Exemple #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);
         }
     }
 }
Exemple #2
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);
         }
     }
 }
Exemple #3
0
 private void BtnOk_Click(object sender, EventArgs e)
 {
     GestionBoutique.maChaine = "Server =" + tbNomServeur.Text + "; Database = " + tbNomBDD.Text + "; Uid = root; Pwd =; ";
     GestionBoutique.seConnecter();
     ((FrmStart)this.MdiParent).clientsToolStripMenuItem.Enabled = true;
     this.Close();
 }
Exemple #4
0
        public static DataTable getLesTuplesByRequete(string requete, string maDataTable)
        {
            GestionBoutique.seConnecter();
            GestionBoutique.maRequete = requete;
            GestionBoutique.maCommandeSpecialRequete.CommandText = GestionBoutique.maRequete;
            GestionBoutique.monRemplisseur.SelectCommand         = GestionBoutique.maCommandeSpecialRequete;
            GestionBoutique.monRemplisseur.Fill(GestionBoutique.monJeuDeDonnees, maDataTable);

            return(GestionBoutique.monJeuDeDonnees.Tables[maDataTable]);
        }
Exemple #5
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);
                }
            }
        }
Exemple #6
0
 public static void PSAddCommande(int idCom, string DateCom, int idCli)
 {
     GestionBoutique.executerRequeteNonQuery("call InsertCommande(" + Convert.ToString(idCom) + ", '" + DateCom + "', " + Convert.ToString(idCli) + ")");
 }
Exemple #7
0
 public static DataTable getSelected()
 {
     return(GestionBoutique.getLesTuplesByRequete("select idProduit, libelleProduit, prixHTProduit, QteStockProduit, libelleCategorie, nomFournisseur FROM Produit, Fournisseur, Categorie WHERE produit.idFourn = fournisseur.idFournisseur and produit.idCat = categorie.idCategorie ", "ToutLesProduitsDG"));
 }
Exemple #8
0
 public static DataTable getById(int id)
 {
     return(GestionBoutique.getLesTuplesByRequete("select * from fournisseur where idFournisseur = " + id, "ToutLesFournisseurs"));
 }
Exemple #9
0
 public static DataTable getByCp(int cp)
 {
     return(GestionBoutique.getLesTuplesByRequete("select * from fournisseur where CPFournisseur like '" + cp + "%'", "ToutLesFournisseurs"));
 }
Exemple #10
0
 public static DataTable getByClientId(int clientId)
 {
     return(GestionBoutique.getLesTuplesByRequete("select * from commande where idCli = " + clientId, "ToutesLesCommandes"));
 }
Exemple #11
0
 public static DataTable getDetailsCommande(int id)
 {
     return(GestionBoutique.getLesTuplesByRequete("SELECT produit.idproduit, libelleproduit, prixhtproduit, quantitecom, (prixhtproduit * quantitecom) AS MontantLigneHT FROM produit, lignedecommande WHERE produit.idProduit = lignedecommande.idProduit AND idcommande = " + id, "laCommande"));
 }
Exemple #12
0
 public static void PSInsertProduitByCommande(int idCommande, int idProduit, int QteCom)
 {
     GestionBoutique.executerRequeteNonQuery("call InsertProduitByCommande(" + Convert.ToString(idCommande) + ", " + Convert.ToString(idProduit) + ", " + Convert.ToString(QteCom) + ")");
 }
Exemple #13
0
 public static int PSGetQteProduitCommande(int idCommande, int idProduit)
 {
     return(GestionBoutique.executerRequeteScalar("call GetQteProduitCommande(" + Convert.ToString(idCommande) + ", " + Convert.ToString(idProduit) + ")"));
 }
Exemple #14
0
 public static DataTable PSgetDetailsCommande(int id)
 {
     return(GestionBoutique.getLesTuplesByRequete("call GetDetailsCommande(" + id + ")", "DetailsCommande"));
 }
