Example #1
0
        private void menuItem_Click(object sender, EventArgs e = null)
        {
            ToolStripItem tab = (ToolStripItem)sender;

            refreshMenu();
            tab.ForeColor = Color.FromArgb(0, 0, 0);

            switch (tab.Name)
            {
            case "tabBestel":
                tab.Image = Bestelapplicatie.Properties.Resources.menu_bestel_focus;
                scherm    = "Bestelscherm";
                vulScherm();

                break;

            case "tabBoek":
                tab.Image = Bestelapplicatie.Properties.Resources.menu_boek_focus;
                scherm    = "Boekscherm";
                vulScherm();
                break;

            case "tabLog":
                tab.Image = Bestelapplicatie.Properties.Resources.menu_log_focus;
                scherm    = "Loggingscherm";
                vulScherm();
                break;

            case "tabBedrijf":
                tab.Image = Bestelapplicatie.Properties.Resources.menu_bedrijf_focus;
                scherm    = "Bedrijfscherm";

                bedrijfsinformatie = BedrijfsinformatieDb.ophalen();
                BedrijfScherm bedrijfscherm = new BedrijfScherm(bedrijfsinformatie, false);

                pnlHoofdscherm.Controls.Clear();

                pnlHoofdscherm.Visible = true;
                pnlHoofdscherm.Dock    = System.Windows.Forms.DockStyle.Fill;
                pnlHoofdscherm.Controls.Clear();
                pnlSubGegevens.Controls.Clear();
                pnlGegevens.Controls.Clear();

                pnlGegevens.Visible = true;
                pnlGegevens.Size    = new Size(1540, 765);
                pnlHoofdscherm.Controls.Add(pnlGegevens);
                pnlGegevens.Location = new Point(0, 0);
                pnlGegevens.Controls.Add(bedrijfscherm);
                break;

            case "tabLoguit":
                tab.Image = Bestelapplicatie.Properties.Resources.menu_loguit_focus;

                Account.uitloggen();
                this.Hide();
                Inloggen form = new Inloggen();
                form.Closed += (s, args) => this.Close();
                form.Show();
                break;
            }
        }
Example #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);
            }
        }
Example #3
0
        //methode om bestelling aan te maken :
        private void bestellen()
        {
            Cursor.Current         = Cursors.WaitCursor;
            bestelling.besteldatum = datum;
            bestelling.klant_id    = klant.id;

            string strDatum     = "";
            string omschrijving = "";
            string aantal       = "";
            string prijs        = "";
            string totaalPrijs  = "";

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

                if ((bool)checkbox.EditedFormattedValue)
                {
                    strDatum     += datum.AddDays(3).ToString("dd/MM/yyyy") + "\v";
                    omschrijving += row.Cells[4].Value + "\v";
                    aantal       += row.Cells[0].Value + "\v";
                    totaalPrijs  += row.Cells[2].Value + "\v";
                    prijs        += "€" + row.Cells[7].Value + "\v";
                }
            }

            BestellingDb.aanmaken(bestelling);

            bestelling.id = BestellingDb.GetLaatsteBestelling();

            Factuur factuur = new Factuur();

            bestelling.factuur = factuur.aanmaken(klant, BedrijfsinformatieDb.ophalen(), bestelling, strDatum, omschrijving, aantal, prijs, totaalPrijs, lblPrijs.Text);

            BestellingDb.wijzigen(bestelling);

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

                if ((bool)checkbox.EditedFormattedValue)
                {
                    bestellingregel.bestelling_id    = bestelling.id;
                    bestellingregel.boek_isbn_nummer = Convert.ToString(row.Cells[3].Value);
                    bestellingregel.aantal           = Convert.ToInt32(row.Cells[0].Value);
                    BestellingregelDB.aanmaken(bestellingregel);

                    Boekvoorraad voorraad = new Boekvoorraad();
                    voorraad.boek_isbn_nummer = bestellingregel.boek_isbn_nummer;

                    if (bestellingregel.aantal > Convert.ToInt32(row.Cells[6].Value))
                    {
                        voorraad.aantal = 0;
                    }
                    else
                    {
                        voorraad.aantal = Convert.ToInt32(row.Cells[6].Value) - bestellingregel.aantal;
                    }
                    BoekvoorraadDb.wijzigen(voorraad);
                }
            }

            Mail mail = new Mail();

            mail.mailAanmaken(klant, bestelling, bestelling.factuur);

            submain.vulDgOverzicht();
            submain.dgvOverzicht.Rows[0].Selected = true;
            submain.dgvOverzichtClick();

            Logging logging = new Logging();

            logging.onderwerp        = "Bestelling";
            logging.handeling        = "Aangemaakt";
            logging.datum            = DateTime.Now;
            logging.medewerker_id    = Account.getMedewerker().id;
            logging.bestelling_id    = bestelling.id;
            logging.boek_isbn_nummer = "";

            LoggingDb.aanmaken(logging);
        }