public InfoFamille() { InitializeComponent(); TB_Famille tmp = new TB_Famille(); c1TextBox1.Value = tmp.GenerateCode(); save = true; }
public InfoFamille(string Code) { InitializeComponent(); currentFamille = new TB_Famille(); currentFamille.FindByKey(Code); SetChamp(currentFamille); save = false; }
private TB_Famille GetChamp() { TB_Famille r = new TB_Famille(); r.Code = (string)c1TextBox1.Value; r.Libelle = (string)c1TextBox2.Value; r.Description = c1TextBox3.Text; return(r); }
private void comboFamille_SelectedIndexChanged(object sender, EventArgs e) { selectedFamilleItem = ((TB_Famille)comboFamille.SelectedItem); comboCode.Text = ""; comboLibelle.Text = ""; comboLibelle.DataSource = comboCode.DataSource = TB_Articles.GetList(selectedFamilleItem.Code, comboOperation.Text); textPrix.DataBindings.Clear(); textPrix.DataBindings.Add("Text", comboCode.DataSource, "Prix_" + comboOperation.Text); }
private void btnOK_Click(object sender, EventArgs e) { if (VerifierChamp()) { TB_Famille newFamille = GetChamp(); if (!save) { newFamille.UpdateData(); } else { newFamille.SaveData(); } this.Close(); } }
public static List <TB_Famille> GetList() { List <TB_Famille> list = new List <TB_Famille>(); DB_PostgreSQL dataBase = new DB_PostgreSQL(); Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Famille\""); while (reader.Read()) { TB_Famille f = new TB_Famille(); f.Code = (string)reader["Code"]; f.Libelle = (string)reader["Libelle"]; f.Description = reader["Description"] != DBNull.Value?(string)reader["Description"]:"------------"; list.Add(f); } return(list); }
private void Supprimer_Click(object sender, EventArgs e) { if (MessageBox.Show("Vous ete sure de vouloire Supprimer cette Famille ?", "Attention", MessageBoxButtons.YesNo) == DialogResult.Yes) { int index = c1TrueDBGrid1.Row; string Code = c1TrueDBGrid1.Columns["Code"].CellText(index); if (Code == null) { MessageBox.Show("Code Vide"); return; } TB_Famille Ar = new TB_Famille(); Ar.FindByKey(Code); Ar.DeleteData(); ((DataTable)c1TrueDBGrid1.DataSource).Rows.Find(Code).Delete(); } }
private void SetChamp(TB_Famille currentFamille) { c1TextBox1.Value = currentFamille.Code; c1TextBox2.Value = currentFamille.Libelle; c1TextBox3.Value = currentFamille.Description; }
public frmFactureAjouterArticle() { InitializeComponent(); listArticle = TB_Articles.GetList(); listFamille = TB_Famille.GetList(); }