private void LoginCambioTurnoAuthorize(TSLogin respuesta)
 {
     TSLoginApp.LoginAuthorize -= LoginCambioTurnoAuthorize;
     Device.BeginInvokeOnMainThread(async() =>
     {
         if (respuesta.EstadoRespuesta == LoginEstado.InformacionObtenida)
         {
             if (respuesta.vRespuestaTurno.Ok == false)
             {
                 busyindicator.IsVisible  = false;
                 circleBtnLogin.IsEnabled = true;
                 await DisplayAlert("Aviso", respuesta.vRespuestaTurno.Mensaje, "Aceptar");
                 return;
             }
             else
             {
                 stackConfirma.IsVisible = true;
                 stacklogin.IsVisible    = false;
                 this.cdusuario          = this.txtUsername.Text;
             }
         }
         if (respuesta.EstadoRespuesta == LoginEstado.ErrorSistema)
         {
             await DisplayAlert("Aviso", "Hubo un problema en la comunicación con el servidor, por favor intente después.", "Aceptar");
             return;
         }
     });
 }
 private void LoginAuthorizeCambioTurno(TSLogin respuesta)
 {
     TSLoginApp.LoginCambioTurno -= LoginAuthorizeCambioTurno;
     Device.BeginInvokeOnMainThread(async() =>
     {
         if (respuesta.EstadoRespuesta == LoginEstado.InformacionObtenida)
         {
             if (respuesta.vRespuestaTurno.Ok == false)
             {
                 this.busyindicator.IsVisible = false;
                 await DisplayAlert("Aviso", respuesta.vRespuestaTurno.Mensaje, "Aceptar");
                 this.circleBtnLogin.IsEnabled = true;
                 return;
             }
             else
             {
                 TSSalesApp.vTerminal.turno   = TSSalesApp.vTerminal.turno + 1;
                 this.stackConfirma.IsVisible = true;
                 this.stacklogin.IsVisible    = false;
             }
         }
         if (respuesta.EstadoRespuesta == LoginEstado.ErrorSistema)
         {
             this.busyindicator.IsVisible = false;
             this.stacklogin.IsVisible    = true;
             await DisplayAlert("Aviso", "Hubo un problema en la comunicación con el servidor, por favor intente después.", "Aceptar");
             return;
         }
     });
 }
Ejemplo n.º 3
0
 private void LoginAuthorize(TSLogin respuesta)
 {
     TSLoginApp.LoginAuthorize -= LoginAuthorize;
     Device.BeginInvokeOnMainThread(() =>
     {
         if (respuesta.EstadoRespuesta == LoginEstado.Autorizacion)
         {
             foreach (var item in respuesta.vLoginOutput.Empresas)
             {
                 if (((item.cdempresa ?? "").Trim()).Equals((TSLoginApp.CurrentEmpresa.cdempresa ?? "").Trim()))
                 {
                     if ((item.cdnivel ?? "").Trim().Equals("01") || (item.cdnivel ?? "").Trim().Equals("02"))
                     {
                         LoginResponse(LoginEstado.Autorizacion, true);
                         return;
                     }
                     else
                     {
                         LoadingUser((TSLoginApp.CurrentEmpresa.cdempresa ?? "").Trim(), (TSLoginApp.CurrentEmpresa.cdnivel ?? "").Trim(), (this.txtUser.Text ?? "").Trim());
                         return;
                     }
                 }
             }
             LoginResponse(LoginEstado.SinAutorizacion, false);
             return;
         }
         else
         {
             LoginResponse(LoginEstado.SinAutorizacion, false);
             return;
         }
     });
 }
Ejemplo n.º 4
0
 private void LoginAuthorize(TSLogin respuesta)
 {
     TSLoginApp.DepositoAuthorize -= LoginAuthorize;
     Device.BeginInvokeOnMainThread(async() =>
     {
         if (respuesta.EstadoRespuesta == LoginEstado.SinAutorizacion)
         {
             busyindicator.IsVisible = false;
             await DisplayAlert("Aviso", respuesta.vMensaje.mensaje, "Aceptar");
             return;
         }
         if (respuesta.EstadoRespuesta == LoginEstado.Autorizacion)
         {
             stackConfirma.IsVisible = true;
             stacklogin.IsVisible    = false;
         }
         if (respuesta.EstadoRespuesta == LoginEstado.ErrorSistema)
         {
             busyindicator.IsVisible = false;
             stacklogin.IsVisible    = true;
             await DisplayAlert("Aviso", "Hubo un problema en la comunicación con el servidor, por favor intente después.", "Aceptar");
             return;
         }
     });
 }
        private void LoginAuthorize(TSLogin respuesta)
        {
            TSLoginApp.LoginAuthorize -= LoginAuthorize;
            Device.BeginInvokeOnMainThread(async() =>
            {
                if (respuesta.EstadoRespuesta == LoginEstado.SinAutorizacion)
                {
                    await DisplayAlert("Aviso", respuesta.vLoginOutput.Mensaje, "Aceptar");
                }
                if (respuesta.EstadoRespuesta == LoginEstado.Autorizacion)
                {
                    if (respuesta.vLoginOutput.Empresas.Length > 0)
                    {
                        int Validado = 0;
                        int Permiso  = 0;
                        foreach (TS_BEEmpresaUser Empresa in respuesta.vLoginOutput.Empresas)
                        {
                            /*Coincide el codigo de la empresa actual con el obtenido del servicio*/
                            if ((TSLoginApp.CurrentEmpresa.cdempresa ?? "").Equals(Empresa.cdempresa ?? ""))
                            {
                                Validado++;
                                Permiso = respuesta.vLoginOutput.Usuario == null ? 0 : respuesta.vLoginOutput.Usuario.flganular ? 1 : 0;
                            }
                        }

                        if (Validado > 0)
                        {
                            if (Permiso > 0)
                            {
                                App.Current.MainPage = new NavigationPage(new AfiliacionClientes());
                                return;
                            }
                            else
                            {
                                await DisplayAlert("Aviso", "Usted no posee los permisos necesarios para acceder al modulo", "Aceptar");
                            }
                        }
                        else
                        {
                            await DisplayAlert("Aviso", "Usted no se encuentra relacionado a la empresa a la cual intenta acceder", "Aceptar");
                        }
                    }
                    else
                    {
                        await DisplayAlert("Aviso", "Usted no posee ninguna empresa relacionada", "Aceptar");
                    }
                }
                if (respuesta.EstadoRespuesta == LoginEstado.ErrorSistema)
                {
                    await DisplayAlert("Aviso", "Hubo un problema en la comunicación con el servidor, por favor intente después.", "Aceptar");
                }
                this.busyindicator.IsVisible  = false;
                this.circleBtnLogin.IsVisible = true;
            });
        }