//Hiennv private void chkDisable_Click(object sender, EventArgs e) { try { int ID = Convert.ToInt32(viewRooms.GetFocusedRowCellValue("ID")); bool disableOld = Convert.ToBoolean(viewRooms.GetFocusedRowCellValue("Disable")); bool disalbeNew = false; string disable = string.Empty; if (disableOld == false) { disalbeNew = true; disable = "Khóa"; } else { disalbeNew = false; disable = "Mở"; } DialogResult result = MessageBox.Show("Bạn có chắc chắn muốn " + disable + " phòng này không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { RoomsBO aRoomsBO = new RoomsBO(); Rooms aRooms = aRoomsBO.Select_ByID(ID); if (aRooms != null) { aRooms.Disable = disalbeNew; int count = aRoomsBO.Update(aRooms); if (count > 0) { this.ReloadData(); if (this.afrmMain != null) { this.afrmMain.ReloadData(); } MessageBox.Show("Thực hiện thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } catch (Exception ex) { MessageBox.Show("frmLst_Rooms.chkDisable_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }