コード例 #1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            try
            {
                string cma_adresse, cma_ville, cma_pays, cma_email, cma_sitew, cma_note, cma_date, cma_statut, cma_date_liv;
                int    cma_code, fr_code, cma_cp, cma_fixe, cma_mobile, cma_fax;

                if (tbCodeCommA.Text == "" || tbCodeFourni.Text == "")
                {
                    MessageBox.Show("Veuillez remplir tous les champs nécessaires .", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    lComm.ForeColor        = Color.Black;
                    lFournisseur.ForeColor = Color.Black;
                    if (tbCodeCommA.Text == "")
                    {
                        lComm.ForeColor = Color.Red;
                    }
                    if (tbCodeFourni.Text == "")
                    {
                        lFournisseur.ForeColor = Color.Red;
                    }
                }
                else
                {
                    if (tbCP.Text == "")
                    {
                        cma_cp = 0;
                    }
                    else
                    {
                        cma_cp = Convert.ToInt32(tbCP.Text);
                    }

                    if (tbFixe.Text == "")
                    {
                        cma_fixe = 0;
                    }
                    else
                    {
                        cma_fixe = Convert.ToInt32(tbFixe.Text);
                    }

                    if (tbMobile.Text == "")
                    {
                        cma_mobile = 0;
                    }
                    else
                    {
                        cma_mobile = Convert.ToInt32(tbMobile.Text);
                    }

                    if (tbFax.Text == "")
                    {
                        cma_fax = 0;
                    }
                    else
                    {
                        cma_fax = Convert.ToInt32(tbFax.Text);
                    }

                    cma_code     = Convert.ToInt32(tbCodeCommA.Text);
                    fr_code      = Convert.ToInt32(tbCodeFourni.Text);
                    cma_adresse  = rtbAdresse.Text;
                    cma_ville    = tbVille.Text;
                    cma_pays     = tbPays.Text;
                    cma_email    = tbEmail.Text;
                    cma_sitew    = tbSitew.Text;
                    cma_note     = rtbNote.Text;
                    cma_date     = dtpCommA.Value.ToString("dd / MM / yyyy");
                    cma_date_liv = dtpLiv.Value.ToString("dd / MM / yyyy");
                    cma_statut   = v_statut;

                    ca1.cma_modifier(fr_code, cma_statut, cma_date, cma_date_liv, cma_adresse, cma_ville, cma_cp, cma_pays, cma_fixe, cma_mobile, cma_fax, cma_email, cma_sitew, cma_note);

                    ca.commandeachatTableAdapter.Fill(ca.gestioncommercialeDataSet1.commandeachat);


                    Hide();
                    ac.Enabled = true;
                }
            }

            catch (FormatException)
            {
                MessageBox.Show("Erreur!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }