コード例 #1
0
        public void Create()
        {
            GebruikerSqlContext gsc = new GebruikerSqlContext();
            GebruikerRepository gr  = new GebruikerRepository(gsc);

            var User = gr.GetById(1);

            int id         = gr.Create(User);
            var nieuweUser = gr.GetById(id);

            Assert.AreEqual(id, nieuweUser.Id);
        }
コード例 #2
0
        public ActionResult RegistreerHulpverlener(FormCollection form, HttpPostedFileBase foto)
        {
            try
            {
                string path     = "";
                string fotoPath = "";
                if (foto != null)
                {
                    if (foto.ContentLength > 0)
                    {
                        if (Path.GetExtension(foto.FileName).ToLower() == ".png" || Path.GetExtension(foto.FileName).ToLower() == ".jpg" ||
                            Path.GetExtension(foto.FileName).ToLower() == ".jpeg")
                        {
                            path = Path.Combine(Server.MapPath("~/Content/Foto"), foto.FileName);
                            foto.SaveAs(path);
                            fotoPath = "/Content/Foto/" + foto.FileName;
                        }
                    }
                }
                if (form["wachtwoord"] == form["wachtwoordherhalen"])
                {
                    Gebruiker gebruiker1 = new Gebruiker();
                    gebruiker1.Image          = fotoPath;
                    gebruiker1.Geslacht       = (Geslacht)Enum.Parse(typeof(Geslacht), form["geslacht"]);
                    gebruiker1.Adres          = form["adres"];
                    gebruiker1.Email          = form["email"];
                    gebruiker1.Geboortedatum  = Convert.ToDateTime(form["geboortedatum"]);
                    gebruiker1.Woonplaats     = form["plaats"];
                    gebruiker1.Land           = form["land"];
                    gebruiker1.Postcode       = form["postcode"];
                    gebruiker1.Telefoonnummer = form["telnr"];
                    gebruiker1.Wachtwoord     = form["wachtwoord"];
                    gebruiker1.Gebruikersnaam = form["gebruikersnaam"];
                    gebruiker1.Naam           = form["naam"];
                    gebruiker1.Barcode        = form["barcode"];

                    GebruikerSqlContext sql             = new GebruikerSqlContext();
                    GebruikerRepository repo            = new GebruikerRepository(sql);
                    int                    id           = repo.Create(gebruiker1);
                    Hulpverlener           hulpverlener = new Hulpverlener(id);
                    HulpverlenerSqlContext hsql         = new HulpverlenerSqlContext();
                    HulpverlenerRepository hrepo        = new HulpverlenerRepository(hsql);
                    hrepo.Create(id);

                    return(RedirectToAction("Index", "Login"));
                }
                return(RedirectToAction("RegistreerHulpverlener", "Registreer"));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index", "Error"));
            }
        }
コード例 #3
0
        public void Delete()
        {
            GebruikerSqlContext gsc = new GebruikerSqlContext();
            GebruikerRepository gr  = new GebruikerRepository(gsc);

            int oudeCount = gr.GetAll().Count;

            // gr.Delete(3);

            int nieuweCount = gr.GetAll().Count;

            Assert.AreEqual(oudeCount, (nieuweCount - 1));
        }
コード例 #4
0
        public void TestCreateChat()
        {
            var sql   = new ChatSqlContext();
            var repo  = new ChatRepository(sql);
            var gsql  = new GebruikerSqlContext();
            var grepo = new GebruikerRepository(gsql);
            var g1    = grepo.GetById(1);
            var g2    = grepo.GetById(4);

            var chat = new Chat(g1, g2, DateTime.Now, "Hallo jongens");

            repo.Create(chat);
        }
コード例 #5
0
        public JsonResult SendChatMessage(int autheurId, int ontvangerId, string bericht)
        {
            GebruikerSqlContext gsc = new GebruikerSqlContext();
            GebruikerRepository gr  = new GebruikerRepository(gsc);
            var sql      = new ChatSqlContext();
            var chatRepo = new ChatRepository(sql);

            Gebruiker auteur       = gr.GetById(autheurId);
            Gebruiker ontvanger    = gr.GetById(ontvangerId);
            Chat      nieuwBericht = new Chat(auteur, ontvanger, DateTime.Now, bericht);

            chatRepo.Create(nieuwBericht);

            return(null);
        }
