コード例 #1
0
 public ExcutedResult UpdateNoticeInfo([FromBody] UpdateNoticeRequestModel model)
 {
     try
     {
         return(_panguLogic.UpdateNoticeInfo(model));
     }
     catch (BusinessException businessException)
     {
         return(ExcutedResult.FailedResult(businessException.ErrorCode, businessException.Message));
     }
 }
コード例 #2
0
 /// <summary>
 /// 改
 /// </summary>
 /// <param name="model"></param>
 /// <param name="oldNotice"></param>
 /// <returns></returns>
 public ExcutedResult UpdateNoticeInfo(UpdateNoticeRequestModel model, out Notice oldNotice)
 {
     oldNotice = null;
     try
     {
         Guid guid = Guid.Empty;
         if (model == null || !Guid.TryParse(model.Id, out guid))
         {
             throw new BusinessException(BusinessResultCode.ArgumentError, "参数错误或无效");
         }
         model.UpdateVerify();
         var notice = _noticeRepository.GetById(guid);
         oldNotice = notice;
         if (notice == null)
         {
             throw new BusinessException(BusinessResultCode.DataNotExist, "数据不存在,请刷新!");
         }
         else
         {
             if (!string.IsNullOrEmpty(model.Content) && model.Content != notice.Content)
             {
                 notice.Content = model.Content;
             }
             if (!string.IsNullOrEmpty(model.Title) && model.Title != notice.Title)
             {
                 notice.Title = model.Title;
             }
             if (model.IsShutdownSystem < 2)
             {
                 notice.IsShutdownSystem = model.IsShutdownSystem;
             }
             if (model.IsOnlyOne < 2 && model.IsOnlyOne != notice.IsOnlyOne)
             {
                 notice.IsOnlyOne = model.IsOnlyOne;
             }
             if (model.ExpireTime != default(DateTime))
             {
                 notice.CreateTime = model.ExpireTime;
             }
             _noticeRepository.Update(notice);
             return(ExcutedResult.SuccessResult());
         }
     }
     catch (BusinessException businessException)
     {
         return(ExcutedResult.FailedResult(businessException.ErrorCode, businessException.Message));
     }
     catch (Exception ex)
     {
         return(ExcutedResult.FailedResult(SysResultCode.ServerException, "发生异常,请稍后再试或联系管理员"));
     }
 }
コード例 #3
0
ファイル: PanguLogic.cs プロジェクト: yu900820/Ngk.Service
        /// <summary>
        /// 公告——改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ExcutedResult UpdateNoticeInfo(UpdateNoticeRequestModel model)
        {
            Notice     oldNotice = null;
            var        result    = _panguRepository.UpdateNoticeInfo(model, out oldNotice);
            OperateLog log       = new OperateLog();

            log.Id             = Guid.NewGuid();
            log.ClientIp       = _principalUser.ClientIP;
            log.CreateTime     = DateTime.UtcNow;
            log.ManagerAccount = _principalUser.Mobile;
            log.ManagerId      = _principalUser.Id;
            log.OriginalValue  = JsonConvert.SerializeObject(oldNotice);
            log.NewValue       = JsonConvert.SerializeObject(model);
            log.Operate        = "Update";
            log.Function       = "公告修改";
            _operateLogRepository.Insert(log);
            return(result);
        }