Пример #1
0
 /// <summary>
 /// Metodo que registra un usuario.
 /// </summary>
 /// <returns>Retorna true si se registro el usuario y false de caso contrario</returns>
 public bool Agregar()
 {
     try
     {
         Halcones.DALC.USUARIO usuario = new DALC.USUARIO();
         usuario.ID_USUARIO       = this._idUsuario;
         usuario.USERNAME         = this._username;
         usuario.PASSWORD         = this._contrasena;
         usuario.CORREO           = this._correo;
         usuario.RUT              = this._rut;
         usuario.NOMBRES          = this._nombres;
         usuario.APELLIDOS        = this._apellidos;
         usuario.FECHA_NACIMIENTO = this._fechaNacimiento;
         usuario.ESTADO           = this._estado;
         usuario.ID_PERFIL        = this._idPerfil;
         CommonBC.ModeloEscuelaHalcones.USUARIO.Add(usuario);
         CommonBC.ModeloEscuelaHalcones.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         ConfigHalcones.GenerarLog("ERROR", ex.ToString());
         return(false);
     }
 }
Пример #2
0
        public bool agregarUsuario(string nombre)
        {
            try
            {
                if (null == CommonBC.Modelo.USUARIO.FirstOrDefault(us => us.USUARIO1 == nombre))
                {
                    DALC.USUARIO user = new DALC.USUARIO();
                    user.ID           = getUsuarioMaxId() + 1;
                    user.USUARIO1     = this.User;
                    user.CONTRASENA   = this.Contrasena;
                    user.TIPO_USUARIO = this.TipoUsuario;

                    CommonBC.Modelo.USUARIO.Add(user);
                    CommonBC.Modelo.SaveChanges();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.Message);
                return(false);
            }
        }
