예제 #1
0
        //methode: Items opvragen uit tabel
        public Boek GetBoekDetailsFromDB(Boek boek)
        {
            MySqlConnection conn = new MySqlConnection(_connectionString);
            MySqlCommand    cmd  = new MySqlCommand("select ablz from boek where item_iditem=@id;", conn);

            cmd.Parameters.AddWithValue("id", boek.Id);
            conn.Open();  //connectie openen
            boek.ABlz = Convert.ToInt32(cmd.ExecuteScalar());
            conn.Close(); //connectie sluiten (!)
            return(boek);
        }
 private void LstBoeken_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (lstBoeken.SelectedItem != null)
     {
         Boek boek = (Boek)lstBoeken.SelectedItem;
         txtTitel.Text             = boek.Titel;
         txtJaar.Text              = boek.Jaar.ToString();
         cmbAuteur.SelectedValue   = boek.AuteurId;
         cmbUitgever.SelectedValue = boek.UitgeverId;
     }
 }
예제 #3
0
        public void Scenario_VoegBoekToe()
        {
            Uitgeverij u1 = new Uitgeverij("Lannoo", "Kasteelstraat 97,8700 Tielt", "*****@*****.**");
            Auteur a1 = new Auteur("Fieke Van der Gucht", "fieke.vandergucht@ugent");
            Boek b1 = new Boek("Het groot Vlaams vloekboek", "Het Groot Vlaams Vloekboek behandelt twintig spitante scheldwoorden en vloeken, in twintig hilarische illustraties en een veelvoud aan weetjes. Wist je dat het brave belhamel naar een gecastreerde ram verwijst, en sletten van oorsprong 'vodden' zijn? ");
            b1.Uitgeverij = u1;
            b1.Auteurs.Add(a1);

            BoekManager BM = new BoekManager();
            BM.VoegBoekToe(b1);            
        }
예제 #4
0
 private void BtnOpslaan_Click(object sender, RoutedEventArgs e)
 {
     huidigBoek = MaakBoekAan();
     boekenBeheer.SlaOp(huidigBoek);
     lblErrors.Content = boekenBeheer.FoutBoodschap;
     if (huidigBoek != null)
     {
         KoppelVariabeleLijsten();
         ClearGui();
     }
 }
        private Boek MaakBoekVanInvoerVelden()
        {
            var boek = new Boek()
            {
                Titel         = txtTitel.Text,
                Auteur        = txtAuteur.Text,
                AantalPaginas = Convert.ToInt32(txtAantalPaginas.Text),
                Genres        = null
            };

            return(boek);
        }
예제 #6
0
        public void TestToevoegenVerwijderenBoek()
        {
            //Afmetingen toevoegen
            Afmeting af = new Afmeting(2, 2, 2);
            //Maken van een boek
            Boek B1 = new Boek("Hercules", "Het oosten", Enum_Taal.Nederlands, af, 12, 25.50m, "de druk", "00000001", 20, 5);

            //Test van het afdrukken van de huidige boeken
            BoekenWinkel.NieuwBoek(B1);
            //Verwijderen van een Tijdschrift
            BoekenWinkel.VerwijderBoek(B1);
        }
예제 #7
0
        static void Main(string[] args)
        {
            Uitgeverij u1 = new Uitgeverij("Jane Do", "Kerkstraat 97,1000 Hemel", "*****@*****.**");
            Auteur     a1 = new Auteur("Michael Jackson", "michael.Jackson@Heaven");
            Boek       b1 = new Boek("Hoe wordt je pedofiel", "Pedofiele is niet OK");

            b1.Uitgeverij = u1;
            b1.Auteurs.Add(a1);
            BoekManager BM = new BoekManager();

            BM.VoegBoekToe(b1);
        }
        private void btnVerwijder_Click(object sender, RoutedEventArgs e)
        {
            if (lstBoeken.SelectedItem == null)
            {
                return;
            }
            Boek boek = (Boek)lstBoeken.SelectedItem;

            bibliotheek.Boeken.Remove(boek);
            VulListbox();
            ControlsLeegmaken();
        }
예제 #9
0
        private bool Wijzig(Boek nieuweVersie)
        {
            bool gelukt     = false;
            Boek oudeVersie = ZoekId(nieuweVersie.ISBN);

            if (VoegBoekToe(nieuweVersie))
            {
                Verwijder(oudeVersie);
                gelukt = true;
            }
            return(gelukt);
        }
