Exemple #1
0
        public void ValidaToken(string token, string claveOperacion, bool tokenFinal = false, String tipoOtp = "", String timestamp = "")
        {
            this.Token = token;
            this.FechaHora = timestamp;
            this.TipoOTP = tipoOtp;
            bool error = true;
            if (!string.IsNullOrEmpty(token))
            {
                if (Validaciones.ValidaToken(token))
                {
                    error = false;
                    if (this.IsTokenInicial)
                    {
                        ReqValidarToken req = new ReqValidarToken();
                        req.token = token;
                        req.operacion = claveOperacion;
                        req.tipoOTP = tipoOtp;
                        req.fechaHora = timestamp;

                        Services.ValidaToken(ServiceRequest, ResponseValidaToken, req);
                    }
                    else
                    {
                        if (ValidaTokenComplete != null)
                        {
                            this._dispatcher.BeginInvoke(() =>
                            {
                                ValidaTokenComplete();
                            });
                        }
                    }
                }
            }

            if (error)
            {
                if (ValidaTokenError != null)
                {
                    this._dispatcher.BeginInvoke(() =>
                    {
                        ValidaTokenError(new Global.ViewModelEventArgs() { ErrorInMakingRequest = false, Error = new Error() { message = TextosFront.frontMensajeTokenNoValido } });
                    });
                }
            }
        }
            public void EliminarCuenta(string token)
            {
                  this.Token = token;
                  bool error = true;
                  if (this.IsTokenInicial || this.IsTokenFinal) {
                        if (Validaciones.ValidaToken(token)) {
                              error = false;
                              ReqValidarToken req = new ReqValidarToken();
                              req.token = token;
                              req.operacion = ClavesOperacion.BajaCuenta;
                              Services.ValidaToken(base.ServiceRequest, ResponseValidaToken, req);
                        }
                  }
                  else {
                        error = false;
                        EliminarCuentaExistente();
                  }

                  if (error) {
                        if (ProcesoError != null) {
                              this._dispatcher.BeginInvoke(() => {
                                    ProcesoError(new Global.ViewModelEventArgs() { ErrorInMakingRequest = false, Error = new Error() { message = TextosFront.frontMensajeTokenNoValido } });
                              });
                        }
                  }
            }
Exemple #3
0
        public static void ValidaToken(ServiceRequest2 serviceRequest, ServiceRequestEventHandler<DtoValidaToken> asyncCallback, ReqValidarToken requestData)
        {
#if OFFLINE
            serviceRequest.BeginWebRequestOffline<ResValidaToken, DtoValidaToken>(service._serviceValidarToken, asyncCallback, json._jsonValidaTokenTemporal);
#else
            new Thread(() => { serviceRequest.BeginWebRequest<ResValidaToken, DtoValidaToken, ReqValidarToken>(service._serviceValidarToken, asyncCallback, requestData); }).Start();
#endif
        }