Пример #3
0
        public bool Create()
        {
            try
            {
                DALC.USUARIO user = new DALC.USUARIO();
                user.ID             = this.Id;
                user.NOMBRECOMPLETO = this.NombreCompleto;
                user.RUT            = this.Rut;
                user.TELEFONO       = this.Telefono;
                user.CORREO         = this.Correo;
                user.NOMBREUSER     = this.NombreUser;
                user.CONTRASENA     = this.Contrasena;
                user.IDTIPOUSER     = int.Parse(this.Login);
                user.IDVIVIENDA     = this.NVivienda;
                user.IDESTADO       = int.Parse(this.Estado);

                CommonBC.ModeloCondominio.AddToUSUARIO(user);
                CommonBC.ModeloCondominio.SaveChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Пример #4
0
        public bool Read()
        {
            try
            {
                DALC.USUARIO u1 = CommonBC.Modelo.USUARIO.First(u => u.RUT == Rut);



                Rut       = u1.RUT;
                IdTipo    = (int)u1.ID_TIPO;
                Pass      = u1.PASS;
                Nombres   = u1.NOMBRES;
                ApellidoP = u1.APELLIDOP;
                ApellidoM = u1.APELLIDOM;
                Correo    = u1.CORREO;
                Telefono  = u1.TELEFONO;
                Direccion = u1.DIRECCION;
                if (u1.MOROSO == 1)
                {
                    Moroso = true;
                }
                if (u1.DAR_BAJA == 1)
                {
                    DarBaja = true;
                }
                RutEmpresa = u1.RUT_EMPRESA;

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Пример #5
0
 public bool Create(string rut, string nombres, string apellidos, string direccion, string telefono, bool foto, bool huella, string username, string password, string email)
 {
     try
     {
         Biblioteca.DALC.USUARIO us = new DALC.USUARIO();
         us.RUTUSUARIO       = rut;
         us.NOMBRESUSUARIO   = nombres;
         us.APELLIDOSUSUARIO = apellidos;
         us.DIRECCIONUSUARIO = direccion;
         us.TELEFONOUSUARIO  = telefono;
         string fotostr   = "n";
         string huellastr = "n";
         if (foto)
         {
             fotostr = "y";
         }
         if (huella)
         {
             huellastr = "y";
         }
         us.FOTOUSUARIO   = fotostr;
         us.HUELLAUSUARIO = huellastr;
         password         = CalculateMD5Hash(password);
         CommonBC.ModeloBiblioteca.PRO_ADD_USUARIO(rut, nombres, apellidos, direccion, telefono, fotostr, huellastr, username, password, email);
         CommonBC.ModeloBiblioteca.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #6
0
 public bool ValidarUsuarioJ(string r, string p)
 {
     try
     {
         DALC.USUARIO u1 = CommonBC.Modelo.USUARIO.First(u => u.RUT == r && u.PASS == p);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #7
0
 public bool ValidarUsuario()
 {
     try
     {
         DALC.USUARIO u1 = CommonBC.Modelo.USUARIO.First(u => u.RUT == Rut && u.PASS == Pass);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #8
0
        public bool Update()
        {
            //        public string Rut { get; set; }
            //public int IdTipo { get; set; }
            //public string Pass { get; set; }
            //public string Nombres { get; set; }
            //public string ApellidoP { get; set; }
            //public string ApellidoM { get; set; }
            //public string Correo { get; set; }
            //public string Telefono { get; set; }
            //public string Direccion { get; set; }
            //public bool Moroso { get; set; }
            //public bool DarBaja { get; set; }
            //public string RutEmpresa { get; set; }

            try
            {
                DALC.USUARIO u = CommonBC.Modelo.USUARIO.First(u1 => u1.RUT == Rut);

                u.ID_TIPO   = IdTipo;
                u.PASS      = Pass;
                u.NOMBRES   = Nombres;
                u.APELLIDOP = ApellidoP;
                u.APELLIDOM = ApellidoM;
                u.CORREO    = Correo;
                u.TELEFONO  = Telefono;
                u.DIRECCION = Direccion;
                if (Moroso)
                {
                    u.MOROSO = 1;
                }
                else
                {
                    u.MOROSO = 0;
                }
                if (DarBaja)
                {
                    u.DAR_BAJA = 1;
                }
                else
                {
                    u.DAR_BAJA = 0;
                }
                u.RUT_EMPRESA = RutEmpresa;

                CommonBC.Modelo.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Пример #9
0
        public bool ValidarUsuario()
        {
            DALC.USUARIO user = CommonBC.ModeloCondominio.USUARIO.Where(u => u.NOMBREUSER == this.NombreUser && u.CONTRASENA == this.Contrasena).FirstOrDefault();

            if (user != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #10
0
        public bool borrarUsuario()
        {
            try
            {
                DALC.USUARIO usuario = CommonBC.Modelo.USUARIO.FirstOrDefault(us => us.ID == this.Id);

                CommonBC.Modelo.USUARIO.Remove(usuario);
                CommonBC.Modelo.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                Logger.Log(ex.Message);
                return(false);
            }
        }
        public bool EliminarUsuario()
        {
            try
            {
                DALC.QueOfrecesEntities ctx  = new DALC.QueOfrecesEntities();
                DALC.USUARIO            user = ctx.USUARIO.First(u => u.ID_USUARIO == IdUsuario);

                ctx.Entry(user).State = System.Data.EntityState.Deleted;
                ctx.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #12
0
 public bool actualizarUsuario()
 {
     try
     {
         DALC.USUARIO usuario = CommonBC.Modelo.USUARIO.FirstOrDefault(us => us.ID == this.Id);
         usuario.USUARIO1     = this.User;
         usuario.TIPO_USUARIO = this.TipoUsuario;
         usuario.CONTRASENA   = this.Contrasena;
         CommonBC.Modelo.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         Logger.Log(ex.Message);
         return(false);
     }
 }
Пример #13
0
 public int getUsuarioIdByName(string nombre)
 {
     try
     {
         DALC.USUARIO usuario = CommonBC.Modelo.USUARIO.FirstOrDefault(us => us.USUARIO1 == nombre);
         if (usuario != null)
         {
             return((int)usuario.ID);
         }
         else
         {
             return(0);
         }
     }
     catch (Exception ex)
     {
         Logger.Log(ex.Message);
         return(0);
     }
 }
Пример #14
0
        public bool Create()
        {
            try
            {
                DALC.USUARIO u = new DALC.USUARIO();
                u.RUT       = Rut;
                u.ID_TIPO   = IdTipo;
                u.PASS      = Pass;
                u.NOMBRES   = Nombres;
                u.APELLIDOP = ApellidoP;
                u.APELLIDOM = ApellidoM;
                u.CORREO    = Correo;
                u.TELEFONO  = Telefono;
                u.DIRECCION = Direccion;
                if (Moroso)
                {
                    u.MOROSO = 1;
                }
                else
                {
                    u.MOROSO = 0;
                }
                if (DarBaja)
                {
                    u.DAR_BAJA = 1;
                }
                else
                {
                    u.DAR_BAJA = 0;
                }
                u.RUT_EMPRESA = RutEmpresa;

                CommonBC.Modelo.USUARIO.Add(u);
                CommonBC.Modelo.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Пример #15
0
        public int validarUsuario(string nombre, string password)
        {
            try
            {
                DALC.USUARIO usuario = CommonBC.Modelo.USUARIO.FirstOrDefault(us => us.USUARIO1 == nombre && us.CONTRASENA == password);

                if (null != usuario)
                {
                    return((int)usuario.ID);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.Message);
                return(0);
            }
        }
Пример #16
0
        public bool Perfil()
        {
            try
            {
                DALC.USUARIO user = CommonBC.ModeloCondominio.USUARIO.Where(u => u.ID == this.Id).FirstOrDefault();

                this.Id             = user.ID;
                this.NombreCompleto = user.NOMBRECOMPLETO;
                this.Rut            = user.RUT;
                this.Telefono       = user.TELEFONO;
                this.Correo         = user.CORREO;
                this.NombreUser     = user.NOMBREUSER;
                this.Contrasena     = user.CONTRASENA;
                this.Login          = Convert.ToString(user.TIPOUSUARIO.NOMBRETIPO);
                this.NVivienda      = user.IDVIVIENDA;
                this.Estado         = Convert.ToString(user.IDESTADO);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Пример #17
0
        /// <summary>
        /// Metodo que registra un llegada de un vuelo.
        /// </summary>
        /// <returns>Retorna true si se registro la llegada del vuelo y false de caso contrario</returns>
        public bool Agregar()
        {
            try
            {
                Halcones.DALC.USUARIO usuario = new DALC.USUARIO();

                Halcones.DALC.LLEGADA_VUELO llegada = new DALC.LLEGADA_VUELO();
                llegada.ID_LLEGADA              = this._idLLegada;
                llegada.FECHA_LLEGADA           = this._fechaLLegada;
                llegada.SEGUNDOS_VUELO          = this._segundosVuelo;
                llegada.SEGUNDOS_VUELO_PILOTO   = this._segundosVueloPiloto;
                llegada.SEGUNDOS_VUELO_COPILOTO = this._segundosVueloCoPiloto;
                llegada.COMENTARIOS             = this._comentarios;
                llegada.ID_VUELO = this._vuelo._idVuelo;
                CommonBC.ModeloEscuelaHalcones.LLEGADA_VUELO.Add(llegada);
                CommonBC.ModeloEscuelaHalcones.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                ConfigHalcones.GenerarLog("ERROR", ex.ToString());
                return(false);
            }
        }
        public bool ActualizarUsuario()
        {
            try
            {
                DALC.QueOfrecesEntities ctx     = new DALC.QueOfrecesEntities();
                DALC.USUARIO            usuario = ctx.USUARIO.First(u => u.NOMBRE_USUARIO == NombreUsuario);


                usuario.PERFIL_ID         = this.IdPerfil;
                usuario.NOMBRE_USUARIO    = this.NombreUsuario;
                usuario.PASSWORD          = this.Password;
                usuario.NOMBRE            = this.Nombre;
                usuario.APELLIDO          = this.Apellido;
                usuario.RUT               = this.Rut;
                usuario.ACTIVO            = this.Activo.ToString();
                usuario.SUCURSAL_ID       = this.IdSucursal;
                usuario.FECHA_NACIMIENTO  = this.FechaNacimiento;
                usuario.SEXO              = this.Sexo.ToString();
                usuario.EMAIL             = this.Email;
                usuario.NUMERO_CELULAR    = this.NumeroCelular;
                usuario.PUNTOS            = this.Puntos;
                usuario.PASSAPORTE        = this.Pasaporte;
                usuario.NACIONALIDAD      = this.Nacionalidad;
                usuario.FECHA_CREACION    = this.FechaCreacion;
                usuario.CODIGO_ACTIVACION = this.CodigoActivacion;


                ctx.SaveChanges();
                ctx = null;
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }