/// <summary>
        /// Creates a GroupMemberHistorical with CurrentRowIndicator = true for the specified groupmember
        /// </summary>
        /// <param name="groupMember">The group member.</param>
        /// <param name="effectiveDateTime">The effective date time.</param>
        /// <returns></returns>
        public static GroupMemberHistorical CreateCurrentRowFromGroupMember(GroupMember groupMember, DateTime effectiveDateTime)
        {
            var groupMemberHistoricalCurrent = new GroupMemberHistorical
            {
                GroupMemberId           = groupMember.Id,
                GroupId                 = groupMember.GroupId,
                GroupRoleId             = groupMember.GroupRoleId,
                GroupRoleName           = groupMember.GroupRole.Name,
                IsLeader                = groupMember.GroupRole.IsLeader,
                GroupMemberStatus       = groupMember.GroupMemberStatus,
                IsArchived              = groupMember.IsArchived,
                ArchivedDateTime        = groupMember.ArchivedDateTime,
                ArchivedByPersonAliasId = groupMember.ArchivedByPersonAliasId,
                InactiveDateTime        = groupMember.InactiveDateTime,

                // Set the Modified/Created fields for GroupMemberHistorical to be the current values from GroupMember table
                ModifiedDateTime        = groupMember.ModifiedDateTime,
                ModifiedByPersonAliasId = groupMember.ModifiedByPersonAliasId,
                CreatedByPersonAliasId  = groupMember.CreatedByPersonAliasId,
                CreatedDateTime         = groupMember.CreatedDateTime,

                // Set HistoricalTracking fields
                CurrentRowIndicator = true,
                EffectiveDateTime   = effectiveDateTime,
                ExpireDateTime      = HistoricalTracking.MaxExpireDateTime
            };

            return(groupMemberHistoricalCurrent);
        }
Beispiel #2
0
 /// <summary>
 /// Copies the properties from another GroupMemberHistorical object to this GroupMemberHistorical object
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="source">The source.</param>
 public static void CopyPropertiesFrom(this GroupMemberHistorical target, GroupMemberHistorical source)
 {
     target.Id = source.Id;
     target.ArchivedByPersonAliasId = source.ArchivedByPersonAliasId;
     target.ArchivedDateTime        = source.ArchivedDateTime;
     target.CurrentRowIndicator     = source.CurrentRowIndicator;
     target.EffectiveDateTime       = source.EffectiveDateTime;
     target.ExpireDateTime          = source.ExpireDateTime;
     target.ForeignGuid             = source.ForeignGuid;
     target.ForeignKey              = source.ForeignKey;
     target.GroupId                 = source.GroupId;
     target.GroupMemberId           = source.GroupMemberId;
     target.GroupMemberStatus       = source.GroupMemberStatus;
     target.GroupRoleId             = source.GroupRoleId;
     target.GroupRoleName           = source.GroupRoleName;
     target.InactiveDateTime        = source.InactiveDateTime;
     target.IsArchived              = source.IsArchived;
     target.IsLeader                = source.IsLeader;
     target.CreatedDateTime         = source.CreatedDateTime;
     target.ModifiedDateTime        = source.ModifiedDateTime;
     target.CreatedByPersonAliasId  = source.CreatedByPersonAliasId;
     target.ModifiedByPersonAliasId = source.ModifiedByPersonAliasId;
     target.Guid      = source.Guid;
     target.ForeignId = source.ForeignId;
 }
Beispiel #3
0
 /// <summary>
 /// Clones this GroupMemberHistorical object to a new GroupMemberHistorical 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 GroupMemberHistorical Clone(this GroupMemberHistorical source, bool deepCopy)
 {
     if (deepCopy)
     {
         return(source.Clone() as GroupMemberHistorical);
     }
     else
     {
         var target = new GroupMemberHistorical();
         target.CopyPropertiesFrom(source);
         return(target);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GroupMemberHistoricalSummary"/> class.
 /// </summary>
 /// <param name="group">The group.</param>
 /// <param name="groupMemberHistorical">The group member historical.</param>
 /// <param name="dateTimeAdded">The date time added.</param>
 public GroupMemberHistoricalSummary(Group group, GroupMemberHistorical groupMemberHistorical, DateTime?dateTimeAdded)
 {
     _group = group;
     _groupMemberHistorical = groupMemberHistorical;
     _dateTimeAdded         = dateTimeAdded;
 }