Example #1
0
        public ModifierDevis(Devis1 d, Devis dv, Accueil ac)
        {
            InitializeComponent();
            this.d  = d;
            this.dv = dv;
            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(pictureBox3, "Ajouter");

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

            t.ShowAlways = true;
            t.SetToolTip(pictureBox5, "Supprimer");
        }
Example #2
0
        private void modifier()
        {
            if (dgvDevis.Rows.Count == 0)
            {
                MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                int    v_code    = Convert.ToInt16(dgvDevis.CurrentRow.Cells[0].Value.ToString());
                int    v_cl_code = Convert.ToInt16(dgvDevis.CurrentRow.Cells[1].Value.ToString());
                string v_date    = Convert.ToString(dgvDevis.CurrentRow.Cells[2].Value.ToString());
                string v_statut  = Convert.ToString(dgvDevis.CurrentRow.Cells[3].Value.ToString());
                string v_adresse = Convert.ToString(dgvDevis.CurrentRow.Cells[4].Value.ToString());
                string v_ville   = Convert.ToString(dgvDevis.CurrentRow.Cells[5].Value.ToString());
                int    v_cp      = Convert.ToInt32(dgvDevis.CurrentRow.Cells[6].Value.ToString());
                string v_pays    = Convert.ToString(dgvDevis.CurrentRow.Cells[7].Value.ToString());
                int    v_fixe    = Convert.ToInt32(dgvDevis.CurrentRow.Cells[8].Value.ToString());
                int    v_fax     = Convert.ToInt32(dgvDevis.CurrentRow.Cells[9].Value.ToString());
                int    v_mobile  = Convert.ToInt32(dgvDevis.CurrentRow.Cells[10].Value.ToString());
                string v_email   = Convert.ToString(dgvDevis.CurrentRow.Cells[11].Value.ToString());
                string v_sitew   = Convert.ToString(dgvDevis.CurrentRow.Cells[12].Value.ToString());
                string v_note    = Convert.ToString(dgvDevis.CurrentRow.Cells[13].Value.ToString());

                Devis dv = new Devis(v_code, v_cl_code, v_date, v_statut, v_adresse, v_ville, v_cp, v_pays, v_fixe, v_mobile, v_fax, v_email, v_sitew, v_note);

                ModifierDevis md = new ModifierDevis(this, dv, ac);
                md.Show();
                ac.Enabled = false;
            }
        }
