public ActionResult Login(string gebruikersnaam, string wachtwoord) { //RepositoryActiveDirectory rad = new RepositoryActiveDirectory(new ActiveDirectory()); RepositoryGebruiker rg = new RepositoryGebruiker(new MSSQLGebruiker()); try { Gebruiker gebruiker = rg.GebruikerInloggen(gebruikersnaam, wachtwoord); if (gebruiker.ID != 0) { Session["Gebruiker"] = rg.GetGebruikerByGebruikersnaam(gebruikersnaam); if (gebruiker.GetGebruikerType() == "Bezoeker") { return(RedirectToAction("SocialMedia", "SocialMedia", new { login = true })); } else if (gebruiker.GetGebruikerType() == "Beheerder") { return(RedirectToAction("Index", "Beheer")); } else if (gebruiker.GetGebruikerType() == "Medewerker") { return(RedirectToAction("Index", "Toegangs")); } } } catch (Exception e) { ViewBag.Error = "Email en/of wachtwoord komen niet overeen"; } return(View()); }
private void btnLogin_Click(object sender, EventArgs e) { try { EyeCT4Events_WF.Classes.Gebruiker gebruiker = gar.GebruikerInloggen(tbUser.Text, tbPass.Text); if (gebruiker != null) { if (gebruiker.GetType() == typeof(Bezoeker)) { this.Hide(); FormMediaOverzicht fmo = new FormMediaOverzicht(gebruiker); fmo.ShowDialog(); if (fmo.DialogResult == DialogResult.OK) { this.Show(); } } else if (gebruiker.GetType() == typeof(Medewerker)) { this.Hide(); FormMedewerkerMainMenu fmh = new FormMedewerkerMainMenu(gebruiker); fmh.ShowDialog(); if (fmh.DialogResult == DialogResult.OK) { this.Show(); } } else if (gebruiker.GetType() == typeof(Beheerder)) { this.Hide(); FormBeheerderMainMenu fbmm = new FormBeheerderMainMenu(gebruiker); fbmm.ShowDialog(); if (fbmm.DialogResult == DialogResult.OK) { this.Show(); } } } else { MessageBox.Show("Gebruikersnaam of wachtwoord incorrect, probeer het nogmaals"); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }