public JsonResult LoadSubmitShipmentBillsGrid(string sidx, string sord, int page, int rows, string carNo) { //读取数据 string strErrText; DeliverSystem deliver = new DeliverSystem(); List<ShipmentBill> listShipmentBill = deliver.LoadSubmitShipmentBills(LoginAccountId, LoginStaffName, out strErrText); if (listShipmentBill == null) { throw new Exception(strErrText); } if (carNo != null && carNo != string.Empty) { listShipmentBill = listShipmentBill.FindAll(delegate(ShipmentBill b) { return b.CarNo == carNo; }); } //提取当前页面数据 int nTotalRows = listShipmentBill.Count; int nPageIndex = page; int nPageSize = rows; int nTotalPages = nTotalRows / nPageSize; if (nTotalRows % nPageSize > 0) nTotalPages++; string sortExpression = (sidx ?? "BillNo") + " " + (sord ?? "ASC"); var data = listShipmentBill.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList(); //生成表格数据 var ret = new { total = nTotalPages, page = nPageIndex, records = nTotalRows, rows = ( from p in data select new { id = p.Id, cell = new string[] { p.Id.ToString(), p.BillNo, p.CustomerName, p.DeliveryNo, p.ReceiverName, p.CarNo, p.TrailerNo, p.TotalPackages.ToString(), p.TotalTunnages.ToString("#0.######"), p.TotalPiles.ToString("#0.######"), p.TotalTenThousands.ToString("#0.######") } }).ToArray() }; return Json(ret, JsonRequestBehavior.AllowGet); }
public JsonResult LoadSubmitShipmentBillsCarNo() { //读取数据 string strErrText; DeliverSystem deliver = new DeliverSystem(); List<ShipmentBill> listShipmentBill = deliver.LoadSubmitShipmentBills(LoginAccountId, LoginStaffName, out strErrText); if (listShipmentBill == null) { throw new Exception(strErrText); } var ret = (from b in listShipmentBill where b.CarNo != null && b.CarNo != string.Empty select b.CarNo).Distinct(); return Json(ret, JsonRequestBehavior.AllowGet); }