private void rdnouveautype_CheckedChanged(object sender, EventArgs e)
 {
     if (rdnouveautype.Checked == true)
     {
         v = false;
         txtcod.DataBindings.Clear();
         cbtypevetement.Hide();
         txttypevetement.Enabled     = true;
         txtputraitementtype.Enabled = true;
         txtpulavage.Enabled         = true;
         txttypevetement.Text        = Vetements.creercodetypevetement();
         txttypevetement.Text        = "";
         txtputraitementtype.Text    = "";
         txtpulavage.Text            = "";
         txtquantitevetement.Text    = "";
     }
 }
Пример #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            string   code_f  = Factures.creercode_f();
            Factures facture = new Factures();

            facture.Code_f        = code_f;
            facture.Montant       = Program.montant;
            facture.Mention       = Program.mention;
            facture.Date_creation = Program.datemysql(dtdatedepot.Text);

            Factures.Ajouterfacture(facture);

            switch (Clients.tableauclient[0])
            {
            case "E":
                foreach (DataRow dr in Program.tabvet.Rows)
                {
                    string id        = Vetements.creeridentifiant();
                    string mle       = Convert.ToString(dr["MleClient"]);
                    string idtypvet  = Convert.ToString(dr["Idvetement"]);
                    string libtypvet = Convert.ToString(dr["TypeVetement"]);
                    int    qte       = Convert.ToInt32(dr["Quantite"]);
                    string ddpot     = Program.datemysql(dtdatedepot.Text);
                    string ddispo    = Program.datemysql(dtdatedispo.Text);

                    int veriff = Vetements.verifiercodetypevetement(libtypvet);

                    if (veriff == 1)
                    {
                        Vetements.Enregistrervetement(id, idtypvet, qte, mle, ddpot, ddispo);

                        Factures.Ajouterlignefacture(code_f, mle, id);

                        MessageBox.Show("Enregistrement reussie");
                    }

                    if (veriff == 0)
                    {
                        string cod  = Vetements.creercodetypevetement();
                        string lib  = Convert.ToString(dr["TypeVetement"]);
                        int    pu_t = Convert.ToInt32(dr["PU_lavage"]);
                        int    pu_l = Convert.ToInt32(dr["PU_lavage"]);

                        Vetements.Enregistrertypevetement(cod, lib, pu_t, pu_l);

                        Vetements.Enregistrervetement(id, cod, qte, mle, ddpot, ddispo);

                        Factures.Ajouterlignefacture(code_f, mle, id);

                        MessageBox.Show("Enregistrement reussie");
                    }
                }
                break;

            case "N":
                Clients client = new Clients();
                client.Mle        = Clients.tableauclient[1];
                client.Nom        = Clients.tableauclient[2];
                client.Prenom     = Clients.tableauclient[3];
                client.Tel        = Convert.ToInt32(Clients.tableauclient[4]);
                client.Quartier   = Clients.tableauclient[5];
                client.Date_ajout = Program.datemysql(dtdatedepot.Text);
                Clients.Ajouterclient(client);

                foreach (DataRow dr in Program.tabvet.Rows)
                {
                    string id        = Vetements.creeridentifiant();
                    string mle       = Convert.ToString(dr["MleClient"]);
                    string idtypvet  = Convert.ToString(dr["Idvetement"]);
                    string libtypvet = Convert.ToString(dr["TypeVetement"]);
                    int    qte       = Convert.ToInt32(dr["Quantite"]);
                    string ddpot     = Program.datemysql(dtdatedepot.Text);
                    string ddispo    = Program.datemysql(dtdatedispo.Text);

                    int veriff = Vetements.verifiercodetypevetement(libtypvet);

                    if (veriff == 1)
                    {
                        Vetements.Enregistrervetement(id, idtypvet, qte, mle, ddpot, ddispo);

                        Factures.Ajouterlignefacture(code_f, mle, id);

                        MessageBox.Show("Enregistrement reussie");
                    }

                    if (veriff == 0)
                    {
                        string cod  = Vetements.creercodetypevetement();
                        string lib  = Convert.ToString(dr["TypeVetement"]);
                        int    pu_t = Convert.ToInt32(dr["PU_lavage"]);
                        int    pu_l = Convert.ToInt32(dr["PU_lavage"]);

                        Vetements.Enregistrertypevetement(cod, lib, pu_t, pu_l);

                        Vetements.Enregistrervetement(id, cod, qte, mle, ddpot, ddispo);

                        Factures.Ajouterlignefacture(code_f, mle, id);

                        MessageBox.Show("Enregistrement reussie");
                    }
                }
                break;
            }
        }