Ejemplo n.º 1
0
        public EditInspectionViewModel(InspectieViewModel inspection, FestiSpecProvider dataServer)
        {
            _previousPage = inspection;
            _dataServer   = dataServer;
            _inspection   = inspection.SelectedInspectie;

            Datum         = _inspection.Datum;
            GebruikerList = new ObservableCollection <GebruikerVM>();
            foreach (var g in _inspection.InspectieModel.Gebruiker1.ToList())
            {
                GebruikerVM gVM = new GebruikerVM(g);
                gVM.IsIncluded = true;
                GebruikerList.Add(gVM);
            }
            PostCode        = _inspection.Postcode;
            huisnummer      = _inspection.Huisnummer;
            Naam            = _inspection.Naam;
            Wens            = _inspection.Wens;
            SelectedKlant   = new KlantVM(_inspection.InspectieModel.Klant);
            SelectedStatus  = new StatusVM(_inspection.InspectieModel.Status);
            SelectedOfferte = new OfferteVM(_inspection.InspectieModel.Offerte);

            KlantList   = _dataServer.GetKlanten();
            StatusList  = _dataServer.GetStatus();
            OfferteList = _dataServer.GetOfferte().ToList();

            EditInspectionCommand = new RelayCommand(EditInspection);
            ShowMapCommand        = new RelayCommand(CalculateRoute);

            apiConnector = new GeodanRepository("6c4c63db-de9a-11e8-8aac-005056805b87");
        }
        public ActionResult Open([Deserialize] VragenlijstViewModel wizard, IVragenlijstStap step)
        {
            wizard.Stappen[wizard.MomenteleStapIndex] = step;

            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(Request["next"]))
                {
                    wizard.MomenteleStapIndex++;
                }
                else
                {
                    var           json = new JavaScriptSerializer().Serialize(wizard);
                    VragenlijstVM tmp  = new VragenlijstVM()
                    {
                        Id = wizard.VragenlijstId
                    };
                    GebruikerVM gebruiker = new GebruikerVM()
                    {
                        Id = User.UserId
                    };
                    InspectieVM inspectie = new InspectieVM()
                    {
                        Id = wizard.InspectieId
                    };
                    (HttpContext.Application["dataServer"] as FestiSpecProvider).AddIngevuldeVragenlijst(inspectie, gebruiker, tmp, json);

                    return(RedirectToAction("Index", "Home"));
                }
            }
            return(View(wizard));
        }
 public CertificaatViewModel(LoginViewModel providerItem, GebruikerVM gebruiker)
 {
     this.dataserver              = providerItem.dataServer;
     SelectedGebruiker            = gebruiker;
     CertificateList              = dataserver.GetCertificaten();
     AdministerCertificateCommand = new RelayCommand <AdministerCertificateWindow>(AdministerCertificate);
 }
Ejemplo n.º 4
0
 public void AddGebruiker(GebruikerVM gebruiker)
 {
     if (gebruiker == null)
     {
         throw new InvalidOperationException("No gebruiker is present");
     }
     GebruikerRepository.AddGebruiker(gebruiker.GebruikerModel);
     // TODO: Validation that it succeeded?
 }
Ejemplo n.º 5
0
        public ActionResult Index()
        {
            if (User == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            GebruikerVM tmp = (GebruikerVM)HttpContext.Application["loggedInGebruiker"];

            (HttpContext.Application["dataServer"] as FestiSpecProvider).AuthenticateGebruiker(tmp.Naam, tmp.Wachtwoord, out GebruikerVM Gebruiker);

            return(View(Gebruiker));
        }
Ejemplo n.º 6
0
        public bool AuthenticateGebruiker(string naam, string wachtwoord, out GebruikerVM gebruiker)
        {
            Gebruiker tmp = GebruikerRepository.GetGebruikerByCredentials(naam, wachtwoord);

            if (tmp != null)
            {
                _gebruiker = gebruiker = new GebruikerVM(tmp);
                return(true);
            }
            else
            {
                gebruiker = new GebruikerVM();
            }

            return(false);
        }
Ejemplo n.º 7
0
        protected void Application_PostAuthenticateRequest(Object sender, EventArgs e)
        {
            HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];

            if (authCookie != null)
            {
                FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);

                GebruikerVM     serializeModel = JsonConvert.DeserializeObject <GebruikerVM>(authTicket.UserData);
                CustomPrincipal newUser        = new CustomPrincipal(authTicket.Name);
                newUser.UserId    = serializeModel.Id;
                newUser.FirstName = serializeModel.Naam;
                newUser.LastName  = serializeModel.Achternaam;

                HttpContext.Current.User = newUser;
            }
        }
        private void AddInspector()
        {
            GebruikerVM gebruikerTemp = new GebruikerVM(new Gebruiker
            {
                Naam           = Name,
                Achternaam     = MiddleName + " " + LastName,
                Geboortedatum  = DateOfBirth,
                Postcode       = Zipcode,
                Telefoonnummer = PhoneNumber,
                Email          = Email,
                Wachtwoord     = Password,
                Huisnummer     = HouseNumber
            });

            gebruikerTemp = dataServer.AddInspector(gebruikerTemp.GebruikerModel);
            Inspector.RaisePropertyChanged();
            Inspector.NotifyInspectorAdded(gebruikerTemp);
        }
