private void simpleButton3_Click(object sender, EventArgs e) { int vitri = gridView1.GetFocusedDataSourceRowIndex(); string MaHang = gridView1.GetRowCellValue(vitri, "MaHang").ToString(); HangHoaBUS.Xoa(MaHang); gridControl1.DataSource = HangHoaBUS.DanhSach(); }
private void XoaHangHoa() { DialogResult hopThoai = MessageBox.Show("Bạn chắc chắn muốn xóa những dòng bạn chọn?", "Xóa", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (hopThoai == DialogResult.Yes) { HangHoaBUS itemBUS = new HangHoaBUS(); for (int i = 0; i < gvDanhMucHangHoa.SelectedRowsCount; i++) { int ma = int.Parse(gvDanhMucHangHoa.GetRowCellValue(gvDanhMucHangHoa.GetSelectedRows()[i], gvDanhMucHangHoa.Columns["Id"]).ToString()); itemBUS.Xoa(ma); } } this.LayDanhSachHangHoa(); }