public ActionResult DataSourceGetAll(DataManager dm) { SMCModels obj = new SMCModels(); IEnumerable data = obj.GetAll(null, null, null).ToList(); int count = obj.GetAll(null, null, null).ToList().Count(); DataOperations operation = new DataOperations(); //Performing filtering operation if (dm.Where != null) { data = operation.PerformWhereFilter(data, dm.Where, "and"); var filtered = (IEnumerable <object>)data; count = filtered.Count(); } //Performing search operation if (dm.Search != null) { data = operation.PerformSearching(data, dm.Search); var searched = (IEnumerable <object>)data; count = searched.Count(); } //Performing sorting operation if (dm.Sorted != null) { data = operation.PerformSorting(data, dm.Sorted); } //Performing paging operations if (dm.Skip != 0) { data = operation.PerformSkip(data, dm.Skip); } if (dm.Take != 0) { data = operation.PerformTake(data, dm.Take); } return(Json(new { result = data, count = count }, JsonRequestBehavior.AllowGet)); }
public ActionResult SMC(string sdate, string edate, int?_emmergency) { bool?emergency = null; if (_emmergency == 1) { emergency = false; } else if (_emmergency == 2) { emergency = true; } SMCModels obj = new SMCModels(); DateTime? StartDate = DateTime.ParseExact(sdate, "dd/MM/yyyy", null); DateTime? EndDate = DateTime.ParseExact(edate, "dd/MM/yyyy", null); // obj.GetAll(StartDate, EndDate); //obj.EndDate = EndDate; Microsoft.Reporting.WebForms.ReportViewer reportViewer = new Microsoft.Reporting.WebForms.ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.SizeToReportContent = true; reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Views\Queries\SMC.rdlc"; reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("sMC", obj.GetAll(StartDate, EndDate, emergency).ToList())); ViewBag.ReportViewer = reportViewer; return(View()); }