public List <EPAssignmentDetails> GetLevel4Data(SearchCorporateER search) { var Level4Data = new List <EPAssignmentDetails>(); Level4Data = GetDataSet(search, (int)WebConstants.EPAssignmentLevels.Level4_EP).Tables[0].ToList <EPAssignmentDetails>(); return(Level4Data); }
public static SaferMatrixMap GetSaferMatrix(SearchCorporateER search) { int limit = 8; var mockSurveyList = GetSaferMatrixData(search); if (mockSurveyList.Count < 1) { return(null); } var saferMatrixMap = new SaferMatrixMap(); using (var dbmDbEntityContainer = new DBMEdition01_Entities()) { foreach (var safer in dbmDbEntityContainer.GetSafterMap()) { var shortList = mockSurveyList.Where(item => item.CorporateFinalScoreID == safer.ScoreID).DistinctBy(x => new { x.SiteID, x.StandardLabel }); shortList = GroupBySite(shortList); var shortListCount = shortList.Count(); var fullEP = ReturnCorpFindings(safer, shortList.Take(limit)); if (shortListCount > limit) { fullEP = string.Format("{0}+({1}) more EP(s)", fullEP, (shortList.Count() - limit).ToString()); } AssignEPValue(saferMatrixMap, fullEP, safer.ScoreID); } } return(saferMatrixMap); }
public static List <MockSurveyCorporateFindingsReport> GetSaferMatrixRDLC(SearchCorporateER search) { var saferMatrixList = new List <MockSurveyCorporateFindingsReport>(); var mockSurveyList = GetSaferMatrixData(search); int limit = int.MaxValue; var list = new List <MockSurveyCorporateFindingsReport>(); using (var dbmDbEntityContainer = new DBMEdition01_Entities()) { foreach (var safer in dbmDbEntityContainer.GetSafterMap()) { var shortList = mockSurveyList.Where(item => item.CorporateFinalScoreID == safer.ScoreID).DistinctBy(x => new { x.SiteID, x.StandardLabel }); shortList = GroupBySite(shortList); var shortListCount = shortList.Count(); MockSurveyCorporateFindingsReport addItem = ReturnCorpFindingsRDLC(safer, shortList.Take(limit)); if (shortListCount > limit) { addItem.FullEP = string.Format("{0}+({1}) more EP(s)", addItem.FullEP, (shortList.Count() - limit).ToString()); } list.Add(addItem); } } return(list); }
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 })); }
public ActionResult RFIEPLevelDetails_Data(SearchCorporateER search) { try { string JCREmailDomain = "@JCRINC.COM"; string JCREmailDomain2 = "@JCAHO.COM"; string encryptionKey = ConfigurationManager.AppSettings.Get("EncryptionKey"); JsonResult jr = new JsonResult(); if (search.ProgramIDs == "-1") { search.ProgramIDs = null; } if (search.SelectedChapterIDs == "-1") { search.SelectedChapterIDs = null; } if (search.SelectedStandardIDs == "-1") { search.SelectedStandardIDs = null; } List <RFIEPFinding> Level2Data = new List <RFIEPFinding>(); Level2Data = TJCRFIFinding.GetRfiEPDetails(search); if (!AppSession.EmailAddress.ToUpper().Contains(JCREmailDomain) && !AppSession.EmailAddress.ToUpper().Contains(JCREmailDomain2)) { Level2Data.ToList().ForEach(data => { data.TJCFinding = CryptHelpers.RFIDecrypt(data.TJCFinding, encryptionKey); }); } else { Level2Data.ToList().ForEach(data => data.TJCFinding = string.Empty); } jr = Json(Level2Data, JsonRequestBehavior.AllowGet); jr.MaxJsonLength = Int32.MaxValue; jr.RecursionLimit = 100; return(jr); } catch (Exception ex) { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "TjcRFIFinding", MethodName = "RFIEPLevelDetails_Data", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; exceptionService.LogException(exceptionLog); return(RedirectToAction("Error", "Transfer")); } }
public List <EPAssignmentbyChapter> GetLevel2Data(SearchCorporateER search) { var Level2Data = new List <EPAssignmentbyChapter>(); Level2Data = GetDataSet(search, (int)WebConstants.EPAssignmentLevels.Level2_Chapter).Tables[0].ToList <EPAssignmentbyChapter>(); return(Level2Data); }
public List <EPAssignmentbySite> GetLevel1Data(SearchCorporateER search) { var Level1Data = new List <EPAssignmentbySite>(); Level1Data = GetDataSet(search, (int)WebConstants.EPAssignmentLevels.Level1_Site).Tables[0].ToList <EPAssignmentbySite>(); Level1Data.ForEach(z => z.SiteFullName = z.HCOID == 0 || z.HCOID == null ? z.SiteName + " " + z.SiteID.ToString() + " (SiteID) " : z.SiteName + " " + z.HCOID.ToString()); return(Level1Data); }
public List <EPAssignmentbyStandard> GetLevel3Data(SearchCorporateER search) { var Level3Data = new List <EPAssignmentbyStandard>(); Level3Data = GetDataSet(search, (int)WebConstants.EPAssignmentLevels.Level3_Standard).Tables[0].ToList <EPAssignmentbyStandard>(); return(Level3Data); }
public static List <CorpProgramFinding> GetCorpFindingByProgram(SearchCorporateER search, DateTime?standardEffBeginDate = null) { var result = new List <CorpProgramFinding>(); using (var dbmEditionEntityContainer = new DBMEdition01_Entities()) { result = dbmEditionEntityContainer.GetCorpFindingByProgram(search.SelectedSiteIDs, search.SelectedMockSurveyIDs, search.SelectedMockSurveyLeadIDs, search.SelectedMockSurveyMemberIDs, search.ProgramIDs, search.SelectedStandardIDs, search.SelectedChapterIDs, search.StartDate, search.EndDate, search.IncludeRFI, search.IncludeFsa, search.MockSurveyStatusID, standardEffBeginDate).ToList(); } return(result); }
public ActionResult CreateERSessionCriteria(SearchCorporateER ERsearch) { try { if (ERsearch.ProgramIDs == "-1") { ERsearch.ProgramIDs = null; } if (ERsearch.ProgramNames == "-1") { ERsearch.ProgramIDs = "All"; } if (ERsearch.ProgramNames == "-1") { ERsearch.ProgramIDs = "All"; } if (ERsearch.SelectedChapterIDs == "-1") { ERsearch.SelectedChapterIDs = null; } if (ERsearch.SelectedChapterNames == "-1") { ERsearch.SelectedChapterIDs = "All"; } if (ERsearch.SelectedStandardIDs == "-1") { ERsearch.SelectedStandardIDs = null; } if (ERsearch.SelectedStandardNames == "-1") { ERsearch.SelectedStandardNames = "All"; } Session["ERsearchcriteria"] = ERsearch; return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "PriorityRFIFinding", MethodName = "PriorityTjcRFICreateERSessionCriteria", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; exceptionService.LogException(exceptionLog); return(RedirectToAction("Error", "Transfer")); } }
public static List <CorpEPFinding> GetCorpFindingByEP(SearchCorporateER search, DateTime?standardEffBeginDate = null) { var result = new List <CorpEPFinding>(); using (var dbmEditionEntityContainer = new DBMEdition01_Entities()) { dbmEditionEntityContainer.Database.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["SPCmdTimeout"].ToString()); result = dbmEditionEntityContainer.GetCorpFindingByEP(search.SelectedSiteIDs, search.SelectedMockSurveyIDs, search.SelectedMockSurveyLeadIDs, search.SelectedMockSurveyMemberIDs, search.ProgramIDs, search.SelectedStandardIDs, search.SelectedChapterIDs, search.StartDate, search.EndDate, search.IncludeRFI, search.IncludeFsa, search.MockSurveyStatusID, standardEffBeginDate).ToList(); } return(result); }
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; // Session.Remove("ERsearchcriteria"); var corporateService = new JCR.Reports.Areas.Corporate.Services.CorporateReportService(); ERsearchcriteria.MockSurveyStatusID = (int)MockSurveyStatus.Publish_CCA_Recommendation; fileContents = corporateService.CorporateReportRDLC(ERsearchcriteria, (int)WebConstants.ReportFormat.PDF, SortBy, SortOrder); email.AttachmentLocation[0] = emailService.SavePDF(ExcelGridName, fileContents); email.FileContents = fileContents; email.ReportName = ERReportName; //int actionTypeId = 84; emailSuccess = emailService.SendExcelEmailAttachemnt(email, true, "FromCorporateEmailAddress"); if (emailSuccess) { emailMessage = WebConstants.Excel_Email_Success; } else { emailMessage = WebConstants.Email_Failed; } } catch (Exception ex) { emailMessage = WebConstants.Excel_Email_Failed; ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "CorporatePriorityFinding", MethodName = "AMPCorporateSummarySendERPDFEmail", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; exceptionService.LogException(exceptionLog); } finally { Session.Remove("ERsearchcriteria"); } return(Json(emailMessage)); }
public static List <SaferMatrixSummaryBySite> GetSaferMatrixSummaryBySite(SearchCorporateER search) { var result = new List <SaferMatrixSummaryBySite>(); using (var dbmDbEntityContainer = new DBMEdition01_Entities()) { result = dbmDbEntityContainer.GetSaferMatrixSummaryBySite(search.SelectedSiteIDs, search.ProgramIDs, search.SelectedStandardIDs, search.SelectedChapterIDs, search.SelectedEPIDs, int.Parse(search.ScoreType), search.StartDate, search.EndDate, search.MatrixID, search.IncludeFsa, search.MockSurveyStatusID, AppSession.CycleID).ToList(); } return(result); }
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); }
public static List <RFIEPFindingViewModel> GetCorpFindingByEP(SearchCorporateER search) { var result = new List <RFIEPFindingViewModel>(); //Added by Subramaniam R on 05 Oct 2016 for calling from DBMEdition entity. using (var DBMEdition01_Entities = new DBMEdition01_Entities()) { try { result = DBMEdition01_Entities.GetRFIFindingByEP(search.SelectedSiteIDs, search.ProgramIDs, search.SelectedStandardIDs, search.SelectedChapterIDs, search.StartDate, search.EndDate, search.IncludeFsa, search.IncludeRFI, search.IncludePre, search.IncludeFin) .ToList() .ConvertAll(x => new RFIEPFindingViewModel() { HCO_ID = x.HCO_ID, Program = x.Program, State = x.State, HospitalName = x.HospitalName, Chapter = x.Chapter, Standard = x.Standard, EP = x.EP, //Documentation = x.Documentation, TJCScore = x.TJCScore, TJCSAFERScoreLikelihood = x.TJCSAFERScoreLikelihood, TJCSAFERScoreScope = x.TJCSAFERScoreScope, TJCScoreDate = x.TJCScoreDate, PreliminaryScore = x.PreliminaryScore, PreliminarySAFERScoreLikelihood = x.PreliminarySAFERScoreLikelihood, PreliminarySAFERScoreScope = x.PreliminarySAFERScoreScope, PreliminaryScoreDate = x.PreliminaryScoreDate, FinalScore = x.FinalScore, FinalSAFERScoreLikelihood = x.FinalSAFERScoreLikelihood, FinalSAFERScoreScope = x.FinalSAFERScoreScope, FinalScoreDate = x.FinalScoreDate, TJCFinding = x.TJCFinding, PlanOfAction = x.PlanOfAction, SustainmentPlan = x.SustainmentPlan }).ToList(); return(result); } catch (Exception e) { string x = e.ToString(); } } return(result); }
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; Session.Remove("ERsearchcriteria"); var corporateService = new JCR.Reports.Areas.Corporate.Services.CorporateReportService(); ERsearchcriteria.MockSurveyStatusID = (int)MockSurveyStatus.Publish_CCA_Recommendation; fileContents = corporateService.CorporateReportRDLC(ERsearchcriteria, (int)WebConstants.ReportFormat.PDF, SortBy, SortOrder); if (fileContents != null) { createErPdf = "success"; } else { createErPdf = "failed"; } fileGuid = emailService.SavePDF(ExcelGridName, fileContents); } catch (Exception ex) { createErPdf = "failed"; ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "CorporatePriorityFinding", MethodName = "AMPCorporateSummarycreateErPdf", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; exceptionService.LogException(exceptionLog); } finally { Session.Remove("ERsearchcriteria"); } return(Json(new { exportCreated = createErPdf, fileGuid = fileGuid })); }
public static List <RFIEPFinding> GetRfiEPDetails(SearchCorporateER search) { var result = new List <RFIEPFinding>(); using (var DBMEdition01_Entities = new DBMEdition01_Entities()) { try { result = DBMEdition01_Entities.GetRFIFindingByEP(search.SelectedSiteIDs, search.ProgramIDs, search.SelectedStandardIDs, search.SelectedChapterIDs, search.StartDate, search.EndDate, search.IncludeFsa, search.IncludeRFI, search.IncludePre, search.IncludeFin).ToList(); return(result); } catch (Exception e) { string x = e.ToString(); } } return(result); }
public static List <RFIStandardFinding> GetRFIFindingByStandard(SearchCorporateER search) { var result = new List <RFIStandardFinding>(); //Added by Subramaniam R on 28th sep 2016 for calling from DBMEdition entity. using (var DBMEdition01_Entities = new DBMEdition01_Entities()) { try { result = DBMEdition01_Entities.GetRFIFindingByStandard(search.SelectedSiteIDs, search.ProgramIDs, search.SelectedStandardIDs, search.SelectedChapterIDs, search.StartDate, search.EndDate, search.IncludeFsa, search.IncludeRFI, search.IncludePre, search.IncludeFin).ToList(); } catch (Exception ex) { throw ex; } return(result); } }
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)); }
public byte[] SaferReportRDLC(SearchCorporateER search, int reportType, string SortBy = "", string SortOrder = "") { byte[] fileContents = null; string reportDateTitle = ""; string rdlcName = String.Empty; string dsName = String.Empty; string reportSubTitle = String.Empty; string stdDetail = string.Empty; string findingDetails = string.Empty; DataView dv = null; ReportParameterCollection reportParameterCollection = null; try { if (AppSession.ReportScheduleID > 0 && !string.IsNullOrEmpty(search.ReportTitle)) { search.ReportTitle = String.Concat(search.ReportTitle, " - Report ID: ", AppSession.ReportScheduleID); } else { search.ReportTitle = "Safer Matrix Report"; } reportDateTitle = CommonService.InitializeReportDateTitle("Score", search.StartDate, search.EndDate); search.EndDate = (search.EndDate != null && search.EndDate.ToString() != "") ? search.EndDate.Value.Date.AddHours(23).AddMinutes(29).AddSeconds(59) : search.EndDate; // Setup ReportViewer ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.SizeToReportContent = true; reportViewer.LocalReport.DisplayName = search.ReportTitle; var scope = string.Empty; var like = string.Empty; // LevelIdentifier references the specific RDLC report requested switch (search.LevelIdentifier) { case (int)WebConstants.SaferMatrixLevels.Level1_Program: default: { rdlcName = "rptCorporate_Findings.rdlc"; dsName = "dsSafer"; dv = new DataView(SaferMatrix.GetSaferMatrixRDLC(search).ToDataTable()); reportSubTitle = "Safer Findings by Program"; break; } case (int)WebConstants.SaferMatrixLevels.Level2_Site: { scope = GetScope(search.MatrixID); like = GetLikelihood(search.MatrixID); rdlcName = "rptSaferMatrix_BySite.rdlc"; dsName = "dsSaferMatrixBySite"; dv = new DataView(SaferMatrix.GetSaferMatrixSummaryBySite(search).ToDataTable()); reportSubTitle = "Safer Findings by Site"; break; } case (int)WebConstants.SaferMatrixLevels.Level3_Chapter: { scope = GetScope(search.MatrixID); like = GetLikelihood(search.MatrixID); rdlcName = "rptSaferMatrix_ByChapter.rdlc"; dsName = "dsSaferMatrixByChapter"; dv = new DataView(SaferMatrix.GetSaferMatrixSummaryByChapter(search).ToDataTable()); reportSubTitle = "Safer Findings by Chapter"; break; } } bool isFalse = false; var showSaferMatrix = search.ScoreType == "4" ? true : false; var scoreType = string.Empty; //Score switch (search.ScoreType.ToString()) { case "1": scoreType = "Individual"; break; case "2": scoreType = "Preliminary"; break; case "3": scoreType = "Final"; break; case "4": scoreType = "Mock Survey"; break; } // Setup Report Parmaeters common to all reports ReportParameter p1 = new ReportParameter("ReportTitle", search.ReportTitle.ToString()); ReportParameter p2 = new ReportParameter("ReportProductName", string.Empty); ReportParameter p3 = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Copyright.ToString()); ReportParameter p4 = new ReportParameter("ProgramName", search.ProgramNames.ToString()); ReportParameter p5 = new ReportParameter("SiteName", string.Empty); ReportParameter p6 = new ReportParameter("SiteAddress", string.Empty); ReportParameter p7 = new ReportParameter("HCOID", search.SelectedSiteHCOIDs.ToString()); ReportParameter p8 = new ReportParameter("GreaterThanLimit", isFalse.ToString()); ReportParameter p9 = new ReportParameter("showSaferMatrix", showSaferMatrix.ToString()); ReportParameter p10 = new ReportParameter("Chapters", search.SelectedChapterNames.ToString()); ReportParameter p11 = new ReportParameter("Standards", search.SelectedStandardNames.ToString()); ReportParameter p12 = new ReportParameter("EPs", search.SelectedEPLabels.ToString()); ReportParameter p13 = new ReportParameter("IsDraft", isFalse.ToString()); ReportParameter p14 = new ReportParameter("ReportDateTitle", reportDateTitle.ToString()); ReportParameter p15 = new ReportParameter("ReportType", search.ReportType.ToString()); ReportParameter p16 = new ReportParameter("FSA", search.IncludeFsa ? "1" : "0"); ReportParameter p17 = new ReportParameter("ScoreType", scoreType); if (search.LevelIdentifier == 2 || search.LevelIdentifier == 3) { ReportParameter p18 = new ReportParameter("Scope", scope); ReportParameter p19 = new ReportParameter("Like", like); reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19 }; } else { reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17 } }; if (SortBy != "") { dv.Sort = SortBy + " " + SortOrder; } // Setup Data sources for report reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.ReportPath = HttpContext.Current.Request.MapPath(HttpContext.Current.Request.ApplicationPath) + @"Areas\Corporate\Reports\" + rdlcName.ToString(); reportViewer.LocalReport.DataSources.Add(new ReportDataSource(dsName, dv)); reportViewer.LocalReport.SetParameters(reportParameterCollection); Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; string format = WebConstants.REPORT_FORMAT_PDF; fileContents = reportViewer.LocalReport.Render(format, null, out mimeType, out encoding, out extension, out streamIds, out warnings); } catch (Exception ex) { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "SaferMatrixService", MethodName = "SaferMatrixRDLC", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; _exceptionService.LogException(exceptionLog); } return(fileContents); }
public byte[] RFIReportRDLC(SearchCorporateER search, int reportType, string SortBy = "", string SortOrder = "") { byte[] fileContents = null; string reportDateTitle = ""; string rdlcName = String.Empty; string dsName = String.Empty; string reportSubTitle = String.Empty; string stdDetail = string.Empty; string findingDetails = string.Empty; DataView dv = null; ReportParameterCollection reportParameterCollection = null; try { if (AppSession.ReportScheduleID > 0 && search.ReportTitle != null) { search.ReportTitle = String.Concat(search.ReportTitle, " - Report ID: ", AppSession.ReportScheduleID); } else { search.ReportTitle = "Priority Findings RFI Report"; } reportDateTitle = CommonService.InitializeReportDateTitle("Observation", search.StartDate, search.EndDate); search.EndDate = (search.EndDate != null && search.EndDate.ToString() != "") ? search.EndDate.Value.Date.AddHours(23).AddMinutes(29).AddSeconds(59) : search.EndDate; // Setup ReportViewer ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.SizeToReportContent = true; reportViewer.LocalReport.DisplayName = search.ReportTitle; int maxRowCount = 0; // LevelIdentifier references the specific RDLC report requested switch (search.LevelIdentifier) { case (int)WebConstants.CorporateSummaryLevels.Level1_Program: default: { rdlcName = "rptReportRFIFindingsByProgram.rdlc"; dsName = "dsReport_RFIFindingsbyProgram"; var result = TJCRFIFinding.GetRFIFindingByProgram(search); maxRowCount = (from l in result group l by new { l.ProgramID } into g select new { totalCount = g.Sum(a => a.PSCount + a.RFICount + a.FSCount) }).Max(a => a.totalCount); dv = new DataView(result.ToDataTable()); reportSubTitle = "Findings by Program"; //stdDetail = "*This graph represents 100% of the total findings for selected sites and criteria."; stdDetail = " "; break; } case (int)WebConstants.CorporateSummaryLevels.Level2_Chapter: { rdlcName = "rptReportRFIFindingsPareto.rdlc"; dsName = "dsReport_RFIFindingsPareto"; var result = TJCRFIFinding.GetRFIFindingByChapter(search); maxRowCount = (from l in result group l by new { l.ChapterID } into g select new { totalCount = g.Sum(a => a.PSCount + a.RFICount + a.FSCount) }).Max(a => a.totalCount); dv = new DataView(result.ToDataTable()); reportSubTitle = "Findings by Chapter"; // stdDetail = "*This graph represents 100% of the total findings for selected sites and criteria."; stdDetail = " "; break; } case (int)WebConstants.CorporateSummaryLevels.Level3_Standard: { rdlcName = "rptReportRFIFindingsPareto.rdlc"; dsName = "dsReport_RFIFindingsPareto"; var result = TJCRFIFinding.GetRFIFindingByStandard(search); maxRowCount = (from l in result group l by new { l.StandardID } into g select new { totalCount = g.Sum(a => a.PSCount + a.RFICount + a.FSCount) }).Max(a => a.totalCount); dv = new DataView(result.ToDataTable()); reportSubTitle = "Findings by Standard"; stdDetail = "*This graph represents " + HttpContext.Current.Session["MaxStandardCount"] + "% of the total findings for selected sites and criteria."; break; } } // Setup Report Parmaeters common to all reports ReportParameter p1 = new ReportParameter("ReportTitle", search.ReportTitle.ToString()); ReportParameter p2 = new ReportParameter("Programs", search.ProgramNames.ToString()); ReportParameter p3 = new ReportParameter("Chapters", search.SelectedChapterNames.ToString()); ReportParameter p4 = new ReportParameter("Standards", search.SelectedStandardNames.ToString()); ReportParameter p5 = new ReportParameter("ReportDateTitle", reportDateTitle.ToString()); ReportParameter p6 = new ReportParameter("HCOID", search.SelectedSiteHCOIDs.ToString()); ReportParameter p7 = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Copyright.ToString()); ReportParameter p8 = new ReportParameter("ReportType", search.ReportType.ToString()); ReportParameter p9 = new ReportParameter("ReportSubTitle", reportSubTitle.ToString()); ReportParameter p10 = new ReportParameter("FSA", search.IncludeFsa ? "1" : "0"); ReportParameter p11 = new ReportParameter("RFI", search.IncludeRFI ? "1" : "0"); ReportParameter p12 = new ReportParameter("PreScore", search.IncludePre ? "1" : "0"); ReportParameter p13 = new ReportParameter("FinScore", search.IncludeFin ? "1" : "0"); if (search.LevelIdentifier != (int)WebConstants.CorporateSummaryLevels.Level1_Program) { ReportParameter p14 = new ReportParameter("StandardDetail", stdDetail); // reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15 }; reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14 }; } else { //reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14 }; reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 } }; reportParameterCollection.Add(new ReportParameter("MaxRowCount", maxRowCount.ToString())); if (SortBy != "") { dv.Sort = SortBy + " " + SortOrder; } // Setup Data sources for report reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.ReportPath = HttpContext.Current.Request.MapPath(HttpContext.Current.Request.ApplicationPath) + @"Areas\Corporate\Reports\" + rdlcName.ToString(); reportViewer.LocalReport.DataSources.Add(new ReportDataSource(dsName, dv)); reportViewer.LocalReport.SetParameters(reportParameterCollection); Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; string format = WebConstants.REPORT_FORMAT_PDF; // PDF is default if (reportType == (int)WebConstants.ReportFormat.EXCEL) { format = WebConstants.REPORT_FORMAT_EXCEL; // If Excel option chosen } fileContents = reportViewer.LocalReport.Render(format, null, out mimeType, out encoding, out extension, out streamIds, out warnings); } catch (Exception ex) { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "RFIReportRDLC", MethodName = "RFIReportRDLC", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; _exceptionService.LogException(exceptionLog); } return(fileContents); }
public ActionResult CreateERSessionCriteria(SearchCorporateER ERsearch) { try { //Mock Survey Status Parameter. Corporate Reports displays data after Mock Survey Recommendations are approved. ERsearch.MockSurveyStatusID = (int)MockSurveyStatus.Publish_CCA_Recommendation; //if (ERsearch.ProgramIDs == "-1") ERsearch.ProgramIDs = null; if (ERsearch.ProgramNames == "-1" || ERsearch.ProgramNames == null) { ERsearch.ProgramNames = "All"; } if (ERsearch.SelectedChapterIDs == "-1") { ERsearch.SelectedChapterIDs = null; } if (ERsearch.SelectedChapterNames == "-1" || ERsearch.SelectedChapterNames == null) { ERsearch.SelectedChapterNames = "All"; } if (ERsearch.SelectedStandardIDs == "-1") { ERsearch.SelectedStandardIDs = null; } if (ERsearch.SelectedStandardNames == "-1" || ERsearch.SelectedStandardNames == null) { ERsearch.SelectedStandardNames = "All"; } if (ERsearch.SelectedEPIDs == "-1") { ERsearch.SelectedEPIDs = null; } if (ERsearch.SelectedEPLabels == "-1" || ERsearch.SelectedEPLabels == null) { ERsearch.SelectedEPLabels = "All"; } if (ERsearch.MatrixID < 1000) { ERsearch.MatrixID = 0; } Session["ERsearchcriteria"] = ERsearch; return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "SaferMatrix", MethodName = "CreateERSessionCriteria", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; exceptionService.LogException(exceptionLog); return(RedirectToAction("Error", "Transfer")); } }
public byte[] EPAssignmentRDLC(SearchCorporateER search, int reportType, string SortBy = "", string SortOrder = "") { byte[] fileContents = null; string rdlcName = String.Empty; string dsName = String.Empty; DataView dv = null; ReportParameterCollection reportParameterCollection = null; try { if (AppSession.ReportScheduleID > 0) { search.ReportTitle = String.Concat(search.ReportTitle, " - Report ID: ", AppSession.ReportScheduleID); } // Setup ReportViewer ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.SizeToReportContent = true; reportViewer.LocalReport.DisplayName = search.ReportTitle; switch (search.LevelIdentifier) { case (int)WebConstants.EPAssignmentLevels.Level1_Site: default: { rdlcName = "rptEPAssignment_BySite.rdlc"; dsName = "dsReport_EPAssignment_BySite"; dv = new DataView(GetDataSet(search, (int)WebConstants.EPAssignmentLevels.Level1_Site).Tables[0]); break; } case (int)WebConstants.EPAssignmentLevels.Level2_Chapter: { rdlcName = "rptEPAssignment_ByChapter.rdlc"; dsName = "dsReport_EPAssignment_ByChapter"; dv = new DataView(GetDataSet(search, (int)WebConstants.EPAssignmentLevels.Level2_Chapter).Tables[0]); break; } case (int)WebConstants.EPAssignmentLevels.Level3_Standard: { rdlcName = "rptEPAssignment_ByStandard.rdlc"; dsName = "dsReport_EPAssignment_ByStandard"; dv = new DataView(GetDataSet(search, (int)WebConstants.EPAssignmentLevels.Level3_Standard).Tables[0]); break; } } ReportParameter p1 = new ReportParameter("ReportTitle", search.ReportTitle.ToString()); ReportParameter p2 = new ReportParameter("Programs", search.ProgramNames.ToString()); ReportParameter p3 = new ReportParameter("Chapters", search.SelectedChapterNames.ToString()); ReportParameter p4 = new ReportParameter("HCOID", search.SelectedSiteHCOIDs.ToString()); ReportParameter p5 = new ReportParameter("Standards", search.SelectedStandardNames.ToString()); ReportParameter p6 = new ReportParameter("AssignedTo", search.SelectedAssignedToNames.ToString()); ReportParameter p7 = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Copyright.ToString()); ReportParameter p8 = new ReportParameter("ScoreType", search.ScoreType.ToString()); ReportParameter p9 = new ReportParameter("ReportSubTitle", "Assignment Status by User"); ReportParameter p10 = new ReportParameter("ReportType", search.ReportType.ToString()); ReportParameter p11 = new ReportParameter("AssignedBy", search.SelectedAssignedByNames.ToString()); reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 }; if (SortBy != "") { dv.Sort = SortBy + " " + SortOrder; } // Setup Data sources for report reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.ReportPath = HttpContext.Current.Request.MapPath(HttpContext.Current.Request.ApplicationPath) + @"Areas\Corporate\Reports\" + rdlcName.ToString(); reportViewer.LocalReport.DataSources.Add(new ReportDataSource(dsName, dv)); reportViewer.LocalReport.SetParameters(reportParameterCollection); Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; string format = WebConstants.REPORT_FORMAT_PDF; // PDF is default if (reportType == (int)WebConstants.ReportFormat.EXCEL) { format = WebConstants.REPORT_FORMAT_EXCEL; // If Excel option chosen } fileContents = reportViewer.LocalReport.Render(format, null, out mimeType, out encoding, out extension, out streamIds, out warnings); } catch (Exception ex) { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "EPAssignmentRDLC", MethodName = "EPAssignmentRDLC", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; _exceptionService.LogException(exceptionLog); } return(fileContents); }
private DataSet GetDataSet(SearchCorporateER search, int LevelIdentifier) { DataSet ds = new DataSet(); try { string sp_name = "amp.usmReport_EPAssignment_BySite"; switch (LevelIdentifier) { case (int)WebConstants.EPAssignmentLevels.Level1_Site: { sp_name = "amp.usmReport_EPAssignment_BySite"; break; } case (int)WebConstants.EPAssignmentLevels.Level2_Chapter: { sp_name = "amp.usmReport_EPAssignment_ByChapter"; break; } case (int)WebConstants.EPAssignmentLevels.Level3_Standard: { sp_name = "amp.usmReport_EPAssignment_ByStandard"; break; } case (int)WebConstants.EPAssignmentLevels.Level4_EP: { sp_name = "amp.usmReport_EPAssignment_Details"; break; } } int _epUserRoleID = GetEPUserRoleID(search.ScoreType); using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { cn.Open(); SqlCommand cmd = new SqlCommand(sp_name, cn); cmd.CommandTimeout = 900; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("SiteIDs", search.SelectedSiteIDs); cmd.Parameters.AddWithValue("JCRProgramID", Convert.ToInt32(search.ProgramIDs)); cmd.Parameters.AddWithValue("ChapterIDs", search.SelectedChapterIDs == "-1" ? "" : search.SelectedChapterIDs); cmd.Parameters.AddWithValue("StandardIDs", search.SelectedStandardIDs == "-1" ? "" : search.SelectedStandardIDs); cmd.Parameters.AddWithValue("ScoreType", _epUserRoleID); cmd.Parameters.AddWithValue("AssignedToIDs", search.SelectedAssignedToIDs == "-1" ? "" : search.SelectedAssignedToIDs); cmd.Parameters.AddWithValue("AssignedByIDs", search.SelectedAssignedByIDs == "-1" ? "" : search.SelectedAssignedByIDs); cmd.Parameters.AddWithValue("docRequired", search.docRequired ? 1 : 0); cmd.Parameters.AddWithValue("FSA", search.IncludeFsa ? 1 : 0); cmd.Parameters.AddWithValue("NewChangedEps", search.NewChangedEps ? 1 : 0); #if DEBUG CreateSQLExecuted(sp_name, cmd); System.Diagnostics.Debug.WriteLine(_SQLExecuted); #endif SqlDataAdapter da = new SqlDataAdapter(cmd); using (cn) using (cmd) using (da) { da.Fill(ds); } } } catch (Exception ex) { ex.Data.Add(TSQL, _SQLExecuted); throw ex; } return(ds); }
public ActionResult SaferReport_Data(SearchCorporateER search, int LevelIdentifier, int LevelTypeIdentifier) { try { //Mock Survey Status Parameter. Corporate Reports displays data after Mock Survey Recommendations are approved. search.MockSurveyStatusID = (int)MockSurveyStatus.Publish_CCA_Recommendation; JsonResult jr = new JsonResult(); if (search.ProgramIDs == "-1") { search.ProgramIDs = "2"; } if (search.SelectedChapterIDs == "-1") { search.SelectedChapterIDs = null; } if (search.SelectedStandardIDs == "-1") { search.SelectedStandardIDs = null; } if (search.SelectedEPIDs == "-1") { search.SelectedEPIDs = null; } if (search.MatrixID < 1000) { search.MatrixID = 0; } search.EndDate = (search.EndDate != null && search.EndDate.ToString() != "") ? search.EndDate.Value.Date.AddHours(23).AddMinutes(29).AddSeconds(59) : search.EndDate; string encryptionKey = ConfigurationManager.AppSettings.Get("EncryptionKey"); switch (LevelIdentifier) { case (int)WebConstants.SaferMatrixLevels.Level1_Program: { switch (LevelTypeIdentifier) { case (int)WebConstants.LevelTypeIdentifier.Graph: var levelGraph = SaferMatrix.GetSaferMatrix(search); if (levelGraph == null) { Response.StatusCode = (int)HttpStatusCode.BadRequest; } jr = Json(levelGraph, JsonRequestBehavior.AllowGet); break; case (int)WebConstants.LevelTypeIdentifier.Summary: var levelSummary = SaferMatrix.GetSaferMatrixSummary(search); jr = Json(levelSummary, JsonRequestBehavior.AllowGet); break; case (int)WebConstants.LevelTypeIdentifier.Detail: var levelDetail = SaferMatrix.GetSaferMatrixData(search); jr = Json(levelDetail, JsonRequestBehavior.AllowGet); break; } break; } case (int)WebConstants.SaferMatrixLevels.Level2_Site: { switch (LevelTypeIdentifier) { case (int)WebConstants.LevelTypeIdentifier.Graph: case (int)WebConstants.LevelTypeIdentifier.Summary: var levelChartSummary = SaferMatrix.GetSaferMatrixSummaryBySite(search); jr = Json(levelChartSummary, JsonRequestBehavior.AllowGet); break; case (int)WebConstants.LevelTypeIdentifier.Detail: var levelData = SaferMatrix.GetSaferMatrixData(search); jr = Json(levelData, JsonRequestBehavior.AllowGet); break; } break; } case (int)WebConstants.SaferMatrixLevels.Level3_Chapter: { switch (LevelTypeIdentifier) { case (int)WebConstants.LevelTypeIdentifier.Graph: case (int)WebConstants.LevelTypeIdentifier.Summary: var levelGraphSummary = SaferMatrix.GetSaferMatrixSummaryByChapter(search); jr = Json(levelGraphSummary, JsonRequestBehavior.AllowGet); break; case (int)WebConstants.LevelTypeIdentifier.Detail: var levelData = SaferMatrix.GetSaferMatrixData(search); jr = Json(levelData, JsonRequestBehavior.AllowGet); break; } break; } case (int)WebConstants.SaferMatrixLevels.Level4_EP: { var levelData = new List <SaferMatrixData>(); levelData = SaferMatrix.GetSaferMatrixData(search); jr = Json(levelData, JsonRequestBehavior.AllowGet); break; } } jr.MaxJsonLength = Int32.MaxValue; jr.RecursionLimit = 100; return(jr); } catch (Exception ex) { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "SaferMatrix", MethodName = "AMPCorporateSummarySaferMatrix_Data", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; exceptionService.LogException(exceptionLog); return(RedirectToAction("Error", "Transfer")); } }
public ActionResult RFIReport_Data(SearchCorporateER search, int LevelIdentifier) { try { JsonResult jr = new JsonResult(); if (search.ProgramIDs == "-1") { search.ProgramIDs = null; } if (search.SelectedChapterIDs == "-1") { search.SelectedChapterIDs = null; } if (search.SelectedStandardIDs == "-1") { search.SelectedStandardIDs = null; } string JCREmailDomain = "@JCRINC.COM"; string JCREmailDomain2 = "@JCAHO.COM"; string encryptionKey = ConfigurationManager.AppSettings.Get("EncryptionKey"); switch (LevelIdentifier) { case (int)WebConstants.RFISummaryLevels.Level1_Program: { List <RFIProgramFinding> Level1Data = new List <RFIProgramFinding>(); Level1Data = TJCRFIFinding.GetRFIFindingByProgram(search); jr = Json(Level1Data, JsonRequestBehavior.AllowGet); break; } case (int)WebConstants.RFISummaryLevels.Level2_Chapter: { if (search.IsDuplicateLoadCall) { jr = TempData["PTR_Level2Data"] as JsonResult; } else { List <RFIChapterFinding> Level2Data = new List <RFIChapterFinding>(); Level2Data = TJCRFIFinding.GetRFIFindingByChapter(search); jr = Json(Level2Data, JsonRequestBehavior.AllowGet); TempData["PTR_Level2Data"] = jr; } break; } case (int)WebConstants.RFISummaryLevels.Level3_Standard: { if (search.IsDuplicateLoadCall) { jr = TempData["PTR_Level3Data"] as JsonResult; } else { List <RFIStandardFinding> Level3Data = new List <RFIStandardFinding>(); Level3Data = TJCRFIFinding.GetRFIFindingByStandard(search); var max = Convert.ToInt32(Level3Data.Max(r => r.CumulativePerc)); Session["MaxStandardCount"] = max >= 100 ? 100 : max; jr = Json(Level3Data, JsonRequestBehavior.AllowGet); TempData["PTR_Level3Data"] = jr; } break; } case (int)WebConstants.RFISummaryLevels.Level4_EP: { string tjcFinding = string.Empty; List <RFIEPFinding> Level4Data = new List <RFIEPFinding>(); Level4Data = TJCRFIFinding.GetRfiEPDetails(search); if (!AppSession.EmailAddress.ToUpper().Contains(JCREmailDomain) && !AppSession.EmailAddress.ToUpper().Contains(JCREmailDomain2)) { Level4Data.ToList().ForEach(data => { data.TJCFinding = CryptHelpers.RFIDecrypt(data.TJCFinding, encryptionKey); }); } else { Level4Data.ToList().ForEach(data => data.TJCFinding = string.Empty); } jr = Json(Level4Data, JsonRequestBehavior.AllowGet); break; } case (int)WebConstants.RFISummaryLevels.Level5_EPDetails: { List <RFIStandardFinding> Level5Data = new List <RFIStandardFinding>(); Level5Data = TJCRFIFinding.GetRFIFindingByStandard(search); jr = Json(Level5Data, JsonRequestBehavior.AllowGet); break; } } jr.MaxJsonLength = Int32.MaxValue; jr.RecursionLimit = 100; return(jr); } catch (Exception ex) { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "TjcRFIFinding", MethodName = "RFIReport_Data", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; exceptionService.LogException(exceptionLog); return(RedirectToAction("Error", "Transfer")); } }
public ActionResult CreateERSessionCriteria(SearchCorporateER ERsearch) { Session["ERsearchcriteria"] = ERsearch; return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); }