Example #3
0
        private void supprimer()
        {
            if (dgvDevis.Rows.Count == 0)
            {
                MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DialogResult result = MessageBox.Show("Voulez-vous vraiment supprimer ce devis?", "Suppression!", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    int v_code = Convert.ToInt16(dgvDevis.CurrentRow.Cells[0].Value.ToString());

                    Devis dv = new Devis(v_code);
                    dv.dv_supprimer();
                    this.devisTableAdapter.Fill(this.gestioncommercialeDataSet1.devis);

                    MessageBox.Show("Devis supprimé!", "Suppression", MessageBoxButtons.OK);
                }
            }
        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            try
            {
             string  dv_adresse, dv_ville, dv_pays, dv_email, dv_sitew, dv_note , dv_date , dv_statut;
             int dv_code, cl_code, dv_cp, dv_fixe, dv_mobile, dv_fax;

            if (tbCodeDevis.Text == "" || tbCodeClient.Text == "")
            {
                MessageBox.Show("Veuillez remplir tous les champs nécessaires .", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                lCodeDevis.ForeColor = Color.Black;
                lClient.ForeColor = Color.Black;
                if (tbCodeDevis.Text == "")
                {
                    lCodeDevis.ForeColor = Color.Red;
                }
                if (tbCodeClient.Text == "")
                {
                    lClient.ForeColor = Color.Red;
                }

            }
            else
            {
                if (tbCP.Text == "")
                        dv_cp = 0;
                    else
                        dv_cp = Convert.ToInt32(tbCP.Text);

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

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

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

                    dv_code = Convert.ToInt16(tbCodeDevis.Text);
                    cl_code = Convert.ToInt16(tbCodeClient.Text);
                    dv_adresse = rtbAdresse.Text;
                    dv_ville = tbVille.Text;
                    dv_pays = tbPays.Text;
                    dv_email = tbEmail.Text;
                    dv_sitew = tbSitew.Text;
                    dv_note = rtbNote.Text;
                    dv_date = dtpDevis.Value.ToString("dd / MM / yyyy");
                    dv_statut = "Actif";

                    Devis dv = new Devis(dv_code, cl_code,dv_statut, dv_date,  dv_adresse, dv_ville, dv_cp, dv_pays, dv_fixe, dv_mobile, dv_fax, dv_email, dv_sitew, dv_note);
                    dv.dv_ajouter();
                    d.devisTableAdapter.Fill(d.gestioncommercialeDataSet1.devis);

                    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 lignedevis";
                        connection.Open();
                        int num = Convert.ToInt32(cmd.ExecuteScalar());
                        connection.Close();
                        if (num != 0)
                        {
                            cmd.CommandText = "select max(num_ligne_devis) from lignedevis;";
                            connection.Open();
                            num_ligne_devis = Convert.ToInt32(cmd.ExecuteScalar()) + 1;
                            connection.Close();
                        }
                        else
                        {
                            num_ligne_devis = 1;
                        }
                        dataGridView1.Rows[i].Cells[8].Value = num_ligne_devis;
                        num_ligne_devis = 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);

                        LigneDevis L = new LigneDevis(num_ligne_devis, dv_code, pr_code, pr_quantite, pr_montant);
                        L.ld_ajouter();
                    }

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

            catch(FormatException)
            {
                MessageBox.Show("Erreur!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #5
0
        private void supprimer()
        {
            if (dgvDevis.Rows.Count == 0)
                MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            else
            {
                DialogResult result = MessageBox.Show("Voulez-vous vraiment supprimer ce devis?", "Suppression!", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    int v_code = Convert.ToInt16(dgvDevis.CurrentRow.Cells[0].Value.ToString());

                    Devis dv = new Devis(v_code);
                    dv.dv_supprimer();
                    this.devisTableAdapter.Fill(this.gestioncommercialeDataSet1.devis);

                    MessageBox.Show("Devis supprimé!", "Suppression", MessageBoxButtons.OK);
                }
            }
        }
Example #6
0
        private void modifier()
        {
            if (dgvDevis.Rows.Count == 0)
                MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            else
            {
                int v_code = Convert.ToInt16(dgvDevis.CurrentRow.Cells[0].Value.ToString());
                int v_cl_code = Convert.ToInt16(dgvDevis.CurrentRow.Cells[1].Value.ToString());
                string v_date = Convert.ToString(dgvDevis.CurrentRow.Cells[2].Value.ToString());
                string v_statut = Convert.ToString(dgvDevis.CurrentRow.Cells[3].Value.ToString());
                string v_adresse = Convert.ToString(dgvDevis.CurrentRow.Cells[4].Value.ToString());
                string v_ville = Convert.ToString(dgvDevis.CurrentRow.Cells[5].Value.ToString());
                int v_cp = Convert.ToInt32(dgvDevis.CurrentRow.Cells[6].Value.ToString());
                string v_pays = Convert.ToString(dgvDevis.CurrentRow.Cells[7].Value.ToString());
                int v_fixe = Convert.ToInt32(dgvDevis.CurrentRow.Cells[8].Value.ToString());
                int v_fax = Convert.ToInt32(dgvDevis.CurrentRow.Cells[9].Value.ToString());
                int v_mobile = Convert.ToInt32(dgvDevis.CurrentRow.Cells[10].Value.ToString());
                string v_email = Convert.ToString(dgvDevis.CurrentRow.Cells[11].Value.ToString());
                string v_sitew = Convert.ToString(dgvDevis.CurrentRow.Cells[12].Value.ToString());
                string v_note = Convert.ToString(dgvDevis.CurrentRow.Cells[13].Value.ToString());

                Devis dv = new Devis(v_code, v_cl_code, v_date, v_statut, v_adresse, v_ville, v_cp, v_pays, v_fixe, v_mobile, v_fax, v_email, v_sitew, v_note);

                ModifierDevis md = new ModifierDevis(this, dv,ac);
                md.Show();
                ac.Enabled = false;
            }
        }
Example #7
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            try
            {
                string dv_adresse, dv_ville, dv_pays, dv_email, dv_sitew, dv_note, dv_date, dv_statut;
                int    dv_code, cl_code, dv_cp, dv_fixe, dv_mobile, dv_fax;

                if (tbCodeDevis.Text == "" || tbCodeClient.Text == "")
                {
                    MessageBox.Show("Veuillez remplir tous les champs nécessaires .", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    lCodeDevis.ForeColor = Color.Black;
                    lClient.ForeColor    = Color.Black;
                    if (tbCodeDevis.Text == "")
                    {
                        lCodeDevis.ForeColor = Color.Red;
                    }
                    if (tbCodeClient.Text == "")
                    {
                        lClient.ForeColor = Color.Red;
                    }
                }
                else
                {
                    if (tbCP.Text == "")
                    {
                        dv_cp = 0;
                    }
                    else
                    {
                        dv_cp = Convert.ToInt32(tbCP.Text);
                    }

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

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

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

                    dv_code    = Convert.ToInt16(tbCodeDevis.Text);
                    cl_code    = Convert.ToInt16(tbCodeClient.Text);
                    dv_adresse = rtbAdresse.Text;
                    dv_ville   = tbVille.Text;
                    dv_pays    = tbPays.Text;
                    dv_email   = tbEmail.Text;
                    dv_sitew   = tbSitew.Text;
                    dv_note    = rtbNote.Text;
                    dv_date    = dtpDevis.Value.ToString("dd / MM / yyyy");
                    dv_statut  = "Actif";

                    Devis dv = new Devis(dv_code, cl_code, dv_statut, dv_date, dv_adresse, dv_ville, dv_cp, dv_pays, dv_fixe, dv_mobile, dv_fax, dv_email, dv_sitew, dv_note);
                    dv.dv_ajouter();
                    d.devisTableAdapter.Fill(d.gestioncommercialeDataSet1.devis);

                    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 lignedevis";
                        connection.Open();
                        int num = Convert.ToInt32(cmd.ExecuteScalar());
                        connection.Close();
                        if (num != 0)
                        {
                            cmd.CommandText = "select max(num_ligne_devis) from lignedevis;";
                            connection.Open();
                            num_ligne_devis = Convert.ToInt32(cmd.ExecuteScalar()) + 1;
                            connection.Close();
                        }
                        else
                        {
                            num_ligne_devis = 1;
                        }
                        dataGridView1.Rows[i].Cells[8].Value = num_ligne_devis;
                        num_ligne_devis = 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);

                        LigneDevis L = new LigneDevis(num_ligne_devis, dv_code, pr_code, pr_quantite, pr_montant);
                        L.ld_ajouter();
                    }

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

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