private void dgv_contenu_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (dgv_contenu.CurrentRow.Cells["_id_"].Value != null) { Int32 id = Convert.ToInt32(dgv_contenu.CurrentRow.Cells["_id_"].Value); if (id > 0) { ContenuStock f = ContenuStockBLL.One(id); if (e.ColumnIndex == 4) { if (DialogResult.Yes == Messages.Confirmation(Mots.Supprimer.ToLower())) { if (ContenuStockBLL.Delete(f)) { DeleteRowContenu(f); ResetContenu(); Messages.Succes(); } } } else { PopulateContenu(f); } } } } catch (Exception ex) { Messages.Exception(ex); } }
private void btn_add_Click(object sender, EventArgs e) { RecopieContenu(); if (current_contenu.Control()) { if (!current_contenu.Update) { ContenuStock f = ContenuStockBLL.Save(current_contenu); if (f != null ? f.Id > 0 : false) { current_contenu.Id = f.Id; current_contenu.Update = true; AddRowContenu(f); Messages.Succes(); ResetContenu(); } } else { if (ContenuStockBLL.Update(current_contenu)) { UpdateRowContenu(current_contenu); Messages.Succes(); ResetContenu(); } } } }
private void LoadGrilleContenu(DocStock d) { dgv_contenu.Rows.Clear(); string query = "select * from contenu_stock where stock = " + d.Id + " order by id"; current.Contenus = ContenuStockBLL.List(query); foreach (ContenuStock c in current.Contenus) { AddRowContenu(c); } ResetContenu(); }
private void txt_search_art_TextChanged(object sender, EventArgs e) { string search = txt_search_art.Text.Trim(); if (search.Length > 0) { dgv_contenu.Rows.Clear(); string query = "select c.* from contenu_stock c inner join articles a on c.article = a.id where a.reference like '" + search + "%' or a.designation like '" + search + "%' and c.stock = " + current.Id; List <ContenuStock> l = ContenuStockBLL.List(query); foreach (ContenuStock f in l) { AddRowContenu(f); } ResetContenu(); } else { LoadGrilleContenu(current); } }
private void dgv_contenu_SelectionChanged(object sender, EventArgs e) { try { if (dgv_contenu.Rows.Count > 0) { if (dgv_contenu.CurrentRow.Cells["_id_"].Value != null) { Int32 id = (Int32)dgv_contenu.CurrentRow.Cells["_id_"].Value; if (id > 0) { ContenuStock f = ContenuStockBLL.One(id); PopulateContenu(f); } } } } catch (Exception ex) { Messages.Exception(ex); } }