Exemplo n.º 1
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetMessageTemplateRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var MessageTemplateBLL = new C_MessageTemplateBLL(loggingSessionInfo);

            try
            {
                C_MessageTemplateEntity DelData = MessageTemplateBLL.GetByID(para.TemplateID);
                if (DelData == null)
                {
                    throw new APIException("消息模板对象为NULL!")
                          {
                              ErrorCode = ERROR_CODES.INVALID_BUSINESS
                          }
                }
                ;
                //执行
                MessageTemplateBLL.Delete(DelData);
            }
            catch (APIException apiEx)
            {
                throw new APIException(apiEx.ErrorCode, apiEx.Message);
            }


            return(rd);
        }
Exemplo n.º 2
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetMessageTemplateRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            var MessageTemplateBLL = new C_MessageTemplateBLL(loggingSessionInfo);

            try
            {
                if (string.IsNullOrWhiteSpace(para.TemplateID))
                {
                    //添加
                    C_MessageTemplateEntity AddData = new C_MessageTemplateEntity();
                    AddData.TemplateID = System.Guid.NewGuid();
                    AddData.Type       = "未定义";
                    AddData.Title      = para.Title;
                    AddData.Content    = para.Content;
                    AddData.CustomerID = loggingSessionInfo.ClientID;
                    MessageTemplateBLL.Create(AddData);
                }
                else
                {
                    //编辑
                    C_MessageTemplateEntity UpData = MessageTemplateBLL.GetByID(para.TemplateID);
                    if (UpData == null)
                    {
                        throw new APIException("假日对象为NULL!")
                              {
                                  ErrorCode = ERROR_CODES.INVALID_BUSINESS
                              }
                    }
                    ;

                    UpData.Title      = para.Title;
                    UpData.Content    = para.Content;
                    UpData.CustomerID = loggingSessionInfo.ClientID;
                    MessageTemplateBLL.Update(UpData);
                }
            }
            catch (APIException apiEx)
            {
                throw new APIException(apiEx.ErrorCode, apiEx.Message);
            }

            return(rd);
        }
        protected override GetMessageTemplateDeatileRD ProcessRequest(DTO.Base.APIRequest <SetMessageTemplateRP> pRequest)
        {
            var rd   = new GetMessageTemplateDeatileRD();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var MessageTemplateBLL = new C_MessageTemplateBLL(loggingSessionInfo);

            if (!string.IsNullOrWhiteSpace(para.TemplateID))
            {
                C_MessageTemplateEntity Data = MessageTemplateBLL.GetByID(para.TemplateID);
                if (Data != null)
                {
                    rd.TemplateID = Data.TemplateID.ToString();
                    rd.Title      = Data.Title;
                    rd.Content    = Data.Content;
                }
            }

            return(rd);
        }