public ActionResult DataSourceGetAll(DataManager dm)
        {
            OISTIModels obj   = new OISTIModels();
            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));
        }
Пример #2
0
        public ActionResult OISI(string sdate, string edate, int?_emmergency)
        {
            bool?emergency = null;

            if (_emmergency == 1)
            {
                emergency = false;
            }
            else if (_emmergency == 2)
            {
                emergency = true;
            }
            OISTIModels obj       = new OISTIModels();
            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\OISI.rdlc";
            reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("oISI", obj.GetAll(StartDate, EndDate, emergency).ToList()));

            ViewBag.ReportViewer = reportViewer;
            return(View());
        }