コード例 #6
0
ファイル: Gebruiker.cs プロジェクト: snekmel/WebshopASP
        public string SaveOrUpdate()
        {
            GebruikerSQLContext gsc = new GebruikerSQLContext();
            GebruikerRepository gr  = new GebruikerRepository(gsc);

            if (Id != 0)
            {
                gr.Update(this);
                return(this.Id.ToString());
            }
            else
            {
                return(gr.Create(this));
            }
        }
コード例 #7
0
ファイル: KiesScherm.xaml.cs プロジェクト: snekmel/Carespot
        private void OpdrachtScherm_Click(object sender, RoutedEventArgs e)
        {
            var gsc = new GebruikerSQLContext();
            var gr  = new GebruikerRepository(gsc);

            var hsc = new HulpopdrachtSQLContext();
            var hr  = new HulpopdrachtRepository(hsc);

            var lijst = hr.GetAllHulpopdrachten();
            var g     = gr.RetrieveGebruiker(1);

            var opdracht = new Opdracht(g, lijst[0]);

            opdracht.Show();
        }
コード例 #8
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);
        }
コード例 #9
0
        //Get: Beheerder/Chat
        public ActionResult Chat(FormCollection f)
        {
            GebruikerSqlContext gsc = new GebruikerSqlContext();
            GebruikerRepository gr  = new GebruikerRepository(gsc);

            ChatSqlContext csc = new ChatSqlContext();
            ChatRepository cr  = new ChatRepository(csc);

            List <Gebruiker> users = gr.GetAll();


            int id1 = Convert.ToInt32(f["user1"]);
            int id2 = Convert.ToInt32(f["user2"]);



            if (id1 != 0 && id2 != 0 && (id1 != id2))
            {
                List <Chat> chat       = cr.GetChatByUsers(id1, id2);
                string      chatString = "";

                if (chat.Count > 0)
                {
                    for (int i = 0; i < chat.Count; i++)
                    {
                        chatString = chatString + chat[i].Auteur.Naam + " | " + chat[i].Bericht + "\r";
                    }

                    ViewBag.Chatstring = chatString;
                }
                else
                {
                    ViewBag.Chatstring = "Geen chat gevonden";
                }
            }
            else
            {
                ViewBag.Chatstring = "";
            }


            ViewBag.Users = users;

            return(View("~/Views/Chat/Beheer.cshtml"));
        }
コード例 #10
0
        public GebruikerRepositoryTest()
        {
            //Arrange
            repo       = new GebruikerRepository(new TestGebruikerContext());
            gebruikers = new List <Gebruiker>
            {
                new Gebruiker(1, 0, "Henrie", "henrie", "Niew", "Nieuwe gebruiker", 0, "*****@*****.**",
                              Functie.Gebruiker),
                new Gebruiker(2, 0, "Dirk", "dirk", "Niew", "Nieuwe gebruiker", 0, "*****@*****.**",
                              Functie.Beheerder)
            };

            //Act
            foreach (Gebruiker gebruiker in gebruikers)
            {
                repo.InsertNonAsyncTest(gebruiker);
            }
        }
コード例 #11
0
        // GET: Chat
        public ActionResult Index()
        {
            if (!AuthRepository.CheckIfUserCanAcces(GebruikerType.All, (Gebruiker)Session["LoggedInUser"]))
            {
                return(View("~/Views/Error/AuthError.cshtml"));
            }

            try {
                GebruikerSqlContext gsc = new GebruikerSqlContext();
                GebruikerRepository gr  = new GebruikerRepository(gsc);
                Gebruiker           g   = (Gebruiker)Session["LoggedInUser"];
                ViewBag.Gebruikers = gr.GetAll().Where(x => x.Id != g.Id).ToList();
                return(View("~/Views/Chat/Index.cshtml"));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index", "Error"));
            }
        }
