Ejemplo n.º 1
0
 private void BtnAjout_Click(object sender, EventArgs e)
 {
     if (btnAjout.Text == "+")
     {
         btnAjout.Text     = "Valider";
         tbNom.Text        = "";
         tbPrenom.Text     = "";
         tbAddresse.Text   = "";
         tbCodePostal.Text = "";
         tbId.Text         = Convert.ToString(GestionBoutique.genererClePrimaire("idClient", "client"));
         tbVille.Text      = "";
     }
     else
     {
         if (tbNom.Text != "" && tbPrenom.Text != "" && tbAddresse.Text != "" && tbCodePostal.Text != "" && tbVille.Text != "" && Convert.ToInt32(errorProvider1.Tag) == 0 && Convert.ToInt32(errorProvider2.Tag) == 0 && Convert.ToInt32(errorProvider3.Tag) == 0 && Convert.ToInt32(errorProvider4.Tag) == 0 && Convert.ToInt32(errorProvider5.Tag) == 0)
         {
             GestionClient.add(Convert.ToInt32(tbId.Text), tbNom.Text, tbPrenom.Text, tbAddresse.Text, tbCodePostal.Text, tbVille.Text);
             btnAjout.Text = "+";
             MessageBox.Show("Client(e) ajouté !", "Succès !", MessageBoxButtons.OK, MessageBoxIcon.Information);
             refreshData();
             rafraichirInterface();
             // MesClients.Clear();
         }
         else
         {
             MessageBox.Show("Erreur, un champ n'est pas ou est mal spécifié", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Ejemplo n.º 2
0
 private void BtnSuivant_Click(object sender, EventArgs e)
 {
     if (position < GestionClient.getNbClient() - 1)
     {
         position++;
         rafraichirInterface();
     }
 }
Ejemplo n.º 3
0
 private void TbRecherche_TextChanged(object sender, EventArgs e)
 {
     dgClients.DataSource = null;
     if (tbRecherche.Text != "")
     {
         DataTable recherche = GestionClient.search(tbRecherche.Text);
         dgClients.DataSource = recherche;
     }
 }
Ejemplo n.º 4
0
 public void refreshData()
 {
     lesCommandes.Clear();
     cbClient.DataSource    = null;
     cbClient.DisplayMember = null;
     cbClient.ValueMember   = null;
     lesCommandes           = GestionCommande.getAll();
     cbClient.DataSource    = GestionClient.getAll();
     cbClient.DisplayMember = "NomClient";
     cbClient.ValueMember   = "idClient";
     dgCommandes.DataSource = GestionCommande.getLesCommandesDG();
     position = 0;
     rafraichirInterface();
 }
Ejemplo n.º 5
0
        private void BtnModif_Click(object sender, EventArgs e)
        {
            string       name   = tbNom.Text;
            string       prenom = tbPrenom.Text;
            DialogResult rep;

            rep = MessageBox.Show("Êtes-vous sûr de modifier le client " + name + " " + prenom + " ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (rep == DialogResult.Yes)
            {
                int c = Convert.ToInt32(tbId.Text);
                GestionClient.change(c, tbNom.Text, tbPrenom.Text, tbAddresse.Text, tbCodePostal.Text, tbVille.Text);
                MessageBox.Show("Client modifié !", "Succès", MessageBoxButtons.OK, MessageBoxIcon.Information);
                refreshData();
                rafraichirInterface();
            }
        }
Ejemplo n.º 6
0
        private void BtnSuppr_Click(object sender, EventArgs e)
        {
            string       name   = tbNom.Text;
            string       prenom = tbPrenom.Text;
            DialogResult rep;

            rep = MessageBox.Show("Êtes-vous sûr de supprimer le client " + name + " " + prenom + " ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (rep == DialogResult.Yes)
            {
                int c = Convert.ToInt32(tbId.Text);
                GestionClient.del(c);
                MessageBox.Show("Client supprimé !", "Succès", MessageBoxButtons.OK, MessageBoxIcon.Information);
                refreshData();
                rafraichirInterface();
            }
        }
Ejemplo n.º 7
0
 private void BtnDernier_Click(object sender, EventArgs e)
 {
     position = GestionClient.getNbClient() - 1;
     rafraichirInterface();
 }
Ejemplo n.º 8
0
 private void FrmAMSClients_FormClosing(object sender, FormClosingEventArgs e)
 {
     GestionClient.Clear();
 }
Ejemplo n.º 9
0
 public void refreshData()
 {
     MesClients.Clear();
     MesClients = GestionClient.getAll();
     position   = 0;
 }