Exemplo n.º 1
0
        public void createCompte(ClassCompagnie compte)
        {
            InitializeConnection();
            try
            {
                string q = "insert into compte(designation,description,solde,ref_compagnie) values(@designation,@description,@solde,@ref_compagnie)";
                cmd = new MySqlCommand(q, con);
                cmd.Parameters.Add(new MySqlParameter("@designation", compte.Noms));
                cmd.Parameters.Add(new MySqlParameter("@description", compte.Description));
                cmd.Parameters.Add(new MySqlParameter("@solde", compte.refSolde));
                cmd.Parameters.Add(new MySqlParameter("@ref_compagnie", compte.Code));

                if (cmd.ExecuteNonQuery() == 1)
                {
                    MessageBox.Show("creation compte effectué avec succes!!");
                }
            }catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }
            finally
            {
                cmd.Dispose();
                con.Close();
            }
        }
Exemplo n.º 2
0
        public void updateCompagnie(ClassCompagnie c)
        {
            InitializeConnection();
            try
            {
                string q = "update compagnie set noms=@noms,description=@description,adresse=@adresse,photo=@photo,rccm=@rccm,email=@email,etat=@etat where code=@code";
                cmd = new MySqlCommand(q, con);
                cmd.Parameters.Add(new MySqlParameter("@code", c.Code));
                cmd.Parameters.Add(new MySqlParameter("@noms", c.Noms));
                cmd.Parameters.Add(new MySqlParameter("@description", c.Adresse));
                cmd.Parameters.Add(new MySqlParameter("@adresse", c.Description));
                cmd.Parameters.Add(new MySqlParameter("@photo", c.photo));
                cmd.Parameters.Add(new MySqlParameter("@rccm", c.Rccm));
                cmd.Parameters.Add(new MySqlParameter("@email", c.Email));
                //cmd.Parameters.Add(new MySqlParameter("@ref_pos", c.Ref_POS));
                cmd.Parameters.Add(new MySqlParameter("@etat", c.Etat));

                if (cmd.ExecuteNonQuery() == 1)
                {
                    MessageBox.Show("Modification effectuée avec succes!");
                    cmd.Dispose();
                    con.Close();
                    ClassCompte co = new ClassCompte();
                    co.Ref_compagnie = c.Code;
                    co.Designation   = c.Noms;
                    co.Description   = c.Description;
                    updateCompte(co.Designation, co.Description, "compte");
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 3
0
        public void insertCompagie(ClassCompagnie c)
        {
            InitializeConnection();
            try
            {
                string q = "insert into compagnie(code,noms,description,adresse,photo,rccm,email) value(@code,@noms,@description,@adresse,@photo,@rccm,@email)";
                cmd = new MySqlCommand(q, con);
                cmd.Parameters.Add(new MySqlParameter("@code", c.Code));
                cmd.Parameters.Add(new MySqlParameter("@noms", c.Noms));
                cmd.Parameters.Add(new MySqlParameter("@description", c.Description));
                cmd.Parameters.Add(new MySqlParameter("@adresse", c.Adresse));
                cmd.Parameters.Add(new MySqlParameter("@photo", c.photo));
                cmd.Parameters.Add(new MySqlParameter("@rccm", c.Rccm));
                cmd.Parameters.Add(new MySqlParameter("@email", c.Email));
                //cmd.Parameters.Add(new MySqlParameter("@commission", c.Commission));

                if (cmd.ExecuteNonQuery() == 1)
                {
                    MessageBox.Show("Insertion effectuée avec succes!");
                    cmd.Dispose();
                    con.Close();
                    //creation compte
                    c.refSolde = 0;

                    createCompte(c);
                    createUser(c.Noms, c.Description, "1234", 1);
                }
            }catch (Exception ex)
            {
                // MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
        public void deleteCompagnie(ClassCompagnie c)
        {
            string q = "delete from compagnie where code=@code";

            cmd = new MySqlCommand(q, con);
            cmd.Parameters.Add(new MySqlParameter("@code", c.Code));
            DialogResult result = MessageBox.Show("Voulez-vous vraiment excuter cette operation ?", "Suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                if (cmd.ExecuteNonQuery() == 1)
                {
                    MessageBox.Show("Suppression avec succes!!");
                }
            }

            else
            {
                // MessageBox.Show("Opération Annulée !");
            }
        }