Example #1
0
        private async void LoginCommandExecuted()
        {
            try
            {
                if (!string.IsNullOrEmpty(Rut))
                {
                    if (!string.IsNullOrEmpty(Usuario))
                    {
                        if (!string.IsNullOrEmpty(Clave))
                        {
                            var verify = await VerifyConnection.IsConnected();

                            if (verify.IsSuccess)
                            {
                                DependencyService.Get <IProgressDialog>().ProgressDialogShow();
                                ServiceClient client   = new ServiceClient();
                                string        query    = string.Format("ValidarAccesoGet?strRutEmpresa={0}&strUsuario={1}&strPass={2}", Rut, Usuario, Clave);
                                var           response = await client.GetListAllWithParam <UserModel>(query);

                                DependencyService.Get <IProgressDialog>().ProgressDialogHide();
                                if (response.Error != null)
                                {
                                    App.MessageError(response.Error.Mensaje);
                                }
                                else
                                {
                                    response.Password = Clave;
                                    InsertUsuario(response);
                                    sync.AsyncData();
                                    App.Current.MainPage = new MasterPage();
                                }
                            }
                            else
                            {
                                App.MessageError(verify.Message);
                            }
                        }
                        else
                        {
                            App.MessageError("Ingrese su Clave");
                        }
                    }
                    else
                    {
                        App.MessageError("Ingrese su usuario");
                    }
                }
                else
                {
                    App.MessageError("Ingrese el Rut");
                }
            }
            catch (Exception e)
            {
                DependencyService.Get <IProgressDialog>().ProgressDialogHide();
                Console.WriteLine(e);
                throw;
            }
        }
Example #2
0
 void ClickSincronizacion(object sender, System.EventArgs e)
 {
     try
     {
         App.MasterPageDetail.IsPresented = false;
         Synchronization sync = new Synchronization();
         sync.AsyncData();
     }
     catch (Exception ex)
     {
     }
 }