当前位置: 首页>>代码示例>>C#>>正文


C# GroupTypeService.Get方法代码示例

本文整理汇总了C#中Rock.Model.GroupTypeService.Get方法的典型用法代码示例。如果您正苦于以下问题:C# GroupTypeService.Get方法的具体用法?C# GroupTypeService.Get怎么用?C# GroupTypeService.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rock.Model.GroupTypeService的用法示例。


在下文中一共展示了GroupTypeService.Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: gGroupType_Delete

        /// <summary>
        /// Handles the Delete event of the gGroupType control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RowEventArgs" /> instance containing the event data.</param>
        protected void gGroupType_Delete( object sender, RowEventArgs e )
        {
            var rockContext = new RockContext();
            GroupTypeService groupTypeService = new GroupTypeService( rockContext );
            GroupType groupType = groupTypeService.Get( e.RowKeyId );

            if ( groupType != null )
            {
                int groupTypeId = groupType.Id;

                if ( !groupType.IsAuthorized( "Administrate", CurrentPerson ) )
                {
                    mdGridWarning.Show( "Sorry, you're not authorized to delete this group type.", ModalAlertType.Alert );
                    return;
                }

                string errorMessage;
                if ( !groupTypeService.CanDelete( groupType, out errorMessage ) )
                {
                    mdGridWarning.Show( errorMessage, ModalAlertType.Alert );
                    return;
                }

                groupType.ParentGroupTypes.Clear();
                groupType.ChildGroupTypes.Clear();

                groupTypeService.Delete( groupType );
                rockContext.SaveChanges();

                GroupTypeCache.Flush( groupTypeId );
            }

            BindGrid();
        }
开发者ID:NewPointe,项目名称:Rockit,代码行数:39,代码来源:GroupTypeList.ascx.cs

示例2: btnDelete_Click

        /// <summary>
        /// Handles the Click event of the btnDelete 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 btnDelete_Click( object sender, EventArgs e )
        {
            var rockContext = new RockContext();
            GroupTypeService groupTypeService = new GroupTypeService( rockContext );
            GroupType groupType = groupTypeService.Get( hfGroupTypeId.Value.AsInteger() );

            if ( groupType != null )
            {
                string errorMessage;
                if ( !groupTypeService.CanDelete( groupType, out errorMessage ) )
                {
                    mdDeleteWarning.Show( errorMessage, ModalAlertType.Information );
                    return;
                }

                int groupTypeId = groupType.Id;

                groupType.ParentGroupTypes.Clear();
                groupType.ChildGroupTypes.Clear();

                groupTypeService.Delete( groupType );
                rockContext.SaveChanges();

                GroupTypeCache.Flush( groupTypeId );
                Rock.CheckIn.KioskDevice.FlushAll();
            }

            var pageRef = new PageReference( CurrentPageReference.PageId, CurrentPageReference.RouteId );
            NavigateToPage( pageRef );
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:35,代码来源:CheckinTypeDetail.ascx.cs

示例3: GetExpression

        /// <summary>
        /// Gets the expression.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="serviceInstance">The service instance.</param>
        /// <param name="parameterExpression">The parameter expression.</param>
        /// <param name="selection">The selection.</param>
        /// <returns></returns>
        public override Expression GetExpression( Type entityType, IService serviceInstance, ParameterExpression parameterExpression, string selection )
        {
            string[] options = selection.Split( '|' );
            if ( options.Length < 4 )
            {
                return null;
            }

            Guid groupTypeGuid = options[0].AsGuid();
            ComparisonType comparisonType = options[1].ConvertToEnum<ComparisonType>( ComparisonType.GreaterThanOrEqualTo );
            int? attended = options[2].AsIntegerOrNull();
            string slidingDelimitedValues;

            if ( options[3].AsIntegerOrNull().HasValue )
            {
                //// selection was from when it just simply a LastXWeeks instead of Sliding Date Range
                // Last X Weeks was treated as "LastXWeeks * 7" days, so we have to convert it to a SlidingDateRange of Days to keep consistent behavior
                int lastXWeeks = options[3].AsIntegerOrNull() ?? 1;
                var fakeSlidingDateRangePicker = new SlidingDateRangePicker();
                fakeSlidingDateRangePicker.SlidingDateRangeMode = SlidingDateRangePicker.SlidingDateRangeType.Last;
                fakeSlidingDateRangePicker.TimeUnit = SlidingDateRangePicker.TimeUnitType.Day;
                fakeSlidingDateRangePicker.NumberOfTimeUnits = lastXWeeks * 7;
                slidingDelimitedValues = fakeSlidingDateRangePicker.DelimitedValues;
            }
            else
            {
                slidingDelimitedValues = options[3].Replace( ',', '|' );
            }

            var dateRange = SlidingDateRangePicker.CalculateDateRangeFromDelimitedValues( slidingDelimitedValues );

            bool includeChildGroupTypes = options.Length >= 5 ? options[4].AsBooleanOrNull() ?? false : false;

            var groupTypeService = new GroupTypeService( new RockContext() );

            var groupType = groupTypeService.Get( groupTypeGuid );
            List<int> groupTypeIds = new List<int>();
            if ( groupType != null )
            {
                groupTypeIds.Add( groupType.Id );

                if ( includeChildGroupTypes )
                {
                    var childGroupTypes = groupTypeService.GetAllAssociatedDescendents( groupType.Guid );
                    if ( childGroupTypes.Any() )
                    {
                        groupTypeIds.AddRange( childGroupTypes.Select( a => a.Id ) );

                        // get rid of any duplicates
                        groupTypeIds = groupTypeIds.Distinct().ToList();
                    }
                }
            }

            var rockContext = serviceInstance.Context as RockContext;
            var attendanceQry = new AttendanceService( rockContext ).Queryable().Where( a => a.DidAttend.HasValue && a.DidAttend.Value );

            if ( dateRange.Start.HasValue )
            {
                var startDate = dateRange.Start.Value;
                attendanceQry = attendanceQry.Where( a => a.StartDateTime >= startDate );
            }

            if ( dateRange.End.HasValue )
            {
                var endDate = dateRange.End.Value;
                attendanceQry = attendanceQry.Where( a => a.StartDateTime < endDate );
            }

            if ( groupTypeIds.Count == 1 )
            {
                int groupTypeId = groupTypeIds[0];
                attendanceQry = attendanceQry.Where( a => a.Group.GroupTypeId == groupTypeId );
            }
            else if ( groupTypeIds.Count > 1 )
            {
                attendanceQry = attendanceQry.Where( a => groupTypeIds.Contains( a.Group.GroupTypeId ) );
            }
            else
            {
                // no group type selected, so return nothing
                return Expression.Constant( false );
            }

            var qry = new PersonService( rockContext ).Queryable()
                  .Where( p => attendanceQry.Where( xx => xx.PersonAlias.PersonId == p.Id ).Count() == attended );

            BinaryExpression compareEqualExpression = FilterExpressionExtractor.Extract<Rock.Model.Person>( qry, parameterExpression, "p" ) as BinaryExpression;
            BinaryExpression result = FilterExpressionExtractor.AlterComparisonType( comparisonType, compareEqualExpression, null );

            return result;
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:100,代码来源:GroupTypeAttendanceFilter.cs

示例4: ShowDetail

        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="groupTypeId">The group type identifier.</param>
        public void ShowDetail( int groupTypeId )
        {
            // hide the details panel until we verify the page params are good and that the user has edit access
            pnlDetails.Visible = false;

            var rockContext = new RockContext();

            GroupTypeService groupTypeService = new GroupTypeService( rockContext );
            GroupType parentGroupType = groupTypeService.Get( groupTypeId );

            if ( parentGroupType == null )
            {
                pnlDetails.Visible = false;
                return;
            }

            lCheckinAreasTitle.Text = parentGroupType.Name.FormatAsHtmlTitle();

            hfParentGroupTypeId.Value = parentGroupType.Id.ToString();

            nbEditModeMessage.Text = string.Empty;
            if ( !IsUserAuthorized( Authorization.EDIT ) )
            {
                // this UI doesn't have a ReadOnly mode, so just show a message and keep the Detail panel hidden
                nbEditModeMessage.Heading = "Information";
                nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed( "check-in configuration" );
                return;
            }

            pnlDetails.Visible = true;

            // limit to child group types that are not Templates
            int[] templateGroupTypes = new int[] {
                DefinedValueCache.Read(Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_TEMPLATE).Id,
                DefinedValueCache.Read(Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_FILTER).Id
            };

            List<GroupType> checkinGroupTypes = parentGroupType.ChildGroupTypes.Where( a => !templateGroupTypes.Contains( a.GroupTypePurposeValueId ?? 0 ) ).ToList();

            // Load the Controls
            foreach ( GroupType groupType in checkinGroupTypes.OrderBy( a => a.Order ).ThenBy( a => a.Name ) )
            {
                CreateGroupTypeEditorControls( groupType, phCheckinGroupTypes, rockContext );
            }
        }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:49,代码来源:CheckinConfiguration.ascx.cs

示例5: mdAddCheckinGroupType_SaveClick

        /// <summary>
        /// Handles the SaveClick event of the mdAddCheckinGroupType 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 mdAddCheckinGroupType_SaveClick( object sender, EventArgs e )
        {
            using ( var rockContext = new RockContext() )
            {
                var groupTypeService = new GroupTypeService( rockContext );
                GroupType groupType;

                if ( hfGroupTypeId.Value.AsInteger() == 0 )
                {
                    groupType = new GroupType();
                    groupTypeService.Add( groupType );
                    groupType.GroupTypePurposeValueId = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_TEMPLATE ).Id;
                    groupType.ShowInNavigation = false;
                    groupType.ShowInGroupList = false;
                }
                else
                {
                    groupType = groupTypeService.Get( hfGroupTypeId.Value.AsInteger() );
                }

                groupType.Name = tbGroupTypeName.Text;
                groupType.Description = tbGroupTypeDescription.Text;

                rockContext.SaveChanges();
            }

            mdAddEditCheckinGroupType.Hide();

            BindGrid();
        }
开发者ID:Higherbound,项目名称:Higherbound-2016-website-upgrades,代码行数:35,代码来源:CheckInGroupTypeList.ascx.cs

示例6: btnSave_Click

        /// <summary>
        /// Handles the Click event of the btnSave 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 btnSave_Click( object sender, EventArgs e )
        {
            GroupType groupType;
            var rockContext = new RockContext();
            GroupTypeService groupTypeService = new GroupTypeService( rockContext );
            GroupTypeRoleService groupTypeRoleService = new GroupTypeRoleService( rockContext );
            AttributeService attributeService = new AttributeService( rockContext );
            AttributeQualifierService qualifierService = new AttributeQualifierService( rockContext );
            CategoryService categoryService = new CategoryService( rockContext );
            GroupScheduleExclusionService scheduleExclusionService = new GroupScheduleExclusionService( rockContext );

            int groupTypeId = int.Parse( hfGroupTypeId.Value );

            if ( groupTypeId == 0 )
            {
                groupType = new GroupType();
                groupTypeService.Add( groupType );
            }
            else
            {
                groupType = groupTypeService.Get( groupTypeId );

                // selected roles
                var selectedRoleGuids = GroupTypeRolesState.Select( r => r.Guid );
                foreach ( var role in groupType.Roles.Where( r => !selectedRoleGuids.Contains( r.Guid ) ).ToList() )
                {
                    groupType.Roles.Remove( role );
                    groupTypeRoleService.Delete( role );
                }
            }

            foreach ( var roleState in GroupTypeRolesState )
            {
                GroupTypeRole role = groupType.Roles.Where( r => r.Guid == roleState.Guid ).FirstOrDefault();
                if ( role == null )
                {
                    role = new GroupTypeRole();
                    groupType.Roles.Add( role );
                }
                else
                {
                    roleState.Id = role.Id;
                    roleState.Guid = role.Guid;
                }

                role.CopyPropertiesFrom( roleState );
            }

            ScheduleType allowedScheduleTypes = ScheduleType.None;
            foreach( ListItem li in cblScheduleTypes.Items )
            {
                if ( li.Selected )
                {
                    allowedScheduleTypes = allowedScheduleTypes | (ScheduleType)li.Value.AsInteger();
                }
            }

            GroupLocationPickerMode locationSelectionMode = GroupLocationPickerMode.None;
            foreach ( ListItem li in cblLocationSelectionModes.Items )
            {
                if ( li.Selected )
                {
                    locationSelectionMode = locationSelectionMode | (GroupLocationPickerMode)li.Value.AsInteger();
                }
            }

            groupType.Name = tbName.Text;
            groupType.Description = tbDescription.Text;
            groupType.GroupTerm = tbGroupTerm.Text;
            groupType.GroupMemberTerm = tbGroupMemberTerm.Text;
            groupType.ShowInGroupList = cbShowInGroupList.Checked;
            groupType.ShowInNavigation = cbShowInNavigation.Checked;
            groupType.IconCssClass = tbIconCssClass.Text;
            groupType.TakesAttendance = cbTakesAttendance.Checked;
            groupType.SendAttendanceReminder = cbSendAttendanceReminder.Checked;
            groupType.AttendanceRule = ddlAttendanceRule.SelectedValueAsEnum<AttendanceRule>();
            groupType.AttendancePrintTo = ddlPrintTo.SelectedValueAsEnum<PrintTo>();
            groupType.AllowedScheduleTypes = allowedScheduleTypes;
            groupType.LocationSelectionMode = locationSelectionMode;
            groupType.GroupTypePurposeValueId = ddlGroupTypePurpose.SelectedValueAsInt();
            groupType.AllowMultipleLocations = cbAllowMultipleLocations.Checked;
            groupType.InheritedGroupTypeId = gtpInheritedGroupType.SelectedGroupTypeId;
            groupType.EnableLocationSchedules = cbEnableLocationSchedules.Checked;

            groupType.ChildGroupTypes = new List<GroupType>();
            groupType.ChildGroupTypes.Clear();
            foreach ( var item in ChildGroupTypesDictionary )
            {
                var childGroupType = groupTypeService.Get( item.Key );
                if ( childGroupType != null )
                {
                    groupType.ChildGroupTypes.Add( childGroupType );
                }
            }

//.........这里部分代码省略.........
开发者ID:Higherbound,项目名称:Higherbound-2016-website-upgrades,代码行数:101,代码来源:GroupTypeDetail.ascx.cs

示例7: SortRows

        private void SortRows( string eventParam, string[] values )
        {
            var groupTypeIds = new List<int>();

            using ( var rockContext = new RockContext() )
            {
                if ( eventParam.Equals( "re-order-area" ) )
                {
                    Guid groupTypeGuid = new Guid( values[0] );
                    int newIndex = int.Parse( values[1] );

                    var allRows = phRows.ControlsOfTypeRecursive<CheckinAreaRow>();
                    var sortedRow = allRows.FirstOrDefault( a => a.GroupTypeGuid.Equals( groupTypeGuid ) );
                    if ( sortedRow != null )
                    {
                        Control parentControl = sortedRow.Parent;

                        var siblingRows = allRows
                            .Where( a => a.Parent.ClientID == sortedRow.Parent.ClientID )
                            .ToList();

                        int oldIndex = siblingRows.IndexOf( sortedRow );

                        var groupTypeService = new GroupTypeService( rockContext );
                        var groupTypes = new List<GroupType>();
                        foreach ( var siblingGuid in siblingRows.Select( a => a.GroupTypeGuid ) )
                        {
                            var groupType = groupTypeService.Get( siblingGuid );
                            if ( groupType != null )
                            {
                                groupTypes.Add( groupType );
                                groupTypeIds.Add( groupType.Id );
                            }
                        }

                        groupTypeService.Reorder( groupTypes, oldIndex, newIndex );
                    }
                }
                else if ( eventParam.Equals( "re-order-group" ) )
                {
                    Guid groupGuid = new Guid( values[0] );
                    int newIndex = int.Parse( values[1] );

                    var allRows = phRows.ControlsOfTypeRecursive<CheckinGroupRow>();
                    var sortedRow = allRows.FirstOrDefault( a => a.GroupGuid.Equals( groupGuid ) );
                    if ( sortedRow != null )
                    {
                        Control parentControl = sortedRow.Parent;

                        var siblingRows = allRows
                            .Where( a => a.Parent.ClientID == sortedRow.Parent.ClientID )
                            .ToList();

                        int oldIndex = siblingRows.IndexOf( sortedRow );

                        var groupService = new GroupService( rockContext );
                        var groups = new List<Group>();
                        foreach ( var siblingGuid in siblingRows.Select( a => a.GroupGuid ) )
                        {
                            var group = groupService.Get( siblingGuid );
                            if ( group != null )
                            {
                                groups.Add( group );
                            }
                        }

                        groupService.Reorder( groups, oldIndex, newIndex );
                    }
                }

                rockContext.SaveChanges();
            }

            foreach( int id in groupTypeIds )
            {
                GroupTypeCache.Flush( id );
            }

            Rock.CheckIn.KioskDevice.FlushAll();

            BuildRows();
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:82,代码来源:CheckinAreas.ascx.cs

示例8: SetGroupTypeContext

        /// <summary>
        /// Sets the group type context.
        /// </summary>
        /// <param name="groupTypeGuid">The group type unique identifier.</param>
        /// <returns></returns>
        protected GroupType SetGroupTypeContext( Guid? groupTypeGuid )
        {
            bool pageScope = GetAttributeValue( "ContextScope" ) == "Page";
            var groupTypeService = new GroupTypeService( new RockContext() );

            // check if a grouptype parameter exists to set
            var groupType = groupTypeService.Get( (Guid)groupTypeGuid );

            if ( groupType == null )
            {
                groupType = new GroupType()
                {
                    Name = GetAttributeValue( "NoGroupText" ),
                    Guid = Guid.Empty
                };
            }

            RockPage.SetContextCookie( groupType, pageScope, false );

            return groupType;
        }
开发者ID:RMRDevelopment,项目名称:Rockit,代码行数:26,代码来源:GroupContextSetter.ascx.cs

示例9: btnSave_Click

        protected void btnSave_Click( object sender, EventArgs e )
        {
            hfAreaGroupClicked.Value = "true";

            using ( var rockContext = new RockContext() )
            {
                var attributeService = new AttributeService( rockContext );

                if ( checkinArea.Visible )
                {
                    var groupTypeService = new GroupTypeService( rockContext );
                    var groupType = groupTypeService.Get( checkinArea.GroupTypeGuid );
                    if ( groupType != null )
                    {
                        checkinArea.GetGroupTypeValues( groupType );

                        if ( groupType.IsValid )
                        {
                            rockContext.SaveChanges();
                            groupType.SaveAttributeValues( rockContext );

                            bool AttributesUpdated = false;

                            // rebuild the CheckinLabel attributes from the UI (brute-force)
                            foreach ( var labelAttribute in CheckinArea.GetCheckinLabelAttributes( groupType.Attributes ) )
                            {
                                var attribute = attributeService.Get( labelAttribute.Value.Guid );
                                Rock.Web.Cache.AttributeCache.Flush( attribute.Id );
                                attributeService.Delete( attribute );
                                AttributesUpdated = true;
                            }

                            // Make sure default role is set
                            if ( !groupType.DefaultGroupRoleId.HasValue && groupType.Roles.Any() )
                            {
                                groupType.DefaultGroupRoleId = groupType.Roles.First().Id;
                            }

                            rockContext.SaveChanges();

                            int labelOrder = 0;
                            int binaryFileFieldTypeID = FieldTypeCache.Read( Rock.SystemGuid.FieldType.BINARY_FILE.AsGuid() ).Id;
                            foreach ( var checkinLabelAttributeInfo in checkinArea.CheckinLabels )
                            {
                                var attribute = new Rock.Model.Attribute();
                                attribute.AttributeQualifiers.Add( new AttributeQualifier { Key = "binaryFileType", Value = Rock.SystemGuid.BinaryFiletype.CHECKIN_LABEL } );
                                attribute.Guid = Guid.NewGuid();
                                attribute.FieldTypeId = binaryFileFieldTypeID;
                                attribute.EntityTypeId = EntityTypeCache.GetId( typeof( GroupType ) );
                                attribute.EntityTypeQualifierColumn = "Id";
                                attribute.EntityTypeQualifierValue = groupType.Id.ToString();
                                attribute.DefaultValue = checkinLabelAttributeInfo.BinaryFileGuid.ToString();
                                attribute.Key = checkinLabelAttributeInfo.AttributeKey;
                                attribute.Name = checkinLabelAttributeInfo.FileName;
                                attribute.Order = labelOrder++;

                                if ( !attribute.IsValid )
                                {
                                    return;
                                }

                                attributeService.Add( attribute );
                                AttributesUpdated = true;

                            }

                            rockContext.SaveChanges();

                            GroupTypeCache.Flush( groupType.Id );
                            Rock.CheckIn.KioskDevice.FlushAll();

                            if ( AttributesUpdated )
                            {
                                AttributeCache.FlushEntityAttributes();
                            }

                            nbSaveSuccess.Visible = true;
                            BuildRows();
                        }
                        else
                        {
                            ShowInvalidResults( groupType.ValidationResults );
                        }
                    }
                }

                if ( checkinGroup.Visible )
                {
                    var groupService = new GroupService( rockContext );
                    var groupLocationService = new GroupLocationService( rockContext );

                    var group = groupService.Get( checkinGroup.GroupGuid );
                    if ( group != null )
                    {
                        group.LoadAttributes( rockContext );
                        checkinGroup.GetGroupValues( group );

                        // populate groupLocations with whatever is currently in the grid, with just enough info to repopulate it and save it later
                        var newLocationIds = checkinGroup.Locations.Select( l => l.LocationId ).ToList();
                        foreach ( var groupLocation in group.GroupLocations.Where( l => !newLocationIds.Contains( l.LocationId ) ).ToList() )
//.........这里部分代码省略.........
开发者ID:NewSpring,项目名称:Rock,代码行数:101,代码来源:CheckinAreas.ascx.cs

示例10: SelectArea

        private void SelectArea( Guid? groupTypeGuid )
        {
            hfIsDirty.Value = "false";

            checkinArea.Visible = false;
            checkinGroup.Visible = false;
            btnSave.Visible = false;

            if ( groupTypeGuid.HasValue )
            {
                using ( var rockContext = new RockContext() )
                {
                    var groupTypeService = new GroupTypeService( rockContext );
                    var groupType = groupTypeService.Get( groupTypeGuid.Value );
                    if ( groupType != null )
                    {
                        _currentGroupTypeGuid = groupType.Guid;

                        checkinArea.SetGroupType( groupType, rockContext );
                        checkinArea.CheckinLabels = new List<CheckinArea.CheckinLabelAttributeInfo>();

                        groupType.LoadAttributes( rockContext );
                        List<string> labelAttributeKeys = CheckinArea.GetCheckinLabelAttributes( groupType.Attributes )
                            .OrderBy( a => a.Value.Order )
                            .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 )
                            {
                                checkinArea.CheckinLabels.Add( new CheckinArea.CheckinLabelAttributeInfo { AttributeKey = key, BinaryFileGuid = binaryFileGuid, FileName = fileName } );
                            }
                        }

                        checkinArea.Visible = true;
                        btnSave.Visible = true;

                    }
                    else
                    {
                        _currentGroupTypeGuid = null;
                    }
                }
            }
            else
            {
                _currentGroupTypeGuid = null;
            }

            BuildRows();
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:55,代码来源:CheckinAreas.ascx.cs

示例11: CheckinAreaRow_DeleteAreaClick

        private void CheckinAreaRow_DeleteAreaClick( object sender, EventArgs e )
        {
            var row = sender as CheckinAreaRow;

            using ( var rockContext = new RockContext() )
            {
                var groupTypeService = new GroupTypeService( rockContext );
                var groupType = groupTypeService.Get( row.GroupTypeGuid );
                if ( groupType != null )
                {
                    // Warn if this GroupType or any of its child grouptypes (recursive) is being used as an Inherited Group Type. Probably shouldn't happen, but just in case
                    if ( IsInheritedGroupTypeRecursive( groupType, groupTypeService ) )
                    {
                        nbDeleteWarning.Text = "WARNING - Cannot delete. This group type or one of its child group types is assigned as an inherited group type.";
                        nbDeleteWarning.Visible = true;
                        return;
                    }

                    string errorMessage;
                    if ( !groupTypeService.CanDelete( groupType, out errorMessage ) )
                    {
                        nbDeleteWarning.Text = "WARNING - Cannot Delete: " + errorMessage;
                        nbDeleteWarning.Visible = true;
                        return;
                    }

                    int id = groupType.Id;

                    groupType.ParentGroupTypes.Clear();
                    groupType.ChildGroupTypes.Clear();

                    groupTypeService.Delete( groupType );
                    rockContext.SaveChanges();

                    GroupTypeCache.Flush( id );
                    Rock.CheckIn.KioskDevice.FlushAll();

                    SelectArea( null );
                }
            }

            BuildRows();
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:43,代码来源:CheckinAreas.ascx.cs

示例12: CheckinAreaRow_AddGroupClick

        private void CheckinAreaRow_AddGroupClick( object sender, EventArgs e )
        {
            var parentRow = sender as CheckinAreaRow;
            parentRow.Expanded = true;

            using ( var rockContext = new RockContext() )
            {
                var groupTypeService = new GroupTypeService( rockContext );
                var parentArea = groupTypeService.Get( parentRow.GroupTypeGuid );
                if ( parentArea != null )
                {
                    Guid newGuid = Guid.NewGuid();

                    var checkinGroup = new Group();
                    checkinGroup.Guid = newGuid;
                    checkinGroup.Name = "New Group";
                    checkinGroup.IsActive = true;
                    checkinGroup.IsPublic = true;
                    checkinGroup.IsSystem = false;
                    checkinGroup.Order = parentArea.Groups.Any() ? parentArea.Groups.Max( t => t.Order ) + 1 : 0;

                    parentArea.Groups.Add( checkinGroup );

                    rockContext.SaveChanges();

                    GroupTypeCache.Flush( parentArea.Id );
                    Rock.CheckIn.KioskDevice.FlushAll();

                    SelectGroup( newGuid );
                }
            }

            BuildRows();
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:34,代码来源:CheckinAreas.ascx.cs

示例13: CheckinAreaRow_AddAreaClick

        private void CheckinAreaRow_AddAreaClick( object sender, EventArgs e )
        {
            var parentRow = sender as CheckinAreaRow;
            parentRow.Expanded = true;

            using ( var rockContext = new RockContext() )
            {
                var groupTypeService = new GroupTypeService( rockContext );
                var parentArea = groupTypeService.Get( parentRow.GroupTypeGuid );
                if ( parentArea != null )
                {
                    Guid newGuid = Guid.NewGuid();

                    var checkinArea = new GroupType();
                    checkinArea.Guid = newGuid;
                    checkinArea.Name = "New Area";
                    checkinArea.IsSystem = false;
                    checkinArea.ShowInNavigation = false;
                    checkinArea.TakesAttendance = true;
                    checkinArea.AttendanceRule = AttendanceRule.None;
                    checkinArea.AttendancePrintTo = PrintTo.Default;
                    checkinArea.AllowMultipleLocations = true;
                    checkinArea.EnableLocationSchedules = true;
                    checkinArea.Order = parentArea.ChildGroupTypes.Any() ? parentArea.ChildGroupTypes.Max( t => t.Order ) + 1 : 0;

                    GroupTypeRole defaultRole = new GroupTypeRole();
                    defaultRole.Name = "Member";
                    checkinArea.Roles.Add( defaultRole );

                    parentArea.ChildGroupTypes.Add( checkinArea );

                    rockContext.SaveChanges();

                    GroupTypeCache.Flush( parentArea.Id );
                    Rock.CheckIn.KioskDevice.FlushAll();

                    SelectArea( newGuid );
                }
            }

            BuildRows();
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:42,代码来源:CheckinAreas.ascx.cs

示例14: btnEdit_Click

 /// <summary>
 /// Handles the Click event of the btnEdit 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 btnEdit_Click( object sender, EventArgs e )
 {
     GroupTypeService groupTypeService = new GroupTypeService( new RockContext() );
     GroupType groupType = groupTypeService.Get( int.Parse( hfGroupTypeId.Value ) );
     ShowEditDetails( groupType );
 }
开发者ID:NewSpring,项目名称:Rock,代码行数:11,代码来源:CheckinTypeDetail.ascx.cs

示例15: GetGroupType

 private GroupType GetGroupType( RockContext context, WorkflowAction action )
 {
     Guid groupTypeGuid = GetAttributeValue( action, "GroupType" ).AsGuid();
     if (groupTypeGuid != null)
     {
         var groupTypeService = new GroupTypeService(context);
         return groupTypeService.Get( groupTypeGuid );
     }
     return null;
 }
开发者ID:Kronos11,项目名称:rock_lib_GroupMatching,代码行数:10,代码来源:MatchGroupsAndAssignAttributes.cs


注:本文中的Rock.Model.GroupTypeService.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。