public JsonResult LoadPriceApproveFlowStepConditionsGrid(string id, string sidx, string sord, int page, int rows) { //读取数据 string strErrText; FlowSystem flow = new FlowSystem(); List <ApproveFlowStepCondition> listConditions = flow.LoadApproveFlowStepConditionsByStepId(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText); if (listConditions == null) { throw new Exception(strErrText); } //提取当前页面数据 int nTotalRows = listConditions.Count; int nPageIndex = page; int nPageSize = rows; int nTotalPages = nTotalRows / nPageSize; if (nTotalRows % nPageSize > 0) { nTotalPages++; } string sortExpression = (sidx ?? "ConditionNum") + " " + (sord ?? "ASC"); var data = listConditions.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList(); //生成表格数据 var ret = new { total = nTotalPages, page = nPageIndex, records = nTotalRows, rows = ( from c in data select new { id = c.Id, cell = new string[] { c.Id.ToString(), c.ConditionNum.ToString(), c.FieldName, c.CompareOperator, c.FieldValue } }).ToArray() }; return(Json(ret, JsonRequestBehavior.AllowGet)); }