private WasteTypeData GetWasteType(NotificationApplication notification) { WasteTypeData chemicalComposition = null; if (notification.WasteType != null) { chemicalComposition = wasteTypeMapper.Map(notification.WasteType); } return(chemicalComposition); }
public ChemicalCompositionViewModel Map(WasteTypeData source, ICollection <WoodInformationData> parameter) { var result = new ChemicalCompositionViewModel(); if (source.WasteAdditionalInformation.Any()) { result.WasteComposition = SetExistingInformations(parameter, source); } else { result.WasteComposition = parameter.ToList(); } result.Energy = source.EnergyInformation; return(result); }
private List <WoodInformationData> SetExistingInformations(ICollection <WoodInformationData> compositions, WasteTypeData existingData) { var result = new List <WoodInformationData>(existingData.WasteAdditionalInformation); var notApplicableCompositions = compositions.Where( wc => existingData.WasteAdditionalInformation .All(c => c.WasteInformationType != wc.WasteInformationType)) .Select(wc => new WoodInformationData { Constituent = wc.Constituent, WasteInformationType = wc.WasteInformationType, MinConcentration = NotApplicable, MaxConcentration = NotApplicable }); result.AddRange(notApplicableCompositions); return(result); }
private bool CheckForChangesInSecondScreen(WasteTypeData existingWasteTypeData, List <WasteTypeCompositionData> filteredWasteCompositions, string futherInformation, bool hasAnnex, ChemicalComposition chemicalCompositionType) { if (chemicalCompositionType != existingWasteTypeData.ChemicalCompositionType) { return(true); } if (futherInformation != existingWasteTypeData.FurtherInformation) { return(true); } if (hasAnnex != existingWasteTypeData.HasAnnex) { return(true); } if (filteredWasteCompositions.Count != existingWasteTypeData.WasteCompositionData.Count) { return(true); } foreach (var newData in filteredWasteCompositions) { var existingData = existingWasteTypeData.WasteCompositionData.FirstOrDefault(p => p.ChemicalCompositionCategory == newData.ChemicalCompositionCategory); if (existingData == null) { return(true); } if (existingData.Constituent != newData.Constituent || existingData.MaxConcentration != Decimal.Parse(newData.MaxConcentration) || existingData.MinConcentration != Decimal.Parse(newData.MinConcentration) || existingData.Constituent != newData.Constituent) { return(true); } } return(false); }
private bool CheckForChangesInFirstScreen(WasteTypeData existingWasteTypeData, List <WoodInformationData> filteredWasteCompositions, string energy, ChemicalComposition chemicalCompositionType) { if (existingWasteTypeData.EnergyInformation != energy) { return(true); } if (existingWasteTypeData.ChemicalCompositionType != chemicalCompositionType) { return(true); } foreach (var newData in filteredWasteCompositions) { var existingData = existingWasteTypeData.WasteAdditionalInformation.FirstOrDefault(p => p.WasteInformationType == newData.WasteInformationType); if (existingData.Constituent != newData.Constituent || Double.Parse(existingData.MaxConcentration) != Double.Parse(newData.MaxConcentration) || Double.Parse(existingData.MinConcentration) != Double.Parse(newData.MinConcentration)) { return(true); } } return(false); }
private bool ContainsCompositionData(WasteTypeData wasteTypeData) { return(wasteTypeData != null && wasteTypeData.WasteAdditionalInformation != null && wasteTypeData.WasteAdditionalInformation.Count > 0); }
private bool ContainsData(WasteTypeData wasteTypeData) { return(wasteTypeData != null && wasteTypeData.WasteCompositionData != null && wasteTypeData.WasteCompositionData.Count > 0); }