Beispiel #1
0
 /// <summary>
 /// Permite buscar o ejecutar un comando a partir de la barra de busqueda
 /// El comando se ejecuta si esta habilitado
 /// Si el texto es un comando, se solicita confirmacion del usuario
 /// </summary>
 private void BuscarTexto()
 {
     if (!string.IsNullOrWhiteSpace(_buscar))
     {
         //  tokenizar la cadena de busqueda
         //  en base a los contenidos, decidir que accion se tiene que realizar
         if (_buscar.ToLower() == "login")
         {
             ConfirmarComando.Raise(new Confirmation()
             {
                 Title   = "VALIDAR COMANDO",
                 Content = "Se esta por intentar ejecutar el comando login desde la barra de busqueda. Es esto correcto?"
             }, conf =>
             {
                 if (conf.Confirmed && Login.CanExecute(null))
                 {
                     Login.Execute(null);
                 }
             });
         }
         else
         {
             if (_buscar.ToLower() == "logout" && Logout.CanExecute(null))
             {
                 Logout.Execute(null);
             }
         }
     }
 }
Beispiel #2
0
        public static void Main(string[] args)
        {
            RQL.Login          login   = new RQL.Login();
            Login.LoginRequest request = new Login.LoginRequest();
            request.Data = new Login.LoginRequest.iodata();
            request.Data.Administration          = new Login.LoginRequest.administration();
            request.Data.Administration.Action   = "login";
            request.Data.Administration.Name     = "admin";
            request.Data.Administration.Password = "******";
            Login.LoginResponse response = login.Execute(request);
            string loginGuid             = response.Data.Login.Guid;

            RQL.ProjectLogin prjLogin           = new RQL.ProjectLogin();
            ProjectLogin.ProjectLoginRequest r2 = new ProjectLogin.ProjectLoginRequest();
            r2.Data                             = new ProjectLogin.ProjectLoginRequest.iodata();
            r2.Data.Loginguid                   = loginGuid;
            r2.Data.Administration              = new ProjectLogin.ProjectLoginRequest.administration();
            r2.Data.Administration.Action       = "validate";
            r2.Data.Administration.Guid         = loginGuid;
            r2.Data.Administration.Project      = new ProjectLogin.ProjectLoginRequest.project();
            r2.Data.Administration.Project.Guid = "DA0A74E7ED3B46BDA16B006E2678C744";
            ProjectLogin.ProjectLoginResponse resp2 = prjLogin.Execute(r2);
            string sessionKey = resp2.Data.Server.Key;

            RQL.ProjectSettingsLoad psl = new ProjectSettingsLoad();
            ProjectSettingsLoad.ProjectSettingsLoadRequest r3 = new ProjectSettingsLoad.ProjectSettingsLoadRequest();
            r3.Data                         = new ProjectSettingsLoad.ProjectSettingsLoadRequest.iodata();
            r3.Data.Loginguid               = loginGuid;
            r3.Data.Sessionkey              = sessionKey;
            r3.Data.Project                 = new ProjectSettingsLoad.ProjectSettingsLoadRequest.project();
            r3.Data.Project.Settings        = new ProjectSettingsLoad.ProjectSettingsLoadRequest.settings();
            r3.Data.Project.Settings.Action = "load";
            ProjectSettingsLoad.ProjectSettingsLoadResponse resp3 = psl.Execute(r3);

            RQL.Logout           logout = new Logout();
            Logout.LogoutRequest r4     = new Logout.LogoutRequest();
            r4.Data                            = new Logout.LogoutRequest.iodata();
            r4.Data.Loginguid                  = loginGuid;
            r4.Data.Administration             = new Logout.LogoutRequest.administration();
            r4.Data.Administration.Logout      = new Logout.LogoutRequest.logout();
            r4.Data.Administration.Logout.Guid = loginGuid;
            Logout.LogoutResponse resp4 = logout.Execute(r4);

            Console.ReadLine();
        }
        public string DispatchCommand(string[] commandParameters)
        {
            string commandName = commandParameters[0];

            commandParameters = commandParameters.Skip(1).ToArray();
            string          result          = string.Empty;
            SavingService   savingService   = new SavingService();
            CheckingService checkingService = new CheckingService();
            UserService     userService     = new UserService();


            switch (commandName)
            {
            case "Exit":
                ExitCommand exit = new ExitCommand();
                result = exit.Execute();
                break;

            case "Deposit":
                DepositCommand deposit = new DepositCommand(savingService);
                result = deposit.Execute(commandParameters);
                break;

            case "Withdraw":
                WithdrawCommand withdeow = new WithdrawCommand(savingService);
                result = withdeow.Execute(commandParameters);
                break;

            case "AddInterest":
                AddInterestCommand addInterest = new AddInterestCommand(savingService);
                result = addInterest.Execute(commandParameters);
                break;

            case "DeductFee":
                DeductCommand deduct = new DeductCommand(checkingService);
                result = deduct.Execute(commandParameters);
                break;

            case "Register":
                RegisterCommand register = new RegisterCommand(userService);
                result = register.Execute(commandParameters);
                break;

            case "Login":
                LoginCommand login = new LoginCommand();
                result = login.Execute(commandParameters);
                break;

            case "Logout":
                Logout logout = new Logout();
                result = logout.Execute();
                break;

            case "AddSavingAccount":
                AddSavingAccountCommand addAccount = new AddSavingAccountCommand(savingService);
                result = addAccount.Execute(commandParameters);
                break;

            case "ListAccounts":
                ListAccounts listAccounts = new ListAccounts(savingService, checkingService);
                result = listAccounts.Execute();
                break;
            }
            return(result);
        }