Пример #1
0
        public ActionResult ReportingRatesCopy(string productCategory, string sdate, string edate)
        {
            ReportsModel obj = new ReportsModel();

            if (productCategory == "")
            {
                productCategory = null;
            }

            obj.productCategory = productCategory;

            DateTime?StartDate; //= DateTime.ParseExact(sdate, "dd/MM/yyyy", null);
            DateTime?EndDate;   //= DateTime.ParseExact(edate, "dd/MM/yyyy", null);

            if ((!sdate.Contains("null") && sdate != "") || (!edate.Contains("null") && edate != ""))
            {
                StartDate = DateTime.ParseExact(sdate, "dd/MM/yyyy", null);
                EndDate   = DateTime.ParseExact(edate, "dd/MM/yyyy", null);
            }
            else
            {
                StartDate = null; // Convert.ToDateTime(DBNull.Value);
                EndDate   = null; // Convert.ToDateTime(DBNull.Value);
            }
            obj.StartDate = StartDate;
            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) + @"\LMIS_Reports\Reporting_Rates.rdlc";
            reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("ReportingRates", obj.GetReportingRatesCopy().ToList()));

            ViewBag.ReportViewer = reportViewer;

            return(View());
        }