private void pictureBox9_Click(object sender, EventArgs e) { if (textBox2.Text == "" || textBox7.Text == "") { MessageBox.Show("Vous devez remplir les champs vides!", "Champs vides", MessageBoxButtons.OK); label7.ForeColor = Color.Black; label8.ForeColor = Color.Black; if (textBox2.Text == "") { label7.ForeColor = Color.Red; } if (textBox7.Text == "") { label8.ForeColor = Color.Red; } } else { pr_code = textBox2.Text; pr_quantite = Convert.ToInt16(textBox7.Text); double prix_vente_produit = 0; pr_montant = pr_quantite * prix_vente_produit; LigneCommandeVente L = new LigneCommandeVente(num_ligne_commande); L.lcmv_modifier(cmv_code, pr_code, pr_quantite, pr_montant); this.lignecommandeventeTableAdapter.Fill(this.gestioncommercialeDataSet1.lignecommandevente); textBox2.Text = ""; textBox7.Text = ""; panel2.Visible = false; } }
private void pictureBox3_Click(object sender, EventArgs e) { if (textBox2.Text == "" || textBox7.Text == "") { MessageBox.Show("Vous devez remplir les champs vides!", "Champs vides", MessageBoxButtons.OK); label7.ForeColor = Color.Black; label8.ForeColor = Color.Black; if (textBox2.Text == "") { label7.ForeColor = Color.Red; } if (textBox7.Text == "") { label8.ForeColor = Color.Red; } } else { //num_ligne_commande int num_ligne_commande; if (dataGridView1.Rows.Count == 0) { num_ligne_commande = 1; } else { string MyConString = "SERVER=localhost;" + "DATABASE=gestioncommerciale;" + "UID=root;" + "PASSWORD=freedomity;"; MySqlConnection connection = new MySqlConnection(MyConString); MySqlCommand cmd = connection.CreateCommand(); cmd.CommandText = "select max(num_ligne_commande) from lignecommandevente"; connection.Open(); num_ligne_commande = Convert.ToInt32(cmd.ExecuteScalar()) + 1; connection.Close(); } int cma_code = Convert.ToInt16(tbCodeCommV.Text); string pr_code = textBox2.Text; int pr_quantite = Convert.ToInt16(textBox7.Text); double prix_vente_produit = 0; double pr_montant = pr_quantite * prix_vente_produit; LigneCommandeVente L = new LigneCommandeVente(num_ligne_commande, cma_code, pr_code, pr_quantite, pr_montant); L.lcmv_ajouter(); this.lignecommandeventeTableAdapter.Fill(this.gestioncommercialeDataSet1.lignecommandevente); textBox2.Text = ""; textBox7.Text = ""; panel2.Visible = false; } }
public void supprimerLigneCommandeVente() { if (dataGridView1.Rows.Count == 0) { MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK); } else { DialogResult rsl = MessageBox.Show("Voulez-vous vraiment éliminer ce produit de la facture?", "Supprimer Produit", MessageBoxButtons.YesNo); if (rsl == DialogResult.Yes) { int num_ligne_commande = Convert.ToInt16(dataGridView1.CurrentRow.Cells[0].Value.ToString()); LigneCommandeVente L = new LigneCommandeVente(num_ligne_commande); L.lcmv_supprimer(); this.lignecommandeventeTableAdapter.Fill(this.gestioncommercialeDataSet1.lignecommandevente); } } }
public void supprimerLigneCommandeVente() { if (dataGridView1.Rows.Count == 0) MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK); else { DialogResult rsl = MessageBox.Show("Voulez-vous vraiment éliminer ce produit de la facture?", "Supprimer Produit", MessageBoxButtons.YesNo); if (rsl == DialogResult.Yes) { int num_ligne_commande = Convert.ToInt16(dataGridView1.CurrentRow.Cells[0].Value.ToString()); LigneCommandeVente L = new LigneCommandeVente(num_ligne_commande); L.lcmv_supprimer(); this.lignecommandeventeTableAdapter.Fill(this.gestioncommercialeDataSet1.lignecommandevente); } } }
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); } }