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