Ejemplo n.º 1
0
        public void modifier()
        {
            if (dgvCommVente.Rows.Count == 0)
            {
                MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                int    v_code     = Convert.ToInt16(dgvCommVente.CurrentRow.Cells[0].Value.ToString());
                int    v_cl_code  = Convert.ToInt16(dgvCommVente.CurrentRow.Cells[1].Value.ToString());
                string v_statut   = Convert.ToString(dgvCommVente.CurrentRow.Cells[2].Value.ToString());
                String v_date     = Convert.ToString(dgvCommVente.CurrentRow.Cells[3].Value.ToString());
                String v_date_liv = Convert.ToString(dgvCommVente.CurrentRow.Cells[4].Value.ToString());
                string v_adresse  = Convert.ToString(dgvCommVente.CurrentRow.Cells[5].Value.ToString());
                string v_ville    = Convert.ToString(dgvCommVente.CurrentRow.Cells[6].Value.ToString());
                int    v_cp       = Convert.ToInt32(dgvCommVente.CurrentRow.Cells[7].Value.ToString());
                string v_pays     = Convert.ToString(dgvCommVente.CurrentRow.Cells[8].Value.ToString());
                int    v_fixe     = Convert.ToInt32(dgvCommVente.CurrentRow.Cells[9].Value.ToString());
                int    v_mobile   = Convert.ToInt32(dgvCommVente.CurrentRow.Cells[10].Value.ToString());
                int    v_fax      = Convert.ToInt32(dgvCommVente.CurrentRow.Cells[11].Value.ToString());
                string v_email    = Convert.ToString(dgvCommVente.CurrentRow.Cells[12].Value.ToString());
                string v_sitew    = Convert.ToString(dgvCommVente.CurrentRow.Cells[13].Value.ToString());
                string v_note     = Convert.ToString(dgvCommVente.CurrentRow.Cells[14].Value.ToString());
                double v_frais    = Convert.ToDouble(dgvCommVente.CurrentRow.Cells[15].Value.ToString());

                CommandeVente         cmv = new CommandeVente(v_code, v_cl_code, v_statut, v_date, v_date_liv, v_adresse, v_ville, v_cp, v_pays, v_fixe, v_mobile, v_fax, v_email, v_sitew, v_note, v_frais);
                ModifierCommandeVente mcv = new ModifierCommandeVente(this, cmv, ac);
                mcv.Show();
                ac.Enabled = false;
            }
        }
Ejemplo n.º 2
0
        public void supprimer()
        {
            if (dgvCommVente.Rows.Count == 0)
            {
                MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DialogResult result = MessageBox.Show("Voulez-vous vraiment supprimer cette commande?", "Suppression!", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    int v_code = Convert.ToInt32(dgvCommVente.CurrentRow.Cells[0].Value.ToString());

                    CommandeVente cmv = new CommandeVente(v_code);
                    cmv.cmv_supprimer();
                    this.commandeventeTableAdapter.Fill(this.gestioncommercialeDataSet1.commandevente);
                    MessageBox.Show("Commande supprimée!", "Suppression", MessageBoxButtons.OK);
                }
            }
        }
        public ModifierCommandeVente(CommandesVente cv, CommandeVente cv1,Accueil ac)
        {
            InitializeComponent();
            this.cv = cv;
            this.cv1 = cv1;
            this.ac = ac;

            ToolTip t = new ToolTip();

            t.ShowAlways = true;
            t.SetToolTip(tbCP, "Insertion des numéros uniquement.");

            t.ShowAlways = true;
            t.SetToolTip(tbFixe, "Insertion des numéros uniquement.");

            t.ShowAlways = true;
            t.SetToolTip(tbMobile, "Insertion des numéros uniquement.");

            t.ShowAlways = true;
            t.SetToolTip(tbFax, "Insertion des numéros uniquement.");

            t.ShowAlways = true;
            t.SetToolTip(textBox7, "Insertion des numéros uniquement.");

            t.ShowAlways = true;
            t.SetToolTip(tbFrais, "Insertion des numéros uniquement (Ex : 1,01).");

            t.ShowAlways = true;
            t.SetToolTip(pictureBox4, "Ajouter");

            t.ShowAlways = true;
            t.SetToolTip(pictureBox5, "Modifier");

            t.ShowAlways = true;
            t.SetToolTip(pictureBox8, "Supprimer");
        }
        public ModifierCommandeVente(CommandesVente cv, CommandeVente cv1, Accueil ac)
        {
            InitializeComponent();
            this.cv  = cv;
            this.cv1 = cv1;
            this.ac  = ac;

            ToolTip t = new ToolTip();

            t.ShowAlways = true;
            t.SetToolTip(tbCP, "Insertion des numéros uniquement.");

            t.ShowAlways = true;
            t.SetToolTip(tbFixe, "Insertion des numéros uniquement.");

            t.ShowAlways = true;
            t.SetToolTip(tbMobile, "Insertion des numéros uniquement.");

            t.ShowAlways = true;
            t.SetToolTip(tbFax, "Insertion des numéros uniquement.");

            t.ShowAlways = true;
            t.SetToolTip(textBox7, "Insertion des numéros uniquement.");

            t.ShowAlways = true;
            t.SetToolTip(tbFrais, "Insertion des numéros uniquement (Ex : 1,01).");

            t.ShowAlways = true;
            t.SetToolTip(pictureBox4, "Ajouter");

            t.ShowAlways = true;
            t.SetToolTip(pictureBox5, "Modifier");

            t.ShowAlways = true;
            t.SetToolTip(pictureBox8, "Supprimer");
        }
