Exemplo n.º 1
0
        public static void createEarth()
        {
            List <double> percentageList = new List <double>();


            ChemicalElement        element;
            List <ChemicalElement> chemicalElements = new List <ChemicalElement>();

            element = PeriodicTable.findByName("Nitrogen");
            chemicalElements.Add(element);
            percentageList.Add(78.08);

            element = PeriodicTable.findByName("Oxygen");
            chemicalElements.Add(element);
            percentageList.Add(20.95);

            element = PeriodicTable.findByName("Argon");
            chemicalElements.Add(element);
            percentageList.Add(0.93);
            element = PeriodicTable.findByName("Carbon");
            chemicalElements.Add(element);
            percentageList.Add(0.04);


            ChemicalComposition chemicalComposition = new ChemicalComposition(chemicalElements, percentageList);
            Planet x = new Planet(chemicalComposition, ParametriUtente.Science.r_t, ParametriUtente.Science.AU);

            x.initPlanet();

            Console.WriteLine("Earth created check debug values");
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Parameters(Guid id, ChemicalComposition chemicalCompositionType, bool?backToOverview = null)
        {
            var model = GetBlankCompositionViewModel(id, chemicalCompositionType);

            await GetExistingParameters(id, chemicalCompositionType, model);

            return(View(model));
        }
Exemplo n.º 3
0
 public UpdateWasteType(Guid notificationId, ChemicalComposition chemicalCompositionType,
                        string furtherInformation, List <WasteTypeCompositionData> wasteCompositions)
 {
     NotificationId                 = notificationId;
     ChemicalCompositionType        = chemicalCompositionType;
     ChemicalCompositionDescription = FurtherInformation;
     WasteCompositions              = wasteCompositions;
     FurtherInformation             = furtherInformation;
 }
Exemplo n.º 4
0
        public void DefaultChemicalComposition_HasValidationError()
        {
            var chemicalComposition = new ChemicalComposition(AnyGuid)
            {
                Composition = default(Core.WasteType.ChemicalComposition)
            };

            validator.ShouldHaveValidationErrorFor(x => x.Composition, chemicalComposition);
        }
Exemplo n.º 5
0
        public void NullChemicalComposition_HasValidationError()
        {
            var chemicalComposition = new ChemicalComposition(AnyGuid)
            {
                Composition = null
            };

            validator.ShouldHaveValidationErrorFor(x => x.Composition, chemicalComposition);
        }
Exemplo n.º 6
0
 private ChemicalCompositionViewModel GetBlankCompositionViewModel(Guid id, ChemicalComposition chemicalCompositionType)
 {
     return(new ChemicalCompositionViewModel
     {
         NotificationId = id,
         WasteComposition = GetChemicalCompositionCategories(),
         ChemicalCompositionType = chemicalCompositionType
     });
 }
Exemplo n.º 7
0
        private WasteType(ChemicalComposition chemicalComposition, string chemicalCompositionName)
        {
            ChemicalCompositionType = chemicalComposition;

            if (chemicalComposition == ChemicalComposition.Other)
            {
                Guard.ArgumentNotNull(() => chemicalCompositionName, chemicalCompositionName);
                ChemicalCompositionName = chemicalCompositionName;
            }
        }
        public async Task<ActionResult> Download(DateTime from, DateTime to, ChemicalComposition chemicalComposition, FoiReportDates dateType)
        {
            var report = await mediator.SendAsync(new GetFreedomOfInformationReport(from, to, chemicalComposition, dateType));

            var type = EnumHelper.GetShortName(chemicalComposition);

            var fileName = string.Format("foi-report-{0}-{1}-{2}.xlsx", type, from.ToShortDateString(), to.ToShortDateString());

            return new XlsxActionResult<FreedomOfInformationData>(report, fileName);
        }
Exemplo n.º 9
0
        private WasteType(ChemicalComposition chemicalComposition, string chemicalCompositionName)
        {
            ChemicalCompositionType = chemicalComposition;

            if (chemicalComposition == ChemicalComposition.Other)
            {
                Guard.ArgumentNotNull(() => chemicalCompositionName, chemicalCompositionName);
                ChemicalCompositionName = chemicalCompositionName;
            }
        }
Exemplo n.º 10
0
        private static ChemicalComposition GetChemicalCompositionType(ChemicalComposition chemicalComposition)
        {
            ChemicalComposition type;

            if (Enum.TryParse(chemicalComposition.ToString(), out type))
            {
                return(type);
            }

            throw new ArgumentException(string.Format("Unknown Chemical Composition {0}", chemicalComposition), "chemicalComposition");
        }
Exemplo n.º 11
0
        public void ValidChemicalComposition_HasNoValidationErrors()
        {
            var validChemicalComposition = new ChemicalComposition(AnyGuid)
            {
                Composition = Core.WasteType.ChemicalComposition.Other
            };

            var result = validator.Validate(validChemicalComposition);

            Assert.True(result.IsValid);
        }
        public static Planet createGasGiant(ChemicalComposition _chemicalComposition, double _earthRadii, double distance_from_star)
        {
            Planet planet = null;


            int relMass = random.Next(50, 120 * 3);

            planet = new Planet(_chemicalComposition, (_earthRadii * ParametriUtente.Science.r_t), distance_from_star);
            planet.initPlanet(1, relMass);
            return(planet);
        }
Exemplo n.º 13
0
        public WasteType(Guid importNotificationId,
            string name,
            BaselOecdCode baselOecdCode,
            EwcCode ewcCode,
            YCode yCode,
            HCode hCode,
            UnClass unClass,
            ChemicalComposition chemicalComposition)
        {
            Guard.ArgumentNotDefaultValue(() => importNotificationId, importNotificationId);
            Guard.ArgumentNotNullOrEmpty(() => name, name);
            Guard.ArgumentNotNull(() => baselOecdCode, baselOecdCode);
            Guard.ArgumentNotNull(() => ewcCode, ewcCode);
            Guard.ArgumentNotNull(() => yCode, yCode);
            Guard.ArgumentNotNull(() => hCode, hCode);
            Guard.ArgumentNotNull(() => unClass, unClass);
            Guard.ArgumentNotDefaultValue(() => chemicalComposition, chemicalComposition);

            ImportNotificationId = importNotificationId;
            Name = name;

            var wasteCodes = new List<WasteTypeWasteCode>();

            WasteCodesCollection = new List<WasteTypeWasteCode>();
            BaselOecdCodeNotListed = baselOecdCode.NotListed;
            YCodeNotApplicable = yCode.NotApplicable;
            HCodeNotApplicable = hCode.NotApplicable;
            UnClassNotApplicable = unClass.NotApplicable;
            ChemicalCompositionType = chemicalComposition;

            wasteCodes.AddRange(ewcCode.Codes);

            if (!BaselOecdCodeNotListed)
            {
                wasteCodes.Add(baselOecdCode.Code);
            }

            if (!YCodeNotApplicable)
            {
                wasteCodes.AddRange(yCode.Codes);
            }

            if (!HCodeNotApplicable)
            {
                wasteCodes.AddRange(hCode.Codes);
            }

            if (!UnClassNotApplicable)
            {
                wasteCodes.AddRange(unClass.Codes);
            }

            WasteCodesCollection = wasteCodes;
        }
Exemplo n.º 14
0
        public WasteType(Guid importNotificationId,
                         string name,
                         BaselOecdCode baselOecdCode,
                         EwcCode ewcCode,
                         YCode yCode,
                         HCode hCode,
                         UnClass unClass,
                         ChemicalComposition chemicalComposition)
        {
            Guard.ArgumentNotDefaultValue(() => importNotificationId, importNotificationId);
            Guard.ArgumentNotNullOrEmpty(() => name, name);
            Guard.ArgumentNotNull(() => baselOecdCode, baselOecdCode);
            Guard.ArgumentNotNull(() => ewcCode, ewcCode);
            Guard.ArgumentNotNull(() => yCode, yCode);
            Guard.ArgumentNotNull(() => hCode, hCode);
            Guard.ArgumentNotNull(() => unClass, unClass);
            Guard.ArgumentNotDefaultValue(() => chemicalComposition, chemicalComposition);

            ImportNotificationId = importNotificationId;
            Name = name;

            var wasteCodes = new List <WasteTypeWasteCode>();

            WasteCodesCollection    = new List <WasteTypeWasteCode>();
            BaselOecdCodeNotListed  = baselOecdCode.NotListed;
            YCodeNotApplicable      = yCode.NotApplicable;
            HCodeNotApplicable      = hCode.NotApplicable;
            UnClassNotApplicable    = unClass.NotApplicable;
            ChemicalCompositionType = chemicalComposition;

            wasteCodes.AddRange(ewcCode.Codes);

            if (!BaselOecdCodeNotListed)
            {
                wasteCodes.Add(baselOecdCode.Code);
            }

            if (!YCodeNotApplicable)
            {
                wasteCodes.AddRange(yCode.Codes);
            }

            if (!HCodeNotApplicable)
            {
                wasteCodes.AddRange(hCode.Codes);
            }

            if (!UnClassNotApplicable)
            {
                wasteCodes.AddRange(unClass.Codes);
            }

            WasteCodesCollection = wasteCodes;
        }
Exemplo n.º 15
0
        public async Task <ActionResult> Constituents(Guid id, ChemicalComposition chemicalCompositionType, bool?backToOverview = null)
        {
            var model = GetBlankCompositionContinuedViewModel(id, chemicalCompositionType);

            if (chemicalCompositionType == ChemicalComposition.Wood)
            {
                model.WasteComposition = model.WasteComposition.Where(x => x.ChemicalCompositionCategory != ChemicalCompositionCategory.Food).ToList();
            }

            await GetExistingConstituents(id, chemicalCompositionType, model);

            return(View(model));
        }
Exemplo n.º 16
0
        public static ChemicalComposition generateComposites(int _numberOfIterations, ChemicalComposition _composition)
        {
            List <ChemicalElement> chemicalElements, validElements, validMolecules;
            ChemicalComposition    moleculeComposition = null;
            List <double>          moleculeDistList    = new List <double>();

            validMolecules = new List <ChemicalElement>();

            if (_numberOfIterations <= 0)
            {
                return(null);
            }
            validElements    = new List <ChemicalElement>();
            chemicalElements = PeriodicTable.getListOfElementsByState(ElementState.Molecule);
            chemicalElements.AddRange(PeriodicTable.getListOfElementsByState(ElementState.Gas, true));

            foreach (ChemicalElement molecule in chemicalElements)
            {
                foreach (string _component in molecule.components)
                {
                    ChemicalElement chemicalElement = _composition.getElementFromName(_component);
                    if (chemicalElement == null)
                    {
                        validElements.Clear();
                        break;
                    }

                    validElements.Add(chemicalElement);
                }

                if (validElements.Count > 0)
                {
                    validMolecules.Add(molecule);
                }
            }

            if (validMolecules.Count > 0)
            {
                moleculeDistList = SimulationEngine.generateDistributionList(4, 1, validMolecules.Count);
                DataEngine.Shuffle <ChemicalElement>(validMolecules, new Random());
                moleculeComposition = new ChemicalComposition(validMolecules, moleculeDistList);
            }



            return(moleculeComposition);
            //get distribuzione a partire dal totale di elementi che devo generare
        }
Exemplo n.º 17
0
        private static BasicSearchResult ConvertToSearchResults(Guid notificationId, string notificationNumber,
                                                                string exporterName, ChemicalComposition wasteTypeValue, NotificationStatus status, bool showSummaryLink)
        {
            var searchResult = new BasicSearchResult
            {
                Id = notificationId,
                NotificationNumber = notificationNumber,
                ExporterName       = exporterName,
                WasteType          = wasteTypeValue != default(ChemicalComposition)
                    ? EnumHelper.GetShortName(wasteTypeValue) : string.Empty,
                NotificationStatus      = EnumHelper.GetDisplayName(status),
                ShowShipmentSummaryLink = showSummaryLink
            };

            return(searchResult);
        }
Exemplo n.º 18
0
        public async Task <ActionResult> OtherWaste(Guid id, ChemicalComposition chemicalCompositionType, bool?backToOverview = null)
        {
            var model = new OtherWasteViewModel
            {
                NotificationId = id
            };

            var wasteTypeData = await mediator.SendAsync(new GetWasteType(id));

            if (wasteTypeData != null && wasteTypeData.ChemicalCompositionName != null)
            {
                model.Description = wasteTypeData.ChemicalCompositionName;
            }

            return(View(model));
        }
Exemplo n.º 19
0
        public static void createSun()
        {
            List <double> percentageList = new List <double>();


            ChemicalElement        element;
            List <ChemicalElement> chemicalElements = new List <ChemicalElement>();

            element = PeriodicTable.findByName("Hydrogen");
            chemicalElements.Add(element);
            percentageList.Add(73.46);

            element = PeriodicTable.findByName("Helium");
            chemicalElements.Add(element);
            percentageList.Add(24.85);

            element = PeriodicTable.findByName("Oxygen");
            chemicalElements.Add(element);

            percentageList.Add(0.87);
            element = PeriodicTable.findByName("Iron");
            chemicalElements.Add(element);
            percentageList.Add(0.26);
            element = PeriodicTable.findByName("Neon");
            chemicalElements.Add(element);
            percentageList.Add(0.22);
            element = PeriodicTable.findByName("Nitrogen");
            chemicalElements.Add(element);
            percentageList.Add(0.12);
            element = PeriodicTable.findByName("Silicon");
            chemicalElements.Add(element);
            percentageList.Add(0.11);
            element = PeriodicTable.findByName("Magnesium");
            chemicalElements.Add(element);
            percentageList.Add(0.06);;
            element = PeriodicTable.findByName("Sulfur");
            chemicalElements.Add(element);
            percentageList.Add(0.05);


            ChemicalComposition chemicalComposition = new ChemicalComposition(chemicalElements, percentageList);
            Star star = new Star(ParametriUtente.Science.r_sun, 0, chemicalElements);


            star.initStar(1, 1, chemicalComposition.get_percentage());
            Console.WriteLine("Sun created check debug values");
        }
Exemplo n.º 20
0
        private async Task GetExistingConstituents(Guid id, ChemicalComposition chemicalCompositionType, ChemicalCompositionContinuedViewModel model)
        {
            var wasteTypeData = await mediator.SendAsync(new GetWasteType(id));

            // If the old data does not exist or corresponds to a different waste type data.
            if (!ContainsData(wasteTypeData) || wasteTypeData.ChemicalCompositionType != chemicalCompositionType)
            {
                while (model.OtherCodes.Count < NumberOfOtherCodesFields)
                {
                    model.OtherCodes.Add(new WasteTypeCompositionData());
                }
                return;
            }

            var compositions = wasteTypeData.WasteCompositionData.Select(c => new WasteTypeCompositionData
            {
                ChemicalCompositionCategory = c.ChemicalCompositionCategory,
                Constituent      = c.Constituent,
                MinConcentration = c.MinConcentration.ToString(),
                MaxConcentration = c.MaxConcentration.ToString()
            }).ToList();

            // Where the waste concentration is not applicable it is not stored.
            var notApplicableCompositions =
                model.WasteComposition.Where(
                    wc =>
                    compositions.All(c => c.ChemicalCompositionCategory != wc.ChemicalCompositionCategory)).Select(wc => new WasteTypeCompositionData
            {
                ChemicalCompositionCategory = wc.ChemicalCompositionCategory,
                Constituent      = wc.Constituent,
                MinConcentration = NotApplicable,
                MaxConcentration = NotApplicable
            });

            compositions.AddRange(notApplicableCompositions);

            model.WasteComposition   = compositions.Where(c => c.ChemicalCompositionCategory != ChemicalCompositionCategory.Other).ToList();
            model.OtherCodes         = compositions.Where(c => c.ChemicalCompositionCategory == ChemicalCompositionCategory.Other).ToList();
            model.FurtherInformation = wasteTypeData.FurtherInformation;
            model.HasAnnex           = wasteTypeData.HasAnnex;

            while (model.OtherCodes.Count < NumberOfOtherCodesFields)
            {
                model.OtherCodes.Add(new WasteTypeCompositionData());
            }
        }
Exemplo n.º 21
0
        public static void Main(string[] Args)
        {
            SimulationEngine.mustShowInfo = true;

            PeriodicTable.init();
            TestClass.createEarth();
            TestClass.createSun();
            List <double> percentageList = new List <double>();

            createEarth();
            ChemicalElement        element;
            List <ChemicalElement> chemicalElements = DataEngine.starSeed;

            PeriodicTable.findElementByName("Water").getMolality();
            percentageList = SimulationEngine.generateDistributionList(90, 70, chemicalElements.Count);


            ChemicalComposition chemicalComposition = new ChemicalComposition(chemicalElements, percentageList);

            StarSystem system = new StarSystem();

            system.InitSystemParams(new Double[] { 1, ParametriUtente.Science.r_sun, 1 }, chemicalComposition);
            system.createStarSystem();

            string outputFile = system.toString();

            system.InitSystemParams(new Double[] { 1, ParametriUtente.Science.r_sun * 1.71, 2.02 }, chemicalComposition);
            system.createStarSystem();


            PlanetColor color = new PlanetColor(System.Drawing.Color.Blue);
            double      ggg   = color.getAlbedo();

            outputFile = string.Concat(outputFile, system.toString());
            int x = 0;

            while (x < 1000)
            {
                x++;
            }

            printToFile(outputFile);
            int i = 0;
        }
Exemplo n.º 22
0
        private WasteType(ChemicalComposition chemicalComposition,
                          IList <WasteAdditionalInformation> wasteCompositions, string chemicalCompositionDescription = "")
        {
            ChemicalCompositionType = chemicalComposition;

            if (!string.IsNullOrEmpty(chemicalCompositionDescription))
            {
                ChemicalCompositionDescription = chemicalCompositionDescription;
            }

            if (wasteCompositions == null)
            {
                WasteAdditionalInformationCollection = new List <WasteAdditionalInformation>();
            }
            else
            {
                WasteAdditionalInformationCollection = new List <WasteAdditionalInformation>(wasteCompositions);
            }
        }
        public void GetWasteName(ChemicalComposition type, string expected)
        {
            var chemicalComposition = ChemicalComposition.RDF;

            if (type == ChemicalComposition.SRF)
            {
                chemicalComposition = ChemicalComposition.SRF;
            }
            else if (type == ChemicalComposition.Wood)
            {
                chemicalComposition = ChemicalComposition.Wood;
            }

            wasteType.ChemicalCompositionType = chemicalComposition;

            var result = formatter.GetWasteName(wasteType);

            Assert.Equal(expected, result);
        }
Exemplo n.º 24
0
        private WasteType(ChemicalComposition chemicalComposition,
            IList<WasteAdditionalInformation> wasteCompositions, string chemicalCompositionDescription = "")
        {
            ChemicalCompositionType = chemicalComposition;

            if (!string.IsNullOrEmpty(chemicalCompositionDescription))
            {
                ChemicalCompositionDescription = chemicalCompositionDescription;
            }

            if (wasteCompositions == null)
            {
                WasteAdditionalInformationCollection = new List<WasteAdditionalInformation>();
            }
            else
            {
                WasteAdditionalInformationCollection = new List<WasteAdditionalInformation>(wasteCompositions);
            }
        }
        public static Planet createPlanet(ChemicalComposition _chemicalComposition, double _earthRadii, double distance_from_star)
        {
            Planet planet = null;

            double relMass;

            if (_earthRadii > 2)
            {
                relMass = random.NextDouble() * (45 - 1) + 1;
            }
            else
            {
                relMass = random.NextDouble() * (7 - _earthRadii) + _earthRadii;
            }


            planet = new Planet(_chemicalComposition, (_earthRadii * ParametriUtente.Science.r_t), distance_from_star);
            planet.initPlanet(1, relMass);
            return(planet);
        }
Exemplo n.º 26
0
        private async Task GetExistingParameters(Guid id, ChemicalComposition chemicalCompositionType, ChemicalCompositionViewModel model)
        {
            var wasteTypeData = await mediator.SendAsync(new GetWasteType(id));

            // If the old data does not exist or corresponds to a different waste type data.
            if (!ContainsCompositionData(wasteTypeData) || wasteTypeData.ChemicalCompositionType != chemicalCompositionType)
            {
                return;
            }

            var compositions = wasteTypeData.WasteAdditionalInformation.Select(c => new WoodInformationData
            {
                WasteInformationType = c.WasteInformationType,
                Constituent          = c.Constituent,
                MinConcentration     = c.MinConcentration.ToString(),
                MaxConcentration     = c.MaxConcentration.ToString()
            }).ToList();

            // Where the waste concentration is not applicable it is not stored.
            var notApplicableCompositions =
                model.WasteComposition.Where(
                    wc =>
                    compositions.All(c => c.WasteInformationType != wc.WasteInformationType)).Select(wc => new WoodInformationData
            {
                WasteInformationType = wc.WasteInformationType,
                Constituent          = wc.Constituent,
                MinConcentration     = NotApplicable,
                MaxConcentration     = NotApplicable
            });

            compositions.AddRange(notApplicableCompositions);

            model.WasteComposition = compositions;

            model.Energy = wasteTypeData.EnergyInformation;

            if (chemicalCompositionType == ChemicalComposition.Wood)
            {
                model.Description = wasteTypeData.WoodTypeDescription;
            }
        }
Exemplo n.º 27
0
 private ChemicalCompositionContinuedViewModel GetBlankCompositionContinuedViewModel(Guid id, ChemicalComposition chemicalCompositionType)
 {
     return(new ChemicalCompositionContinuedViewModel
     {
         NotificationId = id,
         WasteComposition = GetChemicalCompositionContinuedCategories(),
         OtherCodes = new List <WasteTypeCompositionData> {
             new WasteTypeCompositionData()
         },
         ChemicalCompositionType = chemicalCompositionType
     });
 }
        public async Task<IEnumerable<FreedomOfInformationData>> Get(DateTime from, DateTime to,
            ChemicalComposition chemicalComposition, UKCompetentAuthority competentAuthority, FoiReportDates dateType)
        {
            return await context.Database.SqlQuery<FreedomOfInformationData>(
                @"SELECT DISTINCT
                    [NotificationNumber],
                    [NotifierName],
                    [NotifierAddress],
                    [ProducerName],
                    [ProducerAddress],
                    [PointOfExport],
                    [PointOfEntry],
                    [ImportCountryName],
                    [NameOfWaste],
                    [EWC],
                    [YCode],
                    [HCode],
                    [OperationCodes],
                    [ImporterName],
                    [ImporterAddress],
                    [FacilityName],
                    [FacilityAddress],
                    COALESCE(                    
                        (SELECT	SUM(
                            CASE WHEN [QuantityReceivedUnitId] IN (1, 2) -- Tonnes / Cubic Metres
                                THEN COALESCE([QuantityReceived], 0)
                            ELSE 
                                COALESCE([QuantityReceived] / 1000, 0) -- Convert to Tonnes / Cubic Metres
                            END
                            ) 
                            FROM [Reports].[Movements]
                            WHERE Id = NotificationId
                                AND (@dateType = 'NotificationReceivedDate'
				                     OR @dateType = 'ConsentFrom'
				                     OR @dateType = 'ReceivedDate' and  [ReceivedDate] BETWEEN @from AND @to
				                     OR @dateType = 'CompletedDate' and  [CompletedDate] BETWEEN @from AND @to)
                        ), 0) AS [QuantityReceived],
                    CASE WHEN [IntendedQuantityUnitId] IN (1, 2) -- Due to conversion units will only be Tonnes / Cubic Metres
                        THEN [IntendedQuantityUnit] 
                    WHEN [IntendedQuantityUnitId] = 3 THEN 'Tonnes'
                    WHEN [IntendedQuantityUnitId] = 4 THEN 'Cubic Metres'
                    END AS [QuantityReceivedUnit],
                    [IntendedQuantity],
                    [IntendedQuantityUnit],
                    [ConsentFrom],
                    [ConsentTo],
                    [LocalArea]
                FROM 
                    [Reports].[FreedomOfInformation]
                WHERE 
                    [CompetentAuthorityId] = @competentAuthority
                    AND [ChemicalCompositionTypeId] = @chemicalComposition
                    AND (@dateType = 'NotificationReceivedDate' AND  [ReceivedDate] BETWEEN @from AND @to
				         OR @dateType = 'ConsentFrom' AND  [ConsentFrom] BETWEEN @from AND @to
                         OR @dateType = 'ReceivedDate' AND [MovementReceivedDate] BETWEEN @from AND @to
				         OR @dateType = 'CompletedDate' AND [MovementCompletedDate] BETWEEN @from AND @to)",
                new SqlParameter("@from", from),
                new SqlParameter("@to", to),
                new SqlParameter("@chemicalComposition", (int)chemicalComposition),
                new SqlParameter("@competentAuthority", (int)competentAuthority),
                new SqlParameter("@dateType", dateType.ToString())).ToArrayAsync();
        }
Exemplo n.º 29
0
 public Body()
 {
     body_composition = new ChemicalComposition();
 }
Exemplo n.º 30
0
        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);
        }
Exemplo n.º 31
0
        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);
        }
        public void GetWasteName(ChemicalComposition type, string expected)
        {
            var chemicalComposition = ChemicalComposition.RDF;

            if (type == ChemicalComposition.SRF)
            {
                chemicalComposition = ChemicalComposition.SRF;
            }
            else if (type == ChemicalComposition.Wood)
            {
                chemicalComposition = ChemicalComposition.Wood;
            }

            wasteType.ChemicalCompositionType = chemicalComposition;

            var result = formatter.GetWasteName(wasteType);

            Assert.Equal(expected, result);
        }