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


C# GroupMember.IsNewOrChangedGroupMember方法代码示例

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


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

示例1: ShowConnectionOpportunityRequirementsStatuses

        /// <summary>
        /// Shows the connectionOpportunity requirements statuses.
        /// </summary>
        private void ShowConnectionOpportunityRequirementsStatuses()
        {
            using ( var rockContext = new RockContext() )
            {
                int connectionRequestId = hfConnectionRequestId.Value.AsInteger();
                var connectionOpportunityId = hfConnectionOpportunityId.Value.AsInteger();
                ConnectionRequest connectionRequest = null;
                bool passedAllRequirements = true;
                connectionRequest = new ConnectionRequestService( rockContext ).Get( connectionRequestId );

                var groupMember = new GroupMember { Id = 0 };
                groupMember.GroupId = connectionRequest.AssignedGroupId.Value;
                groupMember.Group = new GroupService( rockContext ).Get( groupMember.GroupId );
                groupMember.GroupRoleId = groupMember.Group.GroupType.DefaultGroupRoleId ?? 0;
                groupMember.GroupMemberStatus = GroupMemberStatus.Active;

                cblManualRequirements.Items.Clear();
                lRequirementsLabels.Text = string.Empty;

                IEnumerable<GroupRequirementStatus> requirementsResults;

                if ( groupMember.IsNewOrChangedGroupMember( rockContext ) )
                {
                    requirementsResults = groupMember.Group.PersonMeetsGroupRequirements( connectionRequest.PersonAlias.PersonId, connectionRequest.ConnectionOpportunity.GroupMemberRoleId );
                }
                else
                {
                    requirementsResults = groupMember.GetGroupRequirementsStatuses().ToList();
                }

                // hide requirements section if there are none
                if ( !requirementsResults.Where( a => a.MeetsGroupRequirement != MeetsGroupRequirement.NotApplicable ).Any() )
                {
                    rcwRequirements.Visible = false;
                }

                // only show the requirements that apply to the GroupRole (or all Roles)
                foreach ( var requirementResult in requirementsResults.Where( a => a.MeetsGroupRequirement != MeetsGroupRequirement.NotApplicable ) )
                {
                    if ( requirementResult.GroupRequirement.GroupRequirementType.RequirementCheckType == RequirementCheckType.Manual )
                    {
                        var checkboxItem = new ListItem( requirementResult.GroupRequirement.GroupRequirementType.CheckboxLabel, requirementResult.GroupRequirement.Id.ToString() );
                        if ( string.IsNullOrEmpty( checkboxItem.Text ) )
                        {
                            checkboxItem.Text = requirementResult.GroupRequirement.GroupRequirementType.Name;
                        }

                        checkboxItem.Selected = requirementResult.MeetsGroupRequirement == MeetsGroupRequirement.Meets;
                        cblManualRequirements.Items.Add( checkboxItem );
                    }
                    else
                    {
                        string labelText;
                        string labelType;
                        string labelTooltip;
                        if ( requirementResult.MeetsGroupRequirement == MeetsGroupRequirement.Meets )
                        {
                            labelText = requirementResult.GroupRequirement.GroupRequirementType.PositiveLabel;
                            labelType = "success";
                        }
                        else if ( requirementResult.MeetsGroupRequirement == MeetsGroupRequirement.MeetsWithWarning )
                        {
                            labelText = requirementResult.GroupRequirement.GroupRequirementType.WarningLabel;
                            labelType = "warning";
                        }
                        else
                        {
                            passedAllRequirements = false;
                            labelText = requirementResult.GroupRequirement.GroupRequirementType.NegativeLabel;
                            labelType = "danger";
                        }

                        if ( string.IsNullOrEmpty( labelText ) )
                        {
                            labelText = requirementResult.GroupRequirement.GroupRequirementType.Name;
                        }

                        if ( requirementResult.MeetsGroupRequirement == MeetsGroupRequirement.MeetsWithWarning )
                        {
                            labelTooltip = requirementResult.RequirementWarningDateTime.HasValue
                                ? "Last Checked: " + requirementResult.RequirementWarningDateTime.Value.ToString( "g" )
                                : "Not calculated yet";
                        }
                        else
                        {
                            labelTooltip = requirementResult.LastRequirementCheckDateTime.HasValue
                                ? "Last Checked: " + requirementResult.LastRequirementCheckDateTime.Value.ToString( "g" )
                                : "Not calculated yet";
                        }

                        lRequirementsLabels.Text += string.Format(
                            @"<span class='label label-{1}' title='{2}'>{0}</span>
                        ",
                            labelText,
                            labelType,
                            labelTooltip );
                    }
//.........这里部分代码省略.........
开发者ID:SparkDevNetwork,项目名称:Rock,代码行数:101,代码来源:ConnectionRequestDetail.ascx.cs


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