예제 #10
0
        public ActionResult AddRoute2(string routeNaam, string activiteitenIds, int?boekId)
        {
            if (!boekId.HasValue)
            {
                return(RedirectToAction("Index"));
            }
            Route nieuweRoute = new Route();

            nieuweRoute.EigenaarID = bs.GetUser(User.Identity.Name).Id;
            //DIT NOG VERANDEREN
            Boek boek = bs.GetBoekByID(boekId);

            if (boek == null)
            {
                return(RedirectToAction("Index"));
            }
            if (boek.EigenaarId != bs.GetUser(User.Identity.Name).Id)
            {
                return(RedirectToAction("Index"));
            }
            nieuweRoute.Boeken = new List <Models.OmgevingsBoek_Models.Boek>();
            nieuweRoute.Boeken.Add(bs.GetBoekByID(boekId));
            nieuweRoute.Naam = routeNaam;
            string[] idsSplit = activiteitenIds.Split(',');
            nieuweRoute.RouteLijst = new List <RouteListItem>();

            foreach (string a in idsSplit)
            {
                int res;
                if (!int.TryParse(a, out res))
                {
                    continue;
                }

                Activiteit ac = bs.GetActiviteitById(res);
                if (ac == null)
                {
                    continue;
                }
                if (!bs.IsActivityAccessibleByUser(ac.Id, User.Identity.Name))
                {
                    continue;
                }
                nieuweRoute.RouteLijst.Add(new RouteListItem()
                {
                    Activiteit = ac
                });
            }
            bs.InsertRoute(nieuweRoute);

            return(RedirectToAction("Boek", new { id = boekId }));
        }
예제 #11
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));
        }
        public async Task <int> WijzigBoek(Boek boek)
        {
            var huidigBoek = _database.Boeken.SingleOrDefault(x => x.Id == boek.Id);

            if (huidigBoek != null)
            {
                huidigBoek.Auteur        = boek.Auteur;
                huidigBoek.Titel         = boek.Titel;
                huidigBoek.AantalPaginas = boek.AantalPaginas;
            }

            return(await _database.SaveChangesAsync());
        }
예제 #13
0
        public void LeenBoek()
        {
            //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.LeenBoek(boek);
            //Assert
            Assert.IsTrue(gebruiker.Boeken.Contains(boek));
        }
예제 #14
0
        public void TerugbrengenTest()
        {
            Controller c    = new Controller();
            Item       item = c.ZoekItem("Woeste Hoogten");
            Boek       boek = item as Boek;
            Exemplaar  exc  = c.GetExemplarenForItem(item)[1];
            Lid        lid  = c.GetLeden()[2] as Lid;

            c.Ontlenen(lid, exc, new DateTime(2016, 9, 1));
            decimal bedrag = c.Terugbrengen(lid, exc, new DateTime(2016, 10, 1));

            Assert.AreEqual(bedrag, 3.00M);
        }
예제 #15
0
 public ActionResult Edit([Bind(Include = "BoekID,AuteurID,UitgeverID,TaalID,Titel,Afmeting,Gewicht,Druk,ISBN,Fotolink")] Boek boek)
 {
     if (ModelState.IsValid)
     {
         db.Entry(boek).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AuteurID   = new SelectList(db.Auteur, "AuteurID", "AuteurVoornaam", boek.AuteurID);
     ViewBag.TaalID     = new SelectList(db.Taal, "TaalID", "Taal1", boek.TaalID);
     ViewBag.UitgeverID = new SelectList(db.Uitgever, "UitgeverID", "UitgeverNaam", boek.UitgeverID);
     return(View(boek));
 }
예제 #16
0
        private Boek ZoekId(string isbn)
        {
            Boek TeZoekenBoek = null;

            foreach (Boek zoekBoek in Boeken)
            {
                if (zoekBoek.ISBN == isbn)
                {
                    TeZoekenBoek = zoekBoek;
                    break;
                }
            }
            return(TeZoekenBoek);
        }
예제 #17
0
        // GET: Boeken/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Boek boek = db.Boek.Find(id);

            if (boek == null)
            {
                return(HttpNotFound());
            }
            return(View(boek));
        }