コード例 #12
0
        public ActionResult KeuzeRedirect(string id)
        {
            GebruikerSqlContext gsc = new GebruikerSqlContext();
            GebruikerRepository gr  = new GebruikerRepository(gsc);

            GebruikerType    gt    = (GebruikerType)Enum.Parse(typeof(GebruikerType), id);
            List <Gebruiker> users = gr.GetUserTypesByUserId((int)Session["UserId"]);

            List <GebruikerType> types = new List <GebruikerType>();

            foreach (Gebruiker gebr in users)
            {
                types.Add((GebruikerType)Enum.Parse(typeof(GebruikerType), gebr.GetType().Name));
            }

            foreach (GebruikerType type in types)
            {
                if (type == gt)
                {
                    if (type == GebruikerType.Vrijwilliger)
                    {
                        VrijwilligerSqlContext vsc = new VrijwilligerSqlContext();
                        VrijwilligerRepository vr  = new VrijwilligerRepository(vsc);
                        Session["LoggedInUser"] = vr.GetVrijwilligerById((int)Session["UserId"]);
                        return(RedirectToAction("Index", "Vrijwilliger"));
                    }
                    if (type == GebruikerType.Hulpbehoevende)
                    {
                        HulpbehoevendeSqlContext hsc = new HulpbehoevendeSqlContext();
                        HulpbehoevendeRepository hr  = new HulpbehoevendeRepository(hsc);

                        Session["LoggedInUser"] = hr.GetHulpbehoevendeById((int)Session["UserId"]);
                        return(RedirectToAction("Index", "Hulpbehoevende"));
                    }
                }
            }

            return(null);
        }
コード例 #13
0
 public ActionResult Delete(int id)
 {
     if (!AuthRepository.CheckIfUserCanAcces(GebruikerType.All, (Gebruiker)Session["LoggedInUser"]))
     {
         return(View("~/Views/Error/AuthError.cshtml"));
     }
     try
     {
         GebruikerSqlContext gsql  = new GebruikerSqlContext();
         GebruikerRepository grepo = new GebruikerRepository(gsql);
         grepo.Delete(id);
         Gebruiker gebruiker = (Gebruiker)Session["LoggedInUser"];
         if (gebruiker.GetType() == typeof(Beheerder))
         {
             return(RedirectToAction("Index", "Beheerder"));
         }
         return(RedirectToAction("Index", "Login"));
     }
     catch (Exception)
     {
         return(RedirectToAction("Index", "Error"));
     }
 }
コード例 #14
0
        public Beheerder RetrieveBeheerder(int id)
        {
            var gsc = new GebruikerSQLContext();
            var gr  = new GebruikerRepository(gsc);
            var g   = gr.RetrieveGebruiker(id);

            var b = new Beheerder();

            b.Id             = g.Id;
            b.Naam           = g.Naam;
            b.Wachtwoord     = g.Wachtwoord;
            b.Geslacht       = g.Geslacht;
            b.Straat         = g.Straat;
            b.Huisnummer     = g.Huisnummer;
            b.Postcode       = g.Postcode;
            b.Plaats         = g.Plaats;
            b.Land           = g.Land;
            b.Email          = g.Email;
            b.Telefoonnummer = g.Telefoonnummer;
            b.Foto           = g.Foto;

            return(b);
        }
コード例 #15
0
        public Hulpverlener RetrieveHulpverlener(int id)
        {
            var gsc = new GebruikerSQLContext();
            var gr  = new GebruikerRepository(gsc);
            var g   = gr.RetrieveGebruiker(id);

            var h = new Hulpverlener();

            h.Id             = g.Id;
            h.Naam           = g.Naam;
            h.Wachtwoord     = g.Wachtwoord;
            h.Geslacht       = g.Geslacht;
            h.Straat         = g.Straat;
            h.Huisnummer     = g.Huisnummer;
            h.Postcode       = g.Postcode;
            h.Plaats         = g.Plaats;
            h.Land           = g.Land;
            h.Email          = g.Email;
            h.Telefoonnummer = g.Telefoonnummer;
            h.Foto           = g.Foto;

            return(h);
        }
