Exemplo n.º 1
0
        private void Ajouter_Click(object sender, EventArgs e)
        {
            client c = new client(Convert.ToInt32(Txt_Cin.Text), Txt_Nom.Text, Txt_Pren.Text, Txt_Vil.Text, Convert.ToInt32(Txt_Tel.Text));

            ClientADO.inserer(c);
            Dg_Clt.DataSource = ClientADO.Liste_Client();
        }
Exemplo n.º 2
0
 private void Ajout_Click(object sender, EventArgs e)
 {
     if (Txt_Nom.Text == "")
     {
         MetroFramework.MetroMessageBox.Show(this, "Nom client invalid");
     }
     else if (Txt_Cin.Text == "")
     {
         MetroFramework.MetroMessageBox.Show(this, "CIN client invalid");
     }
     else if (Txt_Adr.Text == "")
     {
         MetroFramework.MetroMessageBox.Show(this, "Adresse client invalid");
     }
     else if (Txt_Tel.Text == "")
     {
         MetroFramework.MetroMessageBox.Show(this, "Téléphone client invalid");
     }
     else
     {
         Client cl = new Client
         {
             Nom_Cl  = Txt_Nom.Text,
             Num_CIN = Txt_Cin.Text,
             Adr_Cl  = Txt_Adr.Text,
             Tel_Cl  = Txt_Tel.Text
         };
         ClientADO.Ajouter(cl);
         clearFields();
         Afficher_Client();
         MessageBox.Show("Client ajouté avec succès");
     }
 }
        private void FListe_Cl_Load(object sender, EventArgs e)
        {
            // TODO: cette ligne de code charge les données dans la table 'bd_ClientDataSet3.CLIENT'. Vous pouvez la déplacer ou la supprimer selon les besoins.
            this.cLIENTTableAdapter1.Fill(this.bd_ClientDataSet3.CLIENT);

            Dg_Clt.DataSource = ClientADO.Liste_Client();
        }
Exemplo n.º 4
0
 private void Txt_NumCde_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (Convert.ToInt32(e.KeyChar) == 13)
     {
         if (!string.IsNullOrEmpty(Txt_NumCde.Text))
         {
             int      numCmd = int.Parse(Txt_NumCde.Text);
             Commande cmd    = CommandeADO.Recherche_Commande_Num_Cde(numCmd);
             if (cmd != null)
             {
                 cmdSelected = cmd;
                 Client cl = ClientADO.Recherche_cin(cmd.CIN_Cl);
                 if (cl != null)
                 {
                     clSelected = cl;
                     setClientFields(cl);
                 }
                 else
                 {
                     MessageBox.Show("Client introuvable");
                 }
             }
             else
             {
                 Nouv_Cde_Click(sender, e);
             }
         }
         else
         {
             MessageBox.Show("Entrer numero de commande");
         }
     }
 }
Exemplo n.º 5
0
 private void Nouv_Clt_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Txt_Cin.Text))
     {
         Client cl = ClientADO.Recherche_cin(int.Parse(Txt_Cin.Text));
         if (cl != null)
         {
             setClientFields(cl);
             clSelected = cl;
         }
         else
         {
             Client client = new Client
             {
                 CIN_Cl   = int.Parse(Txt_Cin.Text),
                 Nom_Cl   = Txt_Nom.Text,
                 Pren_Cl  = Txt_Pren.Text,
                 Ville_Cl = Txt_Vil.Text,
                 Tel_Cl   = Txt_Tel.Text
             };
             ClientADO.Inserer(client);
             clSelected = client;
             MessageBox.Show("Client ajouté avec succès");
         }
     }
 }