예제 #18
0
        public static BoekenWinkel.BoekenWinkel GetData()
        {
            BoekenWinkel.BoekenWinkel bo = new BoekenWinkel.BoekenWinkel();



            bo.OpeningsTijden = "Maandag: 08:30 -- 17:00" +
                                "Dinsdag: 08:30 -- 17:00" +
                                "Woensdag: 08:30 -- 17:00" +
                                "Donderdag: 08:30 -- 17:00" +
                                "Vrijdag: 08:30 -- 17:00" +
                                "Zaterdag: 08:30 -- 17:00" +
                                "Zondag: Gesloten";

            bo.ContactInformatie = "Tel: 084-32588853, Adres: Hellinker 6, E-mail: [email protected]";

            Boek boek  = new Boek("1", "8324588285252", 1, 80, "The sluiper", "Jan schekking", new Afmeting(122, 21, 121), 200, 12.90m, 8);
            Boek boek1 = new Boek("1", "234546345636", 5, 40, "The hendrik valls", "Peter pieter", new Afmeting(132, 41, 221), 200, 13.90m, 3);
            Boek boek2 = new Boek("3", "005366245888", 1, 30, "The humen", "Valls Koning", new Afmeting(132, 41, 61), 200, 18.90m, 5);
            Boek boek3 = new Boek("1", "264567772245", 1, 30, "The hundergames", "Iris stengerik", new Afmeting(122, 51, 121), 200, 19.90m, 8);
            Boek boek4 = new Boek("2", "466246342422", 1, 70, "The Salinker", "Jop Wolterink", new Afmeting(122, 15, 21), 200, 13.90m, 3);
            Boek boek5 = new Boek("1", "006888828845", 1, 90, "AJ rop", "Teun Steggink", new Afmeting(12, 41, 121), 200, 14.90m, 9);

            Boek boek6 = new Boek("1", "425466660008", 1, 10, "Android Studio", "Ik kom dichterbij", new Afmeting(122, 41, 121), 200, 12.90m, 8);



            Tijdschrift tijd1 = new Tijdschrift("Ik ben slim", "Pietje puk", new Afmeting(123, 13, 74), 90, 12.90m, "6457565474332", 13, DayOfWeek.Monday, DayOfWeek.Saturday, 9);
            Tijdschrift tijd2 = new Tijdschrift("Space shuttle", "Andriaan kok", new Afmeting(129, 235, 35), 30, 19.90m, "56645654362", 123, DayOfWeek.Monday, DayOfWeek.Saturday, 8);
            Tijdschrift tijd3 = new Tijdschrift("Radio luisteren", "Jan beton", new Afmeting(123, 13, 74), 90, 12.90m, "6715576656672", 13, DayOfWeek.Monday, DayOfWeek.Saturday, 1);
            Tijdschrift tijd4 = new Tijdschrift("Hoe kijk ik door een raam", "Jan katon", new Afmeting(43, 123, 732), 90, 9.90m, "6477676757572", 133, DayOfWeek.Monday, DayOfWeek.Saturday, 5);
            Tijdschrift tijd5 = new Tijdschrift("Hoe wordt je dik", "Pietje puk", new Afmeting(123, 13, 74), 90, 40.90m, "67672478829107", 14, DayOfWeek.Monday, DayOfWeek.Saturday, 8);

            bo.Voorraad.Add(boek);
            bo.Voorraad.Add(boek1);
            bo.Voorraad.Add(boek2);
            bo.Voorraad.Add(boek3);
            bo.Voorraad.Add(boek4);
            bo.Voorraad.Add(boek5);
            bo.Voorraad.Add(boek6);

            bo.Voorraad.Add(tijd1);
            bo.Voorraad.Add(tijd2);
            bo.Voorraad.Add(tijd3);
            bo.Voorraad.Add(tijd4);
            bo.Voorraad.Add(tijd5);

            return(bo);
        }
