本文整理汇总了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 );
}
//.........这里部分代码省略.........