Ejemplo n.º 5
0
        public void modifier()
        {
            if (dgvCommVente.Rows.Count == 0)
                MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            else
            {
                int v_code = Convert.ToInt16(dgvCommVente.CurrentRow.Cells[0].Value.ToString());
                int v_cl_code = Convert.ToInt16(dgvCommVente.CurrentRow.Cells[1].Value.ToString());
                string v_statut = Convert.ToString(dgvCommVente.CurrentRow.Cells[2].Value.ToString());
                String v_date = Convert.ToString(dgvCommVente.CurrentRow.Cells[3].Value.ToString());
                String v_date_liv = Convert.ToString(dgvCommVente.CurrentRow.Cells[4].Value.ToString());
                string v_adresse = Convert.ToString(dgvCommVente.CurrentRow.Cells[5].Value.ToString());
                string v_ville = Convert.ToString(dgvCommVente.CurrentRow.Cells[6].Value.ToString());
                int v_cp = Convert.ToInt32(dgvCommVente.CurrentRow.Cells[7].Value.ToString());
                string v_pays = Convert.ToString(dgvCommVente.CurrentRow.Cells[8].Value.ToString());
                int v_fixe = Convert.ToInt32(dgvCommVente.CurrentRow.Cells[9].Value.ToString());
                int v_mobile = Convert.ToInt32(dgvCommVente.CurrentRow.Cells[10].Value.ToString());
                int v_fax = Convert.ToInt32(dgvCommVente.CurrentRow.Cells[11].Value.ToString());
                string v_email = Convert.ToString(dgvCommVente.CurrentRow.Cells[12].Value.ToString());
                string v_sitew = Convert.ToString(dgvCommVente.CurrentRow.Cells[13].Value.ToString());
                string v_note = Convert.ToString(dgvCommVente.CurrentRow.Cells[14].Value.ToString());
                double v_frais = Convert.ToDouble(dgvCommVente.CurrentRow.Cells[15].Value.ToString());

                CommandeVente cmv = new CommandeVente(v_code, v_cl_code, v_statut, v_date, v_date_liv, v_adresse, v_ville, v_cp, v_pays, v_fixe, v_mobile, v_fax, v_email, v_sitew, v_note, v_frais);
                ModifierCommandeVente mcv = new ModifierCommandeVente(this, cmv,ac);
                mcv.Show();
                ac.Enabled = false;
            }
        }
Ejemplo n.º 6
0
        public void supprimer()
        {
            if (dgvCommVente.Rows.Count == 0)
                MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            else
            {
                DialogResult result = MessageBox.Show("Voulez-vous vraiment supprimer cette commande?", "Suppression!", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    int v_code = Convert.ToInt32(dgvCommVente.CurrentRow.Cells[0].Value.ToString());

                    CommandeVente cmv = new CommandeVente(v_code);
                    cmv.cmv_supprimer();
                    this.commandeventeTableAdapter.Fill(this.gestioncommercialeDataSet1.commandevente);
                    MessageBox.Show("Commande supprimée!", "Suppression", MessageBoxButtons.OK);
                }
            }
        }
