public override void EditLast(DatumBeheerViewModel vm)
        {
            IsValid = false;

            if (Ctx.StukPrestaties.Any())
            {
                //Get all previous StukPrestaties of the selected klant
                var tempPrestatie = Ctx.StukPrestaties.GetLatestPrestatie(SelectedKlant);
                if (tempPrestatie != null)
                {
                    AddStukPrestatie = tempPrestatie;
                    //Load the previous dates
                    vm.EditLast(tempPrestatie.Id);
                }
                else
                {
                    throw new Exception("Deze klant heeft geen vorige prestaties, u kunt niets wijzigen");
                }
            }
            else
            {
                throw new Exception("Er bevinden zich nog geen prestaties in de databank, u kunt niets wijzigen");
            }

            //Thinking reverse => The current Tegoed of the Klant was the NiewTegoed of the last prestatie
            SelectedKlant.Tegoed = AddStukPrestatie.RecalculatePrestatie(SelectedKlant.Tegoed);
        }
        public BerekenModuleViewModel(UnitOfWork ctx)
            : base(ctx)
        {
            Header = "Berekenmodule";
            ButtonBerekenContent = "Berekenen";
            ButtonToevoegenContent = "Toevoegen";
            ButtonChangeContent = "Laatste prestatie aanpassen";

            DatumViewModel = new DatumBeheerViewModel(ctx);
            CurrentView = new TijdBerekenModuleViewModel(ctx);

            BerekenCommandEvent = new RelayCommand(Bereken);
            SaveCommandEvent = new RelayCommand(Save);
            RefreshCommandEvent = new RelayCommand(Edit);
            PrintCommandEvent = new RelayCommand(Print);
        }
 public abstract void EditLast(DatumBeheerViewModel vm);
        public override void EditLast(DatumBeheerViewModel vm)
        {
            IsValid = false;

            if (Ctx.TijdPrestaties.Any())
            {
                //Get all previous TijdPrestaties of the selected klant
                var tempPrestatie = Ctx.TijdPrestaties.GetLatestPrestatie(SelectedKlant);
                if (tempPrestatie != null)
                {
                    AddTijdPrestatie = tempPrestatie;
                    vm.EditLast(tempPrestatie.Id);
                }
                else
                {
                    throw new Exception("Deze klant heeft geen vorige prestaties, u kunt niets wijzigen");
                }
            }
            else
            {
                throw new Exception("Er bevinden zich nog geen prestaties in de databank, u kunt niets wijzigen");
            }

            //Change the current parameters to the parameters that where active at the time the parameter was made!
            CurrentParameters.ParameterHemden = AddTijdPrestatie.ParameterHemden;
            CurrentParameters.ParameterLakens1 = AddTijdPrestatie.ParameterLakens1;
            CurrentParameters.ParameterLakens2 = AddTijdPrestatie.ParameterLakens2;
            CurrentParameters.ParameterAndereStrijk = AddTijdPrestatie.ParameterAndereStrijk;

            //Thinking reverse => The current Tegoed of the Klant was the NiewTegoed of the last prestatie
            SelectedKlant.Tegoed = AddTijdPrestatie.RecalculatePrestatie(SelectedKlant.Tegoed);
        }