Exemplo n.º 1
0
 public ResponseCustomDataGet CustomDataGet([FromBody] RequestCustomDataGet request)
 {
     try
     {
         CustomDataBLL bll = new CustomDataBLL();
         return(bll.CustomDataGet(request));
     }
     catch (Exception ex)
     {
         throw new HttpResponseException(
                   Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
Exemplo n.º 2
0
        public ResponseCustomDataGet CustomDataGet(RequestCustomDataGet request)
        {
            ResponseCustomDataGet response = new ResponseCustomDataGet();

            using (cnn = GetConnection())
            {
                var ts = cnn.BeginTransaction();
                try
                {
                    //detail data id-->parentId-->meta data
                    var data = cnn.QuerySingle <TKS_FAS_CaculateHelperDetail>(@"select * from 
                            TKS_FAS_CaculateHelperDetail where id=@Id", new
                    {
                        Id = request.Data.Id
                    }, ts);

                    var head = cnn.QuerySingle <TKS_FAS_CaculateHelperItem>(@"select * from
                    TKS_FAS_CaculateHelperItem where id=@Id", new
                    {
                        Id = data.ParentId
                    }, ts);

                    var customColDes = cnn.Query <TKS_FAS_CustomColDes>(@"select * from
                    TKS_FAS_CustomColDes where parentId=@ParentId", new
                    {
                        ParentId = data.ParentId
                    }, ts).ToList();

                    var customCodeValue = CodeBindValue(customColDes, data);

                    ts.Commit();
                    response.IsSuccess = true;
                    response.Message   = "加载完毕";
                    response.Data      = data;
                    response.Head      = head;
                    response.CustomDes = customCodeValue;
                    return(response);
                }
                catch (Exception ex)
                {
                    ts.Rollback();
                    return(this.DealException(response, ex) as ResponseCustomDataGet);
                }
            }
        }