private void btnDisable_Click(object sender, EventArgs e) { if (flag == 0) { MessageBox.Show("Please choose!"); return; } Object dummyObject = new object(); switch (flag) { case 1: { // Department _departmentRepository.Disable(selectedId, dummyObject); } break; case 2: { // Role _rolesRepository.Disable(selectedId, dummyObject); } break; case 3: { // User _usersRepository.Disable(selectedId, dummyObject); } break; case 4: { // Shift _shiftsRepository.Disable(selectedId, dummyObject); } break; case 5: { // Attendance _attendancesRepository.Disable(selectedId, dummyObject); } break; case 6: { // Payslip _payslipsRepository.Disable(selectedId, dummyObject); } break; default: break; } MessageBox.Show("Disable successfully!"); LoadData(); }