public async Task SaveSingleRepairToDatabase(RepairModel repair)
        {
            repair.RestorationDate = new DateTime(2500, 1, 1);
            await _repairsManager.AddRepair(repair);

            CalcAutomatisation();
        }
示例#2
0
        public RepairAddViewModel(
            IArchitecturesManager architecturesManager,
            IRestorationsManager restorationsManager,
            IRepairsManager repairsManager)
        {
            _architecturesManager = architecturesManager;
            _restorationsManager  = restorationsManager;
            _repairsManager       = repairsManager;

            _customNavigationService = ServiceLocator.Current.GetInstance <ICustomNavigationService>("RepairInternal");

            _repair = _customNavigationService.CurrentPageParams as RepairModel;

            _isAddingMode = _repair == null;

            SaveCommand = _isAddingMode
                ? new RelayCommand(AddRepair)
                : new RelayCommand(UpdateRepair);

            ActionText = _isAddingMode ? "Добавление" : "Редактирование";
            ButtonText = _isAddingMode ? "Добавить" : "Сохранить изменения";

            InitData();
            SetupFields();
        }
示例#3
0
        private void SetupFields()
        {
            RepairModel editableRep = _repair;

            RestorationKind = editableRep?.RestorationKind ?? RestorationKind.Косметическая;
            Architecture    = editableRep?.Architecture ?? null;
            RestorationDate = editableRep?.RestorationDate ?? DateTime.Now;
            RestorationCost = editableRep?.RestorationCost ?? 0;
        }
示例#4
0
        private async void AddRepair()
        {
            var repair = new RepairModel(RestorationKind,
                                         Architecture.Id, RestorationDate.DateTime.Date, RestorationCost);

            await _repairsManager.AddRepair(repair);

            _customNavigationService.NavigateTo(PageKeys.RepairMain);
        }
        public async Task SaveSingleRepairToDatabase(ArchitecturesNeedRepairModel architecturesNeedRepairModel)
        {
            var repair = new RepairModel
            {
                ArchitectureId  = architecturesNeedRepairModel.ArchitectureId,
                RestorationCost = architecturesNeedRepairModel.RepairCost,
                RestorationKind = architecturesNeedRepairModel.RestorationKind,
                RestorationDate = new DateTime(2500, 1, 1)
            };

            await SaveSingleRepairToDatabase(repair);
        }
        public async Task SaveCombinationToDatabase()
        {
            foreach (var autoRepairModel in SelectedCombination.Key.Repairs)
            {
                var repair = new RepairModel()
                {
                    ArchitectureId  = autoRepairModel.ArchitectureId,
                    RestorationCost = autoRepairModel.RepairCost,
                    RestorationKind = autoRepairModel.RestorationKind,
                    RestorationDate = new DateTime(2500, 1, 1)
                };

                await _repairsManager.AddRepair(repair);
            }

            CalcAutomatisation();
        }