private void NouvelleCommande_Load(object sender, EventArgs e) { this.comboCodeClient.Focus(); //----------------Informations Societe (BEGIN)------------------------------// InfoSociete Societe = new InfoSociete(); string titre = Societe.nom + "\n" + Societe.adresse + "\nTel:" + Societe.tel + " Fax:" + Societe.fax; label10.Text = titre; MemoryStream ms = new MemoryStream(); ms.Write(Societe.logo, 0, Societe.logo.Length); Image imgPhoto = Image.FromStream(ms); picLogo.Image = imgPhoto; //----------------Informations Societe (END)------------------------------// labelCodeFacture.Text = facture.GenerateCode(); comboCodeClient.DataSource = TB_Client.GetList(); comboCodeClient.DisplayMember = "Code"; dateTimePicker2.Value = dateTimePicker2.Value.AddDays(1); comboCodeClient.Text = client.GenerateCode(); textNomClient.Text = ""; textPrenomClient.Text = ""; maskedTextTelClient.Text = ""; textAdresseClient.Text = ""; }
private void comboCodeClient_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { TB_Client c = new TB_Client(); if (c.FindByKey(comboCodeClient.Text)) { textNomClient.Text = c.Nom; textPrenomClient.Text = c.Prenom; maskedTextTelClient.Text = c.NTel; textAdresseClient.Text = c.Adresse; this.SelectNextControl(textAdresseClient, true, true, true, true); clientExiste = true; } else { comboCodeClient.Text = c.GenerateCode(); textNomClient.Text = ""; textPrenomClient.Text = ""; maskedTextTelClient.Text = ""; textAdresseClient.Text = ""; this.SelectNextControl(comboCodeClient, true, true, true, true); clientExiste = false; } } }
public InfoClient() { InitializeComponent(); Save = true; btnOK.Enabled = true; TB_Client client = new TB_Client(); c1TextBox1.Value = client.GenerateCode(); }
private void c1Combo1_TextChanged(object sender, EventArgs e) { TB_Client client = new TB_Client(); client.FindByKey(c1Combo1.Text); TextNomClient.Value = client.Nom; TextPrenomClient.Value = client.Prenom; TextTelClient.Value = client.NTel; TextAdresseClient.Value = client.Adresse; }
private void button1_Click(object sender, EventArgs e) { TB_Client client = new TB_Client(); TextNomClient.Value = ""; TextPrenomClient.Value = ""; TextTelClient.Value = ""; TextAdresseClient.Value = ""; c1Combo1.Text = client.GenerateCode(); }
private TB_Client GetChamp() { TB_Client r = new TB_Client(); r.Code = (string)c1TextBox1.Value; r.Nom = (string)c1TextBox2.Value; r.Prenom = (string)c1TextBox3.Value; r.NTel = (string)c1TextBox5.Value; r.Adresse = (string)c1TextBox4.Value; return(r); }
public InfoClient(string Code) { InitializeComponent(); Save = false; TB_Client client = new TB_Client(); client.FindByKey(Code); c1TextBox1.Value = client.Code; c1TextBox2.Value = client.Nom; c1TextBox3.Value = client.Prenom; c1TextBox4.Value = client.Adresse; c1TextBox5.Value = client.NTel; }
private void comboCodeClient_SelectedIndexChanged(object sender, EventArgs e) { TB_Client c = new TB_Client(); if (c.FindByKey(comboCodeClient.Text)) { textNomClient.Text = c.Nom; textPrenomClient.Text = c.Prenom; maskedTextTelClient.Text = c.NTel; textAdresseClient.Text = c.Adresse; this.SelectNextControl(textAdresseClient, true, true, true, true); clientExiste = true; } }
private void btnOK_Click(object sender, EventArgs e) { if (VerifierChamp()) { TB_Client newClient = GetChamp(); if (!Save) { newClient.UpdateData(); } else { newClient.SaveData(); } this.Close(); } }
public static List <TB_Client> GetList() { List <TB_Client> list = new List <TB_Client>(); DB_PostgreSQL dataBase = new DB_PostgreSQL(); Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Client\""); while (reader.Read()) { TB_Client c = new TB_Client(); c.Code = (string)reader["Code"]; c.Nom = (string)reader["Nom"]; c.Prenom = (string)reader["Prenom"]; c.NTel = (string)reader["Tel"]; c.Adresse = (string)reader["Adresse"]; list.Add(c); } return(list); }
private void Supprimer_Click(object sender, EventArgs e) { if (MessageBox.Show("Vous ete sure de vouloire Supprimer ceux Client ?", "Attention", MessageBoxButtons.YesNo) == DialogResult.Yes) { int index = c1TrueDBGrid1.Row; string Code = c1TrueDBGrid1.Columns["Code"].CellText(index); if (Code == null) { MessageBox.Show("Code Vide"); return; } DB_PostgreSQL dataBase = new DB_PostgreSQL(); dataBase.ExecuteNonQuery("DELETE FROM \"Facture\" Where \"Code_Client\"='" + Code + "'"); TB_Client Ar = new TB_Client(); Ar.FindByKey(Code); Ar.DeleteData(); GestionClient_Load(sender, e); } }