Exemple #1
0
 public String ObtenerNombrePorId(int id)
 {
     try
     {
         Datos.USUARIO us = CommonBC.DBConexion.USUARIO.First(b => b.ID == id);
         return(us.NOMBRE);
     }
     catch (Exception)
     {
         return("");
     }
 }
Exemple #2
0
 public bool Authenticate()
 {
     try
     {
         Datos.USUARIO user = Conexion.ModeloEntities.USUARIO.First
                                  (u => u.NOMBRE == NOMBRE && u.CONTRASENA == CONTRASENA);
         NOMBRE = user.NOMBRE;
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #3
0
        public bool Read()
        {
            try
            {
                Datos.USUARIO usuario = Conexion.ModeloEntities.USUARIO.First(em => em.ID == ID);
                ID     = usuario.ID;
                NOMBRE = usuario.NOMBRE;

                //USUARIO_ID = trabajador.



                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #4
0
 public bool ObtenerUsuario(int id)
 {
     try
     {
         Datos.USUARIO us = CommonBC.DBConexion.USUARIO.First(b => b.ID == id);
         this.Id          = (int)us.ID;
         this.Rut         = us.RUT;
         this.Nombre      = us.NOMBRE;
         this.Direccion   = us.DIRECCION;
         this.Mail        = us.MAIL;
         this.Telefono    = us.TELEFONO;
         this.TipoCliente = char.Parse(us.TIPO_CLIENTE);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #5
0
 public bool read()
 {
     try
     {//cvcvc
         Datos.USUARIO usuario = null;
         usuario = CommonBC.ModeloCEM.USUARIO.Where(u => u.ID_REGISTRO.Equals(this.IdRegistro)).FirstOrDefault();
         if (usuario != null)
         {
             this.Username = usuario.USERNAME;
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #6
0
        //Agregar
        public bool Create()
        {
            Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities();

            Datos.USUARIO usu = new Datos.USUARIO();

            try
            {
                CommonBC.Syncronize(this, usu);

                bbdd.USUARIO.Add(usu);
                bbdd.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                bbdd.USUARIO.Remove(usu);
                return(false);
            }
        }
Exemple #7
0
        /// <summary>
        /// Elimina un registro de producto en la BBDD
        /// </summary>
        /// <returns></returns>
        public bool Delete()
        {
            Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities();

            try
            {
                /* Se obtiene el primer registro coincidente con el id */
                Datos.USUARIO usu = bbdd.USUARIO.First(e => e.ID_USUARIO == ID_USUARIO);

                /* Se elimina el registro del EDM */
                bbdd.USUARIO.Remove(usu);

                bbdd.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemple #8
0
        /// <summary>
        /// Actualiza un registro de cargo en la BBDD
        /// </summary>
        /// <returns></returns>
        public bool Update()
        {
            Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities();

            try
            {
                /* Se obtiene el primer registro coincidente con el id */
                Datos.USUARIO usu = bbdd.USUARIO.First(e => e.ID_USUARIO == ID_USUARIO);

                /* Se copian las propiedades del negocio a los datos */
                CommonBC.Syncronize(this, usu);

                bbdd.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemple #9
0
 public bool rolUsuario()
 {
     try
     {
         Datos.USUARIO usuario = null;
         usuario = CommonBC.ModeloCEM.USUARIO.Where(u => u.USERNAME.Equals(this.Username) && u.PASSWORD.Equals(this.Password)).FirstOrDefault();
         if (usuario != null)
         {
             this.IdRegistro = usuario.ID_REGISTRO;
             this.Rol        = (int)(usuario.ID_ROL);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #10
0
        /// <summary>
        /// Lee un registro de cargi en la BBDD
        /// </summary>
        /// <returns></returns>
        public bool Read()
        {
            Datos.FerreteriaFermeEntities bbdd = new Datos.FerreteriaFermeEntities();

            try
            {
                /* Se obtiene el primer registro coincidente con el id */
                Datos.USUARIO usu = bbdd.USUARIO.First(e => e.ID_USUARIO == ID_USUARIO);

                /* Se copian las propiedades de datos al negocio */
                CommonBC.Syncronize(usu, this);

                /* Carga descripción de los Tipos */
                LeerNombreProveedor();

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