Beispiel #1
0
 private void BtnAjouter_Click(object sender, EventArgs e)
 {
     if (btnAjouter.Text == "+")
     {
         btnAjouter.Text = "Valider";
         tbLibelle.Text  = "";
         tbPrixHT.Text   = "";
         tbQteStock.Text = "";
         tbId.Text       = Convert.ToString(GestionBoutique.genererClePrimaire("idProduit", "produit"));
     }
     else
     {
         if (tbLibelle.Text != "" && tbPrixHT.Text != "" && tbQteStock.Text != "" && Convert.ToInt32(errorProvider1.Tag) == 0 && Convert.ToInt32(errorProvider2.Tag) == 0 && Convert.ToInt32(errorProvider3.Tag) == 0)
         {
             GestionProduit.add(Convert.ToInt32(tbId.Text), tbLibelle.Text, Convert.ToInt32(tbPrixHT.Text), Convert.ToInt32(tbQteStock.Text), Convert.ToInt32(cbFournisseur.SelectedValue), Convert.ToInt32(cbCategories.SelectedValue));
             btnAjouter.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);
         }
     }
 }
Beispiel #2
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);
         }
     }
 }
Beispiel #3
0
        private void btnAjoutCommande_Click(object sender, EventArgs e)
        {
            if (btnAjoutCommande.Text == "Ajouter une Commande")
            {
                btnAjoutCommande.Text        = "Valider";
                tbDate.Text                  = "";
                cbClient.Text                = "";
                cbClient.Enabled             = true;
                tbDate.Enabled               = true;
                btnDernier.Enabled           = false;
                btnPrecedent.Enabled         = false;
                btnSuivant.Enabled           = false;
                btnPremier.Enabled           = false;
                btnSupprCommande.Enabled     = false;
                btnConsulterCommande.Enabled = false;
                tbNumero.Text                = Convert.ToString(GestionBoutique.genererClePrimaire("idCommande", "commande"));
            }
            else
            {
                if (tbNumero.Text != "" && cbClient.Text != "" && tbDate.Text != "")
                {
                    GestionPS.PSAddCommande(Convert.ToInt32(tbNumero.Text), tbDate.Text, Convert.ToInt32(cbClient.SelectedValue));
                    btnAjoutCommande.Text = "Ajouter une Commande";
                    MessageBox.Show("Commande ajoutée !", "Succès !", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    refreshData();
                    cbClient.Enabled             = false;
                    tbDate.Enabled               = false;
                    btnDernier.Enabled           = true;
                    btnPrecedent.Enabled         = true;
                    btnSuivant.Enabled           = true;
                    btnPremier.Enabled           = true;
                    btnSupprCommande.Enabled     = true;
                    btnConsulterCommande.Enabled = true;


                    btnDernier.PerformClick();
                    btnConsulterCommande.PerformClick();
                }
                else
                {
                    MessageBox.Show("Erreur, un champ n'est pas ou est mal spécifié", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }