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); }
public void AddGebruiker(GebruikerVM gebruiker) { if (gebruiker == null) { throw new InvalidOperationException("No gebruiker is present"); } GebruikerRepository.AddGebruiker(gebruiker.GebruikerModel); // TODO: Validation that it succeeded? }
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)); }
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); }
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); }
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)); }
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)); }
public void NotifyInspectorAdded(GebruikerVM gebruiker) { Inspectors.Add(gebruiker); _addInspectorWindow.Close(); _addInspectorWindow = null; }
public void AddCertificaatToGebruiker(CertificaatVM selectedCertificaat, GebruikerVM gebruiker) { CertificaatRepository.AddCertificaatToGebruiker(selectedCertificaat.CertificaatModel, gebruiker.GebruikerModel); }
public void AddIngevuldeVragenlijst(InspectieVM inspectie, GebruikerVM user, VragenlijstVM originalVragenlijst, string data) { IngevuldeVragenlijstRepository.AddIngevuldeVragenlijst(inspectie.InspectieModel, user.GebruikerModel, originalVragenlijst.VragenlijstModel, data); }