public void CalculateProjectData()
        {
            var technologicalConditions = Mapper
                                          .MapCollection <
                TechnologicalConditionDTO,
                TechnologicalCondition,
                ObservableCollection <TechnologicalConditionDTO>,
                ObservableCollection <TechnologicalCondition> >
                                              (TechnologicalConditionDTOs).ToList();

            var resources = Mapper
                            .MapCollection <
                ResourceDTO,
                Resource,
                ObservableCollection <ResourceDTO>,
                ObservableCollection <Resource> >
                                (ResourceDTOs).ToList();

            try
            {
                var timeCharacteristicCalculator = new TimeCharacteristicCalculator(technologicalConditions);
                var timeCharacteristics          = timeCharacteristicCalculator.Calculate().ToList();

                var variableParameterCalculator = new VariableParameterCalculator(technologicalConditions);
                var cycleCount         = timeCharacteristics.Max(p => p.EarlyFinish);
                var variableParameters = variableParameterCalculator.Calculate(cycleCount);

                foreach (var item in timeCharacteristics)
                {
                    var timeCharacteristicDTO = Mapper.Map <TimeCharacteristic, TimeCharacteristicDTO>(item);
                    TimeCharacteristicDTOs.Add(timeCharacteristicDTO);
                }

                foreach (var parameter in variableParameters)
                {
                    var variableParameterDTO = Mapper.Map <VariableParameter, VariableParameterDTO>(parameter);

                    var buffer = string.Empty;
                    foreach (var item in parameter.CycleNumberConsumptions)
                    {
                        buffer += $"{item} ";
                    }

                    variableParameterDTO.CycleNumberConsumptions = buffer;
                    VariableParameterDTOs.Add(variableParameterDTO);
                }

                Project = new ProjectBuilder()
                          .SetTitle(ProjectDTO.Title)
                          .SetWorkCount(ProjectDTO.WorkCount)
                          .SetTechnologicalConditions(technologicalConditions)
                          .SetResources(resources)
                          .SetTimeCharacteristics(timeCharacteristics)
                          .Build();
            }
            catch (ArgumentNullException ex)
            {
                Debug.WriteLine(ex.ToString());
            }
        }
示例#2
0
        public void SetUp()
        {
            var timeCharacteristicCalculator = new TimeCharacteristicCalculator(CalculatorSource.GetTechnologicalConditions());

            _timeCharacteristics = timeCharacteristicCalculator.Calculate().ToList();

            var variableParameterCalculator = new VariableParameterCalculator(CalculatorSource.GetTechnologicalConditions());

            _variableParameters = variableParameterCalculator.Calculate(12).ToList();
        }
示例#3
0
        public void SetUp()
        {
            TimeCharacteristicCalculator = new(CalculatorSource.GetTechnologicalConditions());

            TimeCharacteristics = TimeCharacteristicCalculator.Calculate().ToList();
        }