Пример #1
0
 public PageTemplateManageModel(PageTemplateLog log)
     : this()
 {
     Id = log.PageTemplateId;
     Name = log.Name;
     Content = log.Content;
     ParentId = log.ParentId;
     Parents = _pageTemplateServices.GetPossibleParents(log.PageTemplateId);
 }
Пример #2
0
 public PageTemplateLogItem(PageTemplateLog model)
     : this()
 {
     Id = model.Id;
     Name = model.Name;
     ChangeLog = model.ChangeLog;
     Created = model.Created;
     Creator = _userServices.GetUser(model.CreatedBy);
     ParentId = model.ParentId;
 }
Пример #3
0
 public ResponseModel Insert(PageTemplateLog pageTemplateLog)
 {
     return _pageTemplateLogRepository.Insert(pageTemplateLog);
 }
Пример #4
0
 public ResponseModel Delete(PageTemplateLog pageTemplateLog)
 {
     return _pageTemplateLogRepository.Delete(pageTemplateLog);
 }
Пример #5
0
        /// <summary>
        /// Update data and create change log
        /// </summary>
        /// <param name="pageTemplateLog"></param>
        /// <param name="pageTemplateLogModel"></param>
        /// <returns></returns>
        private string ChangeLog(PageTemplateLog pageTemplateLog, PageTemplateLogManageModel pageTemplateLogModel)
        {
            var changeLog = new StringBuilder();
            const string format = "- Update field: {0}\n";
            if (!ConvertUtilities.Compare(pageTemplateLog.Name, pageTemplateLogModel.Name))
            {
                changeLog.AppendFormat(format, "Name");
                pageTemplateLog.Name = pageTemplateLogModel.Name;
            }
            if (!ConvertUtilities.Compare(pageTemplateLog.Content, pageTemplateLogModel.Content))
            {
                changeLog.AppendFormat(format, "Content");
                pageTemplateLog.Content = pageTemplateLogModel.Content;
            }
            if (!ConvertUtilities.Compare(pageTemplateLog.ParentId, pageTemplateLogModel.ParentId))
            {
                changeLog.AppendFormat(format, "ParentId");
                pageTemplateLog.ParentId = pageTemplateLogModel.ParentId;
            }

            if (!string.IsNullOrEmpty(changeLog.ToString()))
            {
                changeLog.Insert(0, string.Format("** Update Page Template **\n"));
            }

            return changeLog.ToString();
        }