Ejemplo n.º 9
0
        public ActionResult Login(LoginViewModel model, string returnUrl = "")
        {
            if (ModelState.IsValid)
            {
                GebruikerVM user;
                if (((FestiSpecProvider)HttpContext.Application["dataServer"]).AuthenticateGebruiker(model.Username, model.Password, out user))
                {
                    GebruikerVM tmp = new GebruikerVM()
                    {
                        Id             = user.Id,
                        Achternaam     = user.Achternaam,
                        Email          = user.Email,
                        Naam           = user.Naam,
                        GeboorteDatum  = user.GeboorteDatum,
                        Huisnummer     = user.Huisnummer,
                        Telefoonnummer = user.Telefoonnummer,
                        Postcode       = user.Postcode,
                        Wachtwoord     = user.Wachtwoord
                                         //Beschikbaarheid = user.Beschikbaarheid
                    };

                    HttpContext.Application["loggedInGebruiker"] = tmp;

                    string userData = JsonConvert.SerializeObject(tmp);
                    FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
                        1,
                        user.Email,
                        DateTime.Now,
                        DateTime.Now.AddMinutes(15),
                        false, //pass here true, if you want to implement remember me functionality
                        userData);

                    string     encTicket = FormsAuthentication.Encrypt(authTicket);
                    HttpCookie faCookie  = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
                    Response.Cookies.Add(faCookie);

                    return(RedirectToAction("Index", "Home"));
                }

                ModelState.AddModelError("", "Incorrecte gebruikersnaam en/of wachtwoord ingegeven!");
            }

            return(View(model));
        }
Ejemplo n.º 10
0
        public ActionResult Index(DateTime Datum)
        {
            GebruikerVM tmp = (GebruikerVM)HttpContext.Application["loggedInGebruiker"];

            (HttpContext.Application["dataServer"] as FestiSpecProvider).AuthenticateGebruiker(tmp.Naam, tmp.Wachtwoord, out GebruikerVM Gebruiker);

            if (Datum != null)
            {
                Gebruiker.Beschikbaarheid.Add(new Beschikbaarheid {
                    Datum = Datum
                });
                (HttpContext.Application["dataServer"] as FestiSpecProvider).SaveBeschikbaarheid(Gebruiker.GebruikerModel);
            }
            else
            {
                ModelState.AddModelError("", "Er is een fout opgetreden bij het toevoegen van je beschikbaarheid");
            }

            return(View(Gebruiker));
        }
Ejemplo n.º 11
0
 public void NotifyInspectorAdded(GebruikerVM gebruiker)
 {
     Inspectors.Add(gebruiker);
     _addInspectorWindow.Close();
     _addInspectorWindow = null;
 }
Ejemplo n.º 12
0
 public void AddCertificaatToGebruiker(CertificaatVM selectedCertificaat, GebruikerVM gebruiker)
 {
     CertificaatRepository.AddCertificaatToGebruiker(selectedCertificaat.CertificaatModel, gebruiker.GebruikerModel);
 }
Ejemplo n.º 13
0
 public void AddIngevuldeVragenlijst(InspectieVM inspectie, GebruikerVM user, VragenlijstVM originalVragenlijst, string data)
 {
     IngevuldeVragenlijstRepository.AddIngevuldeVragenlijst(inspectie.InspectieModel, user.GebruikerModel, originalVragenlijst.VragenlijstModel, data);
 }