コード例 #16
0
        private void btInloggen_Click(object sender, RoutedEventArgs e)
        {
            //Controleer gegevens en log in, indien er meerdere soorten gebruik binnen die persoon mogelijk zijn, opent eerst het scherm 'Keuzescherm'
            Gebruiker g;
            Gebruiker gebrVrijwilliger   = null;
            Gebruiker gebrHulpbehoevende = null;
            var       i = 0;

            g = AuthRepository.CheckAuth(tbEmail.Text, pbWachtwoord.Password);
            if (g != null)
            {
                var gr         = new GebruikerRepository();
                var gebruikers = gr.RetrieveAll();
                foreach (var gebr in gebruikers)
                {
                    if (gebr.Id == g.Id)
                    {
                        i++;
                        if (gebr.GetType() == typeof(Vrijwilliger))
                        {
                            gebrVrijwilliger = gebr;
                        }
                        else if (gebr.GetType() == typeof(Hulpbehoevende))
                        {
                            gebrHulpbehoevende = gebr;
                        }
                        else if (gebr.GetType() == typeof(Hulpverlener))
                        {
                            var hulpverlenerhoofdscherm = new HulpverlenerHoofdscherm(gebr);
                            hulpverlenerhoofdscherm.Show();
                            Close();
                        }
                        else if (gebr.GetType() == typeof(Beheerder))
                        {
                            var beheerderscherm = new GebruikerBeheer(gebr);
                            beheerderscherm.Show();
                            Close();
                        }
                    }
                }
                if (i == 1)
                {
                    if (gebrHulpbehoevende == null && gebrVrijwilliger != null)
                    {
                        var vrijwilligerscherm = new VrijwilligerHoofdscherm(gebrVrijwilliger);
                        vrijwilligerscherm.Show();
                        Close();
                    }
                    else if (gebrHulpbehoevende != null && gebrVrijwilliger == null)
                    {
                        var hulpbehoevendescherm = new CliëntOverzicht(gebrHulpbehoevende);
                        hulpbehoevendescherm.Show();
                        Close();
                    }
                }
                else if (i > 1)
                {
                    var keuzescherm = new Keuzescherm(gebrVrijwilliger, gebrHulpbehoevende);
                    keuzescherm.Show();
                    Close();
                }
            }
            else
            {
                MessageBox.Show("Foute inloggegevens.");
            }
        }
コード例 #17
0
        public ActionResult Update(FormCollection form, int id, HttpPostedFileBase foto)
        {
            if (!AuthRepository.CheckIfUserCanAcces(GebruikerType.All, (Gebruiker)Session["LoggedInUser"]))
            {
                return(View("~/Views/Error/AuthError.cshtml"));
            }

            try
            {
                if (Session["LoggedInUser"] != null)
                {
                    Gebruiker              loggedinGebruiker = Session["LoggedInUser"] as Gebruiker;
                    GebruikerSqlContext    sql       = new GebruikerSqlContext();
                    GebruikerRepository    repo      = new GebruikerRepository(sql);
                    VrijwilligerSqlContext vsql      = new VrijwilligerSqlContext();
                    VrijwilligerRepository vrepo     = new VrijwilligerRepository(vsql);
                    Gebruiker              gebruiker = new Gebruiker();
                    gebruiker.Id = id;
                    string path     = "";
                    string fotoPath = "";
                    if (foto != null)
                    {
                        if (foto.ContentLength > 0)
                        {
                            if (Path.GetExtension(foto.FileName).ToLower() == ".png" || Path.GetExtension(foto.FileName).ToLower() == ".jpg" ||
                                Path.GetExtension(foto.FileName).ToLower() == ".jpeg")
                            {
                                path = Path.Combine(Server.MapPath("~/Content/Foto"), foto.FileName);
                                foto.SaveAs(path);
                                fotoPath        = "/Content/Foto/" + foto.FileName;
                                gebruiker.Image = fotoPath;
                            }
                        }
                    }
                    else
                    {
                        gebruiker.Image = loggedinGebruiker.Image;
                    }
                    if (form["wachtwoord"] != "" && form["wachtwoordnieuw"] != "")
                    {
                        if (form["wachtwoord"] == form["wachtwoordnieuw"])
                        {
                            gebruiker.Wachtwoord = form["wachtwoord"];
                        }
                    }
                    else
                    {
                        gebruiker.Wachtwoord = loggedinGebruiker.Wachtwoord;
                    }

                    gebruiker.Geslacht = (Geslacht)Enum.Parse(typeof(Geslacht), form["geslacht"]);
                    gebruiker.Adres    = form["adres"];
                    gebruiker.Email    = form["email"];

                    gebruiker.Woonplaats     = form["plaats"];
                    gebruiker.Land           = form["land"];
                    gebruiker.Postcode       = form["postcode"];
                    gebruiker.Telefoonnummer = form["telnr"];
                    gebruiker.Gebruikersnaam = form["gebruikersnaam"];
                    gebruiker.Naam           = form["naam"];
                    gebruiker.HeeftAuto      = Convert.ToBoolean(form["auto"]);
                    gebruiker.HeeftRijbewijs = Convert.ToBoolean(form["rijbewijs"]);
                    gebruiker.HeeftOv        = Convert.ToBoolean(form["ov"]);
                    gebruiker.Barcode        = form["barcode"];

                    string[]   vaardigheidIds    = form.GetValues("vaardigheden");
                    List <int> vaardigheidIdList = new List <int>();
                    if (vaardigheidIds != null)
                    {
                        foreach (string vaardigheidId in vaardigheidIds)
                        {
                            vaardigheidIdList.Add(Convert.ToInt32(vaardigheidId));
                        }
                    }
                    if (vaardigheidIdList.Count != 0)
                    {
                        vrepo.CreateVrijwilligerWithVaardigheid(gebruiker.Id, vaardigheidIdList);
                    }
                    repo.Update(gebruiker);

                    return(RedirectToAction("Gegevens", "Gebruiker", new { id = gebruiker.Id }));
                }
                return(RedirectToAction("Index", "Login"));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index", "Error"));
            }
        }
コード例 #18
0
        private void btGegevensWijzigen_Click(object sender, RoutedEventArgs e)
        {
            var  inf       = new GebruikerSQLContext();
            bool canUpdate = true;
            var  repo      = new GebruikerRepository(inf);

            if (!String.IsNullOrEmpty(tbEmail.Text) && !String.IsNullOrEmpty(tbNaam.Text) &&
                !String.IsNullOrEmpty(tbTelefoon.Text) && !String.IsNullOrEmpty(tbAdres.Text) &&
                !String.IsNullOrEmpty(tbNummer.Text) && !String.IsNullOrEmpty(tbPostcode.Text) && !String.IsNullOrEmpty(tbPlaats.Text) &&
                !String.IsNullOrEmpty(tbLand.Text))
            {
                System.Windows.MessageBox.Show(_g.Wachtwoord);
                _g.Email          = tbEmail.Text;
                _g.Naam           = tbNaam.Text;
                _g.Telefoonnummer = tbTelefoon.Text;
                _g.Straat         = tbAdres.Text;
                _g.Huisnummer     = tbNummer.Text;
                _g.Postcode       = tbPostcode.Text;
                _g.Plaats         = tbPlaats.Text;
                _g.Land           = tbLand.Text;

                //Wanneer 1 van de 2 leeg is
                if (String.IsNullOrEmpty(pwbWachtwoord.Password) || String.IsNullOrEmpty(pwbWachtwoordHerhalen.Password))
                {
                    if (String.IsNullOrEmpty(pwbWachtwoord.Password) &&
                        String.IsNullOrEmpty(pwbWachtwoordHerhalen.Password))
                    {
                        //allebei is leeg
                        _g.Wachtwoord = _g.Wachtwoord;
                        System.Windows.MessageBox.Show("allebei leeg + updaten");
                    }
                    else
                    {
                        //een van de 2 is leeg
                        System.Windows.MessageBox.Show("Vul allebei de velden in.");
                        canUpdate = false;
                    }
                }
                else
                {
                    //allebei gevuld
                    if (!String.IsNullOrEmpty(pwbWachtwoord.Password) &&
                        !String.IsNullOrEmpty(pwbWachtwoordHerhalen.Password))
                    {
                        if (pwbWachtwoord.Password != pwbWachtwoordHerhalen.Password)
                        {
                            System.Windows.MessageBox.Show("De wachtwoorden zijn niet gelijk.");
                            canUpdate = false;
                        }
                        else
                        {
                            _g.Wachtwoord = pwbWachtwoordHerhalen.Password;
                        }
                    }
                }


                if (cbGeslacht.SelectedItem != null)
                {
                    _g.Geslacht = (Gebruiker.GebruikerGeslacht)cbGeslacht.SelectedItem;
                }

                if (img == null)
                {
                }
                else
                {
                    _g.Foto = img;
                }

                if (canUpdate)
                {
                    repo.UpdateGebruiker(_g);
                }
            }
            else
            {
                MessageBox.Show("Er mogen geen velden leeggelaten worden");
            }
        }
コード例 #19
0
 public List <GebruikerVM> GetInspecteurByDate(DateTime date)
 {
     return(GebruikerRepository.GetInspecteursByDate(date).Select(i => new GebruikerVM(i)).ToList());
 }
コード例 #20
0
        static void Main(string[] args)
        {
            IGebruikerOpvragenRepository gebruikerOpvragenRepository = new GebruikerRepository();

            gebruikerOpvragenRepository.GetGebruiker(1);
        }
コード例 #21
0
 public GebruikerLogic(GebruikerRepository gebruikersrepo)
 {
     _gebruikerRepo = gebruikersrepo;
 }
コード例 #22
0
 public void DeleteInspector(Gebruiker gebruiker)
 {
     GebruikerRepository.DeleteGebruiker(gebruiker);
 }
コード例 #23
0
 public ObservableCollection <GebruikerVM> GetGebruikers()
 {
     return(new ObservableCollection <GebruikerVM>(GebruikerRepository.GetGebruikers().Select(i => new GebruikerVM(i)).ToList()));
 }
コード例 #24
0
 public void UpdateInspector(Gebruiker g)
 {
     GebruikerRepository.UpdateGebruiker(g);
 }
コード例 #25
0
        public ActionResult Save(FormCollection form, HttpPostedFileBase foto, HttpPostedFileBase vog)
        {
            try
            {
                string vogPath = "";
                string path    = "";
                if (vog != null)
                {
                    if (vog.ContentLength > 0)
                    {
                        if (Path.GetExtension(vog.FileName).ToLower() == ".pdf")
                        {
                            path = Path.Combine(Server.MapPath("~/Content/VOG"), vog.FileName);
                            vog.SaveAs(path);
                            vogPath = "/Content/VOG/" + vog.FileName;
                        }
                    }
                }
                string fotoPath = "";
                if (foto != null)
                {
                    if (foto.ContentLength > 0)
                    {
                        if (Path.GetExtension(foto.FileName).ToLower() == ".png" ||
                            Path.GetExtension(foto.FileName).ToLower() == ".jpg" ||
                            Path.GetExtension(foto.FileName).ToLower() == ".jpeg")
                        {
                            path = Path.Combine(Server.MapPath("~/Content/Foto"), foto.FileName);
                            foto.SaveAs(path);
                            fotoPath = "/Content/Foto/" + foto.FileName;
                        }
                    }
                }
                if (form["vrij"] == null && form["hulp"] == null)
                {
                    return(RedirectToAction("Index", "Registreer"));
                }
                if (form["wachtwoord"] == form["wachtwoordherhalen"])
                {
                    Gebruiker gebruiker1 = new Gebruiker();
                    gebruiker1.Image          = fotoPath;
                    gebruiker1.Geslacht       = (Geslacht)Enum.Parse(typeof(Geslacht), form["geslacht"]);
                    gebruiker1.Adres          = form["adres"];
                    gebruiker1.Email          = form["email"];
                    gebruiker1.Geboortedatum  = Convert.ToDateTime(form["geboortedatum"]);
                    gebruiker1.Woonplaats     = form["plaats"];
                    gebruiker1.Land           = form["land"];
                    gebruiker1.Postcode       = form["postcode"];
                    gebruiker1.Telefoonnummer = form["telnr"];
                    // gebruiker1.Huisnummer = form["huisnr"];
                    gebruiker1.Wachtwoord     = form["wachtwoord"];
                    gebruiker1.Gebruikersnaam = form["gebruikersnaam"];
                    gebruiker1.Naam           = form["naam"];
                    gebruiker1.HeeftAuto      = bool.Parse(form["auto"]);
                    gebruiker1.HeeftRijbewijs = bool.Parse(form["rijbewijs"]);
                    gebruiker1.HeeftOv        = bool.Parse(form["ov"]);
                    gebruiker1.Barcode        = form["barcode"];

                    string[]   vaardigheidIds    = form.GetValues("vaardigheden");
                    List <int> vaardigheidIdList = new List <int>();
                    if (vaardigheidIds != null)
                    {
                        foreach (string vaardigheidId in vaardigheidIds)
                        {
                            vaardigheidIdList.Add(Convert.ToInt32(vaardigheidId));
                        }
                    }

                    GebruikerSqlContext sql  = new GebruikerSqlContext();
                    GebruikerRepository repo = new GebruikerRepository(sql);
                    int id = repo.Create(gebruiker1);
                    if (form["hulp"] != null && form["hulp"] == "hulpbehoevende")
                    {
                        Hulpbehoevende hulpbehoevende = new Hulpbehoevende(id);
                        hulpbehoevende.Id = id;
                        HulpbehoevendeSqlContext hsql  = new HulpbehoevendeSqlContext();
                        HulpbehoevendeRepository hrepo = new HulpbehoevendeRepository(hsql);
                        hrepo.CreateHulpbehoevende(hulpbehoevende.Id, hrepo.BepaalHulpverlener());
                    }

                    if (form["vrij"] != null && form["vrij"] == "vrijwilliger")
                    {
                        Vrijwilliger           vrijwilliger = new Vrijwilliger(id, vogPath, false);
                        VrijwilligerSqlContext vsql         = new VrijwilligerSqlContext();
                        VrijwilligerRepository vrepo        = new VrijwilligerRepository(vsql);
                        vrepo.Create(vrijwilliger.Id, vrijwilliger.VOG);
                        if (vaardigheidIdList.Count != 0)
                        {
                            vrepo.CreateVrijwilligerWithVaardigheid(vrijwilliger.Id, vaardigheidIdList);
                        }
                    }
                    return(RedirectToAction("Index", "Login"));
                }

                return(RedirectToAction("Index", "Registreer"));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index", "Error"));
            }
        }
