示例#1
0
 public void GetBoekenLijst()
 {
     //Act
     Bibliotheek.GetBoekenLijst();
     //Assert
     Assert.IsTrue(Bibliotheek.Boeken.Count > 0);
 }
示例#2
0
 public void GetGebruikersLijst()
 {
     //Act
     Bibliotheek.GetGebruikersLijst();
     //Assert
     Assert.IsTrue(Bibliotheek.Gebruikers.Count > 0);
 }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     bibliotheek = new Bibliotheek();
     SituatieStandaard();
     ControlsLeegmaken();
     VulListbox();
     VulCombobox();
 }
示例#4
0
        public void GetGebruiker()
        {
            //Arrange
            Gebruiker gebruiker = new Gebruiker("Admin", "Admin", "Mohamed Ali", "Vlinderstraat 76", "29-09-1997", "Admin");

            //Assert
            Assert.AreEqual(Bibliotheek.GetGebruiker(gebruiker.Gebruikernaam), gebruiker);
        }
示例#5
0
        public void GetBoek()
        {
            //Arrange
            Auteur   auteur   = new Auteur("Bert", "Berenstraat 39");
            Uitgever uitgever = new Uitgever("Dirk", "Leeuwenstraat 93");
            Boek     boek     = new Boek(auteur, uitgever, "Suske & Wiske", "Horror", 5, 5);

            //Assert
            Assert.AreEqual(Bibliotheek.GetBoek(boek.Titel), boek);
        }
示例#6
0
        public void GebruikerToevoegen()
        {
            //Arrange
            Gebruiker gebruiker = new Gebruiker("Admin", "Admin", "Mohamed Ali", "Vlinderstraat 76", "29-09-1997", "Admin");

            //Act
            Bibliotheek.GebruikerToevoegen(gebruiker);
            //Assert
            Assert.IsTrue(Bibliotheek.Gebruikers.Contains(gebruiker));
        }
示例#7
0
        public void WijzigGegevens()
        {
            //Arrange
            Gebruiker gebruiker = new Gebruiker("Admin", "Admin", "Mohamed Ali", "Vlinderstraat 76", "29-09-1997", "Admin");

            //Act
            Bibliotheek.GebruikerToevoegen(gebruiker);
            Bibliotheek.WijzigGegevens(gebruiker.Gebruikernaam, "Naam", "Adres", "Geboortedatum", "Wachtwoord");
            //Assert
            Assert.IsTrue(Bibliotheek.GetGebruiker(gebruiker.Gebruikernaam).Naam == "Naam");
        }
示例#8
0
        public void CheckMijnLijst()
        {
            //Arrange
            Auteur    auteur    = new Auteur("Bert", "Berenstraat 39");
            Uitgever  uitgever  = new Uitgever("Dirk", "Leeuwenstraat 93");
            Boek      boek      = new Boek(auteur, uitgever, "Suske & Wiske", "Horror", 5, 5);
            Gebruiker gebruiker = new Gebruiker("Admin", "Admin", "Mohamed Ali", "Vlinderstraat 76", "29-09-1997", "Admin");

            //Act
            gebruiker.Boeken.Add(boek);
            //Assert
            Assert.IsTrue(Bibliotheek.CheckMijnLijst("Admin", boek.Titel));
        }
示例#9
0
 public ActionResult Login(FormCollection fc)
 {
     if (!string.IsNullOrEmpty(fc["gebruikernaam"]) && !string.IsNullOrEmpty(fc["wachtwoord"]) && Bibliotheek.Login(fc["gebruikernaam"], fc["wachtwoord"]) == true)
     {
         Bibliotheek.GetBoekenLijst();
         Bibliotheek.GetGebruikersLijst();
         Session["Gebruikernaam"] = fc["gebruikernaam"];
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         ViewBag.Message = "Gebruikersgegevens komen niet overeen.";
     }
     return(View());
 }
示例#10
0
 public ActionResult GetBoekenLijst(FormCollection fc)
 {
     Bibliotheek.GetBoekenLijst();
     //Kijkt of er een zoektitel is waar op gefilterd moet worden
     if (Request.QueryString["ZoekTitel"] != null)
     {
         ViewData["boeken"] = Bibliotheek.ZoekBoek(Request.QueryString["ZoekTitel"]);
         ViewBag.Message    = "Boeken voor zoekterm: " + "'" + Request.QueryString["ZoekTitel"] + "'";
     }
     //Als er geen zoekfilter is geeft die de volledige boekenlijst weer
     else
     {
         ViewData["boeken"] = Bibliotheek.Boeken;
     }
     return(View());
 }
