public ActionResult OTOrCathLabOperation() { var viewModel = new OTOrCathLabOperation() { StartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), EndDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), OperationOrCatLab = "0", isDone = true }; return(View(viewModel)); }
public ActionResult OTOrCathLabOperation(OTOrCathLabOperation operationcath) { var vm = operationcath; if (Request.IsAjaxRequest()) { ReportViewerVm reportVM = new ReportViewerVm(); ReportViewer reportViewer = new ReportViewer(); string reportDocPath = ""; if (true) //vm.isDone not working force true muna :) { if (vm.OperationOrCatLab == "0") //Operation { DataTable reportData = OTOrCathLabDB.OTOperationSelectionIsDONE(vm.StartDate, vm.EndDate.AddDays(1)); if (reportData.Rows.Count == 0) { return(Content(Errors.ReportContent("NO RECORDS FOUND"))); } reportDocPath = @"\Areas\ManagementReports\Reports\OperationTheatre\RptOperationIsDone.rdl"; reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + reportDocPath; ReportDataSource datasourceItem = new ReportDataSource("DataSet1", reportData); reportViewer.LocalReport.DataSources.Add(datasourceItem); reportViewer.LocalReport.SetParameters(new ReportParameter("from", vm.StartDate.ToString("dd-MMM-yyyy"))); reportViewer.LocalReport.SetParameters(new ReportParameter("to", vm.EndDate.ToString("dd-MMM-yyyy"))); reportViewer.LocalReport.SetParameters(new ReportParameter("aaaCompanyName", Global.OrganizationDetails.Name + " - " + Global.OrganizationDetails.City.ToUpper())); reportViewer.SizeToReportContent = true; reportViewer.ShowPrintButton = true; reportVM.ReportViewer = reportViewer; System.Web.HttpContext.Current.Session[Global.ReportViewerSessionName] = reportViewer; System.Web.HttpContext.Current.Session[Global.PdfUriSessionName] = Common.Helper.getApplicationUri("Preview", "Print", null); return(PartialView("~/Views/Shared/_reportViewer.cshtml", reportVM)); } else { //cath lab DataTable reportData = OTOrCathLabDB.OTCathLabIsDone(vm.StartDate, vm.EndDate.AddDays(1)); if (reportData.Rows.Count == 0) { return(Content(Errors.ReportContent("NO RECORDS FOUND"))); } reportDocPath = @"\Areas\ManagementReports\Reports\OperationTheatre\RptCathLabIsDone.rdl"; reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + reportDocPath; ReportDataSource datasourceItem = new ReportDataSource("DataSet1", reportData); reportViewer.LocalReport.DataSources.Add(datasourceItem); reportViewer.LocalReport.SetParameters(new ReportParameter("from", vm.StartDate.ToString("dd-MMM-yyyy"))); reportViewer.LocalReport.SetParameters(new ReportParameter("to", vm.EndDate.ToString("dd-MMM-yyyy"))); reportViewer.LocalReport.SetParameters(new ReportParameter("aaaCompanyName", Global.OrganizationDetails.Name + " - " + Global.OrganizationDetails.City.ToUpper())); reportViewer.SizeToReportContent = true; reportViewer.ShowPrintButton = true; reportVM.ReportViewer = reportViewer; System.Web.HttpContext.Current.Session[Global.ReportViewerSessionName] = reportViewer; System.Web.HttpContext.Current.Session[Global.PdfUriSessionName] = Common.Helper.getApplicationUri("Preview", "Print", null); return(PartialView("~/Views/Shared/_reportViewer.cshtml", reportVM)); } } else // not done { if (vm.OperationOrCatLab == "0")//Operation to be continuee.... { DataTable reportData = OTOrCathLabDB.OTOperationSelection(vm.StartDate, vm.EndDate); } else { //cath } } } return(View()); }