Exemplo n.º 1
0
        public void LoginRSA(string nip)
        {
            ReqLoginRSA reqLRSA = new ReqLoginRSA();
            reqLRSA.nip = nip;
            reqLRSA.collectData = new CollectData() { HardwareID = Global.GetDeviceUniqueId(), SDK_VERSION = string.Empty, TIMESTAMP = string.Empty };
            Services.LoginRSA(
                  base.ServiceRequest,
                  (_) =>
                  {
                      if (!_.ErrorInMakingRequest)
                      {
                          switch (_.Error.clave)
                          {
                              case PE.Generic.OK:
                                  int cuentas = !string.IsNullOrEmpty(_.Dto.numProductos.cuentasPesos) ? Convert.ToInt32(_.Dto.numProductos.cuentasPesos) : 0;
                                  int tarjetas = !string.IsNullOrEmpty(_.Dto.numProductos.tarjetasCredito) ? Convert.ToInt32(_.Dto.numProductos.tarjetasCredito) : 0;
                                  (Application.Current as App).dtoLogin = _.Dto;
                                  (Application.Current as App).matrix = Validaciones.cargarCSVResToken();
                                  (Application.Current as App).SesionIniciada = true;
                                  (Application.Current as App).Cuentas = cuentas > 0;
                                  (Application.Current as App).Tarjetas = tarjetas > 0;
                                  (Application.Current as App).TotalCuentas = cuentas;


                                  switch (_.Dto.estatusToken)
                                  {
                                      case "A": (App.Current as App).EstatusToken = EstatusToken.A; break;
                                      case "E": (App.Current as App).EstatusToken = EstatusToken.E; break;
                                      case "B": (App.Current as App).EstatusToken = EstatusToken.B; break;
                                      case "N": (App.Current as App).EstatusToken = EstatusToken.N; break;
                                      case "T": (App.Current as App).EstatusToken = EstatusToken.T; break;
                                  }

                                  switch (_.Dto.estatusST)
                                  {
                                      case "A": (App.Current as App).EstatusSoftToken = EstatusToken.A; break;
                                      case "E": (App.Current as App).EstatusSoftToken = EstatusToken.E; break;
                                      case "B": (App.Current as App).EstatusSoftToken = EstatusToken.B; break;
                                      case "N": (App.Current as App).EstatusSoftToken = EstatusToken.N; break;
                                      case "T": (App.Current as App).EstatusSoftToken = EstatusToken.T; break;
                                  }

                                  if (!this._isEnrolled && !this._rsaOff)
                                  {
                                      IniciaEnrolamientoS2U();
                                  }
                                  else
                                  {
                                      if (null != ProcessSuccess)
                                      {
                                          base._dispatcher.BeginInvoke(() =>
                                          {
                                              ProcessSuccess(PS.Service.LOGIN_RSA);
                                          });
                                      }
                                  }
                                  _logoutAvailable = true;
                                  break;
                              default:
                                  if (null != ProcesoError)
                                  {
                                      base._dispatcher.BeginInvoke(() =>
                                      {
                                          ProcesoError(new Global.ViewModelEventArgs() { ErrorInMakingRequest = false, Error = _.Error });
                                      });
                                  }
                                  break;
                          }
                      }
                      else
                      {
                          if (null != ProcesoError)
                          {
                              base._dispatcher.BeginInvoke(() =>
                              {
                                  ProcesoError(new Global.ViewModelEventArgs() { ErrorInMakingRequest = _.ErrorInMakingRequest });
                              });
                          }
                      }
                  },
                  reqLRSA);
        }
Exemplo n.º 2
0
        public static void LoginRSA(ServiceRequest2 serviceRequest, ServiceRequestEventHandler<DtoLoginRSA> asyncCallback, ReqLoginRSA requestData)
        {
#if OFFLINE
            serviceRequest.BeginWebRequestOffline<ResLoginRSA, DtoLoginRSA>(Services._serviceLoginRSA, asyncCallback, json._jsonLoginRSA);
#else
            new Thread(() => { serviceRequest.BeginWebRequest<ResLoginRSA, DtoLoginRSA, ReqLoginRSA>(service._serviceLoginRSA, asyncCallback, requestData); }).Start();
#endif
        }