public ActionResult _ComplianceQuestionChartExcel([DataSourceRequest] DataSourceRequest request, TracerComplianceQuestionInput search)
        {
            var dcaService          = new TracerComplianceQuestion();
            DataSourceResult result = dcaService._complianceQuestionChartExcel(request, search);
            JsonResult       jr     = new JsonResult();

            jr = Json(result, JsonRequestBehavior.AllowGet);
            jr.MaxJsonLength  = Int32.MaxValue;
            jr.RecursionLimit = 100;
            return(jr);
        }
        public ActionResult ComplianceQuestion_Export(string SortBy, string SortOrder)
        {
            TracerComplianceQuestionInput searchcriteria = Session["searchcriteria"] as TracerComplianceQuestionInput;

            Session.Remove("searchcriteria");
            var dcaService = new TracerComplianceQuestion();
            //if (Convert.ToInt32(searchcriteria.TopLeastCompliantQuestions) > 0)
            //{
            //    searchcriteria.TopLeastCompliantQuestions = (Convert.ToInt32(searchcriteria.TopLeastCompliantQuestions) - 1).ToString();
            //}
            string filtereddataQID = Session["filtereddataQID"].ToString();

            Session.Remove("filtereddataQID");
            byte[] fileContents = dcaService._complianceQuestionChartRDLC(searchcriteria, filtereddataQID, SortBy, SortOrder);
            string dtNow        = DateTime.Now.ToString("MM-dd-yyyy_hhmmssfff_tt");
            string filename     = string.Format("{0}_{1}.pdf", "Compliance By Question", dtNow.ToString());

            return(File(fileContents, "application/pdf", filename));
        }
Exemplo n.º 3
0
        public ActionResult CreateExcelFileQuestion(string fileName, string ExcelGridName)
        {
            TracerComplianceQuestionInput searchcriteria = Session["searchcriteria"] as TracerComplianceQuestionInput;

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

            var teService = new TracerComplianceQuestion();

            byte[] file = teService.ReportComplianceQuestionDetailExcelIE8(searchcriteria);
            // Get the spreadsheet from seession.
            //replace file with the actual content


            string filename = string.Format("{0}.xlsx", fileName);

            return(File(file, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", filename));
        }
Exemplo n.º 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));
        }
Exemplo n.º 5
0
        public ActionResult SendPDFEmail(string ExcelGridName, Email email, string SortBy, string SortOrder)
        {
            var  emailService = new CommonService();
            bool emailSuccess = true;
            var  emailMessage = WebConstants.Excel_Email_Success;

            try
            {
                byte[] fileContents = null;
                if (email.MultipleAttachment)
                {
                    if (Session["Attachment1Location"] == null)
                    {
                        Session["Attachment1Location"] = GetPDFFilePath(ExcelGridName, email.Title.ToString());
                        emailMessage = "Preping Second Attachment";
                    }
                    else
                    {
                        email.AttachmentLocation[0] = Session["Attachment1Location"].ToString();
                        email.AttachmentLocation[1] = GetPDFFilePath(ExcelGridName, email.Title.ToString());
                        email.FileContents          = fileContents;
                        emailSuccess = emailService.SendExcelEmailAttachemnt(email);
                        if (emailSuccess)
                        {
                            emailMessage = WebConstants.Excel_Email_Success;
                        }
                        else
                        {
                            emailMessage = WebConstants.Email_Failed;
                        }
                        Session["Attachment1Location"] = null;
                    }
                }
                else
                {
                    if (ExcelGridName == "Tracer by CMS")
                    {
                        var cmsService = new TracerByCMS();


                        Search searchcriteria = Session["searchcriteria"] as Search;
                        Session.Remove("searchcriteria");


                        string filtereddataTag = Session["filtereddataCMS"].ToString();
                        Session.Remove("filtereddataCMS");

                        fileContents = cmsService.TracerByCMSIE(searchcriteria, 1, filtereddataTag, SortBy, SortOrder);
                    }
                    else
                    {
                        TracerComplianceQuestionInput searchcriteria = Session["searchcriteria"] as TracerComplianceQuestionInput;
                        Session.Remove("searchcriteria");
                        var dcaService = new TracerComplianceQuestion();
                        //if (Convert.ToInt32(searchcriteria.TopLeastCompliantQuestions) > 0)
                        //{
                        //    searchcriteria.TopLeastCompliantQuestions = (Convert.ToInt32(searchcriteria.TopLeastCompliantQuestions) - 1).ToString();
                        //}
                        string filtereddataQID = Session["filtereddataQID"].ToString();
                        Session.Remove("filtereddataQID");
                        fileContents = dcaService._complianceQuestionChartRDLC(searchcriteria, filtereddataQID, SortBy, SortOrder);
                    }


                    email.AttachmentLocation[0] = emailService.SavePDF(ExcelGridName, fileContents);
                    email.FileContents          = fileContents;
                    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));
        }