Пример #1
0
        private void Load(CampusData c)
        {
            Init();
            if (c != null)
            {
                CampusService campusService = new CampusService(new Rock.Data.RockContext());

                Rock.Model.Campus RockCampus = campusService.Get(c.campus_id);
                Id = RockCampus.Id;
                CreatedDateTime         = RockCampus.CreatedDateTime;
                ModifiedDateTime        = RockCampus.ModifiedDateTime;
                CreatedByPersonAliasId  = RockCampus.CreatedByPersonAliasId;
                ModifiedByPersonAliasId = RockCampus.ModifiedByPersonAliasId;
                Guid = RockCampus.Guid;
                Name = RockCampus.Name;
                LeaderPersonAliasId = RockCampus.LeaderPersonAliasId;
                LocationId          = RockCampus.LocationId;
                CompanyID           = c.campus_company_id;
                FundID           = c.campus_fund_id;
                XrefDateCreated  = c.date_created;
                XrefCreatedBy    = c.created_by;
                XrefDateModified = c.date_modified;
                XrefModifiedBy   = c.modified_by;
                XrefActive       = c.active;
            }
        }
Пример #2
0
        /// <summary>
        /// Gets the defined value value.
        /// </summary>
        /// <param name="campus">The defined value.</param>
        /// <param name="campusId">The defined value identifier.</param>
        /// <param name="blankValue">The blank value.</param>
        /// <returns></returns>
        public static string GetCampusValue(Campus campus, int?campusId, string blankValue)
        {
            if (campus != null)
            {
                return(campus.Name);
            }

            if (campusId.HasValue)
            {
                var dv = CampusCache.Read(campusId.Value);
                if (dv != null)
                {
                    return(dv.Name);
                }
            }

            return(blankValue);
        }
Пример #3
0
 /// <summary>
 /// Copies the properties from another Campus object to this Campus object
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="source">The source.</param>
 public static void CopyPropertiesFrom(this Campus target, Campus source)
 {
     target.Id                      = source.Id;
     target.Description             = source.Description;
     target.IsActive                = source.IsActive;
     target.IsSystem                = source.IsSystem;
     target.LeaderPersonAliasId     = source.LeaderPersonAliasId;
     target.LocationId              = source.LocationId;
     target.Name                    = source.Name;
     target.PhoneNumber             = source.PhoneNumber;
     target.ServiceTimes            = source.ServiceTimes;
     target.ShortCode               = source.ShortCode;
     target.Url                     = source.Url;
     target.CreatedDateTime         = source.CreatedDateTime;
     target.ModifiedDateTime        = source.ModifiedDateTime;
     target.CreatedByPersonAliasId  = source.CreatedByPersonAliasId;
     target.ModifiedByPersonAliasId = source.ModifiedByPersonAliasId;
     target.Guid                    = source.Guid;
     target.ForeignId               = source.ForeignId;
 }
Пример #4
0
 /// <summary>
 /// Gets the value.
 /// </summary>
 /// <param name="campus">The defined value.</param>
 /// <param name="campusId">The defined value identifier.</param>
 /// <returns></returns>
 public static string GetCampusValue(Campus campus, int?campusId)
 {
     return(GetCampusValue(campus, campusId, string.Empty));
 }
Пример #5
0
 /// <summary>
 /// Evaluates the change.
 /// </summary>
 /// <param name="historyMessages">The history messages.</param>
 /// <param name="propertyName">Name of the property.</param>
 /// <param name="oldCampusId">The old defined value identifier.</param>
 /// <param name="newCampus">The new defined value.</param>
 /// <param name="newCampusId">The new defined value identifier.</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?oldCampusId, Campus newCampus, int?newCampusId, string blankValue, bool isSensitive)
 {
     if (!oldCampusId.Equals(newCampusId))
     {
         string oldStringValue = GetCampusValue(null, oldCampusId, blankValue);
         string newStringValue = GetCampusValue(newCampus, newCampusId, blankValue);
         EvaluateChange(historyMessages, propertyName, oldStringValue, newStringValue, isSensitive);
     }
 }
Пример #6
0
 /// <summary>
 /// Evaluates a campus change.
 /// </summary>
 /// <param name="historyMessages">The history messages.</param>
 /// <param name="propertyName">Name of the property.</param>
 /// <param name="oldCampusId">The old defined value identifier.</param>
 /// <param name="newCampus">The new defined value.</param>
 /// <param name="newCampusId">The new defined value identifier.</param>
 public static void EvaluateChange(List <string> historyMessages, string propertyName, int?oldCampusId, Campus newCampus, int?newCampusId)
 {
     EvaluateChange(historyMessages, propertyName, oldCampusId, newCampus, newCampusId, string.Empty, false);
 }
Пример #7
0
 /// <summary>
 /// Instantiates a new DTO object from the entity
 /// </summary>
 /// <param name="campus"></param>
 public CampusDto(Campus campus)
 {
     CopyFromModel(campus);
 }
Пример #8
0
 /// <summary>
 /// To the dto.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public static CampusDto ToDto(this Campus value)
 {
     return(new CampusDto(value));
 }
Пример #9
0
 /// <summary>
 /// Returns a <see cref="System.String" /> that represents this instance.
 /// </summary>
 /// <returns>
 /// A <see cref="System.String" /> that represents this instance.
 /// </returns>
 public override string ToString()
 {
     return(Schedule.ToStringSafe() + " at " + Campus.ToStringSafe());
 }