Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (!bln)
                {
                    fourniseur.inserts();
                    MessageBox.Show("Enregistrement éffectué", "Enregistrement", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    if (bsrc.DataSource != null)
                    {
                        clsfournisseur s   = new clsfournisseur();
                        Object[]       obj = ((DataRowView)bsrc.Current).Row.ItemArray;
                        int            i   = 0;
                        foreach (DataColumn dtc in ((DataRowView)bsrc.Current).Row.Table.Columns)
                        {
                            if (dtc.ToString().Equals("numero"))
                            {
                                s.Numero = ((string)obj[i]);
                            }
                            else if (dtc.ToString().Equals("idFrss"))
                            {
                                s.Id = ((int)obj[i]);
                            }
                            else if (dtc.ToString().Equals("id_personne"))
                            {
                                s.Id_personne = ((int)obj[i]);
                            }
                            i++;
                        }
                        new clsfournisseur().update(s);
                        MessageBox.Show("Modification effectuée!", "Modification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

                try
                {
                    loadData();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Erreur lors du chargement des informations du fournisseur sélectionné =>" + ex.Message, "Affichage informations fournisseur", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Echec de la mise à jour" + ex.Message, "Mise à jour", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            //this.New();
            //refresh();
        }
Esempio n. 2
0
        private void New()
        {
            fourniseur = new clsfournisseur();
            bln        = false;
            bindingcls();

            btnAfficherDonnees.Enabled = false;
            txtNom.Clear();
            txtPNom.Clear();
            txtPrenom.Clear();
            txtTelephone.Clear();
            txtAdresse.Clear();
            txtSexe.Clear();
            txtEtatCivil.Clear();
            txtNumero.Clear();
            pbPhotoPersonne.Image = null;
            txtPersonne.Clear();
            txtPersonne.Focus();

            try
            {
                bsrc.DataSource = clsMetier.GetInstance().getAllClsfournisseur1(-100);
                dgv.DataSource  = bsrc;
            }
            catch (Exception) { }

            RecherchePersonneFrm frm = new RecherchePersonneFrm();

            frm.setFormPrincipal(principal);
            frm.Icon = this.Icon;
            frm.ShowDialog();

            if (clsDoTraitement.doubleclicRecherchePersonneDg)
            {
                btnSave.Enabled = true;
                clsDoTraitement.doubleclicRecherchePersonneDg = false;
                txtPersonne.Text = clsDoTraitement.FullNamePersonne;
            }
            else
            {
                btnSave.Enabled = false;
            }
        }
Esempio n. 3
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult result = MessageBox.Show("Voulez - vous vraiment supprimer cet enregistrement ?", "Suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             if (bsrc.DataSource != null)
             {
                 clsfournisseur s   = new clsfournisseur();
                 Object[]       obj = ((DataRowView)bsrc.Current).Row.ItemArray;
                 int            i   = 0;
                 foreach (DataColumn dtc in ((DataRowView)bsrc.Current).Row.Table.Columns)
                 {
                     if (dtc.ToString().Equals("numero"))
                     {
                         s.Numero = ((string)obj[i]);
                     }
                     else if (dtc.ToString().Equals("idFrss"))
                     {
                         s.Id = ((int)obj[i]);
                     }
                     else if (dtc.ToString().Equals("id_personne"))
                     {
                         s.Id_personne = ((int)obj[i]);
                     }
                     i++;
                 }
                 new clsfournisseur().delete(s);
                 MessageBox.Show("Suppression éffectuée", "Suppression", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 //this.New();
                 refresh();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Echec de la suppression " + ex.Message, "Suppression", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }