Пример #1
0
        public List <ViewTableTipoAdjunto> listarTipoAdjuntos()
        {
            List <ViewTableTipoAdjunto> lstTAdjuntos = new List <ViewTableTipoAdjunto>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstTAdjuntos = (from a in context.TIPO_ADJUNTO
                                    select new ViewTableTipoAdjunto
                    {
                        IdTAdjunto = a.IdTAdjunto,
                        CodTitulo = a.CodTitulo,
                        Nombre = a.Nombre,
                        Activo = a.Activo,
                        Grupo = a.GRUPO_ADJUNTO.NombreGrupo
                    }).ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstTAdjuntos);
        }
Пример #2
0
        public UsuarioMostrar Ingresar(string usuario, string password)
        {
            UsuarioMostrar user = new UsuarioMostrar();

            try
            {
                using (var context = new SIGHUContext())
                {
                    user = (from u in context.USUARIO
                            where u.LoginUsuario == usuario && u.PasswordUsuario == password && u.Activo == 1
                            select new UsuarioMostrar {
                        IdUsuario = u.IdUsuario,
                        NombresMostrar = u.PERSONA.NombreP + " " + u.PERSONA.ApellidoP,
                        IdPerfil = u.IdPerfil,
                        Perfil = u.PERFILES.Perfil,
                        FotoPerfil = u.PERSONA.FotoPerfil
                    }).FirstOrDefault();

                    return(user);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Пример #3
0
        public List <ViewListAdjuntos> listarAdjuntos(int id)
        {
            List <ViewListAdjuntos> lstAdjuntos = new List <ViewListAdjuntos>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstAdjuntos = (from la in context.ADJUNTOS
                                   where la.IdPersona == id
                                   orderby la.TIPO_ADJUNTO.CodTitulo
                                   select new ViewListAdjuntos
                    {
                        idAdjunto = la.IdAdjunto,
                        Codigo = la.TIPO_ADJUNTO.CodTitulo,
                        Tipo = la.TIPO_ADJUNTO.Nombre,
                        Nombre = la.RutaAdjunto
                    }).ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstAdjuntos);
        }
Пример #4
0
        public List <ViewTableUsuario> listarUsuarios()
        {
            List <ViewTableUsuario> lstUsuarios = new List <ViewTableUsuario>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstUsuarios = (from u in context.USUARIO
                                   select new ViewTableUsuario
                    {
                        IdUsuario = u.IdUsuario,
                        NumDoc = u.PERSONA.NumeroDoc,
                        Nombres = u.PERSONA.NombreP + " " + u.PERSONA.ApellidoP,
                        Usuario = u.LoginUsuario,
                        Activo = u.Activo
                    }).ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstUsuarios);
        }
Пример #5
0
        public ViewTipoAdjunto traeTipoAdjunto(int id)
        {
            ViewTipoAdjunto tipo = new ViewTipoAdjunto();

            try
            {
                using (var context = new SIGHUContext())
                {
                    tipo = (from t in context.TIPO_ADJUNTO
                            where t.IdTAdjunto == id
                            select new ViewTipoAdjunto
                    {
                        IdTipo = t.IdTAdjunto,
                        grupoAdjunto = t.IdGrupo,
                        CodTitulo = t.CodTitulo,
                        Nombre = t.Nombre
                    }).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(tipo);
        }
Пример #6
0
        public List <viewListContratos> listarContratos()
        {
            List <viewListContratos> lstContratos = new List <viewListContratos>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstContratos = (from c in context.PERSONA_HAS_CARGO
                                    orderby c.IdPersona
                                    select new viewListContratos
                    {
                        NumDoc = c.PERSONA.NumeroDoc,
                        Nombres = c.PERSONA.NombreP + " " + c.PERSONA.ApellidoP,
                        Cargo = c.CARGO.NombreC,
                        Contrato = c.IdPersonaHasCargo,
                        Actual = c.actual
                    }).ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstContratos);
        }
Пример #7
0
 public void guardaAdjunto()
 {
     try
     {
         var context = new SIGHUContext();
         context.Entry(this).State = System.Data.Entity.EntityState.Added;
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #8
0
 public void delAdjunto(int id)
 {
     try
     {
         var context = new SIGHUContext();
         context.Database.ExecuteSqlCommand("DELETE FROM ADJUNTOS WHERE IdAdjunto = " + id);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #9
0
 public void editarGrupo()
 {
     try
     {
         using (var context = new SIGHUContext())
         {
             context.Entry(this).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #10
0
 public void ingresaVehiculo()
 {
     try
     {
         using (var context = new SIGHUContext())
         {
             context.Entry(this).State = System.Data.Entity.EntityState.Added;
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #11
0
        public List <VEHICULO> ddVehiculos()
        {
            List <VEHICULO> lstVehiculos = new List <VEHICULO>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstVehiculos = context.VEHICULO.ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstVehiculos);
        }
Пример #12
0
        public VEHICULO traeVehiculo(int id)
        {
            VEHICULO vehiculo = new VEHICULO();

            try
            {
                using (var context = new SIGHUContext())
                {
                    vehiculo = context.VEHICULO.Where(v => v.IdVehiculo == id).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(vehiculo);
        }
Пример #13
0
        public List <VESTUARIO> ddVestuario()
        {
            List <VESTUARIO> lstVestuario = new List <VESTUARIO>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstVestuario = context.VESTUARIO.ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstVestuario);
        }
Пример #14
0
        public List <PERFILES> ddPerfiles()
        {
            List <PERFILES> lstPerfiles = new List <PERFILES>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstPerfiles = context.PERFILES.Where(p => p.Activo == 1).ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstPerfiles);
        }
Пример #15
0
        public List <ARMA> ddArmas()
        {
            List <ARMA> lstArmas = new List <ARMA>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstArmas = context.ARMA.ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstArmas);
        }
Пример #16
0
        public VESTUARIO traeVestuario(int id)
        {
            VESTUARIO vestuario = new VESTUARIO();

            try
            {
                using (var context = new SIGHUContext())
                {
                    vestuario = context.VESTUARIO.Where(v => v.IdVestuario == id).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(vestuario);
        }
Пример #17
0
        public List <EMPRESA> ddEmpresas()
        {
            List <EMPRESA> lstEmpresas = new List <EMPRESA>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstEmpresas = context.EMPRESA.ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstEmpresas);
        }
Пример #18
0
        public List <CARGO> listarCargos()
        {
            List <CARGO> lstCargo = new List <CARGO>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstCargo = context.CARGO.ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstCargo);
        }
Пример #19
0
        public PERSONA traePersona(int id)
        {
            PERSONA persona = new PERSONA();

            try
            {
                using (var context = new SIGHUContext())
                {
                    persona = context.PERSONA.Where(p => p.IdPersona == id).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(persona);
        }
Пример #20
0
        public List <PERSONA> listarPersonas()
        {
            List <PERSONA> lstPersonas = new List <PERSONA>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstPersonas = context.PERSONA.ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstPersonas);
        }
Пример #21
0
        public List <CARGO> ddCargos()
        {
            List <CARGO> lstCargos = new List <CARGO>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstCargos = context.CARGO.Where(c => c.Activo == 1).ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstCargos);
        }
Пример #22
0
        public ARMA traeArma(int id)
        {
            ARMA arma = new ARMA();

            try
            {
                using (var context = new SIGHUContext())
                {
                    arma = context.ARMA.Where(a => a.IdArma == id).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(arma);
        }
Пример #23
0
        public List <GRUPO_ADJUNTO> listarGrupos()
        {
            List <GRUPO_ADJUNTO> lstGrupos = new List <GRUPO_ADJUNTO>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstGrupos = context.GRUPO_ADJUNTO.ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstGrupos);
        }
Пример #24
0
        public List <GRUPO_ADJUNTO> ddGrupos()
        {
            List <GRUPO_ADJUNTO> lstGrupos = new List <GRUPO_ADJUNTO>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstGrupos = context.GRUPO_ADJUNTO.Where(g => g.Activo == 1).OrderBy(g => g.NombreGrupo).ToList();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(lstGrupos);
        }
Пример #25
0
        public void activaUsuario(int id)
        {
            USUARIO usuario = new USUARIO();

            try
            {
                using (var context = new SIGHUContext())
                {
                    usuario = context.USUARIO.Where(u => u.IdUsuario == id).FirstOrDefault();

                    usuario.Activo = 1;
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Пример #26
0
        public GRUPO_ADJUNTO traeGrupo(int id)
        {
            GRUPO_ADJUNTO grupo = new GRUPO_ADJUNTO();

            try
            {
                using (var context = new SIGHUContext())
                {
                    grupo = (from g in context.GRUPO_ADJUNTO
                             where g.IdGrupo == id
                             select g).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(grupo);
        }
Пример #27
0
        public ADJUNTOS traeNomArchivo(int id)
        {
            ADJUNTOS adjunto = new ADJUNTOS();

            try
            {
                using (var context = new SIGHUContext())
                {
                    adjunto = (from a in context.ADJUNTOS
                               where a.IdAdjunto == id
                               select a).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(adjunto);
        }
Пример #28
0
        public CARGO traeCargo(int id)
        {
            CARGO cargo = new CARGO();

            try
            {
                using (var context = new SIGHUContext())
                {
                    cargo = (from c in context.CARGO
                             where c.IdCargo == id
                             select c).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(cargo);
        }
Пример #29
0
        public EMPRESA traeEmpresa(int id)
        {
            EMPRESA empresa = new EMPRESA();

            try
            {
                using (var context = new SIGHUContext())
                {
                    empresa = (from e in context.EMPRESA
                               where e.IdEmpresa == id
                               select e).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(empresa);
        }
Пример #30
0
        public List <MENU> listarMenu(int id)
        {
            List <MENU> lstMenu = new List <MENU>();

            try
            {
                using (var context = new SIGHUContext())
                {
                    lstMenu = (from m in context.MENU
                               where m.Activo == 1 && m.Perfil == id
                               select m).ToList();
                }

                return(lstMenu);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }