예제 #1
0
        /// <summary>
        /// Creates the current row from group location.
        /// </summary>
        /// <param name="groupLocation">The group location.</param>
        /// <param name="effectiveDateTime">The effective date time.</param>
        /// <returns></returns>
        public static GroupLocationHistorical CreateCurrentRowFromGroupLocation(GroupLocation groupLocation, DateTime effectiveDateTime)
        {
            var locationName = groupLocation.Location?.ToString(true);

            var groupLocationHistoricalCurrent = new GroupLocationHistorical
            {
                GroupLocationId          = groupLocation.Id,
                GroupId                  = groupLocation.GroupId,
                GroupLocationTypeValueId = groupLocation.GroupLocationTypeValueId,
                GroupLocationTypeName    = groupLocation.GroupLocationTypeValue?.Value,
                LocationId               = groupLocation.LocationId,
                LocationName             = locationName,
                LocationModifiedDateTime = groupLocation.Location?.ModifiedDateTime,

                // Set the Modified/Created fields for GroupLocationHistorical to be the current values from the GroupLocation table
                ModifiedDateTime        = groupLocation.ModifiedDateTime,
                ModifiedByPersonAliasId = groupLocation.ModifiedByPersonAliasId,
                CreatedByPersonAliasId  = groupLocation.CreatedByPersonAliasId,
                CreatedDateTime         = groupLocation.CreatedDateTime,

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

            return(groupLocationHistoricalCurrent);

            #endregion
        }
예제 #2
0
 /// <summary>
 /// Clones this GroupLocationHistorical object to a new GroupLocationHistorical 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 GroupLocationHistorical Clone(this GroupLocationHistorical source, bool deepCopy)
 {
     if (deepCopy)
     {
         return(source.Clone() as GroupLocationHistorical);
     }
     else
     {
         var target = new GroupLocationHistorical();
         target.CopyPropertiesFrom(source);
         return(target);
     }
 }
예제 #3
0
 /// <summary>
 /// Copies the properties from another GroupLocationHistorical object to this GroupLocationHistorical object
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="source">The source.</param>
 public static void CopyPropertiesFrom(this GroupLocationHistorical target, GroupLocationHistorical source)
 {
     target.Id = source.Id;
     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.GroupLocationId          = source.GroupLocationId;
     target.GroupLocationTypeName    = source.GroupLocationTypeName;
     target.GroupLocationTypeValueId = source.GroupLocationTypeValueId;
     target.LocationId               = source.LocationId;
     target.LocationModifiedDateTime = source.LocationModifiedDateTime;
     target.LocationName             = source.LocationName;
     target.CreatedDateTime          = source.CreatedDateTime;
     target.ModifiedDateTime         = source.ModifiedDateTime;
     target.CreatedByPersonAliasId   = source.CreatedByPersonAliasId;
     target.ModifiedByPersonAliasId  = source.ModifiedByPersonAliasId;
     target.Guid      = source.Guid;
     target.ForeignId = source.ForeignId;
 }