public JsonResult DistributionReport(FormCollection collection) { DistributionModel model = new DistributionModel(); this.TryUpdateModel(model, collection); string error = string.Empty; ResultModel resultModel = new ResultModel(); FlexigridData flexgridData = new FlexigridData(); int pageIndex = DataTypeHelper.ToInt32(collection["pageIndex"]); int pageSize = DataTypeHelper.ToInt32(collection["pageSize"]); string sortName = collection["sortName"]; string sortOrder = collection["sortOrder"]; int totalRows = 0; if (ModelState.IsValid) { List<DistributionReportDetail> feesExpenses = ReportRepository.FindDistributionReport(pageIndex, pageSize, sortName, sortOrder, ref totalRows, model.FundId, (model.StartDate ?? Convert.ToDateTime("01/01/1900")), (model.EndDate ?? DateTime.Now)); flexgridData.total = totalRows; flexgridData.page = 1; foreach (var distribution in feesExpenses) { flexgridData.rows.Add(new FlexigridRow { cell = new List<object> { distribution.DealNo, distribution.FundName, distribution.Date, distribution.Amount, distribution.Type, distribution.Stock, distribution.NoOfShares } }); } } else { foreach (var values in ModelState.Values.ToList()) { foreach (var err in values.Errors.ToList()) { if (string.IsNullOrEmpty(err.ErrorMessage) == false) { error += err.ErrorMessage + "\n"; } } } } return Json(new { Error = error, Data = flexgridData, page = pageIndex, total = totalRows }, JsonRequestBehavior.AllowGet); }
public ActionResult Distribution() { ViewData["MenuName"] = "ReportManagement"; ViewData["SubmenuName"] = "Distribution"; DistributionModel model = new DistributionModel(); return View(model); }