public ResponseFPFJListSearch FPFJListSearch([FromBody] RequestFPFJListSearch request) { try { FPFJBLL bll = new FPFJBLL(); return(bll.FPFJListSearch(request)); } catch (Exception ex) { throw new HttpResponseException( Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public ResponseFPFJListSearch FPFJListSearch(RequestFPFJListSearch request) { ResponseFPFJListSearch response = new ResponseFPFJListSearch(); using (cnn = GetConnection()) { var ts = cnn.BeginTransaction(); try { var user = this.UserInfoGet(request.Token, ts); string sql = this.GetPageSql("*", @" TKS_FAS_InvoiceAttach where invoiceId=@InvoiceId", " createDate desc ", request.PageSize, request.PageIndex); List <TKS_FAS_InvoiceAttach> data = cnn.Query <TKS_FAS_InvoiceAttach>(sql, new { CreateUser = user.User.UserName, InvoiceId = request.InvoiceId }, ts).ToList(); string countSql = @"select count(1) from TKS_FAS_InvoiceAttach where invoiceId=@InvoiceId"; int total = int.Parse(cnn.ExecuteScalar(countSql, new { CreateUser = user.User.UserName, InvoiceId = request.InvoiceId }, ts).ToString()); ts.Commit(); response.IsSuccess = true; response.Message = "加载完毕"; response.PageIndex = request.PageIndex; response.Data = data; response.Total = total; return(response); } catch (Exception ex) { ts.Rollback(); return(this.DealException(response, ex) as ResponseFPFJListSearch); } } }