private bool GenerateHTMLSUBSECTOR_POLLUTION_SOURCE_SITES(StringBuilder sbTemp) { int Percent = 10; string NotUsed = ""; LanguageEnum language = _TaskRunnerBaseService._BWObj.appTaskModel.Language; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); _TaskRunnerBaseService.SendStatusTextToDB(_TaskRunnerBaseService.GetTextLanguageFormat1List("Creating_", ReportGenerateObjectsKeywordEnum.SUBSECTOR_POLLUTION_SOURCE_SITES.ToString())); //sbTemp.AppendLine("<h2>SUBSECTOR_POLLUTION_SOURCE_SITES - Not implemented</h2>"); List <string> ParamValueList = Parameters.Split("|||".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); // TVItemID and Year already loaded TVItemModel tvItemModelSubsector = _TVItemService.GetTVItemModelWithTVItemIDDB(TVItemID); if (!string.IsNullOrWhiteSpace(tvItemModelSubsector.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFind_With_Equal_, TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat3List("CouldNotFind_With_Equal_", TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); return(false); } string ServerPath = _TVFileService.GetServerFilePath(tvItemModelSubsector.TVItemID); _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 5); List <TVItemModel> tvItemModelListPolSourceSite = _TVItemService.GetChildrenTVItemModelListWithTVItemIDAndTVTypeDB(tvItemModelSubsector.TVItemID, TVTypeEnum.PolSourceSite); List <PolSourceSiteModel> polSourceSiteModelList = _PolSourceSiteService.GetPolSourceSiteModelListWithSubsectorTVItemIDDB(TVItemID).OrderBy(c => c.Site).ToList(); List <PolSourceObservationModel> polSourceObservationModelList = _PolSourceObservationService.GetPolSourceObservationModelListWithSubsectorTVItemIDDB(TVItemID); List <PolSourceObservationIssueModel> polSourceObservationIssueModelList = _PolSourceObservationIssueService.GetPolSourceObservationIssueModelListWithSubsectorTVItemIDDB(TVItemID); List <int> TVItemIDPolSourceSiteActiveList = tvItemModelListPolSourceSite.Where(c => c.IsActive == true).Select(c => c.TVItemID).ToList(); List <int> TVItemIDPolSourceSiteInactiveList = tvItemModelListPolSourceSite.Where(c => c.IsActive == false).Select(c => c.TVItemID).ToList(); List <int> TVItemIDCivicAddressList = polSourceSiteModelList.Where(c => c.CivicAddressTVItemID != null && c.CivicAddressTVItemID != 0).Where(c => c != null).Select(c => (int)c.CivicAddressTVItemID).ToList(); List <int> TVItemIDContactList = polSourceObservationModelList.Select(c => c.ContactTVItemID).ToList(); List <Address> addressList = new List <Address>(); List <MapInfo> mapInfoActiveList = new List <MapInfo>(); List <MapInfo> mapInfoInactiveList = new List <MapInfo>(); List <MapInfoPoint> mapInfoPointActiveList = new List <MapInfoPoint>(); List <MapInfoPoint> mapInfoPointInactiveList = new List <MapInfoPoint>(); List <TVItemLanguage> countryList = new List <TVItemLanguage>(); List <TVItemLanguage> provinceList = new List <TVItemLanguage>(); List <TVItemLanguage> municipalityList = new List <TVItemLanguage>(); List <TVItemLanguage> contactList = new List <TVItemLanguage>(); using (CSSPDBEntities db2 = new CSSPDBEntities()) { addressList = (from c in db2.Addresses from a in TVItemIDCivicAddressList where c.AddressTVItemID == a select c).ToList(); List <int> countryTVItemIDList = addressList.Select(c => c.CountryTVItemID).ToList(); List <int> provinceTVItemIDList = addressList.Select(c => c.ProvinceTVItemID).ToList(); List <int> municipalityTVItemIDList = addressList.Select(c => c.MunicipalityTVItemID).ToList(); countryList = (from c in db2.TVItemLanguages from a in countryTVItemIDList where c.TVItemID == a && c.Language == (int)language select c).ToList(); provinceList = (from c in db2.TVItemLanguages from a in provinceTVItemIDList where c.TVItemID == a && c.Language == (int)language select c).ToList(); municipalityList = (from c in db2.TVItemLanguages from a in municipalityTVItemIDList where c.TVItemID == a && c.Language == (int)language select c).ToList(); contactList = (from c in db2.TVItemLanguages from a in TVItemIDContactList where c.TVItemID == a && c.Language == (int)language select c).ToList(); mapInfoActiveList = (from c in db2.MapInfos from a in TVItemIDPolSourceSiteActiveList where c.TVItemID == a select c).ToList(); mapInfoInactiveList = (from c in db2.MapInfos from a in TVItemIDPolSourceSiteInactiveList where c.TVItemID == a select c).ToList(); List <int> mapInfoIDActiveList = mapInfoActiveList.Select(c => c.MapInfoID).ToList(); mapInfoPointActiveList = (from c in db2.MapInfoPoints from a in mapInfoIDActiveList where c.MapInfoID == a select c).ToList(); List <int> mapInfoIDInactiveList = mapInfoInactiveList.Select(c => c.MapInfoID).ToList(); mapInfoPointInactiveList = (from c in db2.MapInfoPoints from a in mapInfoIDInactiveList where c.MapInfoID == a select c).ToList(); } _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 10); //sbTemp.AppendLine(@"<p>|||PAGE_BREAK|||</p>"); //sbTemp.AppendLine(""); //sbTemp.AppendLine($@"<h1 style=""text-align: center"">{ tvItemModelSubsector.TVText }</h1>"); //sbTemp.AppendLine($@"<h2 style=""text-align: center"">{ TaskRunnerServiceRes.ActivePollutionSourceSites }</h2>"); foreach (TVItemModel tvItemModelPSSActive in tvItemModelListPolSourceSite.Where(c => c.IsActive == true)) { PolSourceSiteModel polSourceSiteModel = polSourceSiteModelList.Where(c => c.PolSourceSiteTVItemID == tvItemModelPSSActive.TVItemID).FirstOrDefault(); if (polSourceSiteModel != null) { sbTemp.AppendLine($@"<div>"); sbTemp.AppendLine($@"<p>"); sbTemp.AppendLine($@"<strong>{ TaskRunnerServiceRes.Site }</strong>: { polSourceSiteModel.Site } "); MapInfo mapInfo = mapInfoActiveList.Where(c => c.TVItemID == tvItemModelPSSActive.TVItemID).FirstOrDefault(); if (mapInfo != null) { List <MapInfoPoint> mapInfoPointListCurrent = mapInfoPointActiveList.Where(c => c.MapInfoID == mapInfo.MapInfoID).ToList(); if (mapInfoPointListCurrent.Count > 0) { sbTemp.AppendLine($@"<span><strong>{ TaskRunnerServiceRes.Lat } { TaskRunnerServiceRes.Long }</strong>: { mapInfoPointListCurrent[0].Lat.ToString("F5") } { mapInfoPointListCurrent[0].Lng.ToString("F5") }</span>"); } } else { sbTemp.AppendLine($@"<span><strong>{ TaskRunnerServiceRes.Lat } { TaskRunnerServiceRes.Long }</strong>: --- ---</span>"); } sbTemp.AppendLine($@"</p>"); if (polSourceSiteModel.CivicAddressTVItemID != null) { if (polSourceSiteModel.CivicAddressTVItemID != 0) { Address address = addressList.Where(c => c.AddressTVItemID == ((int)polSourceSiteModel.CivicAddressTVItemID)).FirstOrDefault(); if (address != null) { sbTemp.AppendLine($@"<p>"); if (_TaskRunnerBaseService._BWObj.appTaskModel.Language == LanguageEnum.fr) { string CountryText = countryList.Where(c => c.TVItemID == address.CountryTVItemID).Select(c => c.TVText).FirstOrDefault(); string ProvinceText = provinceList.Where(c => c.TVItemID == address.ProvinceTVItemID).Select(c => c.TVText).FirstOrDefault(); string MunicipalityText = municipalityList.Where(c => c.TVItemID == address.MunicipalityTVItemID).Select(c => c.TVText).FirstOrDefault(); string StreetTypeText = _BaseEnumService.GetEnumText_StreetTypeEnum((StreetTypeEnum)address.StreetType); string AddressText = $" { address.StreetNumber} { address.StreetName } { StreetTypeText }, { MunicipalityText }, { ProvinceText }, { CountryText }"; sbTemp.AppendLine($@"<strong>{ TaskRunnerServiceRes.CivicAddress }</strong>: { AddressText }"); } else { string CountryText = countryList.Where(c => c.TVItemID == address.CountryTVItemID).Select(c => c.TVText).FirstOrDefault(); string ProvinceText = provinceList.Where(c => c.TVItemID == address.ProvinceTVItemID).Select(c => c.TVText).FirstOrDefault(); string MunicipalityText = municipalityList.Where(c => c.TVItemID == address.MunicipalityTVItemID).Select(c => c.TVText).FirstOrDefault(); string StreetTypeText = _BaseEnumService.GetEnumText_StreetTypeEnum((StreetTypeEnum)address.StreetType); string AddressText = $" { address.StreetNumber}, { StreetTypeText } { address.StreetName }, { MunicipalityText }, { ProvinceText }, { CountryText }"; sbTemp.AppendLine($@"<strong>{ TaskRunnerServiceRes.CivicAddress }</strong>: { AddressText }"); } sbTemp.AppendLine($@"</p>"); } } } PolSourceObservationModel polSourceObservationModel = polSourceObservationModelList.Where(c => c.PolSourceSiteID == polSourceSiteModel.PolSourceSiteID).OrderByDescending(c => c.ObservationDate_Local).FirstOrDefault(); if (polSourceObservationModel != null) { sbTemp.AppendLine($@"<p>"); string ContactObsText = contactList.Where(c => c.TVItemID == polSourceObservationModel.ContactTVItemID).Select(c => c.TVText).FirstOrDefault(); sbTemp.AppendLine($@"<strong>{ TaskRunnerServiceRes.LastObservationDate }</strong>: { polSourceObservationModel.ObservationDate_Local.ToString("yyyy MMMM dd") } <strong>{ TaskRunnerServiceRes.by }</strong>: { ContactObsText }"); sbTemp.AppendLine($@"</p>"); int IssueNumber = 0; foreach (PolSourceObservationIssueModel polSourceObservationIssueModel in polSourceObservationIssueModelList.Where(c => c.PolSourceObservationID == polSourceObservationModel.PolSourceObservationID).OrderBy(c => c.Ordinal).ToList()) { IssueNumber += 1; string TVText = ""; sbTemp.AppendLine($@"<p><strong>{ TaskRunnerServiceRes.Issue }</strong>: { IssueNumber }</p>"); sbTemp.AppendLine($@"<blockquote>"); List <string> ObservationInfoList = (string.IsNullOrWhiteSpace(polSourceObservationIssueModel.ObservationInfo) ? new List <string>() : polSourceObservationIssueModel.ObservationInfo.Trim().Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList()); for (int i = 0, countObs = ObservationInfoList.Count; i < countObs; i++) { string Temp = _BaseEnumService.GetEnumText_PolSourceObsInfoReportEnum((PolSourceObsInfoEnum)int.Parse(ObservationInfoList[i])); switch (ObservationInfoList[i].Substring(0, 3)) { case "101": { Temp = Temp.Replace("Source", "<br /><strong>Source</strong>"); } break; //case "153": // { // Temp = Temp.Replace("Dilution Analyses", " Dilution Analyses"); // } // break; case "250": { Temp = Temp.Replace("Pathway", "<br /><strong>Pathway</strong>"); } break; case "900": { Temp = Temp.Replace("Status", "<br /><strong>Status</strong>"); } break; case "910": { Temp = Temp.Replace("Risk", "<br /><strong>Risk</strong>"); } break; case "110": case "120": case "122": case "151": case "152": case "153": case "155": case "156": case "157": case "163": case "166": case "167": case "170": case "171": case "172": case "173": case "176": case "178": case "181": case "182": case "183": case "185": case "186": case "187": case "190": case "191": case "192": case "193": case "194": case "196": case "198": case "199": case "220": case "930": { //Temp = @"<span class=""hidden"">" + Temp + "</span>"; } break; default: break; } TVText = TVText + Temp; } sbTemp.AppendLine($@"{ TVText }"); if (polSourceObservationIssueModel.ExtraComment != null) { if (polSourceObservationIssueModel.ExtraComment.Length > 0) { sbTemp.AppendLine($@"<p><strong>{ TaskRunnerServiceRes.ExtraComment }</strong></p>"); sbTemp.AppendLine($@"<p>"); sbTemp.AppendLine($@"{ polSourceObservationIssueModel.ExtraComment }"); sbTemp.AppendLine($@"</p>"); } } sbTemp.AppendLine($@"</blockquote>"); } } sbTemp.AppendLine($@"</div>"); sbTemp.AppendLine($@"<hr />"); } } Percent = 98; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); return(true); }
private bool GenerateHTMLSUBSECTOR_POLLUTION_SOURCE_SITES_COMPACT(StringBuilder sbTemp) { int Percent = 10; string NotUsed = ""; LanguageEnum language = _TaskRunnerBaseService._BWObj.appTaskModel.Language; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); _TaskRunnerBaseService.SendStatusTextToDB(_TaskRunnerBaseService.GetTextLanguageFormat1List("Creating_", ReportGenerateObjectsKeywordEnum.SUBSECTOR_POLLUTION_SOURCE_SITES_COMPACT.ToString())); TVItemModel tvItemModelSubsector = _TVItemService.GetTVItemModelWithTVItemIDDB(TVItemID); if (!string.IsNullOrWhiteSpace(tvItemModelSubsector.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFind_With_Equal_, TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat3List("CouldNotFind_With_Equal_", TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); return(false); } string ServerPath = _TVFileService.GetServerFilePath(tvItemModelSubsector.TVItemID); _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 5); List <TVItemModel> tvItemModelListPolSourceSite = _TVItemService.GetChildrenTVItemModelListWithTVItemIDAndTVTypeDB(tvItemModelSubsector.TVItemID, TVTypeEnum.PolSourceSite); List <PolSourceSiteModel> polSourceSiteModelList = _PolSourceSiteService.GetPolSourceSiteModelListWithSubsectorTVItemIDDB(TVItemID).OrderBy(c => c.Site).ToList(); List <PolSourceObservationModel> polSourceObservationModelList = _PolSourceObservationService.GetPolSourceObservationModelListWithSubsectorTVItemIDDB(TVItemID); List <PolSourceObservationIssueModel> polSourceObservationIssueModelList = _PolSourceObservationIssueService.GetPolSourceObservationIssueModelListWithSubsectorTVItemIDDB(TVItemID); List <int> TVItemIDPolSourceSiteActiveList = tvItemModelListPolSourceSite.Where(c => c.IsActive == true).Select(c => c.TVItemID).ToList(); List <MapInfo> mapInfoActiveList = new List <MapInfo>(); List <MapInfoPoint> mapInfoPointActiveList = new List <MapInfoPoint>(); //using (CSSPDBEntities db2 = new CSSPDBEntities()) //{ // mapInfoActiveList = (from c in db2.MapInfos // from a in TVItemIDPolSourceSiteActiveList // where c.TVItemID == a // select c).ToList(); // List<int> mapInfoIDActiveList = mapInfoActiveList.Select(c => c.MapInfoID).ToList(); // mapInfoPointActiveList = (from c in db2.MapInfoPoints // from a in mapInfoIDActiveList // where c.MapInfoID == a // select c).ToList(); //} _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 10); sbTemp.AppendLine($@"|||TableCaption| { TaskRunnerServiceRes.PollutionSourcesSiteInventory }|||"); sbTemp.AppendLine($@"<table class=""PolSourceSiteCompact"">"); sbTemp.AppendLine($@" <tr> "); sbTemp.AppendLine($@" <th class=""allBordersNoWrap"">{ TaskRunnerServiceRes.Site }</th>"); sbTemp.AppendLine($@" <th class=""allBordersNoWrap"">{ TaskRunnerServiceRes.IN }</th>"); sbTemp.AppendLine($@" <th class=""allBordersNoWrap"">{ TaskRunnerServiceRes.Type }</th>"); sbTemp.AppendLine($@" <th class=""allBordersNoWrap"">{ TaskRunnerServiceRes.Path }</th>"); sbTemp.AppendLine($@" <th class=""allBordersNoWrap"">{ TaskRunnerServiceRes.Prob }</th>"); sbTemp.AppendLine($@" <th class=""allBordersNoWrap"">{ TaskRunnerServiceRes.Risk }</th>"); sbTemp.AppendLine($@" <th class=""allBordersNoWrap"">{ TaskRunnerServiceRes.Lat }</th>"); sbTemp.AppendLine($@" <th class=""allBordersNoWrap"">{ TaskRunnerServiceRes.Long }</th>"); sbTemp.AppendLine($@" <th class=""allBordersNoWrap"">{ TaskRunnerServiceRes.ObsDate }</th>"); sbTemp.AppendLine($@" </tr>"); using (CSSPDBEntities db = new CSSPDBEntities()) { var tvItemSS = (from t in db.TVItems from tl in db.TVItemLanguages where t.TVItemID == tl.TVItemID && tl.Language == (int)language && t.TVType == (int)TVTypeEnum.Subsector && t.IsActive == true && t.TVItemID == TVItemID select new { t, tl }).FirstOrDefault(); var PollutionSourceSiteList = (from t in db.TVItems from tl in db.TVItemLanguages from mi in db.MapInfos from mip in db.MapInfoPoints from pss in db.PolSourceSites let address = (from a in db.Addresses let muni = (from cl in db.TVItemLanguages where cl.TVItemID == a.MunicipalityTVItemID && cl.Language == (int)LanguageEnum.en select cl.TVText).FirstOrDefault <string>() let add = a.StreetNumber + " " + a.StreetName + " --- " + muni where a.AddressTVItemID == t.TVItemID select new { add }).FirstOrDefault() let pso = (from pso in db.PolSourceObservations where pso.PolSourceSiteID == pss.PolSourceSiteID orderby pso.ObservationDate_Local descending select new { pso }).FirstOrDefault() let psi = (from psi in db.PolSourceObservationIssues where psi.PolSourceObservationID == pso.pso.PolSourceObservationID orderby psi.Ordinal ascending select new { psi }).ToList() where t.TVItemID == tl.TVItemID && mi.TVItemID == t.TVItemID && mip.MapInfoID == mi.MapInfoID && t.TVItemID == pss.PolSourceSiteTVItemID && tl.Language == (int)LanguageEnum.en && t.TVPath.StartsWith(tvItemSS.t.TVPath + "p") && t.TVType == (int)TVTypeEnum.PolSourceSite && t.IsActive == true && mi.MapInfoDrawType == (int)MapInfoDrawTypeEnum.Point && mi.TVType == (int)TVTypeEnum.PolSourceSite orderby tl.TVText select new { t, tl, mip, address.add, pss, pso, psi }).ToList(); foreach (var polSourceSite in PollutionSourceSiteList.Where(c => c.t.ParentID == tvItemSS.t.TVItemID)) { string SS = tvItemSS.tl.TVText.Replace(",", "_"); string Desc = ""; if (SS.Contains(" ")) { Desc = SS.Substring(SS.IndexOf(" ")); Desc = Desc.Trim(); Desc = Desc.Replace("(", "").Replace(")", ""); SS = SS.Substring(0, SS.IndexOf(" ")); } string PSS = "P" + (polSourceSite.pss != null && polSourceSite.pss.Site != null ? polSourceSite.pss.Site.ToString().Replace(",", "_") : ""); string OBSDate = (polSourceSite.pso != null && polSourceSite.pso.pso.ObservationDate_Local != null ? polSourceSite.pso.pso.ObservationDate_Local.ToString("yyyy-MM-dd") : ""); string PSTVT = polSourceSite.tl.TVText; string[] PSArr = PSTVT.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToArray(); string PSType = ""; string PSPath = ""; string PSProb = ""; string PSRisk = ""; if (PSArr.Length > 0) { PSType = PSArr[0]; if (PSType.Contains(" - ")) { PSType = PSType.Substring(PSType.IndexOf(" - ") + 3); } } if (PSArr.Length > 1) { PSPath = PSArr[1]; } if (PSArr.Length > 2) { PSRisk = PSArr[2]; } string Lat = (polSourceSite.mip != null ? polSourceSite.mip.Lat.ToString("F5") : ""); string Lng = (polSourceSite.mip != null ? polSourceSite.mip.Lng.ToString("F5") : ""); string URL = @"http://131.235.1.167/csspwebtools/en-CA/#!View/a|||" + polSourceSite.t.TVItemID.ToString() + @"|||30010100004000000000000000000000"; string TVText = ""; int IN = 0; foreach (var psi in polSourceSite.psi) { if (psi != null && psi.psi != null) { IN += 1; List <string> ObservationInfoList = (string.IsNullOrWhiteSpace(psi.psi.ObservationInfo) ? new List <string>() : psi.psi.ObservationInfo.Trim().Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList()); for (int i = 0, countObs = ObservationInfoList.Count; i < countObs; i++) { string Temp = _BaseEnumService.GetEnumText_PolSourceObsInfoReportEnum((PolSourceObsInfoEnum)int.Parse(ObservationInfoList[i])); switch (ObservationInfoList[i].Substring(0, 3)) { case "101": { Temp = Temp.Replace("Source", " Source"); } break; case "250": { Temp = Temp.Replace("Pathway", " Pathway"); } break; case "900": { Temp = Temp.Replace("Status", " Status"); if (!string.IsNullOrWhiteSpace(Temp)) { PSProb = Temp.Replace("Status:", ""); PSProb = PSProb.Trim(); if (PSProb.Contains(" ")) { PSProb = PSProb.Substring(0, PSProb.IndexOf(" ")); } } } break; case "910": { Temp = Temp.Replace("Risk", " Risk"); } break; default: break; } TVText = TVText + Temp; } } string TVT = (polSourceSite.pso != null && polSourceSite.pso.pso.Observation_ToBeDeleted != null ? polSourceSite.pso.pso.Observation_ToBeDeleted : ""); string TempISS = (!string.IsNullOrWhiteSpace(TVT) ? TVT.Replace(",", "_") + " ----- " : "") + TVText; string ISS = TempISS.Replace("\r", " ").Replace("\n", "").Replace("empty", "").Replace("Empty", "").Replace("\r", " ").Replace("\n", ""); if (SS.Length == 0) { SS = " "; } if (Desc.Length == 0) { Desc = " "; } if (PSS.Length == 0) { PSS = " "; } if (PSType.Length == 0) { PSType = " "; } if (PSPath.Length == 0) { PSPath = " "; } if (PSProb.Length == 0) { PSProb = " "; } if (Lat.Length == 0) { Lat = " "; } if (Lng.Length == 0) { Lng = " "; } if (OBSDate.Length == 0) { OBSDate = " "; } if (URL.Length == 0) { URL = " "; } sbTemp.AppendLine($@" <tr>"); sbTemp.AppendLine($@" <td class=""allBordersNoWrap"">{ PSS }</td>"); sbTemp.AppendLine($@" <td class=""allBordersNoWrap"">{ IN }</td>"); sbTemp.AppendLine($@" <td class=""allBordersNoWrap"">{ PSType }</td>"); sbTemp.AppendLine($@" <td class=""allBordersNoWrap"">{ PSPath }</td>"); sbTemp.AppendLine($@" <td class=""allBordersNoWrap"">{ PSProb }</td>"); sbTemp.AppendLine($@" <td class=""allBordersNoWrap"">{ PSRisk }</td>"); sbTemp.AppendLine($@" <td class=""allBordersNoWrap"">{ Lat }</td>"); sbTemp.AppendLine($@" <td class=""allBordersNoWrap"">{ Lng }</td>"); sbTemp.AppendLine($@" <td class=""allBordersNoWrap"">{ OBSDate }</td>"); sbTemp.AppendLine($@" </tr>"); } } } sbTemp.AppendLine($@"</table>"); Percent = 98; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); return(true); }
private bool GenerateHTMLSUBSECTOR_MWQM_SITES_DATA_AVAILABILITY(StringBuilder sbTemp) { int Percent = 10; string NotUsed = ""; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); _TaskRunnerBaseService.SendStatusTextToDB(_TaskRunnerBaseService.GetTextLanguageFormat1List("Creating_", ReportGenerateObjectsKeywordEnum.SUBSECTOR_MWQM_SITES_DATA_AVAILABILITY.ToString())); List <string> ParamValueList = Parameters.Split("|||".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); // TVItemID and Year already loaded TVItemModel tvItemModelSubsector = _TVItemService.GetTVItemModelWithTVItemIDDB(TVItemID); if (!string.IsNullOrWhiteSpace(tvItemModelSubsector.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFind_With_Equal_, TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat3List("CouldNotFind_With_Equal_", TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); return(false); } string ServerPath = _TVFileService.GetServerFilePath(tvItemModelSubsector.TVItemID); _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 5); List <TVItemModel> tvItemModelListMWQMSites = _TVItemService.GetChildrenTVItemModelListWithTVItemIDAndTVTypeDB(tvItemModelSubsector.TVItemID, TVTypeEnum.MWQMSite).Where(c => c.IsActive == true).ToList(); List <MWQMSiteModel> mwqmSiteModelList = _MWQMSiteService.GetMWQMSiteModelListWithSubsectorTVItemIDDB(TVItemID); List <MWQMRunModel> mwqmRunModelList = _MWQMRunService.GetMWQMRunModelListWithSubsectorTVItemIDDB(TVItemID); List <MWQMSampleModel> mwqmSampleModelList = _MWQMSampleService.GetMWQMSampleModelListWithSubsectorTVItemIDDB(TVItemID); sbTemp.AppendLine($@"|||TableCaption| { TaskRunnerServiceRes.MWQMSiteSampleDataAvailability }|||"); sbTemp.AppendLine($@" <table class=""DataAvailabilityTableClass"">"); sbTemp.AppendLine($@" <tr>"); sbTemp.AppendLine($@" <th class=""textAlignLeftAndLeftAndBottomBorder"">{ TaskRunnerServiceRes.Site }</th>"); int MaxYear = Math.Min(DateTime.Now.Year, Year); bool FirstHit = false; for (int year = MaxYear; year > 1975; year--) { if (year % 5 == 0) { FirstHit = true; int colSpan = 5; if (year == 1980) { colSpan = 4; } sbTemp.AppendLine($@" <th class=""textAlignLeftAndLeftAndBottomBorder"" colspan=""{ colSpan }"">{ year }</th>"); } if (!FirstHit) { sbTemp.AppendLine($@" <th class=""textAlignLeftAndLeftAndBottomBorder""> </th>"); } } sbTemp.AppendLine($@" </tr>"); int countSite = 0; foreach (MWQMSiteModel mwqmSiteModel in mwqmSiteModelList) { TVItemModel tvItemModel = tvItemModelListMWQMSites.Where(c => c.TVItemID == mwqmSiteModel.MWQMSiteTVItemID).FirstOrDefault(); if (tvItemModel != null) { if (tvItemModel.IsActive) { countSite += 1; string bottomClass = ""; if (countSite % 5 == 0) { bottomClass = "bottomBorder"; } sbTemp.AppendLine($@" <tr>"); sbTemp.AppendLine($@" <td class=""{ bottomClass }"">{ mwqmSiteModel.MWQMSiteTVText }</td>"); for (int year = MaxYear; year > 1979; year--) { string leftClass = year % 5 == 0 ? "leftBorder" : ""; bool hasSamples = mwqmSampleModelList.Where(c => c.MWQMSiteTVItemID == mwqmSiteModel.MWQMSiteTVItemID && c.SampleDateTime_Local.Year == year && c.SampleTypesText.Contains(((int)SampleTypeEnum.Routine).ToString())).Any(); if (hasSamples) { if (leftClass != "") { if (bottomClass != "") { sbTemp.AppendLine($@" <td class=""bggreenfLeftAndBottomBorder""> </td>"); } else { sbTemp.AppendLine($@" <td class=""bggreenfLeftBorder""> </td>"); } } else { if (bottomClass != "") { sbTemp.AppendLine($@" <td class=""bggreenfBottomBorder""> </td>"); } else { sbTemp.AppendLine($@" <td class=""bggreenf""> </td>"); } } } else { if (leftClass != "") { if (bottomClass != "") { sbTemp.AppendLine($@" <td class=""leftAndBottomBorder""> </td>"); } else { sbTemp.AppendLine($@" <td class=""leftBorder""> </td>"); } } else { if (bottomClass != "") { sbTemp.AppendLine($@" <td class=""bottomBorder""> </td>"); } else { sbTemp.AppendLine($@" <td> </td>"); } } } } sbTemp.AppendLine($@" </tr>"); } } } sbTemp.AppendLine($@" </table>"); Percent = 80; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); return(true); }
private bool GenerateHTMLSUBSECTOR_MWQM_SITES_NUMBER_OF_SITES_BY_YEAR(StringBuilder sbTemp) { int Percent = 10; string NotUsed = ""; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); _TaskRunnerBaseService.SendStatusTextToDB(_TaskRunnerBaseService.GetTextLanguageFormat1List("Creating_", ReportGenerateObjectsKeywordEnum.SUBSECTOR_MWQM_SITES_NUMBER_OF_SITES_BY_YEAR.ToString())); List <string> ParamValueList = Parameters.Split("|||".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); // TVItemID and Year already loaded TVItemModel tvItemModelSubsector = _TVItemService.GetTVItemModelWithTVItemIDDB(TVItemID); if (!string.IsNullOrWhiteSpace(tvItemModelSubsector.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFind_With_Equal_, TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat3List("CouldNotFind_With_Equal_", TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); return(false); } string ServerPath = _TVFileService.GetServerFilePath(tvItemModelSubsector.TVItemID); _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 5); List <TVItemModel> tvItemModelListMWQMSites = _TVItemService.GetChildrenTVItemModelListWithTVItemIDAndTVTypeDB(tvItemModelSubsector.TVItemID, TVTypeEnum.MWQMSite).Where(c => c.IsActive == true).ToList(); List <MWQMSiteModel> mwqmSiteModelList = _MWQMSiteService.GetMWQMSiteModelListWithSubsectorTVItemIDDB(TVItemID); List <MWQMRunModel> mwqmRunModelList = _MWQMRunService.GetMWQMRunModelListWithSubsectorTVItemIDDB(TVItemID); List <MWQMSampleModel> mwqmSampleModelList = _MWQMSampleService.GetMWQMSampleModelListWithSubsectorTVItemIDDB(TVItemID); //------------------------------------------------------------------------------ // doing number of sites by year //------------------------------------------------------------------------------ List <int> YearList = new List <int>(); List <int> CountPerYear = new List <int>(); int MaxYear = Math.Min(DateTime.Now.Year, Year); for (int i = MaxYear; i > 1979; i--) { YearList.Add(i); int count = (from s in mwqmSiteModelList from samp in mwqmSampleModelList where s.MWQMSiteTVItemID == samp.MWQMSiteTVItemID && samp.SampleDateTime_Local.Year == i select s.MWQMSiteTVItemID).Distinct().Count(); CountPerYear.Add(count); } Percent = 30; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); if (xlApp == null) { xlApp = new Microsoft.Office.Interop.Excel.Application(); workbook = xlApp.Workbooks.Add(); worksheet = workbook.Worksheets.get_Item(1); xlCharts = (Microsoft.Office.Interop.Excel.ChartObjects)worksheet.ChartObjects(); } Microsoft.Office.Interop.Excel.ChartObject chart = xlCharts.Add(100, 100, 600, 200); Microsoft.Office.Interop.Excel.Chart chartPage = chart.Chart; chartPage.ChartType = Microsoft.Office.Interop.Excel.XlChartType.xlColumnClustered; Microsoft.Office.Interop.Excel.SeriesCollection seriesCollection = chartPage.SeriesCollection(); Microsoft.Office.Interop.Excel.Series series = seriesCollection.NewSeries(); _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 40); series.XValues = YearList.ToArray(); series.Values = CountPerYear.ToArray(); chartPage.ApplyLayout(9, Microsoft.Office.Interop.Excel.XlChartType.xlColumnClustered); chartPage.ChartTitle.Select(); xlApp.Selection.Delete(); chartPage.Axes(Microsoft.Office.Interop.Excel.XlAxisType.xlValue).AxisTitle.Select(); xlApp.Selection.Delete(); chartPage.Legend.Select(); xlApp.Selection.Delete(); chartPage.Axes(Microsoft.Office.Interop.Excel.XlAxisType.xlCategory).MajorTickMark = Microsoft.Office.Interop.Excel.Constants.xlOutside; chartPage.Parent.RoundedCorners = true; chartPage.Axes(Microsoft.Office.Interop.Excel.XlAxisType.xlCategory, Microsoft.Office.Interop.Excel.XlAxisGroup.xlPrimary).AxisTitle.Text = TaskRunnerServiceRes.NumberOfMWQMSitesByYear; // need to save the file with a unique name under the TVItemID FileInfo fiImageNumberOfSitesByYearStat = new FileInfo(fi.DirectoryName + @"\NumberOfSitesByYearStat" + FileNameExtra + ".png"); DirectoryInfo di = new DirectoryInfo(fi.DirectoryName); if (!di.Exists) { try { di.Create(); } catch (Exception ex) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotCreateDirectory__, di.FullName, ex.Message + (ex.InnerException != null ? " Inner: " + ex.InnerException.Message : "")); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat2List("CouldNotCreateDirectory__", di.FullName, ex.Message + (ex.InnerException != null ? " Inner: " + ex.InnerException.Message : "")); return(false); } } chartPage.Export(fiImageNumberOfSitesByYearStat.FullName, "PNG", false); sbTemp.AppendLine($@"<div class=""textAlignCenter"">|||Image|FileName,{ fiImageNumberOfSitesByYearStat.FullName }|width,400|height,150|||</div>"); sbTemp.AppendLine($@"<div>|||FigureCaption| { TaskRunnerServiceRes.NumberOfMWQMSitesByYear }|||</div>"); Percent = 80; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 80); return(true); }
private bool GenerateHTMLMUNICIPALITY_INFRASTRUCTURE_DETAIL(StringBuilder sbTemp) { int Percent = 10; string NotUsed = ""; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); _TaskRunnerBaseService.SendStatusTextToDB(_TaskRunnerBaseService.GetTextLanguageFormat1List("Creating_", ReportGenerateObjectsKeywordEnum.SUBSECTOR_MWQM_SITES_FC_TABLE.ToString())); List <string> ParamValueList = Parameters.Split("|||".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); // TVItemID and Year already loaded TVItemModel tvItemModelSubsector = _TVItemService.GetTVItemModelWithTVItemIDDB(TVItemID); if (!string.IsNullOrWhiteSpace(tvItemModelSubsector.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFind_With_Equal_, TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat3List("CouldNotFind_With_Equal_", TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); return(false); } string ServerPath = _TVFileService.GetServerFilePath(tvItemModelSubsector.TVItemID); _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 5); List <TVItemModel> tvItemModelListMunicipality = _TVItemService.GetChildrenTVItemModelListWithTVItemIDAndTVTypeDB(tvItemModelSubsector.TVItemID, TVTypeEnum.Municipality).Where(c => c.IsActive == true).ToList(); if (tvItemModelListMunicipality.Count > 0) { foreach (TVItemModel tvItemModel in tvItemModelListMunicipality) { sbTemp.AppendLine($@"<h3>{ tvItemModel.TVText } infrastructure detail</h3"); sbTemp.AppendLine($@"<p>{ TaskRunnerServiceRes.NotImplementedYet }</p>"); } } else { sbTemp.AppendLine($@"<p style=""font-size: 2em;"">{ TaskRunnerServiceRes.NoMunicipalityWithinSubsector }</p>"); } _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 80); return(true); }
private bool GenerateHTMLSUBSECTOR_ECCC_AND_SWCP_LOGO(StringBuilder sbTemp) { int Percent = 12; string NotUsed = ""; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); _TaskRunnerBaseService.SendStatusTextToDB(_TaskRunnerBaseService.GetTextLanguageFormat1List("Creating_", ReportGenerateObjectsKeywordEnum.SUBSECTOR_ECCC_AND_SWCP_LOGO.ToString())); List <string> ParamValueList = Parameters.Split("|||".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); // TVItemID and Year already loaded TVItemModel tvItemModelSubsector = _TVItemService.GetTVItemModelWithTVItemIDDB(TVItemID); if (!string.IsNullOrWhiteSpace(tvItemModelSubsector.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFind_With_Equal_, TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageList(tvItemModelSubsector.Error); return(false); } TVItemModel tvItemModelRoot = _TVItemService.GetRootTVItemModelDB(); if (!string.IsNullOrWhiteSpace(tvItemModelRoot.Error)) { NotUsed = TaskRunnerServiceRes.CouldNotFindTVItemRoot; _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageList("CouldNotFindTVItemRoot"); return(false); } string ServerPath = _TVFileService.GetServerFilePath(tvItemModelRoot.TVItemID); TVFileModel tvFileModelFullReportECCCAndSWCPLogo = _TVFileService.GetTVFileModelWithServerFilePathAndServerFileNameDB(ServerPath, "ECCCAndSWCPLogo.png"); if (!string.IsNullOrWhiteSpace(tvFileModelFullReportECCCAndSWCPLogo.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFindFile_, ServerPath + "ECCCAndSWCPLogo.png"); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat1List("CouldNotFindFile_", ServerPath + "ECCCAndSWCPLogo.png"); return(false); } FileInfo fiFullReportECCCAndSWCPLogo = new FileInfo(tvFileModelFullReportECCCAndSWCPLogo.ServerFilePath + tvFileModelFullReportECCCAndSWCPLogo.ServerFileName); if (!fiFullReportECCCAndSWCPLogo.Exists) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFindFile_, fiFullReportECCCAndSWCPLogo.FullName); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat1List("CouldNotFindFile_", fiFullReportECCCAndSWCPLogo.FullName); return(false); } sbTemp.AppendLine($@" |||Image|FileName,{ fiFullReportECCCAndSWCPLogo.FullName }|width,245|height,62|||"); sbTemp.AppendLine($@" <p> </p>"); return(true); }
private bool GenerateHTMLSUBSECTOR_MUNICIPALITIES_COMPACT_AND_FULL(StringBuilder sbTemp, bool IsCompact) { int Percent = 10; string NotUsed = ""; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); _TaskRunnerBaseService.SendStatusTextToDB(_TaskRunnerBaseService.GetTextLanguageFormat1List("Creating_", ReportGenerateObjectsKeywordEnum.SUBSECTOR_MUNICIPALITIES_COMPACT.ToString())); List <string> ParamValueList = Parameters.Split("|||".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); // TVItemID and Year already loaded TVItemModel tvItemModelSubsector = _TVItemService.GetTVItemModelWithTVItemIDDB(TVItemID); if (!string.IsNullOrWhiteSpace(tvItemModelSubsector.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFind_With_Equal_, TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat3List("CouldNotFind_With_Equal_", TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); return(false); } string ServerPath = _TVFileService.GetServerFilePath(tvItemModelSubsector.TVItemID); _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 5); List <UseOfSiteModel> useOfSiteModelList = _UseOfSiteService.GetUseOfSiteModelListWithTVTypeAndSubsectorTVItemIDDB(TVTypeEnum.Municipality, tvItemModelSubsector.TVItemID); if (useOfSiteModelList.Count > 0) { sbTemp.AppendLine($@"<table>"); sbTemp.AppendLine($@"<tr>"); sbTemp.AppendLine($@"<td colspan=""20"">"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.Legend }</b>"); sbTemp.AppendLine($@" <b>W</b> - { TaskRunnerServiceRes.WWTPs }"); sbTemp.AppendLine($@" <b>LS</b> - { TaskRunnerServiceRes.LiftStations }"); sbTemp.AppendLine($@" <b>LO</b> - { TaskRunnerServiceRes.LineOverflows }"); sbTemp.AppendLine($@"</td>"); sbTemp.AppendLine($@"</tr>"); sbTemp.AppendLine($@"<tr>"); sbTemp.AppendLine($@"<td colspan=""20""> </td>"); sbTemp.AppendLine($@"</tr>"); foreach (UseOfSiteModel useOfSiteModel in useOfSiteModelList) { TVItemModel tvItemModelMuni = _TVItemService.GetTVItemModelWithTVItemIDDB(useOfSiteModel.SiteTVItemID); if (string.IsNullOrWhiteSpace(tvItemModelMuni.Error)) // municipality exist { sbTemp.AppendLine($@"<tr>"); sbTemp.AppendLine($@"<td colspan=""20"">"); sbTemp.AppendLine($@"<h3>{ tvItemModelMuni.TVText }</h3>"); sbTemp.AppendLine($@"</td>"); sbTemp.AppendLine($@"</tr>"); sbTemp.AppendLine($@"<tr>"); if (!IsCompact) { sbTemp.AppendLine($@"<td colspan=""20""> </td>"); sbTemp.AppendLine($@"</tr>"); } if (!IsCompact) { List <TVItemLinkModel> tvItemLinkModelList = _TVItemLinkService.GetTVItemLinkModelListWithFromTVItemIDDB(tvItemModelMuni.TVItemID); foreach (TVItemLinkModel tvItemLinkModel in tvItemLinkModelList) { if (tvItemLinkModel.ToTVType == TVTypeEnum.Contact) { ContactItem(sbTemp, tvItemLinkModel.ToTVItemID); } } } List <TVItemModelInfrastructureTypeTVItemLinkModel> tvItemModelInfrastructureTypeTVItemLinkModelList = _InfrastructureService.GetInfrastructureTVItemAndTVItemLinkAndInfrastructureTypeListWithMunicipalityTVItemIDDB(tvItemModelMuni.TVItemID); List <TVItemModelInfrastructureTypeTVItemLinkModel> tvItemModelInfrastructureTypeTVItemLinkModelListDone = new List <TVItemModelInfrastructureTypeTVItemLinkModel>(); foreach (TVItemModelInfrastructureTypeTVItemLinkModel tvItemModelInfrastructureTypeTVItemLinkModel in tvItemModelInfrastructureTypeTVItemLinkModelList.Where(c => c.InfrastructureType != InfrastructureTypeEnum.Other && c.InfrastructureType != InfrastructureTypeEnum.SeeOtherMunicipality && c.TVItemModelLinkList.Count == 0)) { next(tvItemModelInfrastructureTypeTVItemLinkModel, tvItemModelInfrastructureTypeTVItemLinkModelList, tvItemModelInfrastructureTypeTVItemLinkModelListDone); } List <TVItemModelInfrastructureTypeTVItemLinkModel> tvItemModelInfrastructureTypeTVItemLinkModelListFloating = new List <TVItemModelInfrastructureTypeTVItemLinkModel>(); foreach (TVItemModelInfrastructureTypeTVItemLinkModel tvItemModelInfrastructureTypeTVItemLinkModel in tvItemModelInfrastructureTypeTVItemLinkModelList.Where(c => c.InfrastructureType != InfrastructureTypeEnum.Other && c.InfrastructureType != InfrastructureTypeEnum.SeeOtherMunicipality)) { if (!tvItemModelInfrastructureTypeTVItemLinkModelListDone.Contains(tvItemModelInfrastructureTypeTVItemLinkModel)) { tvItemModelInfrastructureTypeTVItemLinkModelListFloating.Add(tvItemModelInfrastructureTypeTVItemLinkModel); } } if (tvItemModelInfrastructureTypeTVItemLinkModelList.Count == 0) { sbTemp.AppendLine($@"<tr>"); sbTemp.AppendLine($@"<td colspan=""20"">"); sbTemp.AppendLine($@"<span style=""font-size: 2em;"">{ TaskRunnerServiceRes.NoInfrastructure }</span>"); sbTemp.AppendLine($@"</td>"); sbTemp.AppendLine($@"</tr>"); sbTemp.AppendLine($@"<tr>"); sbTemp.AppendLine($@"<td colspan=""20""> </td>"); sbTemp.AppendLine($@"</tr>"); } else { foreach (TVItemModelInfrastructureTypeTVItemLinkModel tvItemModelInfrastructureTypeTVItemLinkModel in tvItemModelInfrastructureTypeTVItemLinkModelList.Where(c => c.InfrastructureType != InfrastructureTypeEnum.Other && c.InfrastructureType != InfrastructureTypeEnum.SeeOtherMunicipality && c.TVItemModelLinkList.Count == 0)) { InfrastructureItem(sbTemp, tvItemModelInfrastructureTypeTVItemLinkModel, tvItemModelInfrastructureTypeTVItemLinkModelList, true, 0, IsCompact); } foreach (TVItemModelInfrastructureTypeTVItemLinkModel tvItemModelInfrastructureTypeTVItemLinkModel in tvItemModelInfrastructureTypeTVItemLinkModelListFloating) { InfrastructureItem(sbTemp, tvItemModelInfrastructureTypeTVItemLinkModel, tvItemModelInfrastructureTypeTVItemLinkModelListFloating, false, 0, IsCompact); } if (tvItemModelInfrastructureTypeTVItemLinkModelList.Where(c => c.InfrastructureType == InfrastructureTypeEnum.SeeOtherMunicipality).ToList().Count > 0) { ; } { foreach (TVItemModelInfrastructureTypeTVItemLinkModel tvItemModelInfrastructureTypeTVItemLinkModel in tvItemModelInfrastructureTypeTVItemLinkModelList.Where(c => c.InfrastructureType == InfrastructureTypeEnum.SeeOtherMunicipality)) { if (tvItemModelInfrastructureTypeTVItemLinkModel.SeeOtherMunicipalityTVItemID != null) { TVItemModel tvItemModelSeeOther = _TVItemService.GetTVItemModelWithTVItemIDDB((int)tvItemModelInfrastructureTypeTVItemLinkModel.SeeOtherMunicipalityTVItemID); if (string.IsNullOrWhiteSpace(tvItemModelSeeOther.Error)) { sbTemp.AppendLine($@"<tr>"); sbTemp.AppendLine($@"<td colspan=""20"">"); sbTemp.AppendLine($@"<span style=""font-size: 2em;"">{ TaskRunnerServiceRes.NoInfrastructure }</span>"); sbTemp.AppendLine($@"</td>"); sbTemp.AppendLine($@"</tr>"); sbTemp.AppendLine($@"<tr>"); sbTemp.AppendLine($@"<td colspan=""20""> </td>"); sbTemp.AppendLine($@"</tr>"); } } } } } } } sbTemp.AppendLine($@"</table>"); } else { sbTemp.AppendLine($@"<span style=""font-size: 2em;"">{ TaskRunnerServiceRes.NoMunicipalityWithinSubsector }</span>"); } _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 80); return(true); }
private bool GenerateHTMLSUBSECTOR_MWQM_SITES_SALINITY_TABLE(StringBuilder sbTemp) { List <string> Letters = new List <string>() { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t" }; List <int> ClimateSiteUsedList = new List <int>(); int Percent = 10; string NotUsed = ""; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); _TaskRunnerBaseService.SendStatusTextToDB(_TaskRunnerBaseService.GetTextLanguageFormat1List("Creating_", ReportGenerateObjectsKeywordEnum.SUBSECTOR_MWQM_SITES_SALINITY_TABLE.ToString())); List <string> ParamValueList = Parameters.Split("|||".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); // TVItemID and Year already loaded TVItemModel tvItemModelSubsector = _TVItemService.GetTVItemModelWithTVItemIDDB(TVItemID); if (!string.IsNullOrWhiteSpace(tvItemModelSubsector.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFind_With_Equal_, TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat3List("CouldNotFind_With_Equal_", TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); return(false); } string ServerPath = _TVFileService.GetServerFilePath(tvItemModelSubsector.TVItemID); List <TVItemModel> tvItemModelListMWQMSites = _TVItemService.GetChildrenTVItemModelListWithTVItemIDAndTVTypeDB(tvItemModelSubsector.TVItemID, TVTypeEnum.MWQMSite).Where(c => c.IsActive == true).ToList(); List <MWQMSiteModel> mwqmSiteModelList = _MWQMSiteService.GetMWQMSiteModelListWithSubsectorTVItemIDDB(TVItemID); List <MWQMRunModel> mwqmRunModelList = _MWQMRunService.GetMWQMRunModelListWithSubsectorTVItemIDDB(TVItemID); List <MWQMSampleModel> mwqmSampleModelList = _MWQMSampleService.GetMWQMSampleModelListWithSubsectorTVItemIDDB(TVItemID); List <UseOfSiteModel> useOfSiteModelList = _UseOfSiteService.GetUseOfSiteModelListWithSubsectorTVItemIDDB(TVItemID).Where(c => c.TVType == TVTypeEnum.ClimateSite).OrderBy(c => c.Ordinal).ToList(); List <ClimateSiteModel> climateSiteModelList = new List <ClimateSiteModel>(); List <ClimateDataValueModel> climateDataValueModelList = new List <ClimateDataValueModel>(); foreach (UseOfSiteModel useOfSiteModel in useOfSiteModelList) { ClimateSiteModel climateSiteModel = _ClimateSiteService.GetClimateSiteModelWithClimateSiteTVItemIDDB(useOfSiteModel.SiteTVItemID); if (climateSiteModel != null) { climateSiteModelList.Add(climateSiteModel); List <ClimateDataValueModel> climateDataValueModelOneSiteList = _ClimateDataValueService.GetClimateDataValueModelWithClimateSiteIDDB(climateSiteModel.ClimateSiteID); climateDataValueModelList = climateDataValueModelList.Concat(climateDataValueModelOneSiteList).ToList(); } } //climateSiteModelList = climateSiteModelList.OrderBy(c => c.ClimateSiteName).ToList(); List <MWQMSiteModel> mwqmSiteModelList2 = (from s in mwqmSiteModelList from t in tvItemModelListMWQMSites where s.MWQMSiteTVItemID == t.TVItemID && t.IsActive == true orderby s.MWQMSiteTVText select s).ToList(); int skip = 0; int take = 15; bool HasData = true; //int countRun = 0; int TableCount = 0; while (HasData) { Percent += 10; if (Percent > 100) { Percent = 100; } _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); //countRun += 1; //if (countRun > 2) //{ // break; //} List <MWQMRunModel> mwqmRunModelList2 = (from r in mwqmRunModelList from s in mwqmSiteModelList2 from sa in mwqmSampleModelList where sa.MWQMRunTVItemID == r.MWQMRunTVItemID && sa.MWQMSiteTVItemID == s.MWQMSiteTVItemID && r.RunSampleType == SampleTypeEnum.Routine && r.DateTime_Local.Year <= Year orderby r.DateTime_Local descending select r).Distinct().Skip(skip).Take(take).ToList(); bool HasGreen = false; foreach (MWQMRunModel mwqmRunModel in mwqmRunModelList2) { if (RunSiteInfoList.Where(c => c.RunTVItemID == mwqmRunModel.MWQMRunTVItemID).Any()) { HasGreen = true; } } if (mwqmRunModelList2.Count > 0 && HasGreen) { TableCount += 1; bool hasNoData = false; bool hasNotUsed = false; sbTemp.AppendLine($@"|||TableCaption| { TaskRunnerServiceRes.Salinity } #{TableCount}|||"); sbTemp.AppendLine($@" <table class=""FCSalTempDataTableClass"">"); sbTemp.AppendLine($@" <tr>"); sbTemp.AppendLine($@" <th class=""rightBottomBorder"">{ TaskRunnerServiceRes.Site }</th>"); foreach (MWQMRunModel mwqmRunModel in mwqmRunModelList2) { bool runUsed = RunSiteInfoList.Where(c => c.RunTVItemID == mwqmRunModel.MWQMRunTVItemID).Any() ? true : false; if (runUsed) { // sbTemp.AppendLine($@" <th class=""bottomBorderGreentext"">{ mwqmRunModel.DateTime_Local.ToString("yyyy") }<br />{ mwqmRunModel.DateTime_Local.ToString("MMM") }<br />{ mwqmRunModel.DateTime_Local.ToString("dd") }</th>"); //} //else //{ sbTemp.AppendLine($@" <th class=""bottomBorder"">{ mwqmRunModel.DateTime_Local.ToString("yyyy") }<br />{ mwqmRunModel.DateTime_Local.ToString("MMM") }<br />{ mwqmRunModel.DateTime_Local.ToString("dd") }</th>"); } } sbTemp.AppendLine($@" </tr>"); foreach (MWQMSiteModel mwqmSiteModel in mwqmSiteModelList2) { string siteNameWithoutZeros = mwqmSiteModel.MWQMSiteTVText.Trim(); while (true) { if (siteNameWithoutZeros.StartsWith("0")) { siteNameWithoutZeros = siteNameWithoutZeros.Substring(1); } else { break; } } sbTemp.AppendLine($@" <tr>"); sbTemp.AppendLine($@" <td class=""rightBorder"">{ siteNameWithoutZeros }</td>"); foreach (MWQMRunModel mwqmRunModel in mwqmRunModelList2) { bool runUsed = RunSiteInfoList.Where(c => c.RunTVItemID == mwqmRunModel.MWQMRunTVItemID).Any() ? true : false; bool siteUsed = RunSiteInfoList.Where(c => c.RunTVItemID == mwqmRunModel.MWQMRunTVItemID && c.SiteTVItemID == mwqmSiteModel.MWQMSiteTVItemID).Any() ? true : false; float?value = (float?)(from s in mwqmSampleModelList where s.MWQMRunTVItemID == mwqmRunModel.MWQMRunTVItemID && s.MWQMSiteTVItemID == mwqmSiteModel.MWQMSiteTVItemID select s.Salinity_PPT).FirstOrDefault(); string valueStr = value != null ? (((float)value).ToString("F1")) : "--"; //if (showTextGreen) //{ // sbTemp.AppendLine($@" <td class=""textGreen"">{ valueStr }</td>"); //} //else //{ // sbTemp.AppendLine($@" <td>{ valueStr }</td>"); //} if (runUsed) { if (siteUsed) { sbTemp.AppendLine($@" <td>{ valueStr }</td>"); if (valueStr == "--") { hasNoData = true; } } else { if (valueStr == "--") { sbTemp.AppendLine($@" <td>{ valueStr }</td>"); hasNoData = true; } else { sbTemp.AppendLine($@" <td>NU</td>"); hasNotUsed = true; } } } } sbTemp.AppendLine($@" </tr>"); } sbTemp.AppendLine($@" <tr>"); sbTemp.AppendLine($@" <td class=""topRightBorder"">{ TaskRunnerServiceRes.StartTide }<br />{ TaskRunnerServiceRes.EndTide }</td>"); foreach (MWQMRunModel mwqmRunModel in mwqmRunModelList2) { bool runUsed = RunSiteInfoList.Where(c => c.RunTVItemID == mwqmRunModel.MWQMRunTVItemID).Any() ? true : false; if (runUsed) { string StartTide = GetTideInitial(mwqmRunModel.Tide_Start); string EndTide = GetTideInitial(mwqmRunModel.Tide_End); sbTemp.AppendLine($@" <td class=""topRightBorder"">{ StartTide }<br />{ EndTide }</td>"); } } sbTemp.AppendLine($@" </tr>"); sbTemp.AppendLine($@" <tr>"); sbTemp.AppendLine($@" <td class=""topRightBorder"">{ TaskRunnerServiceRes.Rain }(mm)<br />{ TaskRunnerServiceRes.Minus1Day }<br />{ TaskRunnerServiceRes.Minus2Day }<br />{ TaskRunnerServiceRes.Minus3Day }<br />{ TaskRunnerServiceRes.Minus4Day }<br />{ TaskRunnerServiceRes.Minus5Day }</td>"); foreach (MWQMRunModel mwqmRunModel in mwqmRunModelList2) { bool runUsed = RunSiteInfoList.Where(c => c.RunTVItemID == mwqmRunModel.MWQMRunTVItemID).Any() ? true : false; if (runUsed) { string sup1 = ""; string sup2 = ""; string sup3 = ""; string sup4 = ""; string sup5 = ""; DateTime Date1 = mwqmRunModel.DateTime_Local.AddDays(-1); DateTime Date2 = mwqmRunModel.DateTime_Local.AddDays(-2); DateTime Date3 = mwqmRunModel.DateTime_Local.AddDays(-3); DateTime Date4 = mwqmRunModel.DateTime_Local.AddDays(-4); DateTime Date5 = mwqmRunModel.DateTime_Local.AddDays(-5); // RainDay1 for (int i = 0, count = climateSiteModelList.Count; i < count; i++) { if ((from c in climateDataValueModelList where c.DateTime_Local.Year == Date1.Year && c.DateTime_Local.Month == Date1.Month && c.DateTime_Local.Day == Date1.Day && c.TotalPrecip_mm_cm != null && mwqmRunModel.RainDay1_mm != null && c.TotalPrecip_mm_cm == mwqmRunModel.RainDay1_mm && c.ClimateSiteID == climateSiteModelList[i].ClimateSiteID select c).Any()) { sup1 = Letters[i]; if (!ClimateSiteUsedList.Contains(i)) { ClimateSiteUsedList.Add(i); } break; } } // RainDay2 for (int i = 0, count = climateSiteModelList.Count; i < count; i++) { if ((from c in climateDataValueModelList where c.DateTime_Local.Year == Date2.Year && c.DateTime_Local.Month == Date2.Month && c.DateTime_Local.Day == Date2.Day && c.TotalPrecip_mm_cm != null && mwqmRunModel.RainDay2_mm != null && c.TotalPrecip_mm_cm == mwqmRunModel.RainDay2_mm && c.ClimateSiteID == climateSiteModelList[i].ClimateSiteID select c).Any()) { sup2 = Letters[i]; if (!ClimateSiteUsedList.Contains(i)) { ClimateSiteUsedList.Add(i); } break; } } // RainDay3 for (int i = 0, count = climateSiteModelList.Count; i < count; i++) { if ((from c in climateDataValueModelList where c.DateTime_Local.Year == Date3.Year && c.DateTime_Local.Month == Date3.Month && c.DateTime_Local.Day == Date3.Day && c.TotalPrecip_mm_cm != null && mwqmRunModel.RainDay3_mm != null && c.TotalPrecip_mm_cm == mwqmRunModel.RainDay3_mm && c.ClimateSiteID == climateSiteModelList[i].ClimateSiteID select c).Any()) { sup3 = Letters[i]; if (!ClimateSiteUsedList.Contains(i)) { ClimateSiteUsedList.Add(i); } break; } } // RainDay4 for (int i = 0, count = climateSiteModelList.Count; i < count; i++) { if ((from c in climateDataValueModelList where c.DateTime_Local.Year == Date4.Year && c.DateTime_Local.Month == Date4.Month && c.DateTime_Local.Day == Date4.Day && c.TotalPrecip_mm_cm != null && mwqmRunModel.RainDay4_mm != null && c.TotalPrecip_mm_cm == mwqmRunModel.RainDay4_mm && c.ClimateSiteID == climateSiteModelList[i].ClimateSiteID select c).Any()) { sup4 = Letters[i]; if (!ClimateSiteUsedList.Contains(i)) { ClimateSiteUsedList.Add(i); } break; } } // RainDay5 for (int i = 0, count = climateSiteModelList.Count; i < count; i++) { if ((from c in climateDataValueModelList where c.DateTime_Local.Year == Date5.Year && c.DateTime_Local.Month == Date5.Month && c.DateTime_Local.Day == Date5.Day && c.TotalPrecip_mm_cm != null && mwqmRunModel.RainDay5_mm != null && c.TotalPrecip_mm_cm == mwqmRunModel.RainDay5_mm && c.ClimateSiteID == climateSiteModelList[i].ClimateSiteID select c).Any()) { sup5 = Letters[i]; if (!ClimateSiteUsedList.Contains(i)) { ClimateSiteUsedList.Add(i); } break; } } string RainDay1 = mwqmRunModel.RainDay1_mm != null ? ((double)mwqmRunModel.RainDay1_mm).ToString("F0") : "--"; string RainDay2 = mwqmRunModel.RainDay2_mm != null ? ((double)mwqmRunModel.RainDay2_mm).ToString("F0") : "--"; string RainDay3 = mwqmRunModel.RainDay3_mm != null ? ((double)mwqmRunModel.RainDay3_mm).ToString("F0") : "--"; string RainDay4 = mwqmRunModel.RainDay4_mm != null ? ((double)mwqmRunModel.RainDay4_mm).ToString("F0") : "--"; string RainDay5 = mwqmRunModel.RainDay5_mm != null ? ((double)mwqmRunModel.RainDay5_mm).ToString("F0") : "--"; sbTemp.AppendLine($@" <td class=""topRightBorder""> <br />{ RainDay1 }<sup>{ sup1 }</sup><br />{ RainDay2 }<sup>{ sup2 }</sup><br />{ RainDay3 }<sup>{ sup3 }</sup><br />{ RainDay4 }<sup>{ sup4 }</sup><br />{ RainDay5 }<sup>{ sup5 }</sup></td>"); } } sbTemp.AppendLine($@" </tr>"); sbTemp.AppendLine($@" </table>"); //sbTemp.AppendLine($@" <p><span class=""textGreen"">({ TaskRunnerServiceRes.DataUsedForStatistics })</span>"); sbTemp.AppendLine($@" <p><span>"); if (hasNoData) { sbTemp.AppendLine($@" -- ({TaskRunnerServiceRes.NoData})</span>"); } if (hasNotUsed) { sbTemp.AppendLine($@" NU ({TaskRunnerServiceRes.NotUsed})"); } sbTemp.AppendLine($@" </span>"); sbTemp.AppendLine($@" <span> { TaskRunnerServiceRes.ClimateSite }</span>: "); foreach (int i in ClimateSiteUsedList) { sbTemp.Append($@" <span>{ Letters[i] } - { climateSiteModelList[i].ClimateSiteName }<span> "); } sbTemp.AppendLine($@" </p>"); sbTemp.AppendLine(@"<p>|||PAGE_BREAK|||</p>"); skip += take; } else { HasData = false; } } _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, 80); return(true); }
private bool GenerateHTMLSUBSECTOR_RE_EVALUATION_COVER_PAGE(StringBuilder sbTemp) { int Percent = 10; string NotUsed = ""; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); _TaskRunnerBaseService.SendStatusTextToDB(_TaskRunnerBaseService.GetTextLanguageFormat1List("Creating_", ReportGenerateObjectsKeywordEnum.SUBSECTOR_RE_EVALUATION_COVER_PAGE.ToString())); List <string> ParamValueList = Parameters.Split("|||".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); // TVItemID and Year already loaded TVItemModel tvItemModelSubsector = _TVItemService.GetTVItemModelWithTVItemIDDB(TVItemID); if (!string.IsNullOrWhiteSpace(tvItemModelSubsector.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFind_With_Equal_, TaskRunnerServiceRes.TVItem, TaskRunnerServiceRes.TVItemID, TVItemID.ToString()); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageList(tvItemModelSubsector.Error); return(false); } List <TVItemModel> tvItemModelParentList = _TVItemService.GetParentsTVItemModelList(tvItemModelSubsector.TVPath); TVItemModel tvItemModelProv = new TVItemModel(); foreach (TVItemModel tvItemModel in tvItemModelParentList) { if (tvItemModel.TVType == TVTypeEnum.Province) { tvItemModelProv = tvItemModel; } } string ProvInitCap = ""; switch (tvItemModelProv.TVText) { case "New Brunswick": case "Nouveau-Brunswick": { ProvInitCap = "NB"; } break; case "Newfoundland and Labrador": case "Terre-Neuve_et-Labrador": { ProvInitCap = "NL"; } break; case "Nova Scotia": case "Nouvelle-Écosse": { ProvInitCap = "NS"; } break; case "Prince Edward Island": case "Île-du-Prince-Édouard": { ProvInitCap = "PE"; } break; case "British Columbia": case "Colombie-Britannique": { ProvInitCap = "BC"; } break; case "Quebec": case "Québec": { ProvInitCap = "QC"; } break; default: break; } TVItemModel tvItemModelRoot = _TVItemService.GetRootTVItemModelDB(); if (!string.IsNullOrWhiteSpace(tvItemModelRoot.Error)) { NotUsed = TaskRunnerServiceRes.CouldNotFindTVItemRoot; _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageList("CouldNotFindTVItemRoot"); return(false); } string ServerPath = _TVFileService.GetServerFilePath(tvItemModelRoot.TVItemID); TVFileModel tvFileModelFullReportCoverPageCanadaFlag = _TVFileService.GetTVFileModelWithServerFilePathAndServerFileNameDB(ServerPath, "CanadaFlag.png"); if (!string.IsNullOrWhiteSpace(tvFileModelFullReportCoverPageCanadaFlag.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFindFile_, ServerPath + "CanadaFlag.png"); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat1List("CouldNotFindFile_", ServerPath + "CanadaFlag.png"); return(false); } FileInfo fiFullReportCoverPageImageCanadaFlag = new FileInfo(tvFileModelFullReportCoverPageCanadaFlag.ServerFilePath + tvFileModelFullReportCoverPageCanadaFlag.ServerFileName); if (!fiFullReportCoverPageImageCanadaFlag.Exists) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFindFile_, fiFullReportCoverPageImageCanadaFlag.FullName); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat1List("CouldNotFindFile_", fiFullReportCoverPageImageCanadaFlag.FullName); return(false); } TVFileModel tvFileModelFullReportCoverPageLeafRight = _TVFileService.GetTVFileModelWithServerFilePathAndServerFileNameDB(ServerPath, "LeafRight.png"); if (!string.IsNullOrWhiteSpace(tvFileModelFullReportCoverPageLeafRight.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFindFile_, ServerPath + "LeafRight.png"); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat1List("CouldNotFindFile_", ServerPath + "LeafRight.png"); return(false); } FileInfo fiFullReportCoverPageImageLeafRight = new FileInfo(tvFileModelFullReportCoverPageLeafRight.ServerFilePath + tvFileModelFullReportCoverPageLeafRight.ServerFileName); if (!fiFullReportCoverPageImageLeafRight.Exists) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFindFile_, fiFullReportCoverPageImageLeafRight.FullName); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat1List("CouldNotFindFile_", fiFullReportCoverPageImageLeafRight.FullName); return(false); } TVFileModel tvFileModelFullReportCoverPageBarTopBottom = _TVFileService.GetTVFileModelWithServerFilePathAndServerFileNameDB(ServerPath, "BarTopBottom.png"); if (!string.IsNullOrWhiteSpace(tvFileModelFullReportCoverPageBarTopBottom.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFindFile_, ServerPath + "BarTopBottom.png"); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat1List("CouldNotFindFile_", ServerPath + "BarTopBottom.png"); return(false); } FileInfo fiFullReportCoverPageImageBarTopBottom = new FileInfo(tvFileModelFullReportCoverPageBarTopBottom.ServerFilePath + tvFileModelFullReportCoverPageBarTopBottom.ServerFileName); if (!fiFullReportCoverPageImageBarTopBottom.Exists) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFindFile_, fiFullReportCoverPageImageBarTopBottom.FullName); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat1List("CouldNotFindFile_", fiFullReportCoverPageImageBarTopBottom.FullName); return(false); } TVFileModel tvFileModelFullReportCoverPageThreeImagesBottom = _TVFileService.GetTVFileModelWithServerFilePathAndServerFileNameDB(ServerPath, "ThreeImagesBottom.png"); if (!string.IsNullOrWhiteSpace(tvFileModelFullReportCoverPageThreeImagesBottom.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFindFile_, ServerPath + "ThreeImagesBottom.png"); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat1List("CouldNotFindFile_", ServerPath + "ThreeImagesBottom.png"); return(false); } FileInfo fiFullReportCoverPageImageThreeImagesBottom = new FileInfo(tvFileModelFullReportCoverPageThreeImagesBottom.ServerFilePath + tvFileModelFullReportCoverPageThreeImagesBottom.ServerFileName); if (!fiFullReportCoverPageImageThreeImagesBottom.Exists) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFindFile_, fiFullReportCoverPageImageThreeImagesBottom.FullName); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat1List("CouldNotFindFile_", fiFullReportCoverPageImageThreeImagesBottom.FullName); return(false); } TVFileModel tvFileModelFullReportCoverPageCanadaWithFlag = _TVFileService.GetTVFileModelWithServerFilePathAndServerFileNameDB(ServerPath, "CanadaWithFlag.png"); if (!string.IsNullOrWhiteSpace(tvFileModelFullReportCoverPageCanadaWithFlag.Error)) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFindFile_, ServerPath + "CanadaWithFlag.png"); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat1List("CouldNotFindFile_", ServerPath + "CanadaWithFlag.png"); return(false); } FileInfo fiFullReportCoverPageImageCanadaWithFlag = new FileInfo(tvFileModelFullReportCoverPageCanadaWithFlag.ServerFilePath + tvFileModelFullReportCoverPageCanadaWithFlag.ServerFileName); if (!fiFullReportCoverPageImageCanadaWithFlag.Exists) { NotUsed = string.Format(TaskRunnerServiceRes.CouldNotFindFile_, fiFullReportCoverPageImageCanadaWithFlag.FullName); _TaskRunnerBaseService._BWObj.TextLanguageList = _TaskRunnerBaseService.GetTextLanguageFormat1List("CouldNotFindFile_", fiFullReportCoverPageImageCanadaWithFlag.FullName); return(false); } List <TVItemModel> tvItemModelListParent = _TVItemService.GetParentsTVItemModelList(tvItemModelSubsector.TVPath); TVItemModel tvItemModelProvince = new TVItemModel(); foreach (TVItemModel tvItemModel in tvItemModelListParent) { if (tvItemModel.TVType == TVTypeEnum.Province) { tvItemModelProvince = tvItemModel; break; } } int Pos = tvItemModelSubsector.TVText.IndexOf(" "); string SubsectorShort = "Error"; string SubsectorEndPart = "Error"; if (Pos > 0) { SubsectorShort = tvItemModelSubsector.TVText.Substring(0, Pos).Trim(); SubsectorEndPart = tvItemModelSubsector.TVText.Substring(Pos).Trim(); if (SubsectorEndPart.StartsWith("(")) { SubsectorEndPart = SubsectorEndPart.Substring(1); } if (SubsectorEndPart.EndsWith(")")) { SubsectorEndPart = SubsectorEndPart.Substring(0, SubsectorEndPart.Length - 1); } } Percent = 30; _TaskRunnerBaseService.SendPercentToDB(_TaskRunnerBaseService._BWObj.appTaskModel.AppTaskID, Percent); sbTemp.AppendLine($@" <table>"); sbTemp.AppendLine($@" <tr>"); sbTemp.AppendLine($@" <td>|||Image|FileName,{ fiFullReportCoverPageImageCanadaFlag.FullName }|width,45|height,20|||<br /><br /><br /><br /><br /><br /></td> "); sbTemp.AppendLine($@" <td> <br /><br /><br /><br /><br /></td>"); sbTemp.AppendLine($@" <td class=""textAlignLeft""><p>Environment and <br />Climate Change Canada</p><br /><br /><br /><br /></td>"); sbTemp.AppendLine($@" <td> <br /><br /><br /><br /><br /></td>"); sbTemp.AppendLine($@" <td class=""textAlignLeft""><p>Environnement et <br />Changement climatique Canada</p><br /><br /><br /><br /></td>"); sbTemp.AppendLine($@" <td>|||Image|FileName,{ fiFullReportCoverPageImageLeafRight.FullName }|width,180|height,100|||</td> "); sbTemp.AppendLine($@" </tr>"); sbTemp.AppendLine($@" <tr>"); sbTemp.AppendLine($@" <td colspan=""6"">|||Image|FileName,{ fiFullReportCoverPageImageBarTopBottom.FullName }|width,467|height,10|||</td> "); sbTemp.AppendLine($@" </tr>"); sbTemp.AppendLine($@" </table>"); sbTemp.AppendLine($@" <div>"); sbTemp.AppendLine($@" <p> </p>"); sbTemp.AppendLine($@" <hr style=""color: blue"" />"); sbTemp.AppendLine($@" <p class=""textAlignLeft"" style=""font-size: 1.2em;"">"); sbTemp.AppendLine($@" <strong>{ TaskRunnerServiceRes.ShellfishWaterClassificationProgram } ({ TaskRunnerServiceRes.SWCP }) </strong>"); sbTemp.AppendLine($@" </p>"); sbTemp.AppendLine($@" <p class=""textAlignLeft"" style=""font-size: 1.2em;"">"); sbTemp.AppendLine($@" <strong>{ TaskRunnerServiceRes.ReEvaluationReport }</strong> |||STATISTICS_LAST_YEAR|||"); sbTemp.AppendLine($@" </p>"); sbTemp.AppendLine($@" <hr style=""color: blue"" />"); if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName == "fr") { sbTemp.AppendLine($@" <p class=""textAlignLeft"" style=""font-size: 1.2em;""><strong>{ TaskRunnerServiceRes.ShellfishGrowingArea} (|||PROVINCE_INITIAL|||)</strong></p>"); } else { sbTemp.AppendLine($@" <p class=""textAlignLeft"" style=""font-size: 1.2em;""><strong>|||PROVINCE_INITIAL||| { TaskRunnerServiceRes.ShellfishGrowingArea}</strong></p>"); } sbTemp.AppendLine($@" <p class=""textAlignLeft"" style=""font-size: 1.2em;"">|||SUBSECTOR_NAME_SHORT|||</p>"); sbTemp.AppendLine($@" <p class=""textAlignLeft"" style=""font-size: 1.2em;"">|||SUBSECTOR_NAME_TEXT|||</p>"); sbTemp.AppendLine($@" <hr style=""color: blue"" />"); sbTemp.AppendLine($@" <p class=""textAlignLeft"" style=""font-size: 1.2em;""><strong>{ TaskRunnerServiceRes.Authors }:</strong> |||{ProvInitCap}_AUTHORS|||</p>"); if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName == "fr") { sbTemp.AppendLine($@" <p class=""textAlignLeft"" style=""font-size: 1.2em;""><strong>{ TaskRunnerServiceRes.ReportID }:</strong> RE-|||STATISTICS_LAST_YEAR||| ({ SubsectorShort }) { TaskRunnerServiceRes.Created } { DateTime.Now.ToString("dd MMMM, yyyy") }</p>"); } else { sbTemp.AppendLine($@" <p class=""textAlignLeft"" style=""font-size: 1.2em;""><strong>{ TaskRunnerServiceRes.ReportID }:</strong> RE-|||STATISTICS_LAST_YEAR||| ({ SubsectorShort }) { TaskRunnerServiceRes.Created } { DateTime.Now.ToString("MMMM dd, yyyy") }</p>"); } sbTemp.AppendLine($@" <hr style=""color: blue"" />"); sbTemp.AppendLine($@" <p> </p>"); sbTemp.AppendLine($@" </div>"); sbTemp.AppendLine($@" <div>"); sbTemp.AppendLine($@" |||Image|FileName,{ fiFullReportCoverPageImageThreeImagesBottom.FullName }|width,467|height,110|||"); sbTemp.AppendLine($@" </div>"); sbTemp.AppendLine($@" <div class=""textAlignRight"">"); sbTemp.AppendLine($@" |||Image|FileName,{ fiFullReportCoverPageImageCanadaWithFlag.FullName }|width,76|height,22|||"); sbTemp.AppendLine($@" </div>"); return(true); }