public void FindPreparedMar() { string rows = Context.Request.Form["rows"]; string page = Context.Request.Form["page"]; string workOrder = Context.Request.Form["workOrder"]; int count = _bal.FindPreparedMarCount(workOrder); IList <MaterialStock> ms = _bal.FindPreparedMar(rows, page, workOrder); if (ms != null && ms.Count > 0) { for (int i = 0; i < ms.Count; i++) { ms[i].StockHouse = _bal.FindNameBySubCode(ms[i].StockHouse) == null ? ms[i].StockHouse : _bal.FindNameBySubCode(ms[i].StockHouse).SubName; ms[i].CustName = _bal.FindCustNameByCode(ms[i].CustName) == null ? ms[i].CustName : _bal.FindCustNameByCode(ms[i].CustName).NAME; ms[i].UpdatedBy = _bal.FindUserNameByCode(ms[i].UpdatedBy) == null ? ms[i].UpdatedBy : _bal.FindUserNameByCode(ms[i].UpdatedBy).UserName; ms[i].UNIT = _bal.FindNameBySubCode(ms[i].UNIT) == null ? ms[i].UNIT : _bal.FindNameBySubCode(ms[i].UNIT).SubName; } } Dictionary <String, Object> map = new Dictionary <String, Object>(); map.Add("total", count); map.Add("rows", ms); Context.Response.Write(JsonConvert.SerializeObject(map)); }