public InvoiceController(IInvoiceRepository _repository,
                          ICutomerRepository _cutomerRepository,
                          ICompanyRepository _companyRepository,
                          UserManager <ApplicationUser> _userManager,
                          IProductRepository _productRepository)
 {
     repository         = _repository;
     productRepository  = _productRepository;
     customerRepository = _cutomerRepository;
     companyRepository  = _companyRepository;
     userManager        = _userManager;
     services           = new GeneralServices(this, userManager, companyRepository);
 }
        async private void SignUpBtn_ClickedAsync(object sender, EventArgs e)
        {
            // Verifico que todos los campos tengan contenido
            if (string.IsNullOrEmpty(_EntryUserFirstName.Text) ||
                string.IsNullOrEmpty(_EntryUserLastName.Text) ||
                string.IsNullOrEmpty(_EntryEmail.Text) ||
                string.IsNullOrEmpty(_EntryPassword.Text) ||
                string.IsNullOrEmpty(_EntryGroupCode.Text))
            {
                _LabelAllFields.IsVisible = true;
                return;
            }
            else
            {
                _LabelAllFields.IsVisible = false;
            }

            // Llamo el servicio encargado de crear la cuenta
            UserServices userServices = new UserServices();
            UserToken    userToken    = new UserToken();


            // Implemento un Loading para el Login
            using (UserDialogs.Instance.Loading("Validando...", null, null, true, MaskType.Black))
            {
                // Consigo el ID de Instalacion
                System.Guid?installId = await AppCenter.GetInstallIdAsync();

                userToken = await userServices.UserSignUp(_EntryUserFirstName.Text,
                                                          _EntryUserLastName.Text,
                                                          _EntryEmail.Text,
                                                          _EntryPassword.Text,
                                                          _EntryGroupCode.Text,
                                                          installId.ToString());
            }

            // Reviso si encontre mensajes de error
            if (!userToken.IsSuccessStatusCode)
            {
                // Usuario y/o contraseña no corresponde
                await DisplayAlert("Oppssss", userToken.message, "OK");

                return;
            }

            // Guardo el token en el dispositivo
            GeneralServices.SaveCredentialsMethod(userToken.token, false);

            // Ingreso al usuario en la plataforma e ingreso el menu principal
            Application.Current.MainPage = new MasterMenu();
        }
示例#3
0
        /// <summary>
        /// Login
        /// </summary>
        /// <param name="objAuthInfo"></param>
        public ResLogin Login(AuthenticationInfo objAuthInfo)
        {
            GeneralServices objService = new GeneralServices();

            return(objService.Login(objAuthInfo));
        }
 public UserProjectRolesController(GeneralServices generalServices)
 {
     _generalServices = generalServices;
 }
示例#5
0
        async private void LoginHandler_Clicked(object sender, EventArgs e)
        {
            // Verifico que se ingrese la informacion de Correo
            if (string.IsNullOrEmpty(_EntryEmail.Text))
            {
                _LabelEmail.IsVisible = true;
                return;
            }
            else
            {
                _LabelEmail.IsVisible = false;
            }

            // Verifico que se ingrese la informacion de contraseña
            if (string.IsNullOrEmpty(_EntryPassword.Text))
            {
                _LabelPassword.IsVisible = true;
                return;
            }
            else
            {
                _LabelPassword.IsVisible = false;
            }


            // Creo el objeto para guardar el token del usuario
            UserToken userToken;

            // Implemento un Loading para el Login
            using (UserDialogs.Instance.Loading("Validando...", null, null, true, MaskType.Black))
            {
                // Consigo el ID de Instalacion
                System.Guid?installId = await AppCenter.GetInstallIdAsync();

                // Valido las credenciales ingresadas por el usuario
                userToken = await _userServices.UserSignIn(_EntryEmail.Text, _EntryPassword.Text, installId.ToString());
            };

            // Reviso si encontre mensajes de error
            if (!userToken.IsSuccessStatusCode)
            {
                // Usuario y/o contraseña no corresponde
                await DisplayAlert("Oppssss", userToken.message, "OK");

                return;
            }

            // Reviso si tengo un token que pueda usar
            if (userToken.token == null)
            {
                // Usuario y/o contraseña no corresponde
                await DisplayAlert("Oppssss", "Tenemos un problema con el Token. Contacta al Admin", "OK");

                return;
            }

            // Guardo el token en el dispositivo
            GeneralServices.SaveCredentialsMethod(userToken.token, SaveCredencials.IsToggled);

            // Llamo la pagina principal de Tabs
            Application.Current.MainPage = new MasterMenu();
        }
示例#6
0
 public UserController(GeneralServices generalServices, UserServices userService)
 {
     _generalServices = generalServices;
     _userService     = userService;
 }