示例#11
0
 public ActionResult LeenBoek(string id)
 {
     if (Session["Gebruikernaam"] != null)
     {
         if (!Bibliotheek.GetGebruiker(Session["Gebruikernaam"].ToString()).Boeken.Contains(Bibliotheek.GetBoek(id)))
         {
             Bibliotheek.GetGebruiker(Session["Gebruikernaam"].ToString()).LeenBoek(Bibliotheek.GetBoek(id));
         }
         ViewData["boeken"] = Bibliotheek.Boeken;
         return(View("GetBoekenLijst"));
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
示例#12
0
 public ActionResult WijzigGegevens(string id)
 {
     if (Session["Gebruikernaam"] != null)
     {
         if (id != null)
         {
             return(View(Bibliotheek.GetGebruiker(id)));
         }
         else
         {
             return(View(Bibliotheek.GetGebruiker(Session["Gebruikernaam"].ToString())));
         }
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
示例#13
0
 public ActionResult VerwijderGebruiker(string id)
 {
     if (Session["Gebruikernaam"] != null)
     {
         if (Bibliotheek.GetGebruiker(id).Boeken.Count > 0)
         {
             return(RedirectToAction("GebruikerBeheren", "Gebruikers", new { id = "Error1" }));
         }
         else
         {
             Bibliotheek.VerwijderGebruiker(id);
             return(RedirectToAction("GebruikerBeheren", "Gebruikers"));
         }
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
示例#14
0
 public ActionResult MijnBoeken(string id)
 {
     if (Session["Gebruikernaam"] != null)
     {
         if (id == null)
         {
             ViewBag.Title      = "Mijn boeken";
             ViewData["boeken"] = Bibliotheek.GetGebruiker(Session["Gebruikernaam"].ToString()).Boeken;
             return(View());
         }
         else
         {
             ViewBag.Title      = Bibliotheek.GetGebruiker(id).Naam + "'s " + "boeken";
             ViewData["boeken"] = Bibliotheek.GetGebruiker(id).Boeken;
             ViewBag.Gebruiker  = id;
             return(View());
         }
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
示例#15
0
 public ActionResult RetourBoek(string id, string gebruiker)
 {
     if (Session["Gebruikernaam"] != null)
     {
         if (gebruiker == null)
         {
             ViewBag.Title = "Mijn boeken";
             Bibliotheek.GetGebruiker(Session["Gebruikernaam"].ToString()).RetourBoek(Bibliotheek.GetBoek(id));
             ViewData["boeken"] = Bibliotheek.GetGebruiker(Session["Gebruikernaam"].ToString()).Boeken;
             return(View("MijnBoeken"));
         }
         else
         {
             ViewBag.Title = Bibliotheek.GetGebruiker(gebruiker).Naam + "'s " + "boeken";
             Bibliotheek.GetGebruiker(gebruiker).RetourBoek(Bibliotheek.GetBoek(id));
             ViewData["boeken"] = Bibliotheek.GetGebruiker(gebruiker).Boeken;
             return(View("MijnBoeken"));
         }
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
示例#16
0
 public ActionResult WijzigGegevens(FormCollection fc, string id)
 {
     if (Session["Gebruikernaam"] != null)
     {
         if (id != null)
         {
             if (DateTime.TryParse(fc["Geboortedatum"], out result))
             {
                 Bibliotheek.WijzigGegevens(id, fc["Naam"], fc["Adres"], fc["Geboortedatum"], fc["Wachtwoord"]);
                 ViewBag.Message = "Gegevens zijn succesvol gewijzigd.";
             }
             else
             {
                 ViewBag.Warning = "Verkeerde input voor geboortedatum! (dd/mm/yyyy).";
             }
             return(View(Bibliotheek.GetGebruiker(id)));
         }
         else
         {
             if (DateTime.TryParse(fc["Geboortedatum"], out result))
             {
                 Bibliotheek.WijzigGegevens(Session["Gebruikernaam"].ToString(), fc["Naam"], fc["Adres"], fc["Geboortedatum"], fc["Wachtwoord"]);
                 ViewBag.Message = "Uw gegevens zijn succesvol gewijzigd.";
             }
             else
             {
                 ViewBag.Warning = "Verkeerde input voor geboortedatum! (dd/mm/yyyy).";
             }
             return(View(Bibliotheek.GetGebruiker(Session["Gebruikernaam"].ToString())));
         }
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
示例#17
0
 public ActionResult GebruikerToevoegen(FormCollection fc)
 {
     if (Session["Gebruikernaam"] != null)
     {
         if (!string.IsNullOrEmpty(fc["Gebruikernaam"].ToString()) && !string.IsNullOrEmpty(fc["Wachtwoord"].ToString()) && !string.IsNullOrEmpty(fc["Naam"].ToString()) && !string.IsNullOrEmpty(fc["Adres"].ToString()) && !string.IsNullOrEmpty(fc["Geboortedatum"].ToString()))
         {
             if (Bibliotheek.GetGebruiker(fc["Gebruikernaam"]) == null)
             {
                 if (DateTime.TryParse(fc["Geboortedatum"], out result))
                 {
                     Gebruiker gebruiker = new Gebruiker(fc["Gebruikernaam"].ToString(), fc["Wachtwoord"].ToString(), fc["Naam"].ToString(), fc["Adres"].ToString(), fc["Geboortedatum"].ToString(), "Gebruiker");
                     Bibliotheek.GebruikerToevoegen(gebruiker);
                     ViewBag.Message = "Gebruiker succesvol aangemaakt!";
                     return(View("GebruikerBeheren"));
                 }
                 else
                 {
                     ViewBag.Warning = "Verkeerde input voor geboortedatum! (dd/mm/yyyy).";
                 }
             }
             else
             {
                 ViewBag.Warning = "Gebruikernaam is bezet.";
             }
         }
         else
         {
             ViewBag.Warning = "Voer alle gegevens in aub.";
         }
         return(View());
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
        static void Main(string[] args)
        {
            //bibliotheek aanmaken
            Bibliotheek bib1 = new Bibliotheek("de bib", new Adres("Hendrik Heymanplein", 3, 9100, "Sint-Niklaas"));

            //boeken aanmaken + toevoegen aan bib
            bib1.Add(new Boek(1022, "Schermerzone", new Auteur("Vandermeeren", "Hilde", new Adres("collegestraat", 2, 9100, "Sint-Niklaas"))));
            bib1.Add(new Boek(999, "Complexiteit", new Auteur("Delahaye", "Jean-Paul", new Adres("wittemolenstraat", 5, 9140, "Temse"))));
            bib1.Add(new Boek(200, "Mona", new Auteur("Sehlberg", "Dan", new Adres("bakerstreet", 221, 16, "London"))));
            bib1.Add(new Boek(333, "Ctrl Alt Delete", new Auteur("Suarez", "Daniel", new Adres("potterstraat", 88, 9170, "Sint-Gillis-Waas"))));
            bib1.Add(new Boek(101, "Logica voor informatica", new Auteur("Van Benthem", "J.F.A.K.", new Adres("vosdreef", 1, 9170, "Sint-Pauwels"))));
            bib1.Add(new Boek(2, "Cyberbabe", new Auteur("Verleyen", "Karel", new Adres("Gelaagstraat", 55, 9140, "Steendorp"))));

            //leden aanmaken
            Lid lid1 = new Lid(1, "Aerts", "Sebbe", new Adres("Lodewijk dosfelstraat", 1, 9100, "Sint-Niklaas"));
            Lid lid2 = new Lid(32, "Altamimi", "Ayman", new Adres("Lage Bokstraat", 22, 9100, "Brugge"));
            Lid lid3 = new Lid(8, "De Graeve", "Joeri", new Adres("Watermolenstraat", 12, 9100, "Antwerpen"));
            Lid lid4 = new Lid(700, "de man", "Jeroen", new Adres("Pijkedreef", 120, 9100, "Bornem"));
            Lid lid5 = new Lid(120, "De Parade", "Zino", new Adres("Hadewych", 36, 9100, "Puurs"));
            Lid lid6 = new Lid(77, "De Plucker", "Manuela", new Adres("Moortelhoekstraat", 41, 9100, "Eken"));
            Lid lid7 = new Lid(3, "De Schoesitter", "Nicky", new Adres("Arnhoutstraat", 55, 9100, "Roeselare"));

            ////leden toevoegen aan bib
            bib1.Add(lid1);
            bib1.Add(lid2);
            bib1.Add(lid3);
            bib1.Add(lid4);
            bib1.Add(lid5);
            bib1.Add(lid6);
            bib1.Add(lid7);


            //--Unit tests--
            //test class Bibliotheek
            Console.WriteLine(bib1.Naam == "de bib");
            Console.WriteLine("----------------------------------------------------------");
            bib1.ToonAlleBoeken();
            Console.WriteLine("----------------------------------------------------------");
            //test class Adres-Bibliotheek
            Console.WriteLine(bib1.Adres.Straat == "Hendrik Heymanplein");
            Console.WriteLine(bib1.Adres.Nummer == 3);
            Console.WriteLine(bib1.Adres.Postcode == 9100);
            Console.WriteLine(bib1.Adres.Gemeente == "Sint-Niklaas");
            //test class Boek
            bib1.Item(0).Uitlenen(lid1);
            bib1.Item(0).Uitlenen(lid2); /*2x hetzelfde boek uitlenen gaat niet*/
            Console.WriteLine(bib1.Item(0).UitgeleendDoor() == "Sebbe Aerts");
            bib1.Item(2).Uitlenen(lid5);
            bib1.Item(5).Uitlenen(lid5);
            Console.WriteLine(bib1.Item(2).UitgeleendDoor() == "Zino De Parade");
            Console.WriteLine(bib1.Item(5).UitgeleendDoor() == "Zino De Parade");
            Console.WriteLine("----------------------------------------------------------");
            bib1.UitgeleendeBoeken(); /*print alle uitgeleende boeken*/
            Console.WriteLine("----------------------------------------------------------");
            //test ontlenen boek
            //1
            Console.WriteLine(bib1.Item(0).Ontlenen() == "Het boek is correct binnengebracht.");
            //2 -manipulatie van datum om aan te tonen dat bij laat tijdig inbrengen boek een andere ouput krijgt-
            bib1.Item(2).Ontleendatum = new DateTime(2018, 04, 18);
            string antwoord = bib1.Item(2).Ontlenen();

            Console.WriteLine(antwoord);
            //3 niet uitgeleende boeken kunnen niet ontleent worden
            antwoord = bib1.Item(1).Ontlenen();
            Console.WriteLine(antwoord == "Het boek is niet uitgeleend.");
            Console.WriteLine("----------------------------------------------------------");
            Console.WriteLine((bib1.Item(0).Auteur.Voornaam + " " + bib1.Item(0).Auteur.Naam) == "Hilde Vandermeeren");
            Console.WriteLine(bib1.Item(0).Titel == "Schermerzone");
            Console.WriteLine(bib1.Item(0).Boeknummer == 1022);
            Console.WriteLine("----------------------------------------------------------");
            //test class Lid
            Console.WriteLine(bib1.Person(0).Lidnummer == 1);
            Console.WriteLine(bib1.Person(0).Naam == "Aerts");
            Console.WriteLine(bib1.Person(0).Voornaam == "Sebbe");
            //test class Adres-Lid
            Console.WriteLine(bib1.Person(0).Adres.Straat == "Lodewijk dosfelstraat");
            Console.WriteLine(bib1.Person(0).Adres.Nummer == 1);
            Console.WriteLine(bib1.Person(0).Adres.Postcode == 9100);
            Console.WriteLine(bib1.Person(0).Adres.Gemeente == "Sint-Niklaas");
            //test class Auteur
            Console.WriteLine(bib1.Item(1).Auteur.Naam == "Delahaye");
            Console.WriteLine(bib1.Item(1).Auteur.Voornaam == "Jean-Paul");
            //test class Adres-Auteur
            Console.WriteLine(bib1.Item(1).Auteur.Adres.Straat == "wittemolenstraat");
            Console.WriteLine(bib1.Item(1).Auteur.Adres.Nummer == 5);
            Console.WriteLine(bib1.Item(1).Auteur.Adres.Postcode == 9140);
            Console.WriteLine(bib1.Item(1).Auteur.Adres.Gemeente == "Temse");
            //
            Console.WriteLine("----------------------------------------------------------");
            bib1.ToonAlleBoeken();
            Console.WriteLine("----------------------------------------------------------");
            bib1.UitgeleendeBoeken();
            Console.WriteLine("----------------------------------------------------------");
            bib1.PrintLeden();
            Console.WriteLine("----------------------------------------------------------");
            //
            Console.ReadLine();
        }