Exemplo n.º 6
0
        private void Dg_Prod_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int           index = e.RowIndex;
            int           refe  = int.Parse(Dg_Prod.Rows[index].Cells[0].Value.ToString());
            String        desig = Dg_Prod.Rows[index].Cells[1].Value.ToString();
            int           prix  = int.Parse(Dg_Prod.Rows[index].Cells[2].Value.ToString());
            int           qte   = int.Parse(Dg_Prod.Rows[index].Cells[3].Value.ToString());
            int           total = int.Parse(Dg_Prod.Rows[index].Cells[4].Value.ToString());
            LigneCommande lc    = LigneCommandeADO.LigneCommande(refe);

            if (lc != null)
            {
                lcSelected   = lc;
                Txt_Qte.Text = lc.Qte.ToString();
                Commande cmd = CommandeADO.Recherche_Commande_Num_Cde(lc.NumCde);
                if (cmd != null)
                {
                    cmdSelected     = cmd;
                    Txt_NumCde.Text = cmd.Num_Cde.ToString();
                    Date_Cde.Text   = cmd.Date_Cde.ToString();
                    Client client = ClientADO.Recherche_cin(cmd.CIN_Cl);
                    if (client != null)
                    {
                        setClientFields(client);
                        clSelected = client;
                    }
                }
                Produit pr = ProduitADO.Recherche_Ref(lc.RefProd);
                if (pr != null)
                {
                    prSelected = pr;
                }
            }
        }
 private void Rechercher_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Txt_Cin.Text))
     {
         Client cl = ClientADO.Recherche_cin(int.Parse(Txt_Cin.Text));
         if (cl != null)
         {
             Txt_Nom.Text  = cl.Nom_Cl;
             Txt_Pren.Text = cl.Pren_Cl;
             Txt_Tel.Text  = cl.Tel_Cl.ToString();
             Txt_Vil.Text  = cl.Ville_Cl;
         }
         else
         {
             MessageBox.Show("Client inexistant");
         }
     }
     else if (!string.IsNullOrEmpty(Txt_Nom.Text))
     {
         Dg_Clt.DataSource = ClientADO.Recherche_NomPren(Txt_Nom.Text);
     }
     else if (!string.IsNullOrEmpty(Txt_Pren.Text))
     {
         Dg_Clt.DataSource = ClientADO.Recherche_NomPren(Txt_Pren.Text);
     }
     else
     if (!string.IsNullOrEmpty(Txt_Vil.Text))
     {
         Dg_Clt.DataSource = ClientADO.Recherche_ville(Txt_Vil.Text);
     }
 }
Exemplo n.º 8
0
 private void Txt_NumCde_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)13)
     {
         Boolean val = CommandeDAO.Existe_Commande(Txt_NumCde.Text);
         if (val)
         {
             Pan_LigC.Visible = true;
             DataTable dtlc = LigneCommandeDAO.List_LigneCommande_ParNum(Txt_NumCde.Text);
             foreach (DataRow row in dtlc.Rows)
             {
                 DataTable dtpr = ProduitDAO.List_Prod_Ref(row["Ref_Prod"].ToString());
                 Dg_Prod.Rows.Add(row["Ref_Prod"].ToString(), dtpr.Rows[0]["Desig_Prod"].ToString(), dtpr.Rows[0]["PrixV_Prod"].ToString(), row["qte"].ToString(), Convert.ToInt32(dtpr.Rows[0]["PrixV_Prod"].ToString()) * Convert.ToInt32(row["qte"].ToString()));
                 totalCde += Convert.ToInt32(dtpr.Rows[0]["PrixV_Prod"].ToString()) * Convert.ToInt32(row["qte"].ToString());
             }
             DataTable dtc = CommandeDAO.List_Com_Num(Txt_NumCde.Text);
             DataTable dt  = ClientADO.Liste_Client_ParCin(Convert.ToInt64(dtc.Rows[0]["cin_cl"].ToString()));
             Txt_cin.Text      = dt.Rows[0]["cin_cl"].ToString();
             Txt_nom.Text      = dt.Rows[0]["Nom_cl"].ToString();
             Txt_prenom.Text   = dt.Rows[0]["pren_cl"].ToString();
             Txt_vil.Text      = dt.Rows[0]["ville_cl"].ToString();
             Txt_tel.Text      = dt.Rows[0]["tel_cl"].ToString();
             Txt_TotalCde.Text = totalCde.ToString();
         }
         else
         {
             Pan_LigC.Visible = true;
         }
     }
 }
Exemplo n.º 9
0
 private void FListeCl_Load(object sender, EventArgs e)
 {
     LC = ClientADO.List_Client();
     if (LC != null)
     {
         foreach (Client C in LC)
         {
             Dg_Cl.Rows.Add(C.Id_Cl, C.Nom_Cl, C.Adr_Cl, C.Tel_Cl, C.Num_CIN);
         }
     }
 }
Exemplo n.º 10
0
        // appel au form FListeCl pour sélectionner le client de la nouvelle location
        // et récupération de l'ID du client
        private void Rech_Cl_Click(object sender, EventArgs e)
        {
            FListeCl F = new FListeCl();

            F.LC = ClientADO.List_Client();
            F.ShowDialog();
            if (F.Cl != null)
            {
                Txt_Cl.Text = F.Cl.Id_Cl.ToString();
            }
        }
Exemplo n.º 11
0
 private void Afficher_Client()
 {
     LC = ClientADO.List_Client();
     Dg_Cl.Rows.Clear();
     if (LC != null)
     {
         foreach (Client C in LC)
         {
             Dg_Cl.Rows.Add(C.Id_Cl, C.Nom_Cl, C.Num_CIN, C.Adr_Cl, C.Tel_Cl);
         }
     }
 }
Exemplo n.º 12
0
 private void Supprimer_Click(object sender, EventArgs e)
 {
     if (Cl != null)
     {
         ClientADO.Supprimer(Cl.Id_Cl);
         clearFields();
         Afficher_Client();
         MessageBox.Show("Client supprimé avec succès");
     }
     else
     {
         MessageBox.Show("Sélectionner un client");
     }
 }
Exemplo n.º 13
0
 private void Rechercher_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Txt_Cin.Text))
     {
         Dg_Clt.DataSource = ClientADO.Liste_Client_ParCin(Convert.ToInt64(Txt_Cin.Text));
     }
     else if (!string.IsNullOrEmpty(Txt_Nom.Text))
     {
         Dg_Clt.DataSource = ClientADO.Liste_Client_ParNom(Txt_Nom.Text);
     }
     else if (!string.IsNullOrEmpty(Txt_Pren.Text))
     {
         Dg_Clt.DataSource = ClientADO.Liste_Client_ParPren(Txt_Pren.Text);
     }
     else
     {
         Dg_Clt.DataSource = ClientADO.Liste_Client();
     }
 }
Exemplo n.º 14
0
        private void Modifier_Click(object sender, EventArgs e)
        {
            String cin    = Txt_Cin.Text;
            String nom    = Txt_Nom.Text;
            String prenom = Txt_Pren.Text;
            String ville  = Txt_Vil.Text;
            String tel    = Txt_Tel.Text;

            if (string.IsNullOrEmpty(cin))
            {
                MessageBox.Show("CIN Client invalid");
            }
            else if (string.IsNullOrEmpty(nom))
            {
                MessageBox.Show("Nom Client invalid");
            }
            else if (string.IsNullOrEmpty(prenom))
            {
                MessageBox.Show("Prenom Client invalid");
            }
            else if (string.IsNullOrEmpty(ville))
            {
                MessageBox.Show("Ville Client invalid");
            }
            else if (string.IsNullOrEmpty(tel))
            {
                MessageBox.Show("Téléphone Client invalid");
            }
            else
            {
                Client cl = new Client
                {
                    CIN_Cl   = int.Parse(cin),
                    Nom_Cl   = nom,
                    Pren_Cl  = prenom,
                    Ville_Cl = ville,
                    Tel_Cl   = tel
                };
                ClientADO.Modifier(cl);
                Dg_Clt.DataSource = ClientADO.Liste_Client();
                MessageBox.Show("Client et à jour");
            }
        }
