public CreateEscapeViewModel(int animalID, StayEndViewModel parent)
 {
     Prnt1           = parent;
     Prnt1.IsWorking = true;
     Escape          = new EscapeModel();
     AnimalID        = animalID;
 }
        private async Task LoadData()
        {
            IsWorking = true;
            await Task.Delay(150);

            await Task.Run(() =>
            {
                Escapes = EscapeModel.GetDatedEscapes(DateTime.Now.AddYears(-100), DateTime.Now.AddYears(100));
                Deaths  = DeathModel.GetDatedDeaths(DateTime.Now.AddYears(-100), DateTime.Now.AddYears(100));
            });

            IsWorking = false;
        }
 public void FilterEscapes()
 {
     if (EscapeSince == null || EscapeTo == null)
     {
         IsWorking = true;
         Escapes   = EscapeModel.GetDatedEscapes(DateTime.Now.AddYears(-100), DateTime.Now.AddYears(100));
         IsWorking = false;
     }
     else
     {
         IsWorking = true;
         Escapes   = EscapeModel.GetDatedEscapes(EscapeSince, EscapeTo);
         IsWorking = false;
     }
 }
        public void DeleteEscape()
        {
            MessageBoxResult result = MessageBox.Show("Opravdu chcete vymazat zvolený útěk?",
                                                      "Confirmation",
                                                      MessageBoxButton.YesNo,
                                                      MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                EscapeModel.MarkAsDeleted((int)SelectedEscape.ID);

                SelectedEscape = null;

                FilterEscapes();
            }
        }
Exemplo n.º 5
0
        public async void Restore()
        {
            if (Since == null || To == null || (Since > To))
            {
                MessageBox.Show("Zvolte prosím platné datum.");
            }
            else
            {
                IsWorking = true;
                await Task.Delay(150);

                await Task.Run(() =>
                {
                    AdoptionModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    AnimalModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    BreedModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    CoatTypeModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    CostModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    DeathModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    DiaryModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    DonationModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    EscapeModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    FurColorModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    IncidentModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    PersonModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    MedicalRecordModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    SpeciesModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    StayModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                    WalkModel.RestoreDeleted((DateTime)Since, (DateTime)To);
                });

                ComboBoxSettings();
                IsWorking = false;
                MessageBox.Show("Záznamy od " + Since + " do " + To + " obnoveny.");
            }
        }