コード例 #1
0
ファイル: EmailController.cs プロジェクト: SubhoM/ReportApp
        public ActionResult SendERPDFEmail(string ExcelGridName, Email email, string ERReportName, string SortBy = "", string SortOrder = "")
        {
            var  emailService = new CommonService();
            bool emailSuccess = true;
            var  emailMessage = WebConstants.Excel_Email_Success;

            try
            {
                byte[]   fileContents     = null;
                SearchER ERsearchcriteria = Session["ERsearchcriteria"] as SearchER;
                //   Session.Remove("ERsearchcriteria");

                if (ERReportName == "TracersByTJCStandard")
                {
                    var tjcStandardService = new TracersByTJCStandard();

                    fileContents = tjcStandardService.TracerByTJCStandardRDLC(ERsearchcriteria, (int)WebConstants.ReportFormat.PDF, SortBy, SortOrder);
                }
                else if (ERReportName == "ERTracerByQuestion")
                {
                    var ERTracerByQuestion = new ERTracerByQuestion();

                    fileContents = ERTracerByQuestion.ERTracerByQuestionRDLC(ERsearchcriteria, (int)WebConstants.ReportFormat.PDF, SortBy, SortOrder);
                }
                else
                {
                    var tcsService = new TracersComplianceSummary();
                    fileContents = tcsService.TracersComplianceSummaryRDLC(ERsearchcriteria, (int)WebConstants.ReportFormat.PDF, SortBy, SortOrder);
                }
                email.AttachmentLocation[0] = emailService.SavePDF(ExcelGridName, fileContents);
                email.FileContents          = fileContents;
                emailSuccess = emailService.SendExcelEmailAttachemnt(email, true);
                if (emailSuccess)
                {
                    emailMessage = WebConstants.Excel_Email_Success;
                }
                else
                {
                    emailMessage = WebConstants.Email_Failed;
                }
            }
            catch (Exception)
            {
                emailMessage = WebConstants.Excel_Email_Failed;
            }
            finally
            {
                Session.Remove("ERsearchcriteria");
            }
            return(Json(emailMessage));
        }
コード例 #2
0
ファイル: EmailController.cs プロジェクト: SubhoM/ReportApp
        public ActionResult createErPdf(string ExcelGridName, string ERReportName, string SortBy = "", string SortOrder = "")
        {
            var emailService = new CommonService();

            var    createErPdf = "failed";
            string fileGuid    = "";

            try
            {
                byte[]   fileContents     = null;
                SearchER ERsearchcriteria = Session["ERsearchcriteria"] as SearchER;
                Session.Remove("ERsearchcriteria");

                if (ERReportName == "TracersByTJCStandard")
                {
                    var tjcStandardService = new TracersByTJCStandard();

                    fileContents = tjcStandardService.TracerByTJCStandardRDLC(ERsearchcriteria, (int)WebConstants.ReportFormat.PDF, SortBy, SortOrder);
                }
                else if (ERReportName == "ERTracerByQuestion")
                {
                    var ERTracerByQuestion = new ERTracerByQuestion();

                    fileContents = ERTracerByQuestion.ERTracerByQuestionRDLC(ERsearchcriteria, (int)WebConstants.ReportFormat.PDF, SortBy, SortOrder);
                }
                else
                {
                    var tcsService = new TracersComplianceSummary();
                    fileContents = tcsService.TracersComplianceSummaryRDLC(ERsearchcriteria, (int)WebConstants.ReportFormat.PDF, SortBy, SortOrder);
                }
                if (fileContents != null)
                {
                    createErPdf = "success";
                }
                else
                {
                    createErPdf = "failed";
                }
                fileGuid = emailService.SavePDF(ExcelGridName, fileContents);
            }
            catch (Exception)
            {
                createErPdf = "failed";
            }
            finally
            {
                Session.Remove("ERsearchcriteria");
            }
            return(Json(new { exportCreated = createErPdf, fileGuid = fileGuid }));
        }
コード例 #3
0
        public ActionResult TracersByTJCStandard_Data(SearchER search, int LevelIdentifier)
        {
            TracersByTJCStandard reportservice = new TracersByTJCStandard();
            JsonResult           jr            = new JsonResult();

            switch (LevelIdentifier)
            {
            case (int)WebConstants.TracerByTJCStandardLevels.Level1_Program:
            {
                List <ErTracersbyProgramData> Level1Data = new List <ErTracersbyProgramData>();
                Level1Data = reportservice.GetLevel1Data(search);
                jr         = Json(Level1Data, JsonRequestBehavior.AllowGet);
                break;
            }

            case (int)WebConstants.TracerByTJCStandardLevels.Level2_Site:
            {
                List <ErTracersbySiteData> Level2Data = new List <ErTracersbySiteData>();
                Level2Data = reportservice.GetLevel2Data(search);
                jr         = Json(Level2Data, JsonRequestBehavior.AllowGet);
                break;
            }

            case (int)WebConstants.TracerByTJCStandardLevels.Level3_Chapter:
            {
                List <ErTracersbyChapterData> Level3Data = new List <ErTracersbyChapterData>();
                Level3Data = reportservice.GetLevel3Data(search);
                jr         = Json(Level3Data, JsonRequestBehavior.AllowGet);
                break;
            }

            case (int)WebConstants.TracerByTJCStandardLevels.Level4_Standard:
            {
                List <ErTracersbyStandardData> Level4Data = new List <ErTracersbyStandardData>();
                Level4Data = reportservice.GetLevel4Data(search);
                jr         = Json(Level4Data, JsonRequestBehavior.AllowGet);
                break;
            }

            case (int)WebConstants.TracerByTJCStandardLevels.Level5_EP:
            {
                List <ErTracersbyEPData> Level5Data = new List <ErTracersbyEPData>();
                Level5Data = reportservice.GetLevel5Data(search);
                jr         = Json(Level5Data, JsonRequestBehavior.AllowGet);
                break;
            }

            case (int)WebConstants.TracerByTJCStandardLevels.Level6_EPDetails:
            {
                List <ErTracersbyEPDetails> Level6Data = new List <ErTracersbyEPDetails>();
                Level6Data = reportservice.GetLevel6Data(search);
                jr         = Json(Level6Data, JsonRequestBehavior.AllowGet);
                break;
            }
            }



            jr.MaxJsonLength  = Int32.MaxValue;
            jr.RecursionLimit = 100;
            return(jr);
        }