本文整理汇总了C#中GroupType.GetAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:C# GroupType.GetAttributeValue方法的具体用法?C# GroupType.GetAttributeValue怎么用?C# GroupType.GetAttributeValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupType
的用法示例。
在下文中一共展示了GroupType.GetAttributeValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
}
示例3: GetGroupTypeLabels
private void GetGroupTypeLabels( GroupType groupType, List<CheckInLabel> labels, int labelFileTypeId, Dictionary<string, object> mergeObjects )
{
//groupType.LoadAttributes();
foreach ( var attribute in groupType.Attributes )
{
if ( attribute.Value.FieldType.Guid == new Guid( SystemGuid.FieldType.BINARY_FILE ) &&
attribute.Value.QualifierValues.ContainsKey( "binaryFileType" ) &&
attribute.Value.QualifierValues["binaryFileType"].Value == labelFileTypeId.ToString() )
{
string attributeValue = groupType.GetAttributeValue( attribute.Key );
if ( attributeValue != null )
{
int fileId = int.MinValue;
if ( int.TryParse( attributeValue, out fileId ) )
{
var labelCache = KioskLabel.Read( fileId );
if ( labelCache != null )
{
var checkInLabel = new CheckInLabel( labelCache, mergeObjects );
checkInLabel.FileId = fileId;
labels.Add( checkInLabel );
}
}
}
}
}
}
示例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: 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 );
}
}
示例6: GetGroupTypeLabels
private void GetGroupTypeLabels( GroupType groupType, List<CheckInLabel> labels, Dictionary<string, object> mergeObjects )
{
//groupType.LoadAttributes();
foreach ( var attribute in groupType.Attributes.OrderBy( a => a.Value.Order ) )
{
if ( attribute.Value.FieldType.Guid == SystemGuid.FieldType.BINARY_FILE.AsGuid() &&
attribute.Value.QualifierValues.ContainsKey( "binaryFileType" ) &&
attribute.Value.QualifierValues["binaryFileType"].Value.Equals( SystemGuid.BinaryFiletype.CHECKIN_LABEL, StringComparison.OrdinalIgnoreCase ) )
{
Guid? binaryFileGuid = groupType.GetAttributeValue( attribute.Key ).AsGuidOrNull();
if ( binaryFileGuid != null )
{
var labelCache = KioskLabel.Read( binaryFileGuid.Value );
if ( labelCache != null )
{
var checkInLabel = new CheckInLabel( labelCache, mergeObjects );
checkInLabel.FileGuid = binaryFileGuid.Value;
labels.Add( checkInLabel );
}
}
}
}
}