/// <summary> /// Clones this GroupTypeRole object to a new GroupTypeRole object /// </summary> /// <param name="source">The source.</param> /// <param name="deepCopy">if set to <c>true</c> a deep copy is made. If false, only the basic entity properties are copied.</param> /// <returns></returns> public static GroupTypeRole Clone(this GroupTypeRole source, bool deepCopy) { if (deepCopy) { return(source.Clone() as GroupTypeRole); } else { var target = new GroupTypeRole(); target.CopyPropertiesFrom(source); return(target); } }
/// <summary> /// Copies the properties from another GroupTypeRole object to this GroupTypeRole object /// </summary> /// <param name="target">The target.</param> /// <param name="source">The source.</param> public static void CopyPropertiesFrom(this GroupTypeRole target, GroupTypeRole source) { target.IsSystem = source.IsSystem; target.GroupTypeId = source.GroupTypeId; target.Name = source.Name; target.Description = source.Description; target.Order = source.Order; target.MaxCount = source.MaxCount; target.MinCount = source.MinCount; target.IsLeader = source.IsLeader; target.Id = source.Id; target.Guid = source.Guid; }
/// <summary> /// Gets the value. /// </summary> /// <param name="groupTypeRole">The person alias.</param> /// <param name="groupTypeRoleId">The person alias identifier.</param> /// <param name="rockContext">The rock context.</param> /// <param name="blankValue">The blank value.</param> /// <returns></returns> private static string GetGroupTypeRoleValue(GroupTypeRole groupTypeRole, int?groupTypeRoleId, RockContext rockContext, string blankValue) { if (groupTypeRole != null) { return(groupTypeRole.Name); } if (groupTypeRoleId.HasValue) { var role = new GroupTypeRoleService(rockContext).Get(groupTypeRoleId.Value); if (role != null) { return(role.Name); } } return(blankValue); }
/// <summary> /// Copies the properties from another GroupTypeRole object to this GroupTypeRole object /// </summary> /// <param name="target">The target.</param> /// <param name="source">The source.</param> public static void CopyPropertiesFrom(this GroupTypeRole target, GroupTypeRole source) { target.Id = source.Id; target.CanEdit = source.CanEdit; target.CanView = source.CanView; target.Description = source.Description; target.GroupTypeId = source.GroupTypeId; target.IsLeader = source.IsLeader; target.IsSystem = source.IsSystem; target.MaxCount = source.MaxCount; target.MinCount = source.MinCount; target.Name = source.Name; target.Order = source.Order; target.CreatedDateTime = source.CreatedDateTime; target.ModifiedDateTime = source.ModifiedDateTime; target.CreatedByPersonAliasId = source.CreatedByPersonAliasId; target.ModifiedByPersonAliasId = source.ModifiedByPersonAliasId; target.Guid = source.Guid; target.ForeignId = source.ForeignId; }
/// <summary> /// Copies the properties from another GroupTypeRole object to this GroupTypeRole object /// </summary> /// <param name="target">The target.</param> /// <param name="source">The source.</param> public static void CopyPropertiesFrom(this GroupTypeRole target, GroupTypeRole source) { target.Id = source.Id; target.CanEdit = source.CanEdit; target.CanManageMembers = source.CanManageMembers; target.CanView = source.CanView; target.Description = source.Description; target.ForeignGuid = source.ForeignGuid; target.ForeignKey = source.ForeignKey; target.GroupTypeId = source.GroupTypeId; target.IsLeader = source.IsLeader; target.IsSystem = source.IsSystem; target.MaxCount = source.MaxCount; target.MinCount = source.MinCount; target.Name = source.Name; target.Order = source.Order; target.ReceiveRequirementsNotifications = source.ReceiveRequirementsNotifications; target.CreatedDateTime = source.CreatedDateTime; target.ModifiedDateTime = source.ModifiedDateTime; target.CreatedByPersonAliasId = source.CreatedByPersonAliasId; target.ModifiedByPersonAliasId = source.ModifiedByPersonAliasId; target.Guid = source.Guid; target.ForeignId = source.ForeignId; }
/// <summary> /// Gets the value. /// </summary> /// <param name="groupTypeRole">The person alias.</param> /// <param name="groupTypeRoleId">The person alias identifier.</param> /// <param name="rockContext">The rock context.</param> /// <returns></returns> private static string GetGroupTypeRoleValue(GroupTypeRole groupTypeRole, int?groupTypeRoleId, RockContext rockContext) { return(GetGroupTypeRoleValue(groupTypeRole, groupTypeRoleId, rockContext, string.Empty)); }
/// <summary> /// Evaluates the change. /// </summary> /// <param name="historyMessages">The history messages.</param> /// <param name="propertyName">Name of the property.</param> /// <param name="oldGroupTypeRoleId">The old person alias identifier.</param> /// <param name="newGroupTypeRole">The new person alias.</param> /// <param name="newGroupTypeRoleId">The new person alias identifier.</param> /// <param name="rockContext">The rock context.</param> /// <param name="blankValue">The blank value.</param> /// <param name="isSensitive">if set to <c>true</c> [is sensitive].</param> public static void EvaluateChange(List <string> historyMessages, string propertyName, int?oldGroupTypeRoleId, GroupTypeRole newGroupTypeRole, int?newGroupTypeRoleId, RockContext rockContext, string blankValue, bool isSensitive) { if (!oldGroupTypeRoleId.Equals(newGroupTypeRoleId)) { string oldStringValue = GetValue <GroupTypeRole>(null, oldGroupTypeRoleId, rockContext, blankValue); string newStringValue = GetValue <GroupTypeRole>(newGroupTypeRole, newGroupTypeRoleId, rockContext, blankValue); EvaluateChange(historyMessages, propertyName, oldStringValue, newStringValue, isSensitive); } }
/// <summary> /// Evaluates the person alias change. /// </summary> /// <param name="historyMessages">The history messages.</param> /// <param name="propertyName">Name of the property.</param> /// <param name="oldGroupTypeRoleId">The old person alias identifier.</param> /// <param name="newGroupTypeRole">The new person alias.</param> /// <param name="newGroupTypeRoleId">The new person alias identifier.</param> /// <param name="rockContext">The rock context.</param> public static void EvaluateChange(List <string> historyMessages, string propertyName, int?oldGroupTypeRoleId, GroupTypeRole newGroupTypeRole, int?newGroupTypeRoleId, RockContext rockContext) { EvaluateChange(historyMessages, propertyName, oldGroupTypeRoleId, newGroupTypeRole, newGroupTypeRoleId, rockContext, string.Empty, false); }