public DataSourceResult TracerByCMSChart([DataSourceRequest] DataSourceRequest request, Search search) { SearchFormat sf = new SearchFormat(); sf.CheckInputs(search); List <TracerByCMSGraph> tracerByCMSExcel = new List <TracerByCMSGraph>(); DataTable dt = new DataTable(); var tcService = new TracerByCMS(); DataSourceResult result = new DataSourceResult(); try { dt = tcService.TracerByCMSGraph(search).Tables[0]; //convert datatable to list tracerByCMSExcel = dt.ToList <TracerByCMSGraph>().Where(item => !string.IsNullOrEmpty(item.CMSTag)).ToList <TracerByCMSGraph>(); result = tracerByCMSExcel.ToDataSourceResult(request, tc => new TracerByCMSGraph { CMSTag = tc.CMSTag, Compliance = tc.Compliance, TotalDenominator = tc.TotalDenominator, TotalNumerator = tc.TotalNumerator, TagID = tc.TagID }); } catch (Exception ex) { if (ex.Message.ToString() == "No Data") { result.Errors = WebConstants.NO_DATA_FOUND_EXCEL_VIEW; } else if (ex.Message.ToString() == "Limit") { result.Errors = "Maximum limit of " + ConfigurationManager.AppSettings["ReportOutputLimit"].ToString() + " records reached. Refine your criteria to narrow the result."; } if (ex.Message.ToString() != "No Data" && ex.Message.ToString() != "Limit") { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "OrganizationPriorityFindings", MethodName = "OrganizationPriorityFindingsRDLC", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; _exceptionService.LogException(exceptionLog); } } return(result); }
public DataSourceResult TracerByCMSExcel([DataSourceRequest] DataSourceRequest request, Search search) { SearchFormat sf = new SearchFormat(); sf.CheckInputs(search); List <TracerByCMSExcel> tracerByCMSExcel = new List <TracerByCMSExcel>(); DataTable dt = new DataTable(); var tcService = new TracerByCMS(); DataSourceResult result = new DataSourceResult(); try { dt = tcService.TracerByCMSData(search).Tables[0]; //convert datatable to list tracerByCMSExcel = dt.ToList <TracerByCMSExcel>().Where(item => !string.IsNullOrEmpty(item.TracerResponseTitle)).ToList <TracerByCMSExcel>(); result = tracerByCMSExcel.ToDataSourceResult(request, tc => new TracerByCMSExcel { // TO DO Get Excel View DataSet SiteID = tc.SiteID, ChapterName = tc.ChapterName, CompliancePercent = tc.CompliancePercent, Denominator = tc.Denominator, EPLabel = tc.EPLabel, EPText = tc.EPText.ReplaceNewline(), EPTextID = tc.EPTextID, Numerator = tc.Numerator, ObservationDate = tc.ObservationDate, QuestionText = tc.QuestionText.ReplaceNewline(), ReportDataType = tc.ReportDataType, StandardLabel = tc.StandardLabel, StandardText = tc.StandardText.ReplaceNewline(), TracerCustomName = tc.TracerCustomName, TracerQuestionNote = tc.TracerQuestionNote.ReplaceNewline(), TracerResponseNote = tc.TracerResponseNote.ReplaceNewline(), TracerResponseTitle = tc.TracerResponseTitle, UpdatedByUserName = tc.UpdatedByUserName, UpdatedDate = tc.UpdatedDate, OrgName_Rank3 = tc.OrgName_Rank3, OrgName_Rank2 = tc.OrgName_Rank2, OrgName_Rank1_Dept = tc.OrgName_Rank1_Dept, TagCode = tc.TagCode, TagID = tc.TagID, CopText = tc.RequirementName.Trim().ToString() + " - " + tc.CopText }); } catch (Exception ex) { if (ex.Message.ToString() == "No Data") { result.Errors = WebConstants.NO_DATA_FOUND_EXCEL_VIEW; } else if (ex.Message.ToString() == "Limit") { result.Errors = "Maximum limit of " + ConfigurationManager.AppSettings["ReportOutputLimit"].ToString() + " records reached. Refine your criteria to narrow the result."; } if (ex.Message.ToString() != "No Data" && ex.Message.ToString() != "Limit") { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "OrganizationPriorityFindings", MethodName = "OrganizationPriorityFindingsRDLC", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; _exceptionService.LogException(exceptionLog); } } return(result); }