private async void executeUtilityAction(string obj) { List <Agent> updatedAgentList = new List <Agent>(); switch (obj) { case "activate": // change the agent status to active if (await Singleton.getDialogueBox().showAsync("Do you confirm " + SelectedAgentModel.TxtLogin + " profile activation?")) { Singleton.getDialogueBox().showSearch("Activating Status..."); SelectedAgentModel.TxtStatus = EStatus.Active.ToString(); updatedAgentList = await Bl.BlAgent.UpdateAgentAsync(new List <Agent> { SelectedAgentModel.Agent }); if (updatedAgentList.Count > 0) { await Singleton.getDialogueBox().showAsync("The Agent " + updatedAgentList[0].LastName + "has been successfully activated!"); } } break; case "deactivate": // change the agent status to deactivated if (await Singleton.getDialogueBox().showAsync("Do you confirm " + SelectedAgentModel.TxtLogin + " profile deactivation?")) { Singleton.getDialogueBox().showSearch("Deactivating Status..."); SelectedAgentModel.TxtStatus = EStatus.Deactivated.ToString(); updatedAgentList = await Bl.BlAgent.UpdateAgentAsync(new List <Agent> { SelectedAgentModel.Agent }); if (updatedAgentList.Count > 0) { await Singleton.getDialogueBox().showAsync("The Agent " + updatedAgentList[0].LastName + " has been successfully deactivated!"); } } break; case "use": // connect a new user if (await Singleton.getDialogueBox().showAsync("Do you confirm reconnecting as user " + SelectedAgentModel.TxtLogin + "?")) { Singleton.getDialogueBox().showSearch("Please wait while we are dealing with your request..."); var newAgent = await loadNewUser(SelectedAgentModel.Agent); if (newAgent.ID != 0) { await Singleton.getDialogueBox().showAsync("Your are successfully connected as " + newAgent.FirstName + " " + newAgent.LastName); } } break; case "agent": // connect a new user _page(_main.AgentViewModel); break; } Singleton.getDialogueBox().IsDialogOpen = false; UtilitiesCommand.raiseCanExecuteActionChanged(); }
//----------------------------[ Actions ]------------------ private void updateCommand() { UtilitiesCommand.raiseCanExecuteActionChanged(); SetupCommand.raiseCanExecuteActionChanged(); }