Exemple #1
0
        /// <summary>
        /// 查
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ExcutedResult QueryNoticeInfo(QueryNoticeRequestModel model)
        {
            try
            {
                if (model == null)
                {
                    throw new BusinessException(BusinessResultCode.ArgumentError, "参数错误或无效");
                }
                NoticeParams noticeParams = new NoticeParams();
                if (!string.IsNullOrEmpty(model.Title))
                {
                    noticeParams.Title = model.Title;
                }
                if (!string.IsNullOrEmpty(model.ServiceName))
                {
                    noticeParams.ServiceName = model.ServiceName;
                }
                if (!string.IsNullOrEmpty(model.Content))
                {
                    noticeParams.Content = model.Content;
                }
                if (model.IsShutdownSystem != default(byte) && model.IsShutdownSystem < 3)
                {
                    noticeParams.IsShutdownSystem = model.IsShutdownSystem;
                }
                noticeParams.SortName        = "CreateTime";
                noticeParams.IsSortOrderDesc = true;
                noticeParams.SortList        = new Dictionary <string, bool> {
                    { noticeParams.SortName, noticeParams.IsSortOrderDesc }
                };

                var dataInfo = _noticeRepository.GetQuery(noticeParams);
                if (dataInfo != null)
                {
                    return(ExcutedResult.SuccessResult(dataInfo));
                }
                return(ExcutedResult.FailedResult(BusinessResultCode.DataNotExist, "数据不存在,请刷新!"));
            }
            catch (BusinessException businessException)
            {
                return(ExcutedResult.FailedResult(businessException.ErrorCode, businessException.Message));
            }
            catch (Exception ex)
            {
                return(ExcutedResult.FailedResult(SysResultCode.ServerException, "发生异常,请稍后再试或联系管理员"));
            }
        }