private void delete_button_Click(object sender, EventArgs e) { try { int a = int.Parse(dtg_hoadon.CurrentRow.Cells[0].Value.ToString()); DAOHoaDon hd = new DAOHoaDon(); hd.xoahoadon(a); DataTable tb = new DataTable(); tb = hd.getHoaDon(); dtg_hoadon.DataSource = tb; } catch (Exception lo) { MessageBox.Show(lo.Message); } }
private void frmdanhsachdonhang_Load(object sender, EventArgs e) { if (Globals.role == "employee") { delete_button.Visible = false; } try { DAOHoaDon hd = new DAOHoaDon(); DataTable tb = new DataTable(); tb = hd.getHoaDon(); dtg_hoadon.DataSource = tb; } catch { } }