Exemplo n.º 15
0
 private void Modifier_Click(object sender, EventArgs e)
 {
     if (Cl != null)
     {
         if (Txt_Nom.Text == "")
         {
             MetroFramework.MetroMessageBox.Show(this, "Nom client invalid");
         }
         else if (Txt_Cin.Text == "")
         {
             MetroFramework.MetroMessageBox.Show(this, "CIN client invalid");
         }
         else if (Txt_Adr.Text == "")
         {
             MetroFramework.MetroMessageBox.Show(this, "Adresse client invalid");
         }
         else if (Txt_Tel.Text == "")
         {
             MetroFramework.MetroMessageBox.Show(this, "Téléphone client invalid");
         }
         else
         {
             Client cl = new Client
             {
                 Id_Cl   = Cl.Id_Cl,
                 Nom_Cl  = Txt_Nom.Text,
                 Num_CIN = Txt_Cin.Text,
                 Adr_Cl  = Txt_Adr.Text,
                 Tel_Cl  = Txt_Tel.Text
             };
             ClientADO.Modifier(cl);
             clearFields();
             Afficher_Client();
             MessageBox.Show("Client modifié avec succès");
         }
     }
     else
     {
         MessageBox.Show("Sélectionner un client");
     }
 }
Exemplo n.º 16
0
 private void Supprimer_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Txt_Cin.Text))
     {
         int          cin          = int.Parse(Txt_Cin.Text);
         DialogResult dialogResult = MessageBox.Show("Vous été sur de supprimer le client " + this.selectedClient.Nom_Cl + " " + this.selectedClient.Pren_Cl, "Supprimer client", MessageBoxButtons.YesNo);
         if (dialogResult == DialogResult.Yes)
         {
             ClientADO.Supprimer(cin);
             Dg_Clt.DataSource = ClientADO.Liste_Client();
             MessageBox.Show("Client supprimer avec succées!");
         }
         else if (dialogResult == DialogResult.No)
         {
             //do something else
         }
     }
     else
     {
         MessageBox.Show("Selectionné un client");
     }
 }
Exemplo n.º 17
0
 private void Nouv_Cde_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(Txt_NumCde.Text))
     {
         MessageBox.Show("Numero commande invalid");
     }
     else if (string.IsNullOrEmpty(Date_Cde.Value.Date.ToString()))
     {
         MessageBox.Show("Date commande invalid");
     }
     else
     {
         int      numCmd   = int.Parse(Txt_NumCde.Text);
         DateTime dteCmd   = Date_Cde.Value.Date;
         Commande commande = CommandeADO.Recherche_Commande_Num_Cde(numCmd);
         if (commande != null)
         {
             cmdSelected      = commande;
             Pan_LigC.Visible = true;
             Txt_NumCde.Text  = commande.Num_Cde.ToString();
             Date_Cde.Value   = commande.Date_Cde;
             Client client = ClientADO.Recherche_cin(commande.CIN_Cl);
             if (client != null)
             {
                 setClientFields(client);
                 clSelected = client;
             }
         }
         else
         {
             if (string.IsNullOrEmpty(Txt_Cin.Text))
             {
                 MessageBox.Show("CIN client invalid");
             }
             else
             {
                 int    cin = int.Parse(Txt_Cin.Text);
                 Client cl  = ClientADO.Recherche_cin(cin);
                 if (cl != null)
                 {
                     setClientFields(cl);
                     clSelected = cl;
                     Commande cmd = new Commande
                     {
                         Num_Cde  = numCmd,
                         Date_Cde = dteCmd,
                         CIN_Cl   = cin,
                     };
                     CommandeADO.Inserer(cmd);
                     Pan_LigC.Visible = true;
                     cmdSelected      = cmd;
                     MessageBox.Show("Commande inserer");
                 }
                 else
                 {
                     MessageBox.Show("Client introuvable");
                 }
             }
         }
     }
 }
Exemplo n.º 18
0
 private void Supprimer_Click(object sender, EventArgs e)
 {
     ClientADO.supprimer(Convert.ToInt64(Txt_Cin.Text));
 }
Exemplo n.º 19
0
        private void Modifier_Click(object sender, EventArgs e)
        {
            client c = new client(Convert.ToInt32(Txt_Cin.Text), Txt_Nom.Text, Txt_Pren.Text, Txt_Vil.Text, Convert.ToInt32(Txt_Tel.Text));

            ClientADO.modifier(c);
        }