本文整理汇总了C#中GroupType.LoadAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# GroupType.LoadAttributes方法的具体用法?C# GroupType.LoadAttributes怎么用?C# GroupType.LoadAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupType
的用法示例。
在下文中一共展示了GroupType.LoadAttributes方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowReadonlyDetails
/// <summary>
/// Shows the readonly details.
/// </summary>
/// <param name="groupType">The groupType.</param>
private void ShowReadonlyDetails( GroupType groupType )
{
SetEditMode( false );
if ( groupType != null )
{
hfGroupTypeId.SetValue( groupType.Id );
lReadOnlyTitle.Text = groupType.ToString().FormatAsHtmlTitle();
lDescription.Text = groupType.Description;
groupType.LoadAttributes();
hlType.Text = groupType.GetAttributeValue( "CheckInType" );
hlType.Visible = true;
DescriptionList mainDetailsDescList = new DescriptionList();
DescriptionList leftDetailsDescList = new DescriptionList();
DescriptionList rightDetailsDescList = new DescriptionList();
string scheduleList = string.Empty;
using ( var rockContext = new RockContext() )
{
var descendantGroupTypeIds = new GroupTypeService( rockContext ).GetAllAssociatedDescendents( groupType.Id ).Select( a => a.Id );
scheduleList = new GroupLocationService( rockContext )
.Queryable().AsNoTracking()
.Where( a =>
a.Group.GroupType.Id == groupType.Id ||
descendantGroupTypeIds.Contains( a.Group.GroupTypeId ) )
.SelectMany( a => a.Schedules )
.Select( s => s.Name )
.Distinct()
.OrderBy( s => s )
.ToList()
.AsDelimited( ", " );
}
if ( !string.IsNullOrWhiteSpace( scheduleList ) )
{
mainDetailsDescList.Add( "Scheduled Times", scheduleList );
}
groupType.LoadAttributes();
if ( groupType.AttributeValues.ContainsKey( "core_checkin_CheckInType" ) )
{
leftDetailsDescList.Add( "Check-in Type", groupType.AttributeValues["core_checkin_CheckInType"].ValueFormatted );
}
if ( groupType.AttributeValues.ContainsKey( "core_checkin_SecurityCodeLength" ) )
{
leftDetailsDescList.Add( "Security Code Length", groupType.AttributeValues["core_checkin_SecurityCodeLength"].ValueFormatted );
}
if ( groupType.AttributeValues.ContainsKey( "core_checkin_SearchType" ) )
{
rightDetailsDescList.Add( "Search Type", groupType.AttributeValues["core_checkin_SearchType"].ValueFormatted );
}
if ( groupType.AttributeValues.ContainsKey( "core_checkin_PhoneSearchType" ) )
{
rightDetailsDescList.Add( "Phone Number Compare", groupType.AttributeValues["core_checkin_PhoneSearchType"].ValueFormatted );
}
lblMainDetails.Text = mainDetailsDescList.Html;
lblLeftDetails.Text = leftDetailsDescList.Html;
lblRightDetails.Text = rightDetailsDescList.Html;
}
}
示例2: CreateGroupTypeAttributeControls
/// <summary>
/// Creates the group type attribute controls.
/// </summary>
/// <param name="rockContext">The rock context.</param>
private void CreateGroupTypeAttributeControls( RockContext rockContext )
{
// make a fakeGroupType to use to get the Attribute Controls based on GroupType id and InheritedGroupTypeId
GroupType fakeGroupType = new GroupType();
fakeGroupType.Id = _hfGroupTypeId.ValueAsInt();
fakeGroupType.InheritedGroupTypeId = this.InheritedGroupTypeId;
fakeGroupType.LoadAttributes( rockContext );
_phGroupTypeAttributes.Controls.Clear();
// exclude checkin labels
List<string> checkinLabelAttributeNames = GetCheckinLabelAttributes( fakeGroupType.Attributes, rockContext ).Select( a => a.Value.Name ).ToList();
Rock.Attribute.Helper.AddEditControls( fakeGroupType, _phGroupTypeAttributes, true, string.Empty, checkinLabelAttributeNames );
}
示例3: ShowEditDetails
/// <summary>
/// Shows the edit details.
/// </summary>
/// <param name="groupType">The groupType.</param>
private void ShowEditDetails( GroupType groupType )
{
if ( groupType != null )
{
if ( groupType.Id == 0 )
{
lReadOnlyTitle.Text = ActionTitle.Add( "Check-in Configuration" ).FormatAsHtmlTitle();
}
else
{
lReadOnlyTitle.Text = groupType.ToString().FormatAsHtmlTitle();
}
SetEditMode( true );
tbName.Text = groupType.Name;
tbDescription.Text = groupType.Description;
var rockContext = new RockContext();
groupType.LoadAttributes( rockContext );
cbAgeRequired.Checked = groupType.GetAttributeValue( "core_checkin_AgeRequired" ).AsBoolean( true );
cbGradeRequired.Checked = groupType.GetAttributeValue( "core_checkin_GradeRequired" ).AsBoolean( true );
cbHidePhotos.Checked = groupType.GetAttributeValue( "core_checkin_HidePhotos" ).AsBoolean( true );
cbPreventDuplicateCheckin.Checked = groupType.GetAttributeValue( "core_checkin_PreventDuplicateCheckin" ).AsBoolean( true );
cbPreventInactivePeople.Checked = groupType.GetAttributeValue( "core_checkin_PreventInactivePeople" ).AsBoolean( true );
ddlType.SetValue( groupType.GetAttributeValue( "core_checkin_CheckInType" ) );
cbDisplayLocCount.Checked = groupType.GetAttributeValue( "core_checkin_DisplayLocationCount" ).AsBoolean( true );
cbEnableManager.Checked = groupType.GetAttributeValue( "core_checkin_EnableManagerOption" ).AsBoolean( true );
cbEnableOverride.Checked = groupType.GetAttributeValue( "core_checkin_EnableOverride" ).AsBoolean( true );
nbMaxPhoneLength.Text = groupType.GetAttributeValue( "core_checkin_MaximumPhoneSearchLength" );
nbMaxResults.Text = groupType.GetAttributeValue( "core_checkin_MaxSearchResults" );
nbMinPhoneLength.Text = groupType.GetAttributeValue( "core_checkin_MinimumPhoneSearchLength" );
cbUseSameOptions.Checked = groupType.GetAttributeValue( "core_checkin_UseSameOptions" ).AsBoolean( false );
ddlPhoneSearchType.SetValue( groupType.GetAttributeValue( "core_checkin_PhoneSearchType" ) );
nbRefreshInterval.Text = groupType.GetAttributeValue( "core_checkin_RefreshInterval" );
tbSearchRegex.Text = groupType.GetAttributeValue( "core_checkin_RegularExpressionFilter" );
cbReuseCode.Checked = groupType.GetAttributeValue( "core_checkin_ReuseSameCode" ).AsBoolean( false );
var searchType = DefinedValueCache.Read( groupType.GetAttributeValue( "core_checkin_SearchType" ).AsGuid() );
if ( searchType != null )
{
ddlSearchType.SetValue( searchType.Id.ToString() );
}
nbSecurityCodeLength.Text = groupType.GetAttributeValue( "core_checkin_SecurityCodeLength" );
nbAutoSelectDaysBack.Text = groupType.GetAttributeValue( "core_checkin_AutoSelectDaysBack" );
BuildAttributeEdits( groupType, true );
SetFieldVisibility();
}
}
示例4: CreateGroupTypeEditorControls
/// <summary>
/// Creates the group type editor controls.
/// </summary>
/// <param name="groupType">Type of the group.</param>
/// <param name="parentControl">The parent control.</param>
/// <param name="rockContext">The rock context.</param>
/// <param name="createExpanded">if set to <c>true</c> [create expanded].</param>
private void CreateGroupTypeEditorControls( GroupType groupType, Control parentControl, RockContext rockContext, bool createExpanded = false )
{
CheckinGroupTypeEditor groupTypeEditor = new CheckinGroupTypeEditor();
groupTypeEditor.ID = "GroupTypeEditor_" + groupType.Guid.ToString( "N" );
groupTypeEditor.SetGroupType( groupType.Id, groupType.Guid, groupType.Name, groupType.InheritedGroupTypeId );
groupTypeEditor.AddGroupClick += groupTypeEditor_AddGroupClick;
groupTypeEditor.AddGroupTypeClick += groupTypeEditor_AddGroupTypeClick;
groupTypeEditor.DeleteCheckinLabelClick += groupTypeEditor_DeleteCheckinLabelClick;
groupTypeEditor.AddCheckinLabelClick += groupTypeEditor_AddCheckinLabelClick;
groupTypeEditor.DeleteGroupTypeClick += groupTypeEditor_DeleteGroupTypeClick;
groupTypeEditor.CheckinLabels = null;
if ( createExpanded )
{
groupTypeEditor.Expanded = true;
}
if ( GroupTypeCheckinLabelAttributesState.ContainsKey( groupType.Guid ) )
{
groupTypeEditor.CheckinLabels = GroupTypeCheckinLabelAttributesState[groupType.Guid];
}
if ( groupTypeEditor.CheckinLabels == null )
{
// load CheckInLabels from Database if they haven't been set yet
groupTypeEditor.CheckinLabels = new List<CheckinGroupTypeEditor.CheckinLabelAttributeInfo>();
groupType.LoadAttributes( rockContext );
List<string> labelAttributeKeys = CheckinGroupTypeEditor.GetCheckinLabelAttributes( groupType.Attributes, rockContext ).Select( a => a.Key ).ToList();
BinaryFileService binaryFileService = new BinaryFileService( rockContext );
foreach ( string key in labelAttributeKeys )
{
var attributeValue = groupType.GetAttributeValue( key );
Guid binaryFileGuid = attributeValue.AsGuid();
var fileName = binaryFileService.Queryable().Where( a => a.Guid == binaryFileGuid ).Select( a => a.FileName ).FirstOrDefault();
if ( fileName != null )
{
groupTypeEditor.CheckinLabels.Add( new CheckinGroupTypeEditor.CheckinLabelAttributeInfo { AttributeKey = key, BinaryFileGuid = binaryFileGuid, FileName = fileName } );
}
}
}
parentControl.Controls.Add( groupTypeEditor );
// get the GroupType from the control just in case the InheritedFrom changed
var childGroupGroupType = groupTypeEditor.GetCheckinGroupType( rockContext );
foreach ( var childGroup in groupType.Groups.OrderBy( a => a.Order ).ThenBy( a => a.Name ) )
{
childGroup.GroupType = childGroupGroupType;
CreateGroupEditorControls( childGroup, groupTypeEditor, rockContext, false );
}
foreach ( var childGroupType in groupType.ChildGroupTypes
.Where( t => t.Guid != groupType.Guid )
.OrderBy( a => a.Order )
.ThenBy( a => a.Name ) )
{
CreateGroupTypeEditorControls( childGroupType, groupTypeEditor, rockContext );
}
}
示例5: GetCheckinGroupType
/// <summary>
/// Gets the type of the checkin group.
/// </summary>
/// <param name="rockContext">The rock context.</param>
/// <returns></returns>
public GroupType GetCheckinGroupType( RockContext rockContext )
{
EnsureChildControls();
GroupType result = new GroupType();
//// NOTE: A GroupType that was added will have an Id of 0 since it hasn't been saved to the database.
//// So, we'll use Guid to uniquely identify in this Control since that'll work in both Saved and Unsaved cases.
//// If it is saved, we do need the Id so that Attributes will work
result.Id = _hfGroupTypeId.ValueAsInt();
result.Guid = new Guid( _hfGroupTypeGuid.Value );
result.Name = _tbGroupTypeName.Text;
result.InheritedGroupTypeId = _ddlGroupTypeInheritFrom.SelectedValueAsId();
result.LoadAttributes( rockContext );
Rock.Attribute.Helper.GetEditValues( _phGroupTypeAttributes, result );
result.ChildGroupTypes = new List<GroupType>();
int childGroupTypeOrder = 0;
foreach ( CheckinGroupTypeEditor checkinGroupTypeEditor in this.Controls.OfType<CheckinGroupTypeEditor>() )
{
GroupType childGroupType = checkinGroupTypeEditor.GetCheckinGroupType( rockContext );
childGroupType.Order = childGroupTypeOrder++;
result.ChildGroupTypes.Add( childGroupType );
}
result.Groups = new List<Group>();
int childGroupOrder = 0;
foreach ( CheckinGroupEditor checkinGroupEditor in this.Controls.OfType<CheckinGroupEditor>() )
{
Group childGroup = checkinGroupEditor.GetGroup( rockContext );
childGroup.Order = childGroupOrder++;
result.Groups.Add( childGroup );
}
return result;
}
示例6: groupTypeEditor_AddGroupTypeClick
/// <summary>
/// Handles the AddGroupTypeClick event of the groupTypeEditor control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void groupTypeEditor_AddGroupTypeClick( object sender, EventArgs e )
{
CheckinGroupTypeEditor parentEditor = sender as CheckinGroupTypeEditor;
parentEditor.ForceContentVisible = true;
// CheckinArea is GroupType entity
GroupType checkinArea = new GroupType();
checkinArea.Guid = Guid.NewGuid();
checkinArea.IsSystem = false;
checkinArea.TakesAttendance = true;
checkinArea.AttendanceRule = AttendanceRule.AddOnCheckIn;
checkinArea.AttendancePrintTo = PrintTo.Default;
checkinArea.ParentGroupTypes = new List<GroupType>();
checkinArea.ParentGroupTypes.Add( parentEditor.GetCheckinGroupType() );
checkinArea.LoadAttributes();
CreateGroupTypeEditorControls( checkinArea, parentEditor );
}
示例7: lbAddCheckinArea_Click
/// <summary>
/// Handles the Click event of the lbAddCheckinArea control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void lbAddCheckinArea_Click( object sender, EventArgs e )
{
int parentGroupTypeId = this.PageParameter( "groupTypeid" ).AsInteger() ?? 0;
GroupType parentGroupType = new GroupTypeService().Get( parentGroupTypeId );
// CheckinArea is GroupType entity
GroupType checkinArea = new GroupType();
checkinArea.Guid = Guid.NewGuid();
checkinArea.IsSystem = false;
checkinArea.TakesAttendance = true;
checkinArea.AttendanceRule = AttendanceRule.AddOnCheckIn;
checkinArea.AttendancePrintTo = PrintTo.Default;
checkinArea.ParentGroupTypes = new List<GroupType>();
checkinArea.ParentGroupTypes.Add( parentGroupType );
checkinArea.LoadAttributes();
CreateGroupTypeEditorControls( checkinArea, phCheckinGroupTypes, true );
}
示例8: CreateGroupTypeEditorControls
/// <summary>
/// Creates the group type editor controls.
/// </summary>
/// <param name="groupType">Type of the group.</param>
private void CreateGroupTypeEditorControls( GroupType groupType, Control parentControl, bool forceGroupTypeEditorVisible = false )
{
CheckinGroupTypeEditor groupTypeEditor = new CheckinGroupTypeEditor();
groupTypeEditor.ID = "GroupTypeEditor_" + groupType.Guid.ToString( "N" );
groupTypeEditor.SetGroupType( groupType );
groupTypeEditor.AddGroupClick += groupTypeEditor_AddGroupClick;
groupTypeEditor.AddGroupTypeClick += groupTypeEditor_AddGroupTypeClick;
groupTypeEditor.DeleteCheckinLabelClick += groupTypeEditor_DeleteCheckinLabelClick;
groupTypeEditor.AddCheckinLabelClick += groupTypeEditor_AddCheckinLabelClick;
groupTypeEditor.DeleteGroupTypeClick += groupTypeEditor_DeleteGroupTypeClick;
groupTypeEditor.CheckinLabels = null;
groupTypeEditor.ForceContentVisible = forceGroupTypeEditorVisible;
if ( GroupTypeCheckinLabelAttributesState.ContainsKey( groupType.Guid ) )
{
groupTypeEditor.CheckinLabels = GroupTypeCheckinLabelAttributesState[groupType.Guid];
}
if ( groupTypeEditor.CheckinLabels == null )
{
// load CheckInLabels from Database if they haven't been set yet
groupTypeEditor.CheckinLabels = new List<CheckinGroupTypeEditor.CheckinLabelAttributeInfo>();
groupType.LoadAttributes();
List<string> labelAttributeKeys = CheckinGroupTypeEditor.GetCheckinLabelAttributes( groupType ).Select( a => a.Key ).ToList();
BinaryFileService binaryFileService = new BinaryFileService();
foreach ( string key in labelAttributeKeys )
{
var attributeValue = groupType.GetAttributeValue( key );
int binaryFileId = attributeValue.AsInteger() ?? 0;
var binaryFile = binaryFileService.Get( binaryFileId );
if ( binaryFile != null )
{
groupTypeEditor.CheckinLabels.Add( new CheckinGroupTypeEditor.CheckinLabelAttributeInfo { AttributeKey = key, BinaryFileId = binaryFileId, FileName = binaryFile.FileName } );
}
}
}
parentControl.Controls.Add( groupTypeEditor );
foreach ( var childGroup in groupType.Groups.OrderBy( a => a.Order ).ThenBy( a => a.Name ) )
{
// get the GroupType from the control just in case it the InheritedFrom changed
childGroup.GroupType = groupTypeEditor.GetCheckinGroupType();
CreateGroupEditorControls( childGroup, groupTypeEditor, false );
}
foreach ( var childGroupType in groupType.ChildGroupTypes.OrderBy( a => a.Order ).ThenBy( a => a.Name ) )
{
CreateGroupTypeEditorControls( childGroupType, groupTypeEditor );
}
}
示例9: GetGroupTypeValues
/// <summary>
/// Gets the type of the checkin group.
/// </summary>
/// <param name="groupType">Type of the group.</param>
public void GetGroupTypeValues( GroupType groupType )
{
EnsureChildControls();
groupType.Name = _tbGroupTypeName.Text;
groupType.InheritedGroupTypeId = _ddlGroupTypeInheritFrom.SelectedValueAsId();
groupType.AttendanceRule = _ddlAttendanceRule.SelectedValueAsEnum<AttendanceRule>();
groupType.AttendancePrintTo = _ddlPrintTo.SelectedValueAsEnum<PrintTo>();
// Reload Attributes
groupType.Attributes = null;
groupType.LoadAttributes();
Rock.Attribute.Helper.GetEditValues( _phGroupTypeAttributes, groupType );
}
示例10: CreateGroupTypeAttributeControls
/// <summary>
/// Creates the group type attribute controls.
/// </summary>
/// <param name="groupType">Type of the group.</param>
/// <param name="rockContext">The rock context.</param>
public void CreateGroupTypeAttributeControls( GroupType groupType, RockContext rockContext )
{
EnsureChildControls();
_phGroupTypeAttributes.Controls.Clear();
if ( groupType != null )
{
if ( groupType.Attributes == null )
{
groupType.LoadAttributes( rockContext );
}
// exclude checkin labels
List<string> checkinLabelAttributeNames = GetCheckinLabelAttributes( groupType.Attributes ).Select( a => a.Value.Name ).ToList();
Rock.Attribute.Helper.AddEditControls( groupType, _phGroupTypeAttributes, true, string.Empty, checkinLabelAttributeNames );
}
}