public ResponseNodeListSearch SupplierListSearch([FromBody] RequestNodeListSearch request) { try { NodeBLL bll = new NodeBLL(); return(bll.SupplierSearch(request)); } catch (Exception ex) { throw new HttpResponseException( Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public ResponseNodeListSearch SupplierSearch(RequestNodeListSearch request) { ResponseNodeListSearch response = new ResponseNodeListSearch(); using (cnn = GetConnection()) { var ts = cnn.BeginTransaction(); try { string sql = this.GetPageSql("A.*", "TKS_FAS_Node A where A.name like @Name and type=1 and isOutSource=1", "createDate desc", request.PageSize, request.PageIndex); List <TKS_FAS_Node> data = cnn.Query <TKS_FAS_Node>(sql, new { Name = "%" + request.Data.Name + "%" }, ts).ToList(); string countSql = "select count(1) from tks_fas_Node where name like @Name and type=1 and isOutSource=1"; int total = int.Parse(cnn.ExecuteScalar(countSql, new { Name = "%" + request.Data.Name + "%" }, 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 ResponseNodeListSearch); } } }