Пример #1
0
        public ActionResult _DepartmentComparativeAnalysisDataExcel([DataSourceRequest] DataSourceRequest request, Search search)
        {
            var dcaService          = new DepartmentComparativeAnalysis();
            DataSourceResult result = dcaService._departmentcomparativeanalysisDataExcel(request, search);
            JsonResult       jr     = new JsonResult();

            jr = Json(result, JsonRequestBehavior.AllowGet);
            jr.MaxJsonLength  = Int32.MaxValue;
            jr.RecursionLimit = 100;
            return(jr);
            //  return Json(result, JsonRequestBehavior.AllowGet);
        }
Пример #2
0
        public ActionResult CreateExcelFile(string fileName, string ExcelGridName)
        {
            Search searchcriteria = Session["searchcriteria"] as Search;

            Session.Remove("searchcriteria");
            //get dataset as required using Session["searchcriteria"] as parameter
            DataTable dt = new DataTable();

            byte[] file = null;

            if (ExcelGridName == "gridTCEPDIE8" || ExcelGridName == "gridTCEPIE8" || ExcelGridName == "gridTCEPQIE8" || ExcelGridName == "gridTCSTDIE8")
            {
                var teService = new TracerByEP();
                file = teService.TracerByEPDataIE(searchcriteria);
            }
            else if (ExcelGridName == "gridTCQUESIE8" || ExcelGridName == "gridTCRESPIE8")
            {
                var tcService = new TracerComprehensive();
                file = tcService.TracerComprehensiveDataIE(searchcriteria);
            }
            else if (ExcelGridName == "gridDCADATAIE8")
            {
                var teService = new DepartmentComparativeAnalysis();
                file = teService.DepartmentComparativeAnalysisDataExcelIE8(searchcriteria);
            }
            else if (ExcelGridName == "gridDCAOPPIE8")
            {
                var teService = new DepartmentComparativeAnalysis();
                file = teService.DepartmentComparativeAnalysisOppExcelIE8(searchcriteria);
            }
            else if (ExcelGridName == "gridTCCMSIE8")
            {
                var cmsService = new TracerByCMS();
                file = cmsService.TracerByCMSIE(searchcriteria, 2);     // 2 = Request By Data Detail version  (1 = Graph version)
            }
            else if (ExcelGridName == "gridMQB")
            {
                var qmbService = new MonthlyBreakdownService();
                file = qmbService.QuestionMonthlyBreakdownDataIE(searchcriteria);
            }
            else if (ExcelGridName == "gridMTB")
            {
                var tmbService = new MonthlyBreakdownService();
                file = tmbService.TracerMonthlyBreakdownDataIE(searchcriteria);
            }

            //// Get the spreadsheet from seession.
            //replace file with the actual content
            // byte[] file = System.Text.Encoding.ASCII.GetBytes(dt.CreateCSVFile());
            string filename = string.Format("{0}.xlsx", fileName);

            return(File(file, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", filename));
        }
Пример #3
0
        public PartialViewResult _DepartmentComparativeAnalysis(Search search, Email emailInput)
        {
            ReportViewer reportViewer = new ReportViewer();

            try
            {
                var dcaService = new DepartmentComparativeAnalysis();

                if (emailInput.To != null)
                {
                    ViewBag.FromEmail        = true;
                    ViewBag.FromEmailSuccess = WebConstants.Email_Success;
                }
                //CommonService pdfService = new CommonService();

                reportViewer = dcaService._departmentcomparativeanalysisRDLC(search, emailInput);
                Session["MyReportViewer"] = reportViewer;
                //   ViewBag.ReportViewer = reportViewer;
                // ViewBag.createPdfLocation = pdfService.GetRDLCPathtoOpen(search.ReportTitle, dcaService._departmentcomparativeanalysisRDLC(search, emailInput));
            }
            catch (Exception ex)
            {
                if (ex.Message.ToString() != "Email")
                {
                    if (ex.Message.ToString() == "No Data")
                    {
                        ModelState.AddModelError("Error", WebConstants.NO_DATA_FOUND_RDLC_VIEW);
                    }
                    else
                    {
                        ModelState.AddModelError("Error", "Maximum limit of " + ConfigurationManager.AppSettings["ReportOutputLimit"].ToString() + " records reached. Refine your criteria to narrow the result.");
                    }
                }
                else
                {
                    ViewBag.FromEmail = true;
                    ModelState.AddModelError("Error", WebConstants.Email_Failed);
                }
            }
            return(PartialView("_ReportViewer"));
        }
Пример #4
0
        public ActionResult SendExcelEmailIE8(string ExcelGridName, Email email)
        {
            var  emailService = new CommonService();
            bool emailSuccess = true;
            var  emailMessage = WebConstants.Excel_Email_Success;

            try
            {
                DataTable dt   = new DataTable();
                byte[]    file = null;
                if (ExcelGridName == "gridTCEPDIE8" || ExcelGridName == "gridTCEPIE8" || ExcelGridName == "gridTCEPQIE8" || ExcelGridName == "gridTCSTDIE8")
                {
                    var teService = new TracerByEP();
                    file = teService.TracerByEPDataIE(Session["searchcriteria"] as Search);
                }
                else if (ExcelGridName == "gridTCQUESIE8")
                {
                    var tcService = new TracerComprehensive();
                    file = tcService.TracerComprehensiveDataIE(Session["searchcriteria"] as Search);
                }
                else if (ExcelGridName == "gridTCRESPIE8")
                {
                    var tcService = new TracerComprehensive();
                    file = tcService.TracerComprehensiveDataIE(Session["searchcriteria"] as Search);
                }
                else if (ExcelGridName == "gridDCADATAIE8")
                {
                    var teService = new DepartmentComparativeAnalysis();
                    file = teService.DepartmentComparativeAnalysisDataExcelIE8(Session["searchcriteria"] as Search);
                }
                else if (ExcelGridName == "gridCompQuesDetIE8")
                {
                    var teService = new TracerComplianceQuestion();
                    file = teService.ReportComplianceQuestionDetailExcelIE8(Session["searchcriteria"] as TracerComplianceQuestionInput);
                }
                else if (ExcelGridName == "gridTCCMSIE8")
                {
                    var cmsService = new TracerByCMS();
                    file = cmsService.TracerByCMSIE(Session["searchcriteria"] as Search, 2);        // Request detail version
                }
                else if (ExcelGridName == "gridMQB")
                {
                    var qmbService = new MonthlyBreakdownService();
                    file = qmbService.QuestionMonthlyBreakdownDataIE(Session["searchcriteria"] as Search);
                }
                else if (ExcelGridName == "gridMTB")
                {
                    var tmbService = new MonthlyBreakdownService();
                    file = tmbService.TracerMonthlyBreakdownDataIE(Session["searchcriteria"] as Search);
                }

                if (email.MultipleAttachment)
                {
                    email.AttachmentLocation[0] = emailService.SaveExcel(email.Title.ToString(), file);
                    var teService = new DepartmentComparativeAnalysis();
                    file = teService.DepartmentComparativeAnalysisOppExcelIE8(Session["searchcriteria"] as Search);
                    email.AttachmentLocation[1] = emailService.SaveExcel(email.Title.ToString() + " Details", file);
                    email.FileContents          = file;
                    emailSuccess = emailService.SendExcelEmailAttachemnt(email);
                    if (emailSuccess)
                    {
                        emailMessage = WebConstants.Excel_Email_Success;
                    }
                    else
                    {
                        emailMessage = WebConstants.Email_Failed;
                    }
                }
                else
                {
                    email.AttachmentLocation[0] = emailService.SaveExcel(email.Title.ToString(), file);
                    email.FileContents          = file;
                    emailSuccess = emailService.SendExcelEmailAttachemnt(email);
                    if (emailSuccess)
                    {
                        emailMessage = WebConstants.Excel_Email_Success;
                    }
                    else
                    {
                        emailMessage = WebConstants.Email_Failed;
                    }
                }
            }
            catch (Exception)
            {
                emailMessage = WebConstants.Excel_Email_Failed;
            }
            finally
            {
                Session.Remove("searchcriteria");
            }
            return(Json(emailMessage));
        }