Ejemplo n.º 1
0
        private bool validatieInloggen()
        {
            List <string> input = new List <string>();

            input.Add(txtGebruikersnaam.Text);
            input.Add(txtWachtwoord.Text);

            if (!Validatie.is_null(input))
            {
                medewerker = MedewerkerDb.accountOphalen(txtGebruikersnaam.Text, txtWachtwoord.Text);
                if (medewerker.gebruikersnaam != null)
                {
                    Account.inloggen(medewerker);
                    return(true);
                }
                else
                {
                    lblError.Location = new Point(5, 260);
                    this.Size         = new Size(459, 327);
                    lblError.Text     = "Uw gebruikersnaam en wachtwoord komen niet overheen.";
                    return(false);
                }
            }
            else
            {
                lblError.Location = new Point(100, 260);
                this.Size         = new Size(459, 327);
                Validatie.is_error("null", lblError);
                return(false);
            }
        }
Ejemplo n.º 2
0
        public void CheckValidatieTelefoonNR()
        {
            // Arrange
            bool   check       = false;
            bool   check1      = false;
            bool   check2      = false;
            string NummerFout  = "2546154522";
            string NummerGoed  = "0612345678";
            string NummerGoed2 = "+31612345678";

            // Act
            Validatie val = new Validatie();

            if (val.ValidatieTelefoonNR(NummerFout))
            {
                check = true;
            }

            if (val.ValidatieTelefoonNR(NummerGoed))
            {
                check1 = true;
            }
            if (val.ValidatieTelefoonNR(NummerGoed2))
            {
                check2 = true;
            }

            // Assert
            Assert.False(check);
            Assert.True(check1);
            Assert.True(check2);
        }
Ejemplo n.º 3
0
        public void CheckValidatiePostcode()
        {
            // Arrange
            bool   check        = false;
            bool   check1       = false;
            string PostcodeFout = "1234 ASSS";
            string PostcodeGoed = "1234 AS";

            // Act
            Validatie val = new Validatie();

            if (val.ValidatiePostcode(PostcodeFout))
            {
                check = true;
            }

            if (val.ValidatiePostcode(PostcodeGoed))
            {
                check1 = true;
            }

            // Assert
            Assert.False(check);
            Assert.True(check1);
        }
Ejemplo n.º 4
0
        public void CheckValidatieEmail()
        {
            // validatie voor email. moet een '@' in zitten.
            // Arrange
            bool   check     = false;
            bool   check1    = false;
            string EmailFout = "ubfiebf.com";
            string EmailGoed = "*****@*****.**";

            // Act
            Validatie val = new Validatie();

            if (val.ValidatieEmail(EmailFout))
            {
                check = true;
            }

            if (val.ValidatieEmail(EmailGoed))
            {
                check1 = true;
            }

            // Assert
            Assert.False(check);
            Assert.True(check1);
        }
Ejemplo n.º 5
0
        private void checkPrijs()
        {
            totaalPrijs = 0;
            foreach (DataGridViewRow row in dgvBoeken.Rows)
            {
                DataGridViewCheckBoxCell checkbox = (DataGridViewCheckBoxCell)dgvBoeken.Rows[row.Index].Cells[1];

                if ((bool)checkbox.EditedFormattedValue)
                {
                    List <string> aantal = new List <string>();
                    aantal.Add(Convert.ToString(row.Cells[0].Value));

                    if (Validatie.is_null(aantal))
                    {
                        row.Cells[0].Value = 1;
                    }

                    if (Validatie.is_int(Convert.ToString(row.Cells[0].Value)))
                    {
                        decimal prijs = Convert.ToDecimal(row.Cells[7].Value) * Convert.ToDecimal(row.Cells[0].Value);
                        row.Cells[2].Value = "€" + Convert.ToString(prijs);
                        totaalPrijs       += prijs;
                    }
                    else
                    {
                        lblError.Text    = "Niet alle aantallen zijn getallen.";
                        lblError.Visible = true;
                        is_error         = true;
                    }
                }
                else
                {
                    row.Cells[0].Value = null;
                    row.Cells[2].Value = null;
                    lblPrijs.Text      = "";
                }
            }

            lblPrijs.Text = "€" + Convert.ToString(totaalPrijs);

            if (!is_error)
            {
                lblError.Visible = false;
            }
            is_error = false;
        }
