Esempio n. 1
0
        private void btnToevoegen_Click(object sender, EventArgs e)
        {
            String strNaam  = txtNaam.Text;
            String strPrijs = txtPrijs.Text;
            String strOmSc  = txtOmschrijving.Text;

            if (!(strNaam.Equals("") || strPrijs.Equals("") || strOmSc.Equals("")))
            {
                try
                {
                    Double dblPrijs  = Double.Parse(strPrijs);
                    String strResult = PMB.addProduct(strNaam, strOmSc, dblPrijs);

                    if (strResult.Equals("success"))
                    {
                        this.Close();
                        PM.loadProducts();
                    }
                    else if (strResult.Equals("excists"))
                    {
                        MessageBox.Show("Product naam is al in gebruik!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        MessageBox.Show("Fout: " + strResult, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Vul een geldig prijs in!", "Fout", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Vul alle velden in!", "Fout", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 2
0
        private void btnAanpassen_Click(object sender, EventArgs e)
        {
            if (!(txtNaam.Equals("") || txtOmschrijving.Equals("") || txtPrijs.Equals("")))
            {
                String strOudeNaam = Naam;

                String strNaam = txtNaam.Text.ToString();
                String strOSV  = txtOmschrijving.Text.ToString();

                double dblPrijs;

                if (double.TryParse(txtPrijs.Text.ToString(), out dblPrijs))
                {
                    String resultD = PMB.delProduct(Naam);
                    if (resultD.Equals("success"))
                    {
                        String resultA = PMB.addProduct(strNaam, strOSV, dblPrijs);
                        if (resultA.Equals("success"))
                        {
                            this.Close();
                            PM.loadProducts();
                        }
                        else if (resultA.Equals("excists"))
                        {
                            MessageBox.Show("Productnaam is al in gebruik!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        else
                        {
                            MessageBox.Show("Fout: " + resultA, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Fout: " + resultD, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    MessageBox.Show("Vul een geldige prijs in!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Vul alle velden in!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }