private void btn_sua_Click(object sender, EventArgs e) { Form fr_lh = null; if (comb_danhmuc.SelectedIndex == 0) { int pos = dtgv.CurrentRow.Index; int ID = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value); LoaiHoang lh = LoaiHang_BUL.TimLoaiHang(ID); fr_lh = new fr_QuanLy_LoaiHang(lh); } else if (comb_danhmuc.SelectedIndex == 1) { int pos = dtgv.CurrentRow.Index; int ID = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value); HangHoa hh = HangHoa_BUL.TimLoaiHang(ID); fr_lh = new fr_QuanLy_HangHoa(hh); } else if (comb_danhmuc.SelectedIndex == 2) { int pos = dtgv.CurrentRow.Index; int ID = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value); KhachHang hh = KhachHang_BUL.TimKhachHang(ID); fr_lh = new fr_QuanLy_KhachHang(hh); } else if (comb_danhmuc.SelectedIndex == 3) { int pos = dtgv.CurrentRow.Index; int ID = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value); NhaCungCap hh = NhaCungCap_BUL.TimNCC(ID); fr_lh = new fr_QuanLy_NhaCungCap(hh); } else if (comb_danhmuc.SelectedIndex == 4) { int pos = dtgv.CurrentRow.Index; int ID = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value); NhanVien hh = NhanVien_BUL.TimNhanVien(ID); fr_lh = new fr_QuanLy_NhanVien(hh); } else if (comb_danhmuc.SelectedIndex == 5) { int pos = dtgv.CurrentRow.Index; int ID = Convert.ToInt32(dtgv.Rows[pos].Cells[0].Value); DoiTacQuangCao hh = DoiTacQuangCao_BUL.TimLoaiHang(ID); fr_lh = new fr_QuanLy_DoiTacQuanCao(hh); } if (fr_lh != null) { fr_lh.FormClosing += Frm2_Closing; fr_lh.ShowDialog(); resetAfterHandle(); } }
private void btn_them_Click(object sender, EventArgs e) { Form fr_lh = null; if (comb_danhmuc.SelectedIndex == 0) { fr_lh = new fr_QuanLy_LoaiHang(); } if (comb_danhmuc.SelectedIndex == 1) { fr_lh = new fr_QuanLy_HangHoa(); } if (comb_danhmuc.SelectedIndex == 2) { fr_lh = new fr_QuanLy_KhachHang(); } if (comb_danhmuc.SelectedIndex == 3) { fr_lh = new fr_QuanLy_NhaCungCap(); } if (comb_danhmuc.SelectedIndex == 4) { fr_lh = new fr_QuanLy_NhanVien(); } if (comb_danhmuc.SelectedIndex == 5) { fr_lh = new fr_QuanLy_DoiTacQuanCao(); } if (fr_lh != null) { fr_lh.FormClosing += Frm2_Closing; fr_lh.ShowDialog(); resetAfterHandle(); } }