public ResponseFPtplListSearch FPtplListSearch([FromBody] RequestFPtplListSearch request) { try { FPtplBLL bll = new FPtplBLL(); return(bll.FPtplListSearch(request)); } catch (Exception ex) { throw new HttpResponseException( Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
/// <summary> /// 发票模板获取 /// </summary> /// <param name="request"></param> /// <returns></returns> public ResponseFPtplListSearch FPtplListSearch(RequestFPtplListSearch request) { ResponseFPtplListSearch response = new ResponseFPtplListSearch(); using (cnn = GetConnection()) { var ts = cnn.BeginTransaction(); try { var user = this.UserInfoGet(request.Token, ts); string sql = this.GetPageSql("A.*,B.title", @" TKS_FAS_Invoice2TPL A left join TKS_FAS_DocTPL B on A.tplId=B.id where A.accountId=@AccountId", " A.createDate desc ", request.PageSize, request.PageIndex); List <TKS_FAS_Invoice2TPLExt> data = cnn.Query <TKS_FAS_Invoice2TPLExt>(sql, new { AccountId = user.AccountId }, ts).ToList(); string countSql = @"select count(1) from TKS_FAS_Invoice2TPL where AccountId=@AccountId"; int total = int.Parse(cnn.ExecuteScalar(countSql, new { AccountId = user.AccountId }, 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 ResponseFPtplListSearch); } } }