예제 #19
0
        static void Main(string[] args)
        {
            Boekwinkel winkel = new Boekwinkel("06-4011117, [email protected] ", "ma - vrij : 09:00 - 17:00");

            Console.WriteLine("What would you like to do?");
            Console.WriteLine(" ");
            Console.WriteLine("#1  Add a new Book");
            Console.WriteLine("#2  Show the store contact information");
            // Console.Write(boekwinkelinformatie);

            string s = Console.ReadLine();

            if (s == "1")
            {
                Console.WriteLine("What edition of the book is it?");
                string druk = Console.ReadLine();
                Console.WriteLine("What is the ISBN?");
                string ISBN = Console.ReadLine();
                Console.WriteLine("What is the maximum amount of books to store in the shop");
                int max = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("What is the minimum amount of books to store in the shop");
                int min = Convert.ToInt32(Console.ReadLine());


                Console.WriteLine("What is the title");
                string Titel = Console.ReadLine();
                Console.WriteLine("Who is the author");
                string Auteur = Console.ReadLine();
                Console.WriteLine("What is the language");
                Enum_Taal Taal = Console.ReadLine();
                Console.WriteLine("What is the mass?");
                int Gewicht = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("What is the price");
                Decimal  Prijs    = Convert.ToDecimal(Console.ReadLine());
                Afmeting afmeting = new Afmeting(20, 20, 20);

                Boek boek1 = new Boek(Titel, Auteur, Taal, afmeting, Gewicht, Prijs, druk, ISBN, max, min);
            }


            if (s == "2")
            {
                string boekwinkelinformatie = winkel.Boekenwinkel();
                Console.WriteLine(boekwinkelinformatie);
            }


            Console.ReadKey();
        }
예제 #20
0
        //methode: Item wegschrijven in tabel
        public void AddBoekDetailsToDB(Boek boek)
        {
            //nieuwe connectie met DB met opgegeven connection string
            MySqlConnection conn = new MySqlConnection(_connectionString);
            MySqlCommand    cmd  = new MySqlCommand("INSERT INTO boek (item_iditem, ablz) " +
                                                    " VALUES (@id, @ablz)", conn);

            //invullen van beide parameters voor command 'cmd'
            cmd.Parameters.AddWithValue("ablz", boek.ABlz);
            cmd.Parameters.AddWithValue("id", boek.Id);

            conn.Open();           //connectie openen
            cmd.ExecuteNonQuery(); //toevoegen uitvoeren
            conn.Close();          //connectie sluiten (!)
        }
예제 #21
0
        public Boek GetForId(int id)
        {
            conn.Open();

            SqlCommand    command = new SqlCommand("SELECT * FROM DonnaBoek WHERE id=" + id, conn);
            SqlDataReader reader  = command.ExecuteReader();

            reader.Read();
            Boek boek = ReadBoek(reader);

            reader.Close();
            conn.Close();

            return(boek);
        }
예제 #22
0
        public bool BoekToevoegen(Boek boek)
        {
            if (!BestaatAuteurId(boek.AuteurId))
            {
                return(false);
            }
            if (!BestaatUitgeverId(boek.UitgeverId))
            {
                return(false);
            }

            string sql = $"insert into boeken (id, titel, auteurId, uitgeverId, year) values ('{boek.Id}', '{Helper.HandleQuotes(boek.Titel)}' ,'{boek.AuteurId}','{boek.UitgeverId}', {boek.Jaar})";

            return(DBService.ExecuteCommand(sql));
        }
예제 #23
0
        private void cmbBoeken_SelectedIndexChanged(object sender, EventArgs e)
        {
            lstReserveringen.Items.Clear();
            int selectedIndex = cmbBoeken.SelectedIndex;

            List <Boek> all  = boekservice.GetAll();
            Boek        boek = all[selectedIndex];

            List <Klant> reserveringen = reserveringservice.GetForBoek(boek);

            foreach (Klant klant in reserveringen)
            {
                lstReserveringen.Items.Add(klant.GetNaam());
            }
        }
예제 #24
0
        public void Scenario_VoegBoekenToeVanzelfdeAuteur()
        {
            Uitgeverij u1 = new Uitgeverij("Lannoo", "Kasteelstraat 97,8700 Tielt", "*****@*****.**");
            Auteur a1 = new Auteur("Fieke Van der Gucht", "fieke.vandergucht@ugent");
            Boek b1 = new Boek("Het groot Vlaams vloekboek", "Het Groot Vlaams Vloekboek behandelt twintig spitante scheldwoorden en vloeken, in twintig hilarische illustraties en een veelvoud aan weetjes. Wist je dat het brave belhamel naar een gecastreerde ram verwijst, en sletten van oorsprong 'vodden' zijn? ");
            b1.Uitgeverij = u1;
            b1.Auteurs.Add(a1);
            Boek b2 = new Boek("Atlas van de Nederlandse taal - Editie Vlaanderen", "Taal boeit heel veel mensen. Kijk maar naar het succes van de jaarlijkse zoektocht naar het 'woord van het jaar'. Maar boeken over taal zijn vaak technisch, richten zich op één specifiek aspect en zijn meestal nogal saai. Daar wil deze Atlas van de Nederlandse taal resoluut korte metten mee maken.");
            b2.Uitgeverij = u1;
            b2.Auteurs.Add(a1);

            BoekManager BM = new BoekManager();
            BM.VoegBoekToe(b1);
            BM.VoegBoekToe(b2);
        }
예제 #25
0
 public void RetourBoek(string gebruikernaam, Boek boek)
 {
     try {
         Database.CheckConn();
         query = "DELETE FROM [Boek-Gebruiker] WHERE GebruikerID = (SELECT GebruikerID FROM Login WHERE Username = @Gebruikernaam) AND BoekID = (SELECT BoekID FROM Boek WHERE Titel = @Titel)";
         SqlCommand cmd = new SqlCommand(query, Database.conn);
         cmd.Parameters.AddWithValue("@Gebruikernaam", gebruikernaam);
         cmd.Parameters.AddWithValue("@Titel", boek.Titel);
         cmd.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         Database.exceptionMessage = e.ToString();
         Database.conn.Close();
     }
 }
예제 #26
0
        public bool VoegBoekToe(Boek huidigeBoek)
        {
            bool gelukt = false;

            if (huidigeBoek != null)
            {
                Boeken.Add(huidigeBoek);
                FoutBoodschap = null;
                gelukt        = true;
            }
            else
            {
                FoutBoodschap = ERR_MESSAGE_INPUT_NOT_CORRECT;
            }
            return(gelukt);
        }
예제 #27
0
        public void AfrekenenTest()
        {
            Controller c    = new Controller();
            Item       item = c.ZoekItem("Woeste Hoogten");
            Boek       boek = item as Boek;
            Exemplaar  exc  = c.GetExemplarenForItem(item)[1];
            Lid        lid  = c.GetLeden()[2] as Lid;

            c.Ontlenen(lid, exc, new DateTime(2016, 9, 1));
            decimal bedrag = c.Terugbrengen(lid, exc, new DateTime(2016, 10, 1));

            Assert.AreEqual(lid.Saldo, 3.00M);
            c.Aanmelden("mvervoort", "m123");
            c.Afrekenen(lid, 3.00M);
            Assert.AreEqual(lid.Saldo, 0.0M);
            c.Afmelden();
        }
예제 #28
0
        // GET: Boeken/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Boek boek = db.Boek.Find(id);

            if (boek == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AuteurID   = new SelectList(db.Auteur, "AuteurID", "AuteurVoornaam", boek.AuteurID);
            ViewBag.TaalID     = new SelectList(db.Taal, "TaalID", "Taal1", boek.TaalID);
            ViewBag.UitgeverID = new SelectList(db.Uitgever, "UitgeverID", "UitgeverNaam", boek.UitgeverID);
            return(View(boek));
        }
예제 #29
0
 public void UpdateBoek(Boek boek)
 {
     try
     {
         Database.CheckConn();
         query = "UPDATE Boek SET AantalBeschikbaar = @AantalBeschikbaar WHERE Titel = @Titel";
         SqlCommand cmd = new SqlCommand(query, Database.conn);
         cmd.Parameters.AddWithValue("@Titel", boek.Titel);
         cmd.Parameters.AddWithValue("@AantalBeschikbaar", boek.AantalBeschikbaar);
         cmd.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         Database.exceptionMessage = e.ToString();
         Database.conn.Close();
     }
 }
예제 #30
0
 public void LeenBoek(string gebruikernaam, Boek boek)
 {
     try
     {
         Database.CheckConn();
         query = "INSERT INTO [Boek-Gebruiker] (BoekID, GebruikerID) VALUES ((SELECT BoekID FROM Boek WHERE Titel = @Titel), (SELECT GebruikerID FROM Login WHERE Username = @Gebruikernaam))";
         SqlCommand cmd = new SqlCommand(query, Database.conn);
         cmd.Parameters.AddWithValue("@Gebruikernaam", gebruikernaam);
         cmd.Parameters.AddWithValue("@Titel", boek.Titel);
         cmd.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         Database.exceptionMessage = e.ToString();
         Database.conn.Close();
     }
 }