Exemplo n.º 1
0
        public static bool TokenValido(string Token)
        {
            if (Token == null || Token.Trim().Length == 0)
            {
                return(false);
            }

            BusinessEntity.IMPEG.dbo.UsuarioToken oUsuarioToken = new BusinessEntity.IMPEG.dbo.UsuarioToken();
            oUsuarioToken.Token = Token;

            BusinessEntity.DataHandler oDH = BusinessLogic.Util.Consultar(BusinessEntity.QueryOptions.Consultar_TokenValido, oUsuarioToken);

            if (oDH.Error || !oDH.ContieneInformacion)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 2
0
        public BusinessEntity.DataHandler Insertar(BusinessEntity.QueryOptions Opcion, BusinessEntity.IMPEG.dbo.UsuarioToken oBE)
        {
            BusinessEntity.DataHandler oDataHandler = new BusinessEntity.DataHandler();

            try
            {
                DataSet Resultado = new DataSet();
                oComando.CommandText = "dbo.spUsuarioToken_Insertar";
                oComando.CommandType = System.Data.CommandType.StoredProcedure;

                oComando.Parameters.Clear();
                oParametro       = new System.Data.SqlClient.SqlParameter("@Opcion", System.Data.SqlDbType.SmallInt);
                oParametro.Value = (short)Opcion;
                oComando.Parameters.Add(oParametro);

                oParametro       = new System.Data.SqlClient.SqlParameter("@UsuarioId", System.Data.SqlDbType.Int);
                oParametro.Value = oBE.UsuarioId;
                oComando.Parameters.Add(oParametro);

                oParametro       = new System.Data.SqlClient.SqlParameter("@Token", System.Data.SqlDbType.NVarChar);
                oParametro.Value = oBE.Token;
                oComando.Parameters.Add(oParametro);

                oParametro       = new System.Data.SqlClient.SqlParameter("@UsuarioCreacionId", System.Data.SqlDbType.Int);
                oParametro.Value = oBE.UsuarioCreacionId;
                oComando.Parameters.Add(oParametro);

                oParametro       = new System.Data.SqlClient.SqlParameter("@UsuarioModificacionId", System.Data.SqlDbType.Int);
                oParametro.Value = oBE.UsuarioModificacionId;
                oComando.Parameters.Add(oParametro);

                if (this.Conectar())
                {
                    SqlDataAdapter daResultado = new SqlDataAdapter(oComando);
                    daResultado.Fill(oDataHandler.Resultado);
                    Desconectar();
                }
            }
            catch (Exception ex)
            {
                oDataHandler.Error        = true;
                oDataHandler.MensajeError = ex.Message;
            }

            return(oDataHandler);
        }