本文整理汇总了C#中Rock.Model.GroupService类的典型用法代码示例。如果您正苦于以下问题:C# GroupService类的具体用法?C# GroupService怎么用?C# GroupService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GroupService类属于Rock.Model命名空间,在下文中一共展示了GroupService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FormatValue
/// <summary>
/// Returns the field's current value(s)
/// </summary>
/// <param name="parentControl">The parent control.</param>
/// <param name="value">Information about the value</param>
/// <param name="configurationValues">The configuration values.</param>
/// <param name="condensed">Flag indicating if the value should be condensed (i.e. for use in a grid column)</param>
/// <returns></returns>
public override string FormatValue( Control parentControl, string value, Dictionary<string, ConfigurationValue> configurationValues, bool condensed )
{
string formattedValue = string.Empty;
string[] parts = ( value ?? string.Empty ).Split( '|' );
Guid? groupTypeGuid = parts[0].AsGuidOrNull();
Guid? groupGuid = parts[1].AsGuidOrNull();
var rockContext = new RockContext();
if ( groupGuid.HasValue )
{
var group = new GroupService( rockContext ).Get( groupGuid.Value );
if ( group != null )
{
formattedValue = "Group: " + group.Name;
}
}
else if ( groupTypeGuid.HasValue )
{
var groupType = new GroupTypeService( rockContext ).Get( groupTypeGuid.Value );
if ( groupType != null )
{
formattedValue = "Group type: " + groupType.Name;
}
}
return base.FormatValue( parentControl, formattedValue, null, condensed );
}
开发者ID:Ganon11,项目名称:Rock,代码行数:35,代码来源:GroupTypeGroupFieldType.cs
示例2: Page_Load
/// <summary>
/// Handles the Load event of the Page 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 Page_Load( object sender, EventArgs e )
{
Exception ex = GetSavedValue( "RockLastException" ) as Exception;
if ( ex != null )
{
int? errorLevel = ( GetSavedValue( "RockExceptionOrder" ) ?? "" ).ToString().AsIntegerOrNull();
ClearSavedValue( "RockExceptionOrder" );
ClearSavedValue( "RockLastException" );
bool showDetails = errorLevel.HasValue && errorLevel.Value == 66;
if ( !showDetails )
{
try
{
// check to see if the user is an admin, if so allow them to view the error details
var userLogin = Rock.Model.UserLoginService.GetCurrentUser();
GroupService service = new GroupService( new RockContext() );
Group adminGroup = service.GetByGuid( new Guid( Rock.SystemGuid.Group.GROUP_ADMINISTRATORS ) );
showDetails = userLogin != null && adminGroup.Members.Where( m => m.PersonId == userLogin.PersonId ).Count() > 0;
}
catch { }
}
if ( showDetails )
{
lErrorInfo.Text = "<h3>Exception Log:</h3>";
ProcessException( ex, " " );
}
}
}
开发者ID:Higherbound,项目名称:Higherbound-2016-website-upgrades,代码行数:36,代码来源:Error.aspx.cs
示例3: Execute
/// <summary>
/// Executes the specified workflow action.
/// </summary>
/// <param name="rockContext">The rock context.</param>
/// <param name="action">The action.</param>
/// <param name="entity">The entity.</param>
/// <param name="errorMessages">The error messages.</param>
/// <returns></returns>
public override bool Execute( RockContext rockContext, WorkflowAction action, Object entity, out List<string> errorMessages )
{
errorMessages = new List<string>();
var parts = ( GetAttributeValue( action, "Group" ) ?? string.Empty ).Split( '|' );
Guid? groupTypeGuid = null;
Guid? groupGuid = null;
if ( parts.Length >= 1 )
{
groupTypeGuid = parts[0].AsGuidOrNull();
if ( parts.Length >= 2 )
{
groupGuid = parts[1].AsGuidOrNull();
}
}
if ( groupGuid.HasValue )
{
var group = new GroupService( rockContext ).Get( groupGuid.Value );
if ( group != null )
{
action.Activity.AssignedPersonAlias = null;
action.Activity.AssignedPersonAliasId = null;
action.Activity.AssignedGroup = group;
action.Activity.AssignedGroupId = group.Id;
action.AddLogEntry( string.Format( "Assigned activity to '{0}' group ({1})", group.Name, group.Id ) );
return true;
}
}
return false;
}
开发者ID:NewSpring,项目名称:Rock,代码行数:40,代码来源:AssignActivityToGroup.cs
示例4: FormatSelection
/// <summary>
/// Formats the selection.
/// </summary>
/// <param name="entityType">Type of the entity.</param>
/// <param name="selection">The selection.</param>
/// <returns></returns>
public override string FormatSelection( Type entityType, string selection )
{
string result = "Group Member";
string[] selectionValues = selection.Split( '|' );
if ( selectionValues.Length >= 2 )
{
var rockContext = new RockContext();
var group = new GroupService( rockContext ).Get( selectionValues[0].AsGuid() );
var groupTypeRoleGuidList = selectionValues[1].Split( new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries ).Select( a => a.AsGuid() ).ToList();
var groupTypeRoles = new GroupTypeRoleService( rockContext ).Queryable().Where( a => groupTypeRoleGuidList.Contains( a.Guid ) ).ToList();
if ( group != null )
{
result = string.Format( "Not in group: {0}", group.Name );
if ( groupTypeRoles.Count() > 0 )
{
result += string.Format( ", with role(s): {0}", groupTypeRoles.Select( a => a.Name ).ToList().AsDelimited( "," ) );
}
}
}
return result;
}
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:31,代码来源:NotInGroupFilter.cs
示例5: Handle
/// <summary>
/// When overridden in a derived class, handles the exception synchronously.
/// </summary>
/// <param name="context">The exception handler context.</param>
public override void Handle( ExceptionHandlerContext context )
{
// check to see if the user is an admin, if so allow them to view the error details
var userLogin = Rock.Model.UserLoginService.GetCurrentUser();
GroupService service = new GroupService( new RockContext() );
Group adminGroup = service.GetByGuid( new Guid( Rock.SystemGuid.Group.GROUP_ADMINISTRATORS ) );
context.RequestContext.IncludeErrorDetail = userLogin != null && adminGroup.Members.Where( m => m.PersonId == userLogin.PersonId ).Count() > 0;
base.Handle( context );
}
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:14,代码来源:RockApiExceptionHandler.cs
示例6: GetChildren
public IQueryable<TreeViewItem> GetChildren( int id, int rootGroupId, bool limitToSecurityRoleGroups, string groupTypeIds )
{
var user = CurrentUser();
if ( user != null )
{
var groupService = new GroupService();
groupService.Repository.SetConfigurationValue( "ProxyCreationEnabled", "false" );
var qry = groupService.GetNavigationChildren( id, rootGroupId, limitToSecurityRoleGroups, groupTypeIds );
List<Group> groupList = new List<Group>();
List<TreeViewItem> groupNameList = new List<TreeViewItem>();
foreach ( var group in qry )
{
if ( group.IsAuthorized( "View", user.Person ) )
{
groupList.Add( group );
var treeViewItem = new TreeViewItem();
treeViewItem.Id = group.Id.ToString();
treeViewItem.Name = System.Web.HttpUtility.HtmlEncode( group.Name );
// if there a IconCssClass is assigned, use that as the Icon.
var groupType = Rock.Web.Cache.GroupTypeCache.Read( group.GroupTypeId );
if ( groupType != null )
{
treeViewItem.IconCssClass = groupType.IconCssClass;
}
groupNameList.Add( treeViewItem );
}
}
// try to quickly figure out which items have Children
List<int> resultIds = groupList.Select( a => a.Id ).ToList();
var qryHasChildren = from x in Get().Select( a => a.ParentGroupId )
where resultIds.Contains( x.Value )
select x.Value;
var qryHasChildrenList = qryHasChildren.ToList();
foreach ( var g in groupNameList )
{
int groupId = int.Parse( g.Id );
g.HasChildren = qryHasChildrenList.Any( a => a == groupId );
}
return groupNameList.AsQueryable();
}
else
{
throw new HttpResponseException( HttpStatusCode.Unauthorized );
}
}
开发者ID:pkdevbox,项目名称:Rock,代码行数:54,代码来源:GroupsController.Partial.cs
示例7: SetEditValue
/// <summary>
/// Sets the value.
/// </summary>
/// <param name="control">The control.</param>
/// <param name="configurationValues">The configuration values.</param>
/// <param name="value">The value.</param>
public override void SetEditValue( System.Web.UI.Control control, Dictionary<string, ConfigurationValue> configurationValues, string value )
{
if ( value != null )
{
GroupPicker groupPicker = control as GroupPicker;
int groupId = 0;
int.TryParse( value, out groupId );
Group group = new GroupService().Get( groupId );
groupPicker.SetValue( group );
}
}
开发者ID:pkdevbox,项目名称:Rock,代码行数:17,代码来源:GroupFieldType.cs
示例8: FormatValue
/// <summary>
/// Returns the field's current value(s)
/// </summary>
/// <param name="parentControl">The parent control.</param>
/// <param name="value">Information about the value</param>
/// <param name="configurationValues">The configuration values.</param>
/// <param name="condensed">Flag indicating if the value should be condensed (i.e. for use in a grid column)</param>
/// <returns></returns>
public override string FormatValue( Control parentControl, string value, Dictionary<string, ConfigurationValue> configurationValues, bool condensed )
{
string formattedValue = value;
Guid? guid = value.AsGuidOrNull();
if ( guid.HasValue )
{
var group = new GroupService( new RockContext() ).Get( guid.Value );
if ( group != null )
{
formattedValue = group.Name;
}
}
return base.FormatValue( parentControl, formattedValue, configurationValues, condensed );
}
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:24,代码来源:SecurityRoleFieldType.cs
示例9: BindGrid
private void BindGrid()
{
string type = PageParameter( "SearchType" );
string term = PageParameter( "SearchTerm" );
var groupService = new GroupService( new RockContext() );
var groups = new List<Group>();
if ( !string.IsNullOrWhiteSpace( type ) && !string.IsNullOrWhiteSpace( term ) )
{
switch ( type.ToLower() )
{
case "name":
{
groups = groupService.Queryable()
.Where( g =>
g.GroupType.ShowInNavigation &&
g.Name.Contains( term ) )
.OrderBy( g => g.Order )
.ThenBy( g => g.Name )
.ToList();
break;
}
}
}
if ( groups.Count == 1 )
{
Response.Redirect( string.Format( "~/Group/{0}", groups[0].Id ), false );
Context.ApplicationInstance.CompleteRequest();
}
else
{
gGroups.EntityTypeId = EntityTypeCache.Read<Group>().Id;
gGroups.DataSource = groups
.Select( g => new
{
g.Id,
GroupType = g.GroupType.Name,
Structure = ParentStructure( g ),
MemberCount = g.Members.Count()
} )
.ToList();
gGroups.DataBind();
}
}
开发者ID:RMRDevelopment,项目名称:Rockit,代码行数:47,代码来源:GroupSearch.ascx.cs
示例10: EditControl
/// <summary>
/// Creates the control(s) neccessary for prompting user for a new value
/// </summary>
/// <param name="configurationValues">The configuration values.</param>
/// <param name="id"></param>
/// <returns>
/// The control
/// </returns>
public override Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id )
{
var editControl = new RockDropDownList { ID = id };
var roles = new GroupService( new RockContext() ).Queryable().Where(g => g.IsSecurityRole).OrderBy( t => t.Name );
if ( roles.Any() )
{
foreach ( var role in roles )
{
editControl.Items.Add( new ListItem( role.Name, role.Guid.ToString() ) );
}
return editControl;
}
return null;
}
开发者ID:Ganon11,项目名称:Rock,代码行数:25,代码来源:SecurityRoleFieldType.cs
示例11: bbtnVerify_Click
/// <summary>
/// Marks the selected people/photos as verified by setting their group member status Active.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void bbtnVerify_Click( object sender, EventArgs e )
{
nbMessage.Visible = true;
int count = 0;
RockContext rockContext = new RockContext();
GroupService groupService = new GroupService( rockContext );
Group group = groupService.Get( Rock.SystemGuid.Group.GROUP_PHOTO_REQUEST.AsGuid() );
GroupMember groupMember = null;
var itemsSelected = new List<int>();
gList.SelectedKeys.ToList().ForEach( i => itemsSelected.Add( i.ToString().AsInteger() ) );
if ( itemsSelected.Any() )
{
foreach ( int currentRowsPersonId in itemsSelected )
{
groupMember = group.Members.Where( m => m.PersonId == currentRowsPersonId ).FirstOrDefault();
if ( groupMember != null )
{
count++;
groupMember.GroupMemberStatus = GroupMemberStatus.Active;
}
}
}
if ( count > 0 )
{
nbMessage.NotificationBoxType = NotificationBoxType.Success;
nbMessage.Text = string.Format( "Verified {0} photo{1}.", count, count > 1 ? "s" : "" );
}
else
{
nbMessage.NotificationBoxType = NotificationBoxType.Warning;
nbMessage.Text = "No photos selected.";
}
rockContext.SaveChanges();
_photoRequestGroup = group;
BindGrid();
}
开发者ID:NewPointe,项目名称:Rockit,代码行数:48,代码来源:PhotoVerify.ascx.cs
示例12: Handle
/// <summary>
/// When overridden in a derived class, handles the exception synchronously.
/// </summary>
/// <param name="context">The exception handler context.</param>
public override void Handle( ExceptionHandlerContext context )
{
// check to see if the user is an admin, if so allow them to view the error details
var userLogin = Rock.Model.UserLoginService.GetCurrentUser();
GroupService service = new GroupService( new RockContext() );
Group adminGroup = service.GetByGuid( new Guid( Rock.SystemGuid.Group.GROUP_ADMINISTRATORS ) );
context.RequestContext.IncludeErrorDetail = userLogin != null && adminGroup.Members.Where( m => m.PersonId == userLogin.PersonId ).Count() > 0;
ExceptionResult result = context.Result as ExceptionResult;
// fix up context.Result.IncludeErrorMessage if it didn't get set when we set context.RequestContext.IncludeErrorDetail
// see comments in https://aspnetwebstack.codeplex.com/workitem/1248
if ( result != null && result.IncludeErrorDetail != context.RequestContext.IncludeErrorDetail )
{
context.Result = new ExceptionResult( result.Exception, context.RequestContext.IncludeErrorDetail, result.ContentNegotiator, context.Request, result.Formatters );
}
base.Handle( context );
}
开发者ID:NewSpring,项目名称:Rock,代码行数:24,代码来源:RockApiExceptionHandler.cs
示例13: bbtnVerify_Click
/// <summary>
/// Marks the selected people/photos as verified by setting their group member status Active.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void bbtnVerify_Click( object sender, EventArgs e )
{
nbMessage.Visible = true;
int count = 0;
RockContext rockContext = new RockContext();
GroupService groupService = new GroupService( rockContext );
Group group = groupService.Get( Rock.SystemGuid.Group.GROUP_PHOTO_REQUEST.AsGuid() );
GroupMember groupMember = null;
foreach ( GridViewRow row in gList.Rows )
{
var cb = row.FindControl( "cbSelected" ) as CheckBox;
if ( cb != null && cb.Checked )
{
int currentRowsPersonId = (int)gList.DataKeys[row.RowIndex].Value;
groupMember = group.Members.Where( m => m.PersonId == currentRowsPersonId ).FirstOrDefault();
if ( groupMember != null )
{
count++;
groupMember.GroupMemberStatus = GroupMemberStatus.Active;
}
}
}
if ( count > 0 )
{
nbMessage.NotificationBoxType = NotificationBoxType.Success;
nbMessage.Text = string.Format( "Verified {0} photo{1}.", count, count > 1 ? "s" : "" );
}
else
{
nbMessage.NotificationBoxType = NotificationBoxType.Warning;
nbMessage.Text = "No changes were made.";
}
rockContext.SaveChanges();
_photoRequestGroup = group;
BindGrid();
}
开发者ID:Ganon11,项目名称:Rock,代码行数:46,代码来源:VerifyPhoto.ascx.cs
示例14: Execute
/// <summary>
/// Executes the specified workflow action.
/// </summary>
/// <param name="rockContext">The rock context.</param>
/// <param name="action">The action.</param>
/// <param name="entity">The entity.</param>
/// <param name="errorMessages">The error messages.</param>
/// <returns></returns>
public override bool Execute( RockContext rockContext, WorkflowAction action, Object entity, out List<string> errorMessages )
{
errorMessages = new List<string>();
Guid? groupGuid = GetAttributeValue( action, "SecurityRole" ).AsGuidOrNull();
if ( groupGuid.HasValue )
{
var group = new GroupService( rockContext ).Get( groupGuid.Value );
if ( group != null )
{
action.Activity.AssignedPersonAlias = null;
action.Activity.AssignedPersonAliasId = null;
action.Activity.AssignedGroup = group;
action.Activity.AssignedGroupId = group.Id;
action.AddLogEntry( string.Format( "Assigned activity to '{0}' security role ({1})", group.Name, group.Id ) );
return true;
}
}
return false;
}
开发者ID:NewSpring,项目名称:Rock,代码行数:29,代码来源:AssignActivityToSecurityRole.cs
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Guid? rootGroupGuid = GetAttributeValue("RootGroup").AsGuidOrNull();
GroupService gs = new GroupService(new RockContext());
if (rootGroupGuid != null)
{
var staffGroup = gs.Get(rootGroupGuid.Value);
var groupMembers = staffGroup.Members.OrderByDescending(g => g.GroupMemberStatus).Select(m => m.Person).OrderBy(m => m.LastName).ThenBy(m => m.FirstName).ToList();
var groupName = staffGroup.Name.ToString();
this.lblGroupName.Text = groupName;
var people = new List<PersonData>();
foreach (var person in groupMembers)
{
person.LoadAttributes();
people.Add(new PersonData { Name = person.FullName, PhotoUrl = person.PhotoUrl, Position = person.GetAttributeValue("Position") });
}
this.rptStaff.DataSource = people;
this.rptStaff.DataBind();
}
}
开发者ID:NewPointe,项目名称:Rockit,代码行数:24,代码来源:Staff.ascx.cs
示例16: Execute
/// <summary>
/// Executes the specified context.
/// </summary>
/// <param name="context">The context.</param>
public virtual void Execute( IJobExecutionContext context )
{
JobDataMap dataMap = context.JobDetail.JobDataMap;
var emailTemplateGuid = dataMap.Get( "SystemEmail" ).ToString().AsGuid();
var groupGuid = dataMap.Get( "Group" ).ToString().AsGuid();
var sendToDescendants = dataMap.Get( "SendToDescendantGroups" ).ToString().AsBoolean();
var rockContext = new RockContext();
var group = new GroupService( rockContext ).Get( groupGuid );
if ( group != null )
{
List<int> groupIds = new List<int>();
GetGroupIds( groupIds, sendToDescendants, group );
var recipients = new List<RecipientData>();
var groupMemberList = new GroupMemberService( rockContext ).Queryable().Where( gm =>
groupIds.Contains( gm.GroupId ) &&
gm.GroupMemberStatus == GroupMemberStatus.Active )
.ToList();
foreach ( GroupMember groupMember in groupMemberList )
{
var mergeFields = Rock.Lava.LavaHelper.GetCommonMergeFields( null );
mergeFields.Add( "Person", groupMember.Person );
mergeFields.Add( "GroupMember", groupMember );
mergeFields.Add( "Group", groupMember.Group );
recipients.Add( new RecipientData( groupMember.Person.Email, mergeFields ) );
}
var appRoot = Rock.Web.Cache.GlobalAttributesCache.Read( rockContext ).GetValue( "ExternalApplicationRoot" );
Email.Send( emailTemplateGuid, recipients, appRoot );
context.Result = string.Format( "{0} emails sent", recipients.Count() );
}
}
开发者ID:SparkDevNetwork,项目名称:Rock,代码行数:40,代码来源:SendGroupEmail.cs
示例17: Execute
/// <summary>
/// Executes the specified context.
/// </summary>
/// <param name="context">The context.</param>
public void Execute( IJobExecutionContext context )
{
var rockContext = new RockContext();
JobDataMap dataMap = context.JobDetail.JobDataMap;
Guid? systemEmailGuid = dataMap.GetString( "NotificationEmailTemplate" ).AsGuidOrNull();
if ( systemEmailGuid.HasValue )
{
var selectedGroupTypes = new List<Guid>();
if ( !string.IsNullOrWhiteSpace( dataMap.GetString( "GroupTypes" ) ) )
{
selectedGroupTypes = dataMap.GetString( "GroupTypes" ).Split( ',' ).Select( Guid.Parse ).ToList();
}
var excludedGroupRoleIds = new List<int>();
if ( !string.IsNullOrWhiteSpace( dataMap.GetString( "ExcludedGroupRoleIds" ) ) )
{
excludedGroupRoleIds = dataMap.GetString( "ExcludedGroupRoleIds" ).Split( ',' ).Select( int.Parse ).ToList();
}
var notificationOption = dataMap.GetString( "NotifyParentLeaders" ).ConvertToEnum<NotificationOption>( NotificationOption.None );
var accountAbilityGroupGuid = dataMap.GetString( "AccountabilityGroup" ).AsGuid();
// get groups matching of the types provided
GroupService groupService = new GroupService( rockContext );
var groups = groupService.Queryable().AsNoTracking()
.Where( g => selectedGroupTypes.Contains( g.GroupType.Guid )
&& g.IsActive == true
&& g.GroupRequirements.Any() );
foreach ( var group in groups )
{
// check for members that don't meet requirements
var groupMembersWithIssues = groupService.GroupMembersNotMeetingRequirements( group.Id, true );
if ( groupMembersWithIssues.Count > 0 )
{
// add issues to issue list
GroupsMissingRequirements groupMissingRequirements = new GroupsMissingRequirements();
groupMissingRequirements.Id = group.Id;
groupMissingRequirements.Name = group.Name;
if ( group.GroupType != null )
{
groupMissingRequirements.GroupTypeId = group.GroupTypeId;
groupMissingRequirements.GroupTypeName = group.GroupType.Name;
}
groupMissingRequirements.AncestorPathName = groupService.GroupAncestorPathName( group.Id );
// get list of the group leaders
groupMissingRequirements.Leaders = group.Members
.Where( m => m.GroupRole.IsLeader == true && !excludedGroupRoleIds.Contains( m.GroupRoleId ) )
.Select( m => new GroupMemberResult
{
Id = m.Id,
PersonId = m.PersonId,
FullName = m.Person.FullName
} )
.ToList();
List<GroupMembersMissingRequirements> groupMembers = new List<GroupMembersMissingRequirements>();
foreach ( var groupMemberIssue in groupMembersWithIssues )
{
GroupMembersMissingRequirements groupMember = new GroupMembersMissingRequirements();
groupMember.FullName = groupMemberIssue.Key.Person.FullName;
groupMember.Id = groupMemberIssue.Key.Id;
groupMember.PersonId = groupMemberIssue.Key.PersonId;
groupMember.GroupMemberRole = groupMemberIssue.Key.GroupRole.Name;
List<MissingRequirement> missingRequirements = new List<MissingRequirement>();
foreach ( var issue in groupMemberIssue.Value )
{
MissingRequirement missingRequirement = new MissingRequirement();
missingRequirement.Id = issue.Key.GroupRequirement.GroupRequirementType.Id;
missingRequirement.Name = issue.Key.GroupRequirement.GroupRequirementType.Name;
missingRequirement.Status = issue.Key.MeetsGroupRequirement;
missingRequirement.OccurrenceDate = issue.Value;
switch ( issue.Key.MeetsGroupRequirement )
{
case MeetsGroupRequirement.Meets:
missingRequirement.Message = issue.Key.GroupRequirement.GroupRequirementType.PositiveLabel;
break;
case MeetsGroupRequirement.MeetsWithWarning:
missingRequirement.Message = issue.Key.GroupRequirement.GroupRequirementType.WarningLabel;
break;
case MeetsGroupRequirement.NotMet:
missingRequirement.Message = issue.Key.GroupRequirement.GroupRequirementType.NegativeLabel;
break;
}
missingRequirements.Add( missingRequirement );
}
//.........这里部分代码省略.........
开发者ID:NewSpring,项目名称:Rock,代码行数:101,代码来源:SendGroupRequirementsNotification.cs
示例18: LoadDropDowns
/// <summary>
/// Loads the drop downs.
/// </summary>
private void LoadDropDowns()
{
// Controls on Main Campaign Panel
GroupService groupService = new GroupService( new RockContext() );
List<Group> groups = groupService.Queryable().Where( a => a.GroupType.Guid.Equals( new Guid( Rock.SystemGuid.GroupType.GROUPTYPE_EVENTATTENDEES ) ) ).OrderBy( a => a.Name ).ToList();
groups.Insert( 0, new Group { Id = None.Id, Name = None.Text } );
ddlEventGroup.DataSource = groups;
ddlEventGroup.DataBind();
}
开发者ID:Ganon11,项目名称:Rock,代码行数:12,代码来源:MarketingCampaignDetail.ascx.cs
示例19: 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 )
{
// confirmation was disabled by btnSave on client-side. So if returning without a redirect,
// it should be enabled. If returning with a redirect, the control won't be updated to reflect
// confirmation being enabled, so it's ok to enable it here
confirmExit.Enabled = true;
if ( Page.IsValid )
{
confirmExit.Enabled = true;
RockTransactionScope.WrapTransaction( () =>
{
var rockContext = new RockContext();
var familyService = new GroupService( rockContext );
var familyMemberService = new GroupMemberService( rockContext );
var personService = new PersonService( rockContext );
var historyService = new HistoryService( rockContext );
var familyChanges = new List<string>();
// SAVE FAMILY
_family = familyService.Get( _family.Id );
History.EvaluateChange( familyChanges, "Family Name", _family.Name, tbFamilyName.Text );
_family.Name = tbFamilyName.Text;
int? campusId = cpCampus.SelectedValueAsInt();
if ( _family.CampusId != campusId )
{
History.EvaluateChange( familyChanges, "Campus",
_family.CampusId.HasValue ? CampusCache.Read( _family.CampusId.Value ).Name : string.Empty,
campusId.HasValue ? CampusCache.Read( campusId.Value ).Name : string.Empty );
_family.CampusId = campusId;
}
var familyGroupTypeId = _family.GroupTypeId;
rockContext.SaveChanges();
// SAVE FAMILY MEMBERS
int? recordStatusValueID = ddlRecordStatus.SelectedValueAsInt();
int? reasonValueId = ddlReason.SelectedValueAsInt();
var newFamilies = new List<Group>();
foreach ( var familyMember in FamilyMembers )
{
var memberChanges = new List<string>();
var demographicChanges = new List<string>();
var role = familyRoles.Where( r => r.Guid.Equals( familyMember.RoleGuid ) ).FirstOrDefault();
if ( role == null )
{
role = familyRoles.FirstOrDefault();
}
bool isChild = role != null && role.Guid.Equals( new Guid( Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_CHILD ) );
// People added to family (new or from other family)
if ( !familyMember.ExistingFamilyMember )
{
var groupMember = new GroupMember();
if ( familyMember.Id == -1 )
{
// added new person
demographicChanges.Add( "Created" );
var person = new Person();
person.FirstName = familyMember.FirstName;
person.NickName = familyMember.NickName;
History.EvaluateChange( demographicChanges, "First Name", string.Empty, person.FirstName );
person.LastName = familyMember.LastName;
History.EvaluateChange( demographicChanges, "Last Name", string.Empty, person.LastName );
person.Gender = familyMember.Gender;
History.EvaluateChange( demographicChanges, "Gender", null, person.Gender );
person.BirthDate = familyMember.BirthDate;
History.EvaluateChange( demographicChanges, "Birth Date", null, person.BirthDate );
if ( !isChild )
{
person.GivingGroupId = _family.Id;
History.EvaluateChange( demographicChanges, "Giving Group", string.Empty, _family.Name );
}
person.EmailPreference = EmailPreference.EmailAllowed;
groupMember.Person = person;
}
else
{
// added from other family
//.........这里部分代码省略.........
开发者ID:CentralAZ,项目名称:Rockit-CentralAZ,代码行数:101,代码来源:EditFamily.ascx.cs
|
请发表评论