/// <summary> /// Copies the properties from another GroupHistorical object to this GroupHistorical object /// </summary> /// <param name="target">The target.</param> /// <param name="source">The source.</param> public static void CopyPropertiesFrom(this GroupHistorical target, GroupHistorical source) { target.Id = source.Id; target.ArchivedByPersonAliasId = source.ArchivedByPersonAliasId; target.ArchivedDateTime = source.ArchivedDateTime; target.CampusId = source.CampusId; target.CurrentRowIndicator = source.CurrentRowIndicator; target.Description = source.Description; target.EffectiveDateTime = source.EffectiveDateTime; target.ExpireDateTime = source.ExpireDateTime; target.ForeignGuid = source.ForeignGuid; target.ForeignKey = source.ForeignKey; target.GroupId = source.GroupId; target.GroupName = source.GroupName; target.GroupTypeId = source.GroupTypeId; target.GroupTypeName = source.GroupTypeName; target.InactiveDateTime = source.InactiveDateTime; target.IsActive = source.IsActive; target.IsArchived = source.IsArchived; target.ParentGroupId = source.ParentGroupId; target.ScheduleId = source.ScheduleId; target.ScheduleModifiedDateTime = source.ScheduleModifiedDateTime; target.ScheduleName = source.ScheduleName; target.StatusValueId = source.StatusValueId; 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> /// Creates a GroupHistorical with CurrentRowIndicator = true for the specified group /// </summary> /// <param name="group">The group.</param> /// <param name="effectiveDateTime">The effective date time.</param> /// <returns></returns> public static GroupHistorical CreateCurrentRowFromGroup(Group group, DateTime effectiveDateTime) { var groupHistoricalCurrent = new GroupHistorical { GroupId = group.Id, GroupName = group.Name, GroupTypeId = group.GroupTypeId, GroupTypeName = group.GroupType.Name, CampusId = group.CampusId, ParentGroupId = group.ParentGroupId, ScheduleId = group.ScheduleId, ScheduleName = group.Schedule?.ToString(), ScheduleModifiedDateTime = group.Schedule?.ModifiedDateTime, Description = group.Description, StatusValueId = group.StatusValueId, IsArchived = group.IsArchived, ArchivedDateTime = group.ArchivedDateTime, ArchivedByPersonAliasId = group.ArchivedByPersonAliasId, IsActive = group.IsActive, InactiveDateTime = group.InactiveDateTime, // Set the Modified/Created fields for GroupHistorical to be the current values from Group table ModifiedDateTime = group.ModifiedDateTime, ModifiedByPersonAliasId = group.ModifiedByPersonAliasId, CreatedByPersonAliasId = group.CreatedByPersonAliasId, CreatedDateTime = group.CreatedDateTime, // Set HistoricalTracking fields CurrentRowIndicator = true, EffectiveDateTime = effectiveDateTime, ExpireDateTime = HistoricalTracking.MaxExpireDateTime }; return(groupHistoricalCurrent); }
/// <summary> /// Clones this GroupHistorical object to a new GroupHistorical 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 GroupHistorical Clone(this GroupHistorical source, bool deepCopy) { if (deepCopy) { return(source.Clone() as GroupHistorical); } else { var target = new GroupHistorical(); target.CopyPropertiesFrom(source); return(target); } }