private async void btnSwitch_Click(object sender, EventArgs e) { if (UtilDB.CurrentDeployment == cboDepartment.SelectedIndex) { XtraMessageBox.Show(Cons.ErrorSwitchDepartToCurrent, Cons.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int oldEmployeeId = int.Parse(txtEmployeeId.Text); string newDepartId = UtilDB.GetDepartIdInFilterClause(cboDepartment.SelectedValue.ToString()); SplashScreenManager.ShowForm(null, typeof(WaitFormCustom), true, true, false); if (await SwitchDepartment(oldEmployeeId, newDepartId) == false) { SplashScreenManager.CloseForm(false); XtraMessageBox.Show(Cons.ErrorSwitchDepart, Cons.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { SplashScreenManager.CloseForm(false); XtraMessageBox.Show(Cons.SuccessSwitchDepart, Cons.CaptionSuccess, MessageBoxButtons.OK, MessageBoxIcon.Information); } }