private void next(TVItemModelInfrastructureTypeTVItemLinkModel tvItemModelInfrastructureTypeTVItemLinkModel, List <TVItemModelInfrastructureTypeTVItemLinkModel> tvItemModelInfrastructureTypeTVItemLinkModelList, List <TVItemModelInfrastructureTypeTVItemLinkModel> tvItemModelInfrastructureTypeTVItemLinkModelListDone) { if (!tvItemModelInfrastructureTypeTVItemLinkModelListDone.Contains(tvItemModelInfrastructureTypeTVItemLinkModel)) { tvItemModelInfrastructureTypeTVItemLinkModelListDone.Add(tvItemModelInfrastructureTypeTVItemLinkModel); } foreach (TVItemModelInfrastructureTypeTVItemLinkModel tvItemModelInfrastructureTypeTVItemLinkModelNext in tvItemModelInfrastructureTypeTVItemLinkModelList.Where(c => c.FlowTo == tvItemModelInfrastructureTypeTVItemLinkModel).ToList()) { next(tvItemModelInfrastructureTypeTVItemLinkModelNext, tvItemModelInfrastructureTypeTVItemLinkModelList, tvItemModelInfrastructureTypeTVItemLinkModelListDone); } }
private void InfrastructureItem(StringBuilder sbTemp, TVItemModelInfrastructureTypeTVItemLinkModel tvItemModelInfrastructureTypeTVItemLinkModel, List <TVItemModelInfrastructureTypeTVItemLinkModel> tvItemModelInfrastructureTypeTVItemLinkModelList, bool DoNext, int Level, bool IsCompact) { string InfType = ""; TVTypeEnum tvType = TVTypeEnum.Error; switch (tvItemModelInfrastructureTypeTVItemLinkModel.InfrastructureType) { case InfrastructureTypeEnum.LiftStation: { InfType = "(LS)"; tvType = TVTypeEnum.LiftStation; } break; case InfrastructureTypeEnum.LineOverflow: { InfType = "(LO)"; tvType = TVTypeEnum.LineOverflow; } break; case InfrastructureTypeEnum.WWTP: { InfType = "(W)"; tvType = TVTypeEnum.WasteWaterTreatmentPlant; } break; default: break; } InfrastructureModel infrastructureModel = _InfrastructureService.GetInfrastructureModelWithInfrastructureTVItemIDDB(tvItemModelInfrastructureTypeTVItemLinkModel.TVItemModel.TVItemID); if (string.IsNullOrWhiteSpace(infrastructureModel.Error)) { if (IsCompact) { sbTemp.AppendLine($@"<tr>"); for (int i = 0; i < Level + 1; i++) { sbTemp.AppendLine($@"<td> </td>"); } sbTemp.AppendLine($@"<td style=""border-left: solid black 1px; border-bottom: solid black 1px"" colspan=""{19 - Level}"">"); sbTemp.AppendLine($@"<span>{InfType} - {tvItemModelInfrastructureTypeTVItemLinkModel.TVItemModel.TVText}</span>"); sbTemp.AppendLine($@"</tr>"); //sbTemp.AppendLine($@"<td colspan=""20""> </td>"); //sbTemp.AppendLine($@"</tr>"); } else { List <MapInfoPointModel> mapInfoPointModelList = _MapInfoService._MapInfoPointService.GetMapInfoPointModelListWithTVItemIDAndTVTypeAndMapInfoDrawTypeDB(tvItemModelInfrastructureTypeTVItemLinkModel.TVItemModel.TVItemID, tvType, MapInfoDrawTypeEnum.Point); List <MapInfoPointModel> mapInfoPointModelListOut = _MapInfoService._MapInfoPointService.GetMapInfoPointModelListWithTVItemIDAndTVTypeAndMapInfoDrawTypeDB(tvItemModelInfrastructureTypeTVItemLinkModel.TVItemModel.TVItemID, TVTypeEnum.Outfall, MapInfoDrawTypeEnum.Point); if (mapInfoPointModelList.Count > 0 && mapInfoPointModelListOut.Count > 0) { sbTemp.AppendLine($@"<tr>"); for (int i = 0; i < Level + 1; i++) { sbTemp.AppendLine($@"<td> </td>"); } sbTemp.AppendLine($@"<td style=""border-left: solid black 1px; border-bottom: solid black 1px"" colspan=""{19 - Level}"">"); sbTemp.AppendLine($@"<span>{InfType} - <b>{tvItemModelInfrastructureTypeTVItemLinkModel.TVItemModel.TVText} { TaskRunnerServiceRes.Lat } { TaskRunnerServiceRes.Long } {mapInfoPointModelList[0].Lat} {mapInfoPointModelList[0].Lng}</b></span>"); sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.Outfall } { TaskRunnerServiceRes.Lat } { TaskRunnerServiceRes.Long }:</b> {mapInfoPointModelListOut[0].Lat} {mapInfoPointModelListOut[0].Lng}"); sbTemp.AppendLine($@"</tr>"); sbTemp.AppendLine($@"<td colspan=""20""> </td>"); sbTemp.AppendLine($@"</tr>"); } else { sbTemp.AppendLine($@"<tr>"); for (int i = 0; i < Level + 1; i++) { sbTemp.AppendLine($@"<td> </td>"); } sbTemp.AppendLine($@"<td colspan=""{19 - Level}"">"); sbTemp.AppendLine($@"<h4>{InfType} - <b>{tvItemModelInfrastructureTypeTVItemLinkModel.TVItemModel.TVText}</b></h4>"); sbTemp.AppendLine($@"</td>"); sbTemp.AppendLine($@"</tr>"); sbTemp.AppendLine($@"<td colspan=""20""> </td>"); sbTemp.AppendLine($@"</tr>"); } if (infrastructureModel.CivicAddressTVItemID != null) { AddressModel addressModel = _AddressService.GetAddressModelWithAddressTVItemIDDB((int)infrastructureModel.CivicAddressTVItemID); if (string.IsNullOrWhiteSpace(addressModel.Error)) { string CivicAddress = ""; if (_TaskRunnerBaseService._BWObj.appTaskModel.Language == LanguageEnum.fr) { CivicAddress = $"{addressModel.StreetNumber} {addressModel.StreetName} {_BaseEnumService.GetEnumText_StreetTypeEnum(addressModel.StreetType)} {addressModel.MunicipalityTVText} {addressModel.ProvinceTVText} {addressModel.CountryTVText} {addressModel.PostalCode}"; } else { CivicAddress = $"{addressModel.StreetNumber} {addressModel.StreetName} {_BaseEnumService.GetEnumText_StreetTypeEnum(addressModel.StreetType)} {addressModel.MunicipalityTVText} {addressModel.ProvinceTVText} {addressModel.CountryTVText} {addressModel.PostalCode}"; } _AddressService.CreateTVText(addressModel); sbTemp.AppendLine($@"<tr>"); for (int i = 0; i < Level + 2; i++) { sbTemp.AppendLine($@"<td> </td>"); } sbTemp.AppendLine($@"<td colspan=""{18 - Level}"">"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.CivicAddress }:</b> {CivicAddress}<br />"); sbTemp.AppendLine($@"</td>"); sbTemp.AppendLine($@"</tr>"); } } sbTemp.AppendLine($@"<tr>"); for (int i = 0; i < Level + 2; i++) { sbTemp.AppendLine($@"<td> </td>"); } sbTemp.AppendLine($@"<td style=""border-left: solid black 1px; border-bottom: solid black 1px"" colspan=""{18 - Level}"">"); if (tvType == TVTypeEnum.WasteWaterTreatmentPlant && infrastructureModel.FacilityType == FacilityTypeEnum.Lagoon) { sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.FacilityType }:</b> {_BaseEnumService.GetEnumText_FacilityTypeEnum(infrastructureModel.FacilityType)}"); if (infrastructureModel.IsMechanicallyAerated != null) { sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.IsMechanicallyAerated }:</b> {infrastructureModel.IsMechanicallyAerated}"); if ((bool)infrastructureModel.IsMechanicallyAerated) { sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.AerationType }:</b> {_BaseEnumService.GetEnumText_AerationTypeEnum(infrastructureModel.AerationType)}"); } } sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.NumberOfCells }:</b> {infrastructureModel.NumberOfCells}"); sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.NumberOfAeratedCells }:</b> {infrastructureModel.NumberOfAeratedCells}"); } else if (tvType == TVTypeEnum.WasteWaterTreatmentPlant && infrastructureModel.FacilityType == FacilityTypeEnum.Plant) { sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.FacilityType }:</b> {_BaseEnumService.GetEnumText_FacilityTypeEnum(infrastructureModel.FacilityType)}"); if (infrastructureModel.PreliminaryTreatmentType != null) { sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.PreliminaryTreatmentType }:</b> {_BaseEnumService.GetEnumText_PreliminaryTreatmentTypeEnum(infrastructureModel.PreliminaryTreatmentType)}"); } if (infrastructureModel.PrimaryTreatmentType != null) { sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.PrimaryTreatmentType }:</b> {_BaseEnumService.GetEnumText_PrimaryTreatmentTypeEnum(infrastructureModel.PrimaryTreatmentType)}"); } if (infrastructureModel.SecondaryTreatmentType != null) { sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.SecondaryTreatmentType }:</b> {_BaseEnumService.GetEnumText_SecondaryTreatmentTypeEnum(infrastructureModel.SecondaryTreatmentType)}"); } if (infrastructureModel.TertiaryTreatmentType != null) { sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.TertiaryTreatmentType }:</b> {_BaseEnumService.GetEnumText_TertiaryTreatmentTypeEnum(infrastructureModel.TertiaryTreatmentType)}"); } } if (tvType == TVTypeEnum.WasteWaterTreatmentPlant) { if (infrastructureModel.DisinfectionType != null) { sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.DisinfectionType }:</b> {_BaseEnumService.GetEnumText_DisinfectionTypeEnum(infrastructureModel.DisinfectionType)}"); } if (infrastructureModel.CollectionSystemType != null) { sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.CollectionSystemType }:</b> {_BaseEnumService.GetEnumText_CollectionSystemTypeEnum(infrastructureModel.CollectionSystemType)}"); } sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.DesignFlow }:</b> {infrastructureModel.DesignFlow_m3_day} (m<sup>3</sup>/{TaskRunnerServiceRes.day})"); sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.AverageFlow }:</b> {infrastructureModel.AverageFlow_m3_day} (m<sup>3</sup>/{TaskRunnerServiceRes.day})"); sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.PeakFlow }:</b> {infrastructureModel.PeakFlow_m3_day} (m<sup>3</sup>/{TaskRunnerServiceRes.day})"); sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.PopulationServed }:</b> {infrastructureModel.PopServed}"); } sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.PercentOfFlow }:</b> {infrastructureModel.PercFlowOfTotal} %"); if (infrastructureModel.AlarmSystemType != null) { sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.AlarmSystemType }:</b> {_BaseEnumService.GetEnumText_AlarmSystemTypeEnum(infrastructureModel.AlarmSystemType)}"); } if (infrastructureModel.CanOverflow != null) { sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.CanOverflow }:</b> {infrastructureModel.CanOverflow}"); if (infrastructureModel.ValveType != null) { sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.ValveType }:</b> {_BaseEnumService.GetEnumText_ValveTypeEnum(infrastructureModel.ValveType)}"); } } if (infrastructureModel.HasBackupPower != null) { sbTemp.AppendLine($@" <b>{ TaskRunnerServiceRes.HasBackupPower }:</b> {infrastructureModel.HasBackupPower}"); } if (!string.IsNullOrWhiteSpace(infrastructureModel.Comment)) { sbTemp.AppendLine($@"<br /><h4>{ TaskRunnerServiceRes.Comments }</h4>{infrastructureModel.Comment}<br />"); } sbTemp.AppendLine($@"<h4>Outfall</h4>"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.AverageDepth }:</b> {infrastructureModel.AverageDepth_m} (m)"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.DecayRate }:</b> {infrastructureModel.DecayRate_per_day} (/{ TaskRunnerServiceRes.day})"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.DistanceFromShore }:</b> {infrastructureModel.DistanceFromShore_m} (m)"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.FarFieldVelocity }:</b> {infrastructureModel.FarFieldVelocity_m_s} (m/s)"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.HorizontalAngle }:</b> {infrastructureModel.HorizontalAngle_deg} (deg)"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.NearFieldVelocity }:</b> {infrastructureModel.NearFieldVelocity_m_s} (m/s)"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.NumberOfPorts }:</b> {infrastructureModel.NumberOfPorts}"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.PortDiameter }:</b> {infrastructureModel.PortDiameter_m} (m)"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.PortElevation }:</b> {infrastructureModel.PortElevation_m} (m)"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.PortSpacing }:</b> {infrastructureModel.PortSpacing_m} (m)"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.ReceivingWater }:</b> {infrastructureModel.ReceivingWater_MPN_per_100ml} (MPN/100 mL)"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.ReceivingWaterSalinity }:</b> {infrastructureModel.ReceivingWaterSalinity_PSU} (PSU)"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.ReceivingWaterTemperature }:</b> {infrastructureModel.ReceivingWaterTemperature_C} (ºC)"); sbTemp.AppendLine($@"<b>{ TaskRunnerServiceRes.VerticalAngle }:</b> {infrastructureModel.VerticalAngle_deg} (deg)"); sbTemp.AppendLine($@"</td>"); sbTemp.AppendLine($@"</tr>"); sbTemp.AppendLine($@"<td colspan=""20""> </td>"); sbTemp.AppendLine($@"</tr>"); } } if (DoNext) { foreach (TVItemModelInfrastructureTypeTVItemLinkModel tvItemModelInfrastructureTypeTVItemLinkModelNext in tvItemModelInfrastructureTypeTVItemLinkModelList.Where(c => c.FlowTo == tvItemModelInfrastructureTypeTVItemLinkModel).ToList()) { InfrastructureItem(sbTemp, tvItemModelInfrastructureTypeTVItemLinkModelNext, tvItemModelInfrastructureTypeTVItemLinkModelList, true, Level + 1, IsCompact); } } }