Ejemplo n.º 7
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            try
            {
                string cmv_adresse, cmv_ville, cmv_pays, cmv_email, cmv_sitew, cmv_note, cmv_date, cmv_statut, cmv_date_liv;
                int    cmv_code, cl_code, cmv_cp, cmv_fixe, cmv_mobile, cmv_fax;
                double cmv_frais;
                if (tbCodeCommV.Text == "" || tbCodeClient.Text == "")
                {
                    MessageBox.Show("Veuillez remplir tous les champs nécessaires .", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    lComm.ForeColor   = Color.Black;
                    lClient.ForeColor = Color.Black;
                    if (tbCodeCommV.Text == "")
                    {
                        lComm.ForeColor = Color.Red;
                    }
                    if (tbCodeClient.Text == "")
                    {
                        lClient.ForeColor = Color.Red;
                    }
                }
                else
                {
                    if (tbCP.Text == "")
                    {
                        cmv_cp = 0;
                    }
                    else
                    {
                        cmv_cp = Convert.ToInt32(tbCP.Text);
                    }

                    if (tbFixe.Text == "")
                    {
                        cmv_fixe = 0;
                    }
                    else
                    {
                        cmv_fixe = Convert.ToInt32(tbFixe.Text);
                    }

                    if (tbMobile.Text == "")
                    {
                        cmv_mobile = 0;
                    }
                    else
                    {
                        cmv_mobile = Convert.ToInt32(tbMobile.Text);
                    }

                    if (tbFax.Text == "")
                    {
                        cmv_fax = 0;
                    }
                    else
                    {
                        cmv_fax = Convert.ToInt32(tbFax.Text);
                    }

                    if (tbFrais.Text == "")
                    {
                        cmv_frais = 0;
                    }
                    else
                    {
                        cmv_frais = Convert.ToDouble(tbFrais.Text);
                    }

                    cmv_code     = Convert.ToInt32(tbCodeCommV.Text);
                    cl_code      = Convert.ToInt32(tbCodeClient.Text);
                    cmv_adresse  = rtbAdresse.Text;
                    cmv_ville    = tbVille.Text;
                    cmv_pays     = tbPays.Text;
                    cmv_email    = tbEmail.Text;
                    cmv_sitew    = tbSitew.Text;
                    cmv_note     = rtbNote.Text;
                    cmv_date     = dtpCommV.Value.ToString("dd / MM / yyyy");
                    cmv_date_liv = dtpLiv.Value.ToString("dd / MM / yyyy");
                    cmv_statut   = "Active";

                    CommandeVente cmv = new CommandeVente(cmv_code, cl_code, cmv_statut, cmv_date, cmv_date_liv, cmv_adresse, cmv_ville, cmv_cp, cmv_pays, cmv_fixe, cmv_mobile, cmv_fax, cmv_email, cmv_sitew, cmv_note, cmv_frais);
                    cmv.cmv_ajouter();
                    cv.commandeventeTableAdapter.Fill(cv.gestioncommercialeDataSet1.commandevente);


                    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    {
                        string          MyConString = "SERVER=localhost;" + "DATABASE=gestioncommerciale;" + "UID=root;" + "PASSWORD=freedomity;";
                        MySqlConnection connection  = new MySqlConnection(MyConString);
                        MySqlCommand    cmd         = connection.CreateCommand();
                        cmd.CommandText = "select count(*) from lignecommandevente";
                        connection.Open();
                        int num = Convert.ToInt32(cmd.ExecuteScalar());
                        connection.Close();
                        if (num != 0)
                        {
                            cmd.CommandText = "select max(num_ligne_commande) from lignecommandevente;";
                            connection.Open();
                            num_ligne_commande = Convert.ToInt32(cmd.ExecuteScalar()) + 1;
                            connection.Close();
                        }
                        else
                        {
                            num_ligne_commande = 1;
                        }

                        dataGridView1.Rows[i].Cells[8].Value = num_ligne_commande;
                        num_ligne_commande = Convert.ToInt16(dataGridView1.Rows[i].Cells[8].Value);
                        pr_code            = dataGridView1.Rows[i].Cells[1].Value.ToString();
                        pr_quantite        = Convert.ToInt16(dataGridView1.Rows[i].Cells[6].Value);
                        pr_montant         = Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value);

                        LigneCommandeVente L = new LigneCommandeVente(num_ligne_commande, cmv_code, pr_code, pr_quantite, pr_montant);
                        L.lcmv_ajouter();
                    }

                    Hide();
                    cv.Enabled = true;
                }
            }

            catch (FormatException)
            {
                MessageBox.Show("Erreur!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            try
            {
                string  cmv_adresse, cmv_ville, cmv_pays, cmv_email, cmv_sitew, cmv_note, cmv_date, cmv_statut, cmv_date_liv;
                int cmv_code, cl_code, cmv_cp, cmv_fixe, cmv_mobile, cmv_fax;
                double cmv_frais;
                if(tbCodeCommV.Text == "" || tbCodeClient.Text == "")
                {
                MessageBox.Show("Veuillez remplir tous les champs nécessaires .", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    lComm.ForeColor = Color.Black;
                    lClient.ForeColor = Color.Black;
                if (tbCodeCommV.Text == "")
                {
                    lComm.ForeColor = Color.Red;

                }
                if (tbCodeClient.Text == "")
                {
                    lClient.ForeColor  = Color.Red;
                }
                }
                else
                    {

                    if (tbCP.Text == "")
                        cmv_cp = 0;
                    else
                        cmv_cp = Convert.ToInt32(tbCP.Text);

                    if (tbFixe.Text == "")
                        cmv_fixe = 0;
                    else
                        cmv_fixe = Convert.ToInt32(tbFixe.Text);

                    if (tbMobile.Text == "")
                        cmv_mobile = 0;
                    else
                        cmv_mobile = Convert.ToInt32(tbMobile.Text);

                    if (tbFax.Text == "")
                        cmv_fax = 0;
                    else
                        cmv_fax = Convert.ToInt32(tbFax.Text);

                    if (tbFrais.Text == "")
                        cmv_frais = 0;
                    else
                        cmv_frais = Convert.ToDouble(tbFrais.Text);

                    cmv_code = Convert.ToInt32(tbCodeCommV.Text);
                    cl_code = Convert.ToInt32(tbCodeClient.Text);
                    cmv_adresse = rtbAdresse.Text;
                    cmv_ville = tbVille.Text;
                    cmv_pays = tbPays.Text;
                    cmv_email = tbEmail.Text;
                    cmv_sitew = tbSitew.Text;
                    cmv_note = rtbNote.Text;
                    cmv_date = dtpCommV.Value.ToString("dd / MM / yyyy");
                    cmv_date_liv = dtpLiv.Value.ToString("dd / MM / yyyy");
                    cmv_statut = "Active";

                    CommandeVente cmv = new CommandeVente(cmv_code, cl_code, cmv_statut, cmv_date, cmv_date_liv, cmv_adresse, cmv_ville, cmv_cp, cmv_pays, cmv_fixe, cmv_mobile, cmv_fax, cmv_email, cmv_sitew, cmv_note, cmv_frais);
                    cmv.cmv_ajouter();
                    cv.commandeventeTableAdapter.Fill(cv.gestioncommercialeDataSet1.commandevente);

                    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    {

                        string MyConString = "SERVER=localhost;" + "DATABASE=gestioncommerciale;" + "UID=root;" + "PASSWORD=freedomity;";
                        MySqlConnection connection = new MySqlConnection(MyConString);
                        MySqlCommand cmd = connection.CreateCommand();
                        cmd.CommandText = "select count(*) from lignecommandevente";
                        connection.Open();
                        int num = Convert.ToInt32(cmd.ExecuteScalar());
                        connection.Close();
                        if (num != 0)
                        {
                            cmd.CommandText = "select max(num_ligne_commande) from lignecommandevente;";
                            connection.Open();
                            num_ligne_commande = Convert.ToInt32(cmd.ExecuteScalar()) + 1;
                            connection.Close();
                        }
                        else
                        {
                            num_ligne_commande = 1;
                        }

                        dataGridView1.Rows[i].Cells[8].Value = num_ligne_commande;
                        num_ligne_commande = Convert.ToInt16(dataGridView1.Rows[i].Cells[8].Value);
                        pr_code = dataGridView1.Rows[i].Cells[1].Value.ToString();
                        pr_quantite = Convert.ToInt16(dataGridView1.Rows[i].Cells[6].Value);
                        pr_montant = Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value);

                        LigneCommandeVente L = new LigneCommandeVente(num_ligne_commande, cmv_code, pr_code, pr_quantite, pr_montant);
                        L.lcmv_ajouter();

                    }

                    Hide();
                    cv.Enabled = true;
                    }

            }

            catch (FormatException)
            {
                MessageBox.Show("Erreur!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }