Exemplo n.º 1
0
        public void AddInspectie()
        {
            if (Valid())
            {
                Status statusTemp = new Status();
                statusTemp.Naam = SelectedStatus.Naam;
                List <Gebruiker> selectedGebruikers = new List <Gebruiker>();
                GebruikerList.Where(g => g.IsIncluded).ToList().ForEach(g => selectedGebruikers.Add(g.GebruikerModel));

                InspectieVM inspectieTemp = new InspectieVM(new Inspectie()
                {
                    Offerte    = SelectedOfferte.OfferteModel,          //TODO: Onnodig
                    Klant      = SelectedKlant.KlantModel,              //TODO: Onnodig
                    Gebruiker  = _dataServer._gebruiker.GebruikerModel, //TODO: Onnodig
                    Status     = statusTemp,                            //TODO: Onnodig
                    Datum      = this.Datum,                            //TODO: Change to selection (dataTimePicker)
                    Huisnummer = huisnummer,
                    Postcode   = PostCode,
                    Naam       = this.Naam,
                    Wens       = this.Wens,
                    Gebruiker1 = selectedGebruikers
                });

                InspectieRepository.AddInspection(inspectieTemp.InspectieModel);
                inspectionVM.InspectionList.Add(inspectieTemp);
                inspectionVM.RaisePropertyChanged();
                inspectionVM.UpdateInspecties();
                inspectionVM.CloseAddInspection();
            }
        }
Exemplo n.º 2
0
 public void RemoveInspectieByID(int ID)
 {
     if (ID <= 0)
     {
         throw new InvalidOperationException("Provided inspectie was null.");
     }
     InspectieRepository.RemoveInspectionByID(ID);
 }
Exemplo n.º 3
0
        public ObservableCollection <InspectieVM> GetInspectiesWithGebruikerId(int GebruikerId)
        {
            List <Inspectie> tmp = InspectieRepository.GetInspectiesWithGebruikerId(GebruikerId);
            ObservableCollection <InspectieVM> returnValue = new ObservableCollection <InspectieVM>();

            tmp.ForEach(i => returnValue.Add(new InspectieVM(i)));

            return(returnValue);
        }
Exemplo n.º 4
0
        public InspectieVM GetInspectionOnId(int id)
        {
            if (id <= 0)
            {
                throw new InvalidOperationException("Invalid InspectieId provided.");
            }

            Inspectie tmp = InspectieRepository.GetInspectionOnId(id);

            if (tmp == null)
            {
                return(null);
            }
            return(new InspectieVM(tmp));
        }
Exemplo n.º 5
0
 public bool KlantHasInspecties(int klantId)
 {
     return(InspectieRepository.GetInspectiesWithKlantId(klantId).Count != 0);
 }
Exemplo n.º 6
0
 public void RemoveInspection(Inspectie inspectie)
 {
     InspectieRepository.RemoveInspection(inspectie);
 }
Exemplo n.º 7
0
 public void UpdateInspectie(Inspectie i)
 {
     InspectieRepository.UpdateInspectie(i);
 }
Exemplo n.º 8
0
 public InspectieVM AddInspection(InspectieVM inspectionToInsert)
 {
     return(new InspectieVM(InspectieRepository.AddInspection(inspectionToInsert.InspectieModel)));
 }
Exemplo n.º 9
0
        public ObservableCollection <InspectieVM> GetInspecties()
        {
            List <InspectieVM> tmp = InspectieRepository.GetInspecties().Select(i => new InspectieVM(i)).ToList();

            return(new ObservableCollection <InspectieVM>(tmp));
        }