public void CapNhatLoaiDG(DataGridView dataGrid, string txtMaLoaiDG, string txtLoaiDG) { try { LOAIDG loaiDG = db.LOAIDGs.Single(value => value.MaLoaiDG.Equals(txtMaLoaiDG)); loaiDG.LoaiDG = txtLoaiDG; db.SubmitChanges(); var dsLoaiDG = db.LOAIDGs.Select(value => value); dataGrid.DataSource = dsLoaiDG.ToList(); } catch (Exception err) { Utils.MSG(err.Message); return; } }
public void ThemLoaiDG(DataGridView dataGrid, string txtMaLoaiDG, string txtLoaiDG) { try { LOAIDG loaiDG = new LOAIDG(); loaiDG.MaLoaiDG = txtMaLoaiDG; loaiDG.LoaiDG = txtLoaiDG; db.LOAIDGs.InsertOnSubmit(loaiDG); db.SubmitChanges(); var dsLoaiDG = db.LOAIDGs.Select(value => value); dataGrid.DataSource = dsLoaiDG.ToList(); } catch (Exception err) { Utils.MSG(err.Message); return; } }