public void GenerateReadings() { if (Repeat && Cycle == 1) { foreach (var swvm in WeekDayList.Where(wd => wd.IsSelected)) { var dayOfWeek = new DomainModelService.DayOfWeek(); dayOfWeek.WeekDay = (int)swvm.DayOfWeek; Model.WeekDays.Add(dayOfWeek); } } foreach (var scvm in m_Container.Where(scvm => scvm.IsSelected)) { var result = m_TaskGenerator.GenerateFillLevelReadings(scvm.ContainerViewModel.Model, SelectedResponsibleSubject.Model, Model, WeekDayList.Where(wd => wd.IsSelected) .Select(wd => wd.DayOfWeek) .ToArray()); foreach (var reading in result) { m_Repository.FillLevelReadings.Add(reading); } } m_Repository.Save(); TryClose(); }
public void GenerateReadings() { if (Repeat && Cycle == 1) { foreach (var swvm in WeekDayList.Where(wd => wd.IsSelected)) { var dayOfWeek = new DomainModelService.DayOfWeek(); dayOfWeek.WeekDay = (int)swvm.DayOfWeek; m_Model.WeekDays.Add(dayOfWeek); } } var selectedConditionInspections = new ObservableCollection <ConditionInspection>(); foreach (var scvm in m_SelectableAuxillaryConditionViewModels.Where(scvm => scvm.IsSelected)) { var ciModel = new ConditionInspection(); ciModel.AuxillaryConditionId = scvm.Model.Id; selectedConditionInspections.Add(ciModel); //SaveInAuxillaryCondition(ciModel, scvm.Model); } var result = m_TaskGenerator.GenerateInspections(selectedConditionInspections, SelectedResponsibleSubject.Model, m_Model, WeekDayList.Where(wd => wd.IsSelected) .Select(wd => wd.DayOfWeek) .ToArray()); foreach (var reading in result) { foreach (var conditionInspection in reading.ConditionInspections) { m_Repository.ConditionInspections.Add(conditionInspection); } m_Repository.Inspections.Add(reading); } m_Repository.Save(); TryClose(); }