Exemplo n.º 1
0
        public List <DTOMenu> CargaDto(string[] gru)
        {
            FRONTEntities ctx = new FRONTEntities();
            var           db  = (from a in ctx.WEB_Servicio
                                 from b in ctx.WEB_Aplicacion
                                 from c in ctx.WEB_AppxServicio
                                 where gru.Contains(a.servicio) &&
                                 c.idservicio == a.idservicio &&
                                 c.idapp == b.idapp
                                 select new { b.nombre, b.ruta }).ToList();

            db = db.Distinct().ToList();


            List <DTOMenu> lista = new List <DTOMenu>();

            foreach (var item in db)
            {
                DTOMenu m = new DTOMenu();
                m.app  = item.nombre;
                m.ruta = item.ruta;

                lista.Add(m);
            }

            return(lista);
        }
Exemplo n.º 2
0
        public WEB_Servicio BuscarXID(int?id_servicio)
        {
            var tel = new WEB_Servicio();

            try
            {
                using (var ctx = new FRONTEntities())

                    tel = ctx.WEB_Servicio.Where(x => x.idservicio == id_servicio)
                          .FirstOrDefault();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(tel);
        }
Exemplo n.º 3
0
        public WEB_Servicio BuscarXNombre(string nombre)
        {
            var tel = new WEB_Servicio();

            try
            {
                using (var ctx = new FRONTEntities())

                    tel = ctx.WEB_Servicio.Where(x => x.servicio == nombre)
                          .FirstOrDefault();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(tel);
        }
Exemplo n.º 4
0
        public List <WEB_Servicio> Listar()
        {
            var serv = new List <WEB_Servicio>();

            try
            {
                using (var ctx = new FRONTEntities())

                    serv = ctx.WEB_Servicio
                           .ToList();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(serv);
        }
Exemplo n.º 5
0
 public string ObtenerNombrePorId(int id)
 {
     try
     {
         using (var ctx = new FRONTEntities())
         {
             string sub = (from s in ctx.WEB_Subordinado
                           where s.id_subordinado == id
                           select s.nombre + " " + s.apellido).FirstOrDefault();
             return(sub);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 6
0
        public List <WEB_Subordinado> ListarSinEstado()
        {
            var tel = new List <WEB_Subordinado>();

            try
            {
                using (var ctx = new FRONTEntities())

                    tel = ctx.WEB_Subordinado
                          .ToList();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(tel);
        }
Exemplo n.º 7
0
        public List <WEB_Equipo> Listar()
        {
            var equipo = new List <WEB_Equipo>();

            try
            {
                using (var ctx = new FRONTEntities())

                    equipo = ctx.WEB_Equipo
                             .ToList();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(equipo);
        }
Exemplo n.º 8
0
        public int ObtenerUltimo()
        {
            var sol = new WEB_Solicitud();

            try
            {
                using (var ctx = new FRONTEntities())

                    sol = ctx.WEB_Solicitud.OrderByDescending(x => x.id_solicitud)
                          .FirstOrDefault();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(sol.id_solicitud);
        }
Exemplo n.º 9
0
        public WEB_Equipo ObtenerPorIdSubordinado(int id)
        {
            var sol = new WEB_Equipo();

            try
            {
                using (var ctx = new FRONTEntities())

                    sol = ctx.WEB_Equipo.OrderByDescending(x => x.id_equipo).Where(x => x.subordinado_id == id)
                          .FirstOrDefault();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(sol);
        }
Exemplo n.º 10
0
        public WEB_TipoEquipo ObtenerPorNombre(string nombre)
        {
            var sol = new WEB_TipoEquipo();

            try
            {
                using (var ctx = new FRONTEntities())

                    sol = ctx.WEB_TipoEquipo.OrderByDescending(x => x.id_tipo).Where(x => x.nombre == nombre)
                          .FirstOrDefault();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(sol);
        }
Exemplo n.º 11
0
        public WEB_Solicitud ObtenerPorId(int?id)
        {
            var sol = new WEB_Solicitud();

            try
            {
                using (var ctx = new FRONTEntities())

                    sol = ctx.WEB_Solicitud.OrderByDescending(x => x.id_solicitud).Where(x => x.id_solicitud == id)
                          .FirstOrDefault();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(sol);
        }
Exemplo n.º 12
0
        public WEB_Subordinado ObtenerPorID(int id)
        {
            var sub = new WEB_Subordinado();

            try
            {
                using (var ctx = new FRONTEntities())

                    sub = ctx.WEB_Subordinado.Where(x => x.id_subordinado == id)
                          .FirstOrDefault();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(sub);
        }
Exemplo n.º 13
0
        public List <WEB_Subordinado> ObtenerPorIDServicio(int id)
        {
            var tel = new List <WEB_Subordinado>();

            try
            {
                using (var ctx = new FRONTEntities())

                    tel = ctx.WEB_Subordinado.Where(x => x.servicio_id == id)
                          .ToList();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(tel);
        }
Exemplo n.º 14
0
        public List <WEB_Opciones> Listar()
        {
            var opci = new List <WEB_Opciones>();

            try
            {
                using (var ctx = new FRONTEntities())

                    opci = ctx.WEB_Opciones
                           .ToList();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(opci);
        }
Exemplo n.º 15
0
        public List<WEB_TipoEquipo> Listar()
        {
            var tipo = new List<WEB_TipoEquipo>();
            try
            {
                using (var ctx = new FRONTEntities())

                    tipo = ctx.WEB_TipoEquipo
                        .Where(x => x.estado == true)
                        .ToList();
            }
            catch (Exception E)
            {

                throw E;
            }
            return tipo;
        }
Exemplo n.º 16
0
        public WEB_Opciones Obtener_por_valor(bool valor)
        {
            var opci = new WEB_Opciones();

            try
            {
                using (var ctx = new FRONTEntities())

                    opci = ctx.WEB_Opciones
                           .Where(x => x.valor == valor)
                           .FirstOrDefault();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(opci);
        }
Exemplo n.º 17
0
        public List <WEB_Subordinado> Listar()
        {
            var tel = new List <WEB_Subordinado>();

            try
            {
                using (var ctx = new FRONTEntities())

                    tel = ctx.WEB_Subordinado
                          .Where(x => x.estado == true)
                          .ToList();
            }
            catch (Exception E)
            {
                throw E;
            }
            return(tel);
        }
Exemplo n.º 18
0
        public string ObtenerMacPorSubordinado(int id)
        {
            try
            {
                using (var ctx = new FRONTEntities())
                {
                    string mac = (from a in ctx.WEB_Subordinado
                                  join b in ctx.WEB_Equipo on a.id_subordinado equals b.subordinado_id
                                  where a.id_subordinado == id
                                  select b.mac).FirstOrDefault();

                    return(mac);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 19
0
        public string ObtenerServicioPorId(int id)
        {
            try
            {
                using (var ctx = new FRONTEntities())
                {
                    string srv = (from a in ctx.WEB_Subordinado
                                  join b in ctx.WEB_Servicio on a.servicio_id equals b.idservicio
                                  where a.id_subordinado == id
                                  select b.servicio).FirstOrDefault();

                    return(srv);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 20
0
 public void Guardar(WEB_Equipo a)
 {
     try
     {
         using (var ctx = new FRONTEntities())
         {
             if (a.id_equipo > 0) //Registro que ya existe
             {
                 ctx.Entry(a).State = EntityState.Modified;
             }
             else // Registro que es nuevo
             {
                 ctx.Entry(a).State = EntityState.Added;
             }
             ctx.SaveChanges();
         }
     }
     catch (Exception E)
     {
         throw E;
     }
 }
Exemplo n.º 21
0
 public void RevisaSolicitud(WEB_Solicitud sol)
 {
     try
     {
         using (var ctx = new FRONTEntities())
         {
             if (sol.id_solicitud > 0) //Registro que ya existe
             {
                 ctx.Entry(sol).State = EntityState.Modified;
             }
             else // Registro que es nuevo
             {
                 ctx.Entry(sol).State = EntityState.Added;
             }
             ctx.SaveChanges();
         }
     }
     catch (Exception E)
     {
         throw E;
     }
 }