private void pictureBox1_Click(object sender, EventArgs e) { if (txtcode.Text == "" || txtnom.Text == "" || txtprenom.Text == "" || txtadresse.Text == "" || txtville.Text == "" || comboBox1.Text == "" || (txtfix.Text == "" && txtmobile.Text == "") || txtemail.Text == "") { MessageBox.Show("Vous devez remplir les champs vides!", "Champs vides", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); label1.ForeColor = Color.Black; label2.ForeColor = Color.Black; label3.ForeColor = Color.Black; label4.ForeColor = Color.Black; label5.ForeColor = Color.Black; label6.ForeColor = Color.Black; label8.ForeColor = Color.Black; label9.ForeColor = Color.Black; label11.ForeColor = Color.Black; label12.ForeColor = Color.Black; label13.ForeColor = Color.Black; label16.ForeColor = Color.Black; if (txtcode.Text == "") { label2.ForeColor = Color.Red; } if (txtnom.Text == "") { label3.ForeColor = Color.Red; } if (txtprenom.Text == "") { label4.ForeColor = Color.Red; } if (txtadresse.Text == "") { label5.ForeColor = Color.Red; } if (txtville.Text == "") { label6.ForeColor = Color.Red; } if (comboBox1.Text == "") { label7.ForeColor = Color.Red; } if (txtfix.Text == "" && txtmobile.Text == "") { label8.ForeColor = Color.Red; label9.ForeColor = Color.Red; } if (txtemail.Text == "") { label11.ForeColor = Color.Red; } } else { Entity.Client C = new Entity.Client(); C.code_Client = int.Parse(txtcode.Text); C.ref_Client = textBox2.Text; C.nom_Client = txtnom.Text; C.prenom_Client = txtprenom.Text; C.adresse_Client = txtadresse.Text; C.codepostal_Client = int.Parse(textBox1.Text); C.ville_Client = txtville.Text; C.pays_Client = comboBox1.Text; C.telFixe_Client = int.Parse(txtfix.Text); C.telMobile_Client = int.Parse(txtmobile.Text); C.email_Client = txtemail.Text; C.site_Client = txtsite.Text; C.fax_Client = int.Parse(txtfax.Text); C.societe_Client = txtsociete.Text; if (radionouveau.Checked == true) { C.etat_Client = "Nouveau"; } else if (Radiofidele.Checked == true) { C.etat_Client = "Fidele"; } else if (radiooccasio.Checked == true) { C.etat_Client = "Occasionnel"; } C.notes_Client = txtnotes.Text; DAL.DAL_Client.UpdateClient(C); // if (DAL.DAL_Client.UpdateClient(C) == true) // { MessageBox.Show("Mise à jour avec succès").ToString(); } //else { MessageBox.Show("Mise à jour échouée").ToString(); } cl.clientTableAdapter.Fill(cl.gestioncommercialeDataSet1.client); Hide(); ac.Enabled = true; } }
private void pictureBox1_Click(object sender, EventArgs e) { if (txtcode.Text == "" || txtnom.Text == "" || txtprenom.Text == "" || txtadresse.Text == "" || txtville.Text == "" || comboBox1.Text == "" || (txtfix.Text == "" && txtmobile.Text == "") || txtemail.Text == "" || textBox1.Text =="" ) { MessageBox.Show("Vous devez remplir les champs vides!", "Champs vides", MessageBoxButtons.OK,MessageBoxIcon.Exclamation); label1.ForeColor = Color.Black; label2.ForeColor = Color.Black; label3.ForeColor = Color.Black; label4.ForeColor = Color.Black; label5.ForeColor = Color.Black; label6.ForeColor = Color.Black; label8.ForeColor = Color.Black; label9.ForeColor = Color.Black; label11.ForeColor = Color.Black; label12.ForeColor = Color.Black; label13.ForeColor = Color.Black; label16.ForeColor = Color.Black; if (txtcode.Text == "") { label2.ForeColor = Color.Red; } if (txtnom.Text == "") { label3.ForeColor = Color.Red; } if (txtprenom.Text == "") { label4.ForeColor = Color.Red; } if (txtadresse.Text == "") { label5.ForeColor = Color.Red; } if (txtville.Text == "") { label6.ForeColor = Color.Red; } if (comboBox1.Text == "") { label7.ForeColor = Color.Red; } if (txtfix.Text == "" && txtmobile.Text =="") { label8.ForeColor = Color.Red; label9.ForeColor = Color.Red; } if (txtemail.Text == "") { label11.ForeColor = Color.Red; } if (textBox1.Text == "") { label1.ForeColor = Color.Red; } } else { string etat = "Nouveau"; int nbTr = 0; try { Entity.Client C = new Entity.Client(); C.code_Client = Convert.ToInt16(txtcode.Text); C.ref_Client = textBox2.Text; C.nom_Client = txtnom.Text; C.prenom_Client = txtprenom.Text; C.adresse_Client = txtadresse.Text; C.codepostal_Client = Convert.ToInt16(textBox1.Text); C.ville_Client = txtville.Text; C.pays_Client = comboBox1.Text; C.telFixe_Client = int.Parse(txtfix.Text); C.telMobile_Client = int.Parse(txtmobile.Text); C.email_Client = txtemail.Text; C.site_Client = txtsite.Text; C.fax_Client = int.Parse(txtfax.Text); C.societe_Client = txtsociete.Text; C.etat_Client = etat; C.nbTransactions_Client = nbTr; C.notes_Client = txtnotes.Text; DAL.DAL_Client.InsertClient(C); } catch (Exception ecc) { MessageBox.Show(ecc.ToString()); } cl.clientTableAdapter.Fill(cl.gestioncommercialeDataSet1.client); Hide(); ac.Enabled = true; } }
private void pictureBox1_Click(object sender, EventArgs e) { if (txtcode.Text == "" || txtnom.Text == "" || txtprenom.Text == "" || txtadresse.Text == "" || txtville.Text == "" || comboBox1.Text == "" || (txtfix.Text == "" && txtmobile.Text == "") || txtemail.Text == "" || textBox1.Text == "") { MessageBox.Show("Vous devez remplir les champs vides!", "Champs vides", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); label1.ForeColor = Color.Black; label2.ForeColor = Color.Black; label3.ForeColor = Color.Black; label4.ForeColor = Color.Black; label5.ForeColor = Color.Black; label6.ForeColor = Color.Black; label8.ForeColor = Color.Black; label9.ForeColor = Color.Black; label11.ForeColor = Color.Black; label12.ForeColor = Color.Black; label13.ForeColor = Color.Black; label16.ForeColor = Color.Black; if (txtcode.Text == "") { label2.ForeColor = Color.Red; } if (txtnom.Text == "") { label3.ForeColor = Color.Red; } if (txtprenom.Text == "") { label4.ForeColor = Color.Red; } if (txtadresse.Text == "") { label5.ForeColor = Color.Red; } if (txtville.Text == "") { label6.ForeColor = Color.Red; } if (comboBox1.Text == "") { label7.ForeColor = Color.Red; } if (txtfix.Text == "" && txtmobile.Text == "") { label8.ForeColor = Color.Red; label9.ForeColor = Color.Red; } if (txtemail.Text == "") { label11.ForeColor = Color.Red; } if (textBox1.Text == "") { label1.ForeColor = Color.Red; } } else { string etat = "Nouveau"; int nbTr = 0; try { Entity.Client C = new Entity.Client(); C.code_Client = Convert.ToInt16(txtcode.Text); C.ref_Client = textBox2.Text; C.nom_Client = txtnom.Text; C.prenom_Client = txtprenom.Text; C.adresse_Client = txtadresse.Text; C.codepostal_Client = Convert.ToInt16(textBox1.Text); C.ville_Client = txtville.Text; C.pays_Client = comboBox1.Text; C.telFixe_Client = int.Parse(txtfix.Text); C.telMobile_Client = int.Parse(txtmobile.Text); C.email_Client = txtemail.Text; C.site_Client = txtsite.Text; C.fax_Client = int.Parse(txtfax.Text); C.societe_Client = txtsociete.Text; C.etat_Client = etat; C.nbTransactions_Client = nbTr; C.notes_Client = txtnotes.Text; DAL.DAL_Client.InsertClient(C); } catch (Exception ecc) { MessageBox.Show(ecc.ToString()); } cl.clientTableAdapter.Fill(cl.gestioncommercialeDataSet1.client); Hide(); ac.Enabled = true; } }