Пример #1
0
        protected override SetoffPosterRD ProcessRequest(DTO.Base.APIRequest <SetoffPosterRP> pRequest)
        {
            var rd   = new SetoffPosterRD();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var SetoffPosterBll    = new SetoffPosterBLL(loggingSessionInfo);
            var ObjectImagesBll    = new ObjectImagesBLL(loggingSessionInfo);
            //
            var pTran = SetoffPosterBll.GetTran();
            var Data  = SetoffPosterBll.GetByID(para.SetoffPosterID);

            if (Data == null)
            {
                throw new APIException("数据异常,找不到集客海报!")
                      {
                          ErrorCode = ERROR_CODES.INVALID_BUSINESS
                      }
            }
            ;
            using (pTran.Connection)
            {
                try
                {
                    //图片表
                    var ObjectImageData = ObjectImagesBll.GetByID(Data.ImageId);
                    if (Data == null)
                    {
                        throw new APIException("数据异常,找不到集客海报Url!")
                              {
                                  ErrorCode = ERROR_CODES.INVALID_BUSINESS
                              }
                    }
                    ;

                    ObjectImageData.ImageURL = para.ImageUrl;
                    ObjectImagesBll.Update(ObjectImageData, pTran);//

                    Data.Name    = para.Name;
                    Data.ImageId = ObjectImageData.ImageId;
                    SetoffPosterBll.Update(Data, pTran);//

                    //
                    pTran.Commit();
                    //
                    rd.SetoffPosterID = Data.SetoffPosterID.ToString();
                    rd.Name           = Data.Name;
                    rd.ImageUrl       = ObjectImageData.ImageURL;
                }
                catch (Exception ex)
                {
                    pTran.Rollback();
                    throw ex;
                }
            }
            return(rd);
        }
    }