예제 #1
0
        public ResponseBBDetailtplAdd BBDetailtplAdd(RequestBBDetailtplAdd request)
        {
            ResponseBBDetailtplAdd response = new ResponseBBDetailtplAdd();

            using (cnn = GetConnection())
            {
                var ts = cnn.BeginTransaction();
                try
                {
                    var user = this.UserInfoGetButAccount(request.Token, ts);

                    var data = cnn.Query("select * from TKS_FAS_ReportDetailTPL where id=@Id", new { Id = request.Data.Id }, ts);
                    if (data.Count() > 0)
                    {
                        throw new NormalException("ID已经存在");
                    }
                    request.Data.Id        = Guid.NewGuid().ToString("N");
                    request.Data.AccountId = "-";
                    cnn.Insert <TKS_FAS_ReportDetailTPL>(request.Data, ts);

                    ts.Commit();
                    response.Id = request.Data.Id;

                    response.IsSuccess = true;
                    response.Message   = "新增成功";
                    return(response);
                }
                catch (Exception ex)
                {
                    ts.Rollback();
                    return(this.DealException(response, ex) as ResponseBBDetailtplAdd);
                }
            }
        }
예제 #2
0
 public ResponseBBDetailtplAdd BBDetailtplAdd([FromBody] RequestBBDetailtplAdd request)
 {
     try
     {
         ReportTplBLL bll = new ReportTplBLL();
         return(bll.BBDetailtplAdd(request));
     }
     catch (Exception ex)
     {
         throw new HttpResponseException(
                   Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }