public string getRut(int idUsuario)
 {
     try
     {
         Biblioteca.DALC.USUARIO us = CommonBC.ModeloBiblioteca.USUARIO.First
                                          (u => u.IDUSUARIO == idUsuario);
         return(us.RUTUSUARIO);
     }
     catch (Exception)
     {
         return(String.Empty);
     }
 }
 public bool ExisteUserName(string username)
 {
     try
     {
         Biblioteca.DALC.USUARIO us = CommonBC.ModeloBiblioteca.USUARIO.First
                                          (u => u.NOMBRESUSUARIO == username);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool ExisteRut(string rut)
 {
     try
     {
         Biblioteca.DALC.USUARIO us = CommonBC.ModeloBiblioteca.USUARIO.First
                                          (u => u.RUTUSUARIO == rut);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool ExisteEmail(string email)
 {
     try
     {
         Biblioteca.DALC.USUARIO us = CommonBC.ModeloBiblioteca.USUARIO.First
                                          (u => u.EMAILUSUARIO == email);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool Existe(int Id)
 {
     try
     {
         Biblioteca.DALC.USUARIO us = CommonBC.ModeloBiblioteca.USUARIO.First
                                          (u => u.IDUSUARIO == Id);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
        public bool Delete(int Id)
        {
            try
            {
                Biblioteca.DALC.USUARIO us = CommonBC.ModeloBiblioteca.USUARIO.First
                                                 (u => u.IDUSUARIO == Id);
                CommonBC.ModeloBiblioteca.DeleteObject(us);
                CommonBC.ModeloBiblioteca.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
 public bool EsActivo(int id)
 {
     try
     {
         Biblioteca.DALC.USUARIO us = CommonBC.ModeloBiblioteca.USUARIO.First
                                          (u => u.IDUSUARIO == id);
         if (us.ACTIVOUSUARIO.Equals("y"))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
        public bool Update(int id, string rut, string nombres, string apellidos, string direccion, string telefono, bool activo, bool foto, bool huella)
        {
            try
            {
                Biblioteca.DALC.USUARIO us = CommonBC.ModeloBiblioteca.USUARIO.First
                                                 (u => u.IDUSUARIO == id);
                us.RUTUSUARIO       = rut;
                us.NOMBRESUSUARIO   = nombres;
                us.APELLIDOSUSUARIO = apellidos;
                us.DIRECCIONUSUARIO = direccion;
                us.TELEFONOUSUARIO  = telefono;
                string activostr = "n";
                string fotostr   = "n";
                string huellastr = "n";
                if (foto)
                {
                    fotostr = "y";
                }
                if (huella)
                {
                    huellastr = "y";
                }
                if (activo)
                {
                    activostr = "y";
                }
                us.ACTIVOUSUARIO = activostr;
                us.FOTOUSUARIO   = fotostr;
                us.HUELLAUSUARIO = huellastr;

                CommonBC.ModeloBiblioteca.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Activar(int id, string rut)
        {
            try
            {
                Biblioteca.DALC.USUARIO us = CommonBC.ModeloBiblioteca.USUARIO.First
                                                 (u => u.IDUSUARIO == id);
                if (us.RUTUSUARIO.Equals(rut))
                {
                    us.ACTIVOUSUARIO = "y";
                    CommonBC.ModeloBiblioteca.SaveChanges();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }