public ActionResult _GetEPScoringExcelData(SearchEPScoringParams search) { try { if (String.IsNullOrEmpty(search.ScoreValueList)) { search.ScoreValueList = ""; } JsonResult jr = new JsonResult(); List <EpExcelDetails> EpExcelData = new List <EpExcelDetails>(); EpExcelData = EPScoringReport.GetEPExcelDetails(search); jr = Json(EpExcelData, JsonRequestBehavior.AllowGet); jr.MaxJsonLength = Int32.MaxValue; jr.RecursionLimit = 100; return(jr); } catch (Exception ex) { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "EP Scoring Report", MethodName = "_GetEPScoringExcelData", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; exceptionService.LogException(exceptionLog); return(RedirectToAction("Error", "Transfer")); } }
public PartialViewResult _GetEPScoringDetailData(SearchEPScoringParams search, Email emailInput) { ReportViewer reportViewer = new ReportViewer(); try { if (String.IsNullOrEmpty(search.ScoreValueList)) { search.ScoreValueList = ""; } var findingsService = new EPScoringService(); if (emailInput.To != null) { ViewBag.FromEmail = true; ViewBag.FromEmailSuccess = WebConstants.Email_Success; } reportViewer = findingsService.EPScoringDetailRDLC(search, emailInput); if (Session["EmailSuccess"] != null) { if (Session["EmailSuccess"].ToString() == "false") { ViewBag.FromEmailSuccess = WebConstants.Email_Failed; } } } catch (Exception ex) { if (ex.Message.ToString() != "Email") { if (ex.Message.ToString() == "No Data") { ModelState.AddModelError("Error", WebConstants.NO_DATA_FOUND_RDLC_VIEW_TSR); } else { ViewBag.DataLimit = true; 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); } } finally { if (Session["EmailSuccess"] != null) { Session.Remove("EmailSuccess"); } } Session["MyReportViewer"] = reportViewer; return(PartialView("_ReportViewer")); }
public PartialViewResult _GetEPScoringSummaryData(SearchEPScoringParams search, Email emailInput) { ReportViewer reportViewer = new ReportViewer(); try { if (String.IsNullOrEmpty(search.ScoreValueList)) { search.ScoreValueList = ""; } var findingsService = new EPScoringService(); if (emailInput.To != null) { ViewBag.FromEmail = true; ViewBag.FromEmailSuccess = WebConstants.Email_Success; } reportViewer = findingsService.EPScoringSummaryRDLC(search, emailInput); if (Session["EmailSuccess"] != null) { if (Session["EmailSuccess"].ToString() == "false") { ViewBag.FromEmailSuccess = WebConstants.Email_Failed; } } } catch (Exception ex) { if (ex.Message.ToString() != "Email") { if (ex.Message.ToString() == "No Data") { ModelState.AddModelError("Error", WebConstants.NO_DATA_FOUND_RDLC_VIEW_TSR); } } else { ViewBag.FromEmail = true; ModelState.AddModelError("Error", WebConstants.Email_Failed); } } finally { if (Session["EmailSuccess"] != null) { Session.Remove("EmailSuccess"); } } Session["MyReportViewer"] = reportViewer; return(PartialView("_ReportViewer")); }
public static List <EpExcelDetails> GetEPExcelDetails(SearchEPScoringParams search) { var result = new List <EpExcelDetails>(); using (var DBMEdition01_Entities = new DBMEdition01_Entities()) { DBMEdition01_Entities.Database.CommandTimeout = 6000; try { string ChapterList = string.Empty; string StandardList = string.Empty; string ScoredByList = string.Empty; ChapterList = (search.ChapterAll == 1) ? null : search.ChapterList; StandardList = (search.StandardAll == 1) ? null : search.StandardList; ScoredByList = (search.ScoredByAll == 1) ? null : search.ScoredByList; result = DBMEdition01_Entities.GetEPExcelDetails(search.SiteID, search.ProgramID, ChapterList, StandardList, search.ScoreTypeList, search.ScoreValueList, ScoredByList, search.NotScoredInPeriod, search.FSA, search.DocRequiredValue, search.NewChangedEPs, search.PlanOfAction, search.OrgFindings, search.OrgNotes, search.LinkedDocs, search.DateStart, search.DateEnd, search.StandardEffBeginDate, search.CertificationID, search.chkIncludeCMS).ToList() .ConvertAll(x => new EpExcelDetails() { HCOID = x.HCOID, SiteName = x.SiteName, StandardLabel = x.StandardLabel, EPLabel = x.EPLabel, EPText = x.EPText, EPTextID = x.EPTextID, ScoreTypeName = x.ScoreTypeName, ScoreName = x.ScoreName, Likelihood = x.Likelihood, Scope = x.Scope, ScoreDate = x.ScoreDate, FullName = x.FullName, Findings = x.Findings, OrgNotes = x.OrgNotes, POA = x.POA, DocumentList = x.DocumentList, CompliantDate = x.CompliantDate, MOS = x.MOS, FSA = x.FSA, dcm_fl = x.dcm_fl, esp1_fl = x.esp1_fl, NewEP = x.NewEP, TagCode = x.TagCode, CopText = x.CopText, ProgramCode = x.ProgramCode, ProgramName = x.ProgramName, ChapterName = x.ChapterName, SiteID = x.SiteID }).ToList(); } catch (Exception e) { string x = e.ToString(); } } return(result); }
private DataSet GetReportDataForDetailView(SearchEPScoringParams searchParams) { DataSet ds = new DataSet(); try { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { cn.Open(); SqlCommand cmd = new SqlCommand("amp.usmReportEPScoringDetail", cn); cmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["SPCmdTimeout"].ToString()); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("SiteID", searchParams.SiteID); cmd.Parameters.AddWithValue("ProgramID", searchParams.ProgramID); if (searchParams.ChapterList == "-1") { cmd.Parameters.AddWithValue("ChapterList", null); } else { cmd.Parameters.AddWithValue("ChapterList", searchParams.ChapterList); } if (searchParams.StandardList == "-1") { cmd.Parameters.AddWithValue("StandardList", null); } else { cmd.Parameters.AddWithValue("StandardList", searchParams.StandardList); } cmd.Parameters.AddWithValue("ScoreTypeList", searchParams.ScoreTypeList); cmd.Parameters.AddWithValue("ScoreValueList", searchParams.ScoreValueList); if (searchParams.ScoredByList == "-1") { cmd.Parameters.AddWithValue("ScoredByList", null); } else { cmd.Parameters.AddWithValue("ScoredByList", searchParams.ScoredByList); } cmd.Parameters.AddWithValue("NotScoredInPeriodFlag", searchParams.NotScoredInPeriod); cmd.Parameters.AddWithValue("IncludeFSA", searchParams.FSA); cmd.Parameters.AddWithValue("DocRequired", searchParams.DocRequiredValue); cmd.Parameters.AddWithValue("NewChangedEPs", searchParams.NewChangedEPs); cmd.Parameters.AddWithValue("PlanOfAction", searchParams.PlanOfAction); cmd.Parameters.AddWithValue("OrgFindings", searchParams.OrgFindings); cmd.Parameters.AddWithValue("OrgNotes", searchParams.OrgNotes); cmd.Parameters.AddWithValue("LinkedDocs", searchParams.LinkedDocs); cmd.Parameters.AddWithValue("DateStart", searchParams.DateStart); cmd.Parameters.AddWithValue("DateEnd", searchParams.DateEnd); cmd.Parameters.AddWithValue("StandardEffBeginDate", null); cmd.Parameters.AddWithValue("CertificationItemID", null); cmd.Parameters.AddWithValue("IncludeCMS", searchParams.chkIncludeCMS); SqlDataAdapter da = new SqlDataAdapter(cmd); using (cn) using (cmd) using (da) { da.Fill(ds); } } } catch (Exception ex) { ex.Data.Add(TSQL, _SQLExecuted); throw ex; } int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount == 0) { throw (new Exception("No Data")); } return(ds); }
public ReportViewer EPScoringDetailRDLC(SearchEPScoringParams searchParams, Email emailInput) { DateTime?startDate = null; DateTime?endDate = null; string reportDate = "All Dates"; SearchFormat searchoutput = new SearchFormat(); if (searchParams.DateStart != null) { startDate = searchParams.DateStart; if (searchParams.DateEnd != null) { reportDate = searchParams.DateStart.Value.ToShortDateString() + " - " + searchParams.DateEnd.Value.ToShortDateString(); } else { reportDate = "since " + searchParams.DateStart.Value.ToShortDateString(); } } if (searchParams.DateEnd != null) { endDate = searchParams.DateEnd.Value.Date.AddHours(23).AddMinutes(59).AddSeconds(59); if (searchParams.DateStart == null) { reportDate = "through " + searchParams.DateEnd.Value.ToShortDateString(); } } ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.SizeToReportContent = true; try { if (AppSession.ReportScheduleID > 0 && searchParams.ReportTitle != null) { searchParams.ReportTitle = String.Concat(searchParams.ReportTitle, " - Report ID: ", AppSession.ReportScheduleID); } else { searchParams.ReportTitle = "EP Scoring Report - Detail"; } DataView dvReportResultForEPScoring = new DataView(GetReportDataForDetailView(searchParams).Tables[0]); reportViewer.LocalReport.DisplayName = searchParams.ReportTitle; reportViewer.LocalReport.ReportPath = HttpContext.Current.Request.MapPath(HttpContext.Current.Request.ApplicationPath) + @"Areas\Corporate\Reports\rptEP_Scoring_Consolidated_Detail.rdlc"; reportViewer.LocalReport.DataSources.Add(new ReportDataSource("dsEPScoreConsolidatedDetail", dvReportResultForEPScoring)); string filterBy = string.Empty; if (searchParams.FSA == 1) { filterBy = "\nInclude FSA Eps"; } if (searchParams.DocRequired == "Y") { filterBy += "\nDocumentation Required"; } if (searchParams.NewChangedEPs == 1) { filterBy += "\nNew Eps"; } searchParams.ScoreTypeNameList = string.Empty; if (searchParams.ScoreTypeList.Contains("1")) { searchParams.ScoreTypeNameList = "Individual, "; } if (searchParams.ScoreTypeList.Contains("2")) { searchParams.ScoreTypeNameList += "Preliminary, "; } if (searchParams.ScoreTypeList.Contains("3")) { searchParams.ScoreTypeNameList += "Final"; } searchParams.ScoreValueNameList = string.Empty; if (searchParams.ScoreValueList.Contains("2")) { searchParams.ScoreValueNameList = "Satisfactory, "; } if (searchParams.ScoreValueList.Contains("0")) { searchParams.ScoreValueNameList += "Insufficient, "; } if (searchParams.ScoreValueList.Contains("6")) { searchParams.ScoreValueNameList += "Not Applicable, "; } if (searchParams.ScoreValueList.Contains("99")) { searchParams.ScoreValueNameList += "Not Scored"; } if (searchParams.NotScoredInPeriod == 1) { searchParams.ScoreValueNameList += "Not Scored In Period"; } ReportParameter p1 = new ReportParameter("ReportTitle", searchParams.ReportTitle); ReportParameter p2 = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Copyright.ToString()); ReportParameter p3 = new ReportParameter("ProgramName", searchParams.ProgramName); ReportParameter p4 = new ReportParameter("SiteName", searchParams.SiteName); ReportParameter p5 = new ReportParameter("ReportDateTitle", DateTime.Now.ToString()); ReportParameter p6 = new ReportParameter("ChapterNameList", searchParams.ChapterNameList); ReportParameter p7 = new ReportParameter("StandardNameList", searchParams.StandardNameList); ReportParameter p8 = new ReportParameter("ScoredByNameList", searchParams.ScoredByNameList); ReportParameter p9 = new ReportParameter("ScoringPeriod", reportDate); if (searchParams.ChapterAll == 1) { p6 = new ReportParameter("ChapterNameList", "All"); } if (searchParams.StandardAll == 1) { p7 = new ReportParameter("StandardNameList", "All"); } if (searchParams.ScoredByAll == 1) { p8 = new ReportParameter("ScoredByNameList", "All"); } ReportParameter p10 = new ReportParameter("ScoreValueNameList", Regex.Replace(searchParams.ScoreValueNameList, ", $", "")); ReportParameter p11 = new ReportParameter("ScoreTypeNameList", Regex.Replace(searchParams.ScoreTypeNameList, ", $", "")); ReportParameter p12 = new ReportParameter("FilterByList", filterBy == "" ? "None" : filterBy); string DocumentationList = string.Empty; if (searchParams.OrgFindings == 1) { DocumentationList = "All Organizational Findings\n"; } else if (searchParams.OrgFindings == 2) { DocumentationList = "Presence of Organizational Findings\n"; } else if (searchParams.OrgFindings == 3) { DocumentationList = "Absence of Organizational Findings\n"; } if (searchParams.PlanOfAction == 1) { DocumentationList = DocumentationList + "All Plan of Action\n"; } else if (searchParams.PlanOfAction == 2) { DocumentationList = DocumentationList + "Presence of Plan of Action\n"; } else if (searchParams.PlanOfAction == 3) { DocumentationList = DocumentationList + "Absence of Plan of Action\n"; } if (searchParams.OrgNotes == 1) { DocumentationList = DocumentationList + "All Internal Org Notes\n"; } else if (searchParams.OrgNotes == 2) { DocumentationList = DocumentationList + "Presence of Internal Org Notes\n"; } else if (searchParams.OrgNotes == 3) { DocumentationList = DocumentationList + "Absence of Internal Org Notes\n"; } if (searchParams.LinkedDocs == 1) { DocumentationList = DocumentationList + "All Linked Documents\n"; } else if (searchParams.LinkedDocs == 2) { DocumentationList = DocumentationList + "Presence of Linked Documents\n"; } else if (searchParams.LinkedDocs == 3) { DocumentationList = DocumentationList + "Absence of Linked Documents"; } ReportParameter p13 = new ReportParameter("DocumentationList", DocumentationList); ReportParameter p14 = new ReportParameter("ProgramID", searchParams.ProgramID.ToString()); ReportParameter p15 = new ReportParameter("IncludeCMS", searchParams.chkIncludeCMS.ToString()); ReportParameterCollection reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p12, p13, p14, p15 }; reportViewer.LocalReport.SetParameters(reportParameterCollection); if (emailInput.To != null) { CommonService emailService = new CommonService(); int actionTypeId = (int)ActionTypeEnum.EPScoringReport; if (emailService.SendReportEmail(emailInput, actionTypeId, emailService.SetRdlcEmail(reportViewer))) { HttpContext.Current.Session["EmailSuccess"] = "true"; } else { HttpContext.Current.Session["EmailSuccess"] = "false"; } } } catch (Exception ex) { if (ex.Message.ToString() != "No Data") { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "EPScoringReportDetail", MethodName = "EPScoringDetailRDLC", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; _exceptionService.LogException(exceptionLog); } throw ex; } return(reportViewer); }