Esempio n. 1
0
        public override void Execute(object parameter)
        {
            var vm         = parameter as LoginViewModel;
            var loginModel = vm.Model as LoginModel;

            if (string.IsNullOrWhiteSpace(loginModel?.Login) || string.IsNullOrWhiteSpace(loginModel?.Senha))
            {
                return;
            }

            var model = new ValidarAmbienteInModel
            {
                Login = loginModel.Login,
                Senha = loginModel.Senha,
            };
            var connector = new AbstractAmbienteConnector();
            var token     = connector.Executar(model).Token;

            vm.SetarLogin(token);
            AbstractApiConsumer.SetTokenInterno(token);
        }
Esempio n. 2
0
        public static void ValidarAcesso()
        {
            if (string.IsNullOrWhiteSpace(AbstractApiConsumer.TokenInterno) && !string.IsNullOrWhiteSpace(_token))
            {
                AbstractApiConsumer.SetTokenInterno(_token);
            }

            if (!string.IsNullOrWhiteSpace(AbstractApiConsumer.TokenInterno))
            {
                return;
            }

            var acesso = new ValidarAmbienteInModel
            {
                Ambiente = "desen",
                Login    = "******",
                Senha    = "admin"
            };
            var connector = new AbstractAmbienteConnector();
            var token     = connector.Executar(acesso).Token;

            AbstractApiConsumer.SetTokenInterno(token);
        }