コード例 #26
0
        private void btnHulpverlenerAanmaken_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                var email             = tbmail.Text;
                var wachtwoord        = pwbWachtwoordd.Password;
                var wachtwoordOpnieuw = pwbWachtwoordOpnieuw.Password;
                var naam       = tbNaam.Text;
                var geslacht   = (Gebruiker.GebruikerGeslacht)cbGeslacht.SelectedItem;
                var telNr      = tbTelefoon.Text;
                var adres      = tbAdres.Text;
                var huisNummer = tbNummer.Text;
                var postcode   = tbPostcode.Text;
                var plaats     = tbPlaats.Text;
                var land       = tbLand.Text;
                if (img == null)
                {
                    var inf  = new GebruikerSQLContext();
                    var repo = new GebruikerRepository(inf);
                    foto = repo.RetrieveGebruiker(1).Foto;
                }
                else
                {
                    foto = img;
                }

                if (!String.IsNullOrEmpty(email) && !String.IsNullOrEmpty(wachtwoord) &&
                    !String.IsNullOrEmpty(wachtwoordOpnieuw) && !String.IsNullOrEmpty(naam) &&
                    !String.IsNullOrEmpty(telNr) && !String.IsNullOrEmpty(adres) && !String.IsNullOrEmpty(huisNummer) &&
                    !String.IsNullOrEmpty(postcode) && !String.IsNullOrEmpty(plaats) && !String.IsNullOrEmpty(land))
                {
                    if (wachtwoord == wachtwoordOpnieuw)
                    {
                        var inf  = new GebruikerSQLContext();
                        var repo = new GebruikerRepository(inf);
                        var g    = new Gebruiker
                        {
                            Email          = email,
                            Foto           = foto,
                            Geslacht       = geslacht,
                            Huisnummer     = huisNummer,
                            Land           = land,
                            Naam           = naam,
                            Plaats         = plaats,
                            Postcode       = postcode,
                            Straat         = adres,
                            Wachtwoord     = wachtwoord,
                            Telefoonnummer = telNr
                        };

                        var hlp     = new HulpverlenerSQLContext();
                        var repohlp = new HulpverlenerRepository(hlp);
                        var id      = repo.CreateGebruiker(g);
                        repohlp.CreateHulpverlener(id);
                        // repo.CreateHulpbehoevende(naam, wachtwoord, geslacht, adres, huisNummer, postcode, plaats, land, email,
                        //    telNr, gebruikertype, foto, 3);
                    }
                    else
                    {
                        MessageBox.Show("Wachtwoorden komen niet overeen.");
                    }
                }
                else
                {
                    MessageBox.Show("Alle velden moeten zijn ingevuld.");
                }
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Er moet een geslacht gekozen zijn.");
            }
        }
コード例 #27
0
 private GebruikerManager(IUserStore <Gebruiker> store) : base(store)
 {
     _gebruikerRepository = (GebruikerRepository)store;
 }
コード例 #28
0
ファイル: RFIDLogin.xaml.cs プロジェクト: snekmel/Carespot
        private void Tick(object sender, EventArgs e)
        {
            Gebruiker g;
            Gebruiker gebrVrijwilliger   = null;
            Gebruiker gebrHulpbehoevende = null;
            var       i = 0;

            lblRfid.Content = "Scan uw tag.";
            Scan();
            if (_tag != null)
            {
                //MessageBox.Show(_tag);
                g = AuthRepository.CheckAuthRFID(_tag);

                if (g != null)
                {
                    lblRfid.Content = "U wordt ingelogd.";
                    _timer.Stop();
                    var gr         = new GebruikerRepository();
                    var gebruikers = gr.RetrieveAll();
                    foreach (var gebr in gebruikers)
                    {
                        if (gebr.Id == g.Id)
                        {
                            i++;
                            if (gebr.GetType() == typeof(Vrijwilliger))
                            {
                                gebrVrijwilliger = gebr;
                            }
                            else if (gebr.GetType() == typeof(Hulpbehoevende))
                            {
                                gebrHulpbehoevende = gebr;
                            }
                            else if (gebr.GetType() == typeof(Hulpverlener))
                            {
                                var hulpverlenerhoofdscherm = new HulpverlenerHoofdscherm(gebr);
                                hulpverlenerhoofdscherm.Show();
                                Close();
                            }
                            else if (gebr.GetType() == typeof(Beheerder))
                            {
                                var beheerderscherm = new GebruikerBeheer(gebr);
                                beheerderscherm.Show();
                                Close();
                            }
                        }
                    }
                    if (i == 1)
                    {
                        if (gebrHulpbehoevende == null && gebrVrijwilliger != null)
                        {
                            var vrijwilligerscherm = new VrijwilligerHoofdscherm(gebrVrijwilliger);
                            vrijwilligerscherm.Show();
                            Close();
                        }
                        else if (gebrHulpbehoevende != null && gebrVrijwilliger == null)
                        {
                            var hulpbehoevendescherm = new CliëntOverzicht(gebrHulpbehoevende);
                            hulpbehoevendescherm.Show();
                            Close();
                        }
                    }
                    else if (i > 1)
                    {
                        var keuzescherm = new Keuzescherm(gebrVrijwilliger, gebrHulpbehoevende);
                        keuzescherm.Show();
                        Close();
                    }
                }
                else
                {
                    lblRfid.Content = "Geen gebruiker gevonden met deze tag.";
                }
            }
        }
コード例 #29
0
ファイル: Program.cs プロジェクト: kwlin/SOLID
        static void Main(string[] args)
        {
            IGebruikerRepository gebruikerRepository = new GebruikerRepository();

            var gebruiker = gebruikerRepository.GetGebruiker(1);
        }
コード例 #30
0
        public ActionResult Barcode(FormCollection form)
        {
            try
            {
                Gebruiker           g   = AuthRepository.CheckAuthBarcode(form["barcode"]);
                GebruikerSqlContext gsc = new GebruikerSqlContext();
                GebruikerRepository gr  = new GebruikerRepository(gsc);

                if (g == null)
                {
                    ViewBag.LoginResult = false;
                    return(View("~/Views/Login/Login.cshtml"));
                }
                List <Gebruiker>     users = gr.GetUserTypesByUserId(g.Id);
                List <GebruikerType> types = new List <GebruikerType>();

                foreach (Gebruiker gebr in users)
                {
                    types.Add((GebruikerType)Enum.Parse(typeof(GebruikerType), gebr.GetType().Name));
                }

                if (types.Contains(GebruikerType.Hulpbehoevende) && types.Contains(GebruikerType.Vrijwilliger))
                {
                    ViewBag.Accounts  = users;
                    ViewBag.Types     = types;
                    Session["UserId"] = g.Id;
                    return(Keuze());
                }
                if (types.Contains(GebruikerType.Hulpbehoevende))
                {
                    HulpbehoevendeSqlContext hsc = new HulpbehoevendeSqlContext();
                    HulpbehoevendeRepository hr  = new HulpbehoevendeRepository(hsc);

                    Session["LoggedInUser"] = hr.GetHulpbehoevendeById(g.Id);
                    return(RedirectToAction("Index", "Hulpbehoevende"));
                }
                if (types.Contains(GebruikerType.Vrijwilliger))
                {
                    VrijwilligerSqlContext vsc = new VrijwilligerSqlContext();
                    VrijwilligerRepository vr  = new VrijwilligerRepository(vsc);
                    Session["LoggedInUser"] = vr.GetVrijwilligerById(g.Id);
                    return(RedirectToAction("Index", "Vrijwilliger"));
                }
                if (types.Contains(GebruikerType.Beheerder))
                {
                    BeheerderSqlContext bsc = new BeheerderSqlContext();
                    BeheerderRepository br  = new BeheerderRepository(bsc);
                    Session["LoggedInUser"] = br.GetById(g.Id);
                    return(RedirectToAction("Index", "Beheerder"));
                }
                if (types.Contains(GebruikerType.Hulpverlener))
                {
                    HulpverlenerSqlContext hsc = new HulpverlenerSqlContext();
                    HulpverlenerRepository hr  = new HulpverlenerRepository(hsc);
                    Session["LoggedInUser"] = hr.GetById(g.Id);
                    return(RedirectToAction("Index", "Hulpverlener"));
                }
                return(RedirectToAction("Index", "Login"));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index", "Error"));
            }
        }