Ejemplo n.º 6
0
        public void CheckValidatiePassword()
        {
            // wachtwoord moet minimaal 8 karaters lang zijn, 1 cijfer bevatten en een hoofdletter bevatten.
            // Arrange
            bool   check     = false;
            bool   check1    = false;
            bool   check2    = false;
            bool   check3    = false;
            string passFout  = "Welkom";       // niet 8 karaters lang zijn en bevat geen cijfer
            string passFout1 = "welkom123";    // bevat geen hoofdletter
            string passFout2 = "WelkomWelkom"; // bevat geen cijfers
            string passGoed  = "Welkom123";

            // Act
            Validatie val = new Validatie();

            if (val.ValidatieWachtwoord(passFout))
            {
                check = true;
            }

            if (val.ValidatieWachtwoord(passFout1))
            {
                check1 = true;
            }

            if (val.ValidatieWachtwoord(passFout2))
            {
                check2 = true;
            }

            if (val.ValidatieWachtwoord(passGoed))
            {
                check3 = true;
            }

            // Assert
            Assert.False(check);
            Assert.False(check1);
            Assert.False(check2);
            Assert.True(check3);
        }
Ejemplo n.º 7
0
 // check of het in gevulde klopt
 public bool registerCheck(string klantEmail, string klantPassword, string telefoonNummer, string postcode)
 {
     validatie = new Validatie();
     if (!validatie.ValidatieEmail(klantEmail))
     {
         return(false);
     }
     else if (!validatie.ValidatieWachtwoord(klantPassword))
     {
         return(false);
     }
     else if (!validatie.ValidatieTelefoonNR(telefoonNummer))
     {
         return(false);
     }
     else if (!validatie.ValidatiePostcode(postcode))
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 8
0
 // check of het in gevulde klopt
 public bool registerCheck(Klant klant)
 {
     validatie = new Validatie();
     if (!validatie.ValidatieEmail(klant.klantEmail))
     {
         return(false);
     }
     else if (!validatie.ValidatieWachtwoord(klant.klantPassword))
     {
         return(false);
     }
     else if (!validatie.ValidatieTelefoonNR(klant.telefoonNummer))
     {
         return(false);
     }
     else if (!validatie.ValidatiePostcode(klant.postcode))
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 9
0
        private void Wijzigen_Click(object sender, EventArgs e)
        {
            List <string> input = new List <string>();

            input.Add(txtKvknummer.Text);
            input.Add(txtBedrijfsnaam.Text);
            input.Add(txtAdres.Text);
            input.Add(txtPostcode.Text);
            input.Add(txtPlaats.Text);
            input.Add(txtRekeningnummer.Text);
            input.Add(txtTelefoonnummer.Text);
            input.Add(txtBtwnummer.Text);


            if (!Validatie.is_null(input))
            {
                if (Validatie.is_int(txtKvknummer.Text))
                {
                    if (Validatie.is_postcode(txtPostcode.Text))
                    {
                        if (Validatie.is_telefoon(txtTelefoonnummer.Text))
                        {
                            bedrijfsinformatie.kvk_nummer     = Convert.ToInt32(txtKvknummer.Text);
                            bedrijfsinformatie.naam           = txtBedrijfsnaam.Text;
                            bedrijfsinformatie.adres          = txtAdres.Text;
                            bedrijfsinformatie.postcode       = txtPostcode.Text;
                            bedrijfsinformatie.plaats         = txtPlaats.Text;
                            bedrijfsinformatie.rekeningnummer = txtRekeningnummer.Text;
                            bedrijfsinformatie.telefoonnummer = txtTelefoonnummer.Text;
                            bedrijfsinformatie.btw_nummer     = txtBtwnummer.Text;

                            BedrijfsinformatieDb.wijzigen(bedrijfsinformatie);
                            gegevens(bedrijfsinformatie, false);

                            foreach (Control c in this.Controls)
                            {
                                if (c.GetType().FullName == "System.Windows.Forms.TextBox" || c.Name == "Wijzigen" || c.Name == "lblError")
                                {
                                    c.Visible = false;
                                }
                            }
                        }
                        else
                        {
                            Validatie.is_error("telefoon", lblError);
                        }
                    }
                    else
                    {
                        Validatie.is_error("postcode", lblError);
                    }
                }
                else
                {
                    Validatie.is_error("int", lblError);
                }
            }
            else
            {
                Validatie.is_error("null", lblError);
            }
        }
Ejemplo n.º 10
0
        private void btnKlaar_Click(object sender, EventArgs e)
        {
            List <string> input        = new List <string>();
            string        eigenschapId = null;
            string        id           = null;

            input.Add(txtIsbnNummer.Text);
            input.Add(txtTitel.Text);
            input.Add(txtAuteur.Text);
            input.Add(txtGenre.Text);
            input.Add(txtPrijs.Text);
            input.Add(txtBeschrijving.Text);

            if (is_edit)
            {
                eigenschapId = "isbn_nummer";
                id           = Convert.ToString(boek.isbn_nummer);
            }

            if (!Validatie.is_null(input))
            {
                if (Validatie.is_isbn_nummer(txtIsbnNummer.Text))
                {
                    if (Validatie.is_uniek(txtIsbnNummer.Text, "Boek", "isbn_nummer", eigenschapId, id))
                    {
                        if (Validatie.is_prijs(txtPrijs.Text))
                        {
                            if (Validatie.is_int(txtVoorraad.Text))
                            {
                                boek.isbn_nummer  = txtIsbnNummer.Text;
                                boek.titel        = txtTitel.Text;
                                boek.auteur       = txtAuteur.Text;
                                boek.genre        = txtGenre.Text;
                                boek.prijs        = Convert.ToDecimal(txtPrijs.Text);
                                boek.beschrijving = txtBeschrijving.Text;

                                boekvoorraad.aantal           = Convert.ToInt32(txtVoorraad.Text);
                                boekvoorraad.boek_isbn_nummer = boek.isbn_nummer;

                                if (is_edit)
                                {
                                    BoekDb.wijzigen(boek, boekvoorraad);
                                    submain.vulDgOverzicht();
                                    submain.dgvOverzicht.Rows[submain.selectierow].Selected = true;
                                    submain.dgvOverzichtClick(is_edit);

                                    Logging logging = new Logging();
                                    logging.onderwerp        = "Boek";
                                    logging.handeling        = "Gewijzigd";
                                    logging.datum            = DateTime.Now;
                                    logging.medewerker_id    = Account.getMedewerker().id;
                                    logging.boek_isbn_nummer = boek.isbn_nummer;

                                    LoggingDb.aanmaken(logging);
                                }
                                else
                                {
                                    boek.uitgeversector_naam = uitgever.naam;
                                    BoekDb.aanmaken(boek, boekvoorraad);
                                    submain.vulDgOverzicht();
                                    submain.dgvOverzicht.Rows[0].Selected = true;
                                    submain.dgvOverzichtClick();

                                    Logging logging = new Logging();
                                    logging.onderwerp        = "Boek";
                                    logging.handeling        = "Aangemaakt";
                                    logging.datum            = DateTime.Now;
                                    logging.medewerker_id    = Account.getMedewerker().id;
                                    logging.boek_isbn_nummer = boek.isbn_nummer;

                                    LoggingDb.aanmaken(logging);
                                }
                            }
                            else
                            {
                                Validatie.is_error("int", lblError, "Voorraad");
                            }
                        }
                        else
                        {
                            Validatie.is_error("prijs", lblError);
                        }
                    }
                    else
                    {
                        Validatie.is_error("uniek", lblError, "Isbn-nummer");
                    }
                }
                else
                {
                    Validatie.is_error("isbn", lblError);
                }
            }
            else
            {
                Validatie.is_error("null", lblError);
            }
        }
Ejemplo n.º 11
0
        private void btnKlaar_Click(object sender, EventArgs e)
        {
            List <string> input        = new List <string>();
            string        eigenschapId = null;
            string        id           = null;

            input.Add(txtVoornaam.Text);
            input.Add(txtAchternaam.Text);
            input.Add(txtAdres.Text);
            input.Add(txtPostcode.Text);
            input.Add(txtWoonplaats.Text);
            input.Add(txtTelefoon.Text);
            input.Add(txtEmail.Text);

            if (is_edit)
            {
                eigenschapId = "id";
                id           = Convert.ToString(klant.id);
            }

            if (!Validatie.is_null(input))
            {
                if (Validatie.is_postcode(txtPostcode.Text))
                {
                    if (Validatie.is_telefoon(txtTelefoon.Text))
                    {
                        if (Validatie.is_email(txtEmail.Text))
                        {
                            if (Validatie.is_uniek(txtEmail.Text, "Klant", "email", eigenschapId, id))
                            {
                                klant.voornaam   = txtVoornaam.Text;
                                klant.achternaam = txtAchternaam.Text;
                                klant.adres      = txtAdres.Text;
                                klant.postcode   = txtPostcode.Text;
                                klant.woonplaats = txtWoonplaats.Text;
                                klant.telefoon   = txtTelefoon.Text;
                                klant.email      = txtEmail.Text;

                                if (is_edit)
                                {
                                    KlantDb.wijzigen(klant);
                                    submain.vulDgOverzicht();
                                    submain.dgvOverzicht.Rows[submain.selectierow].Selected = true;
                                    submain.dgvOverzichtClick(is_edit);

                                    Logging logging = new Logging();
                                    logging.onderwerp        = "Klant";
                                    logging.handeling        = "Gewijzigd";
                                    logging.datum            = DateTime.Now;
                                    logging.medewerker_id    = Account.getMedewerker().id;
                                    logging.boek_isbn_nummer = "";
                                    logging.klant_id         = klant.id;

                                    LoggingDb.aanmaken(logging);
                                }
                                else
                                {
                                    KlantDb.aanmaken(klant);
                                    submain.vulDgOverzicht();
                                    submain.dgvOverzicht.Rows[0].Selected = true;
                                    submain.dgvOverzichtClick();

                                    klant.id = KlantDb.GetLaatsteKlant();

                                    Logging logging = new Logging();
                                    logging.onderwerp        = "Klant";
                                    logging.handeling        = "Aangemaakt";
                                    logging.datum            = DateTime.Now;
                                    logging.medewerker_id    = Account.getMedewerker().id;
                                    logging.boek_isbn_nummer = "";
                                    logging.klant_id         = klant.id;

                                    LoggingDb.aanmaken(logging);
                                }
                            }
                            else
                            {
                                Validatie.is_error("uniek", lblError, "Email");
                            }
                        }
                        else
                        {
                            Validatie.is_error("email", lblError);
                        }
                    }
                    else
                    {
                        Validatie.is_error("telefoon", lblError);
                    }
                }
                else
                {
                    Validatie.is_error("postcode", lblError);
                }
            }
            else
            {
                Validatie.is_error("null", lblError);
            }
        }
Ejemplo n.º 12
0
        private void btnKlaar_Click(object sender, EventArgs e)
        {
            List <string> input        = new List <string>();
            string        eigenschapId = null;
            string        id           = null;

            input.Add(txtVoornaam.Text);
            input.Add(txtAchternaam.Text);
            input.Add(txtGebruikersnaam.Text);
            input.Add(txtWachtwoord.Text);
            input.Add(txtHerWachtwoord.Text);

            if (is_edit)
            {
                eigenschapId = "id";
                id           = Convert.ToString(medewerker.id);
            }

            if (!Validatie.is_null(input))
            {
                if (txtWachtwoord.Text == txtHerWachtwoord.Text)
                {
                    if (Validatie.is_wachtwoord(txtWachtwoord.Text))
                    {
                        if (Validatie.is_uniek(txtGebruikersnaam.Text, "Medewerker", "gebruikersnaam", eigenschapId, id))
                        {
                            foreach (DataGridViewRow row in dgvUitgevers.Rows)
                            {
                                DataGridViewCheckBoxCell checkbox = (DataGridViewCheckBoxCell)dgvUitgevers.Rows[row.Index].Cells[0];

                                if ((bool)checkbox.EditedFormattedValue)
                                {
                                    is_uitgever = true;
                                }
                            }

                            if (!dgvUitgevers.Visible || is_uitgever)
                            {
                                if (medewerker.rechten == "Boekrechten")
                                {
                                    if (is_edit)
                                    {
                                        UitgeversectorDb.verwijderenSectorgroep(medewerker);
                                    }
                                }

                                medewerker.voornaam       = txtVoornaam.Text;
                                medewerker.achternaam     = txtAchternaam.Text;
                                medewerker.gebruikersnaam = txtGebruikersnaam.Text;
                                medewerker.wachtwoord     = txtWachtwoord.Text;
                                medewerker.rechten        = cmbRechten.Text;

                                if (is_edit)
                                {
                                    MedewerkerDb.wijzigen(medewerker);
                                }
                                else
                                {
                                    MedewerkerDb.aanmaken(medewerker);
                                }

                                if (medewerker.rechten == "Boekrechten")
                                {
                                    medewerker = MedewerkerDb.ophalenGebruikersnaam(medewerker);

                                    foreach (DataGridViewRow row in dgvUitgevers.Rows)
                                    {
                                        DataGridViewCheckBoxCell checkbox = (DataGridViewCheckBoxCell)dgvUitgevers.Rows[row.Index].Cells[0];

                                        if ((bool)checkbox.EditedFormattedValue)
                                        {
                                            sectorgroep.medewerker_id       = medewerker.id;
                                            sectorgroep.uitgeversector_naam = (string)row.Cells[1].Value;
                                            UitgeversectorDb.aanmakenSectorgroep(sectorgroep);
                                        }
                                    }
                                }

                                if (is_edit)
                                {
                                    submain.vulDgOverzicht();
                                    submain.dgvOverzicht.Rows[submain.selectierow].Selected = true;
                                    submain.dgvOverzichtClick(is_edit);
                                }
                                else
                                {
                                    submain.vulDgOverzicht();
                                    submain.dgvOverzicht.Rows[0].Selected = true;
                                    submain.dgvOverzichtClick();
                                }
                            }
                            else
                            {
                                lblError.Text    = "Selecteer minimaal 1 uitgeversector.";
                                lblError.Visible = true;
                            }
                        }
                        else
                        {
                            Validatie.is_error("uniek", lblError, "Gebruikersnaam");
                        }
                    }
                    else
                    {
                        txtHerWachtwoord.Text = "";
                        Validatie.is_error("wachtwoord", lblError);
                    }
                }
                else
                {
                    lblError.Text    = "De wachtwoorden zijn niet hetzelfde.";
                    lblError.Visible = true;
                }
            }
            else
            {
                Validatie.is_error("null", lblError);
            }
        }