Пример #1
0
        public ActionResult createErPdf(string ExcelGridName, string ERReportName, string SortBy = "", string SortOrder = "")
        {
            var emailService = new CommonService();

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

            try
            {
                byte[]            fileContents     = null;
                SearchCorporateER ERsearchcriteria = Session["ERsearchcriteria"] as SearchCorporateER;

                var epaService = new EPAssignment();
                fileContents = epaService.EPAssignmentRDLC(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 }));
        }
Пример #2
0
        public ActionResult EPAssignment_Data(SearchCorporateER search, int LevelIdentifier)
        {
            EPAssignment reportservice = new EPAssignment();
            JsonResult   jr            = new JsonResult();

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

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

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

            case (int)WebConstants.EPAssignmentLevels.Level4_EP:
            {
                List <EPAssignmentDetails> Level4Data = new List <EPAssignmentDetails>();
                Level4Data = reportservice.GetLevel4Data(search);

                Level4Data.ForEach(z => { z.PastDueDate = z.DueDate == null ? false : Convert.ToDateTime(z.DueDate) < DateTime.Today && z.ScoreDate == null ? true : false;
                                          z.DueDate     = z.PastDueDate == true ? z.DueDate + "</br>Past Due Date" : z.DueDate; }
                                   );

                jr = Json(Level4Data, JsonRequestBehavior.AllowGet);
                break;
            }
            }

            jr.MaxJsonLength  = Int32.MaxValue;
            jr.RecursionLimit = 100;
            return(jr);
        }
Пример #3
0
        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;
                SearchCorporateER ERsearchcriteria = Session["ERsearchcriteria"] as SearchCorporateER;



                var epaService = new EPAssignment();
                fileContents = epaService.EPAssignmentRDLC(ERsearchcriteria, (int)WebConstants.ReportFormat.PDF, SortBy, SortOrder);

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