public static DTOLoginRespuesta Login(ref HttpStatusCode estado, ref string mensaje, DTOUsuario usuario)
        {
            DTOLoginRespuesta loginRespuesta = new DTOLoginRespuesta();

            try
            {
                if (string.IsNullOrEmpty(usuario.Alias) || string.IsNullOrEmpty(usuario.Contrasena))
                {
                    estado  = HttpStatusCode.BadRequest;
                    mensaje = "Alias o contrasena no ingresados";
                    return(null);
                }
                var parametros = new Dictionary <string, object>();
                parametros.Add("Alias", usuario.Alias);
                parametros.Add("Contrasena", Miscelanios.Ecriptacion.Encriptar(usuario.Contrasena, true));
                loginRespuesta = Base.baseFactory.Obtener().ObtenerLista <DTOLoginRespuesta>("PA_Login", parametros)[0];
                if (string.IsNullOrEmpty(loginRespuesta.TOKEN))
                {
                    estado  = HttpStatusCode.Unauthorized;
                    mensaje = "Alias o Contraseña incorrectos";
                }
                else
                {
                    estado  = HttpStatusCode.Created;
                    mensaje = "OK";
                }
            }
            catch (SqlException sqlex)
            {
                MetodosComunes.SQLCatch(sqlex.Number);
                //throw;
            }
            catch (Exception e)
            {
                //estado = HttpStatusCode.InternalServerError;
                throw;
            }
            return(loginRespuesta);
        }
        public HttpResponseMessage Login(DTOPeticion <DTOUsuario> peticion)
        {
            string         mensaje = string.Empty;
            HttpStatusCode estado  = default(HttpStatusCode);

            try
            {
                DTOLoginRespuesta token = UsuarioLogica.Login(ref estado, ref mensaje, peticion.Entidad);

                return(HTTPResponseHelp.CrearResponse <DTORespuesta
                                                       <DTOLoginRespuesta> >(this, new DTORespuesta <DTOLoginRespuesta>()
                {
                    Mensaje = mensaje, Entidad = token
                }, estado));
            }
            catch
            {
                return(HTTPResponseHelp.CrearResponse <DTORespuesta <String> >(this, new DTORespuesta <string>()
                {
                    Mensaje = "Error"
                }, HttpStatusCode.InternalServerError));
            }
        }