Beispiel #1
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;
        }
Beispiel #2
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);
            }
        }
Beispiel #3
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);
            }
        }