Exemple #15
0
 public static DataTable PSgetProduitByIdCategorie(int id)
 {
     return(GestionBoutique.getLesTuplesByRequete("call GetProduitByIdCategorie(" + Convert.ToString(id) + ")", "ToutLesProduits"));
 }
Exemple #16
0
 public static DataTable PSgetLesCategories()
 {
     return(GestionBoutique.getLesTuplesByRequete("call GetAllCategories", "ToutesLesCategories"));
 }
Exemple #17
0
 public static DataTable PSgetLaCommandeById(int id)
 {
     return(GestionBoutique.getLesTuplesByRequete("call GetCommandeById(" + Convert.ToString(id) + ")", "ToutesLesCommandes"));
 }
Exemple #18
0
 public static DataTable PSgetLesCommandesDG()
 {
     return(GestionBoutique.getLesTuplesByRequete("call GetAllCommandesDG", "ToutesLesCommandesDG"));
 }
Exemple #19
0
 public static DataTable getAll()
 {
     return(GestionBoutique.getLesTuplesByRequete("select * from commande", "ToutesLesCommandes"));
 }
Exemple #20
0
 public static void PSChangeQteProduitCommande(int idCommande, int idProduit, int qte)
 {
     GestionBoutique.executerRequeteNonQuery("call ChangeQteProduitCommande(" + Convert.ToString(qte) + " ," + Convert.ToString(idCommande) + ", " + Convert.ToString(idProduit) + ")");
 }
Exemple #21
0
 public static DataTable getByDate(string date)
 {
     return(GestionBoutique.getLesTuplesByRequete("select * from commande where DateCommande like '%" + date + "%'", "ToutesLesCommandes"));
 }
Exemple #22
0
 public static void PSChangeStatutCommande(int idCommande, int boolean)
 {
     GestionBoutique.executerRequeteNonQuery("call ChangeValideCom(" + Convert.ToString(idCommande) + " ," + Convert.ToString(boolean) + ")");
 }
Exemple #23
0
 public static DataTable getLesCommandesDG()
 {
     return(GestionBoutique.getLesTuplesByRequete("Select  commande.idCommande ,dateCommande , CONCAT(prenomClient , ' ' , nomClient) as Client , sum(prixHTProduit* 0.20* quantiteCom) as PrixTTC  from client, commande , produit , lignedecommande  where client.idClient = commande.idCli and lignedecommande.idCommande = commande.idCommande and lignedecommande.idProduit = produit.idProduit group by idCommande", "ToutesLesCommandesDG"));
 }
Exemple #24
0
 public static DataTable PSGetLesClients()
 {
     return(GestionBoutique.getLesTuplesByRequete("call GetAllClients", "ToutLesClients"));
 }
Exemple #25
0
 public static DataTable getAll()
 {
     return(GestionBoutique.getLesTuplesByRequete("select * from fournisseur", "ToutLesFournisseurs"));
 }
Exemple #26
0
 public static DataTable getById(int id)
 {
     return(GestionBoutique.getLesTuplesByRequete("select * from categories where idCategorie =" + id, "ToutesLesCategories"));
 }
Exemple #27
0
 public static DataTable getByName(int name)
 {
     return(GestionBoutique.getLesTuplesByRequete("select * from fournisseur where NomFournisseur like '" + name + "%'", "ToutLesFournisseurs"));
 }
Exemple #28
0
 public static DataTable getByName(string name)
 {
     return(GestionBoutique.getLesTuplesByRequete("select * from categories where LibelleCategories like '%" + name + "%'", "ToutesLesCategories"));
 }
Exemple #29
0
 public static DataTable getName()
 {
     return(GestionBoutique.getLesTuplesByRequete("select nomFournisseur from fournisseur", "ToutLesNomsFournisseurs"));
 }
Exemple #30
0
 public static void PSDeleteCommandeById(int id)
 {
     GestionBoutique.executerRequeteNonQuery("call DeleteCommandeById(" + Convert.ToString(id) + ")");
 }