Esempio n. 1
0
        public List <Item> clienteAutocompletado(string busqueda)
        {
            var clientes = new List <USPCE_CTE_AUTOCOMPLETADO>();

            try
            {
                using (var ctx = new ContextoAplicacion())
                {
                    var data = ctx.Database.SqlQuery <USPCE_CTE_AUTOCOMPLETADO>("USPCE_CTE_AUTOCOMPLETADO").ToList();

                    var consulta = from c in data
                                   where c.NOMBRE.Contains(busqueda.ToUpper())
                                   select new Item
                    {
                        id    = c.ID_CLIENTE.ToString(),
                        value = c.NOMBRE
                    };

                    return(consulta.ToList());
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
 public List <USPCE_CTE_DASHBOARD> getDashboardUser()
 {
     try
     {
         using (var ctx = new ContextoAplicacion())
         {
             return(ctx.Database.SqlQuery <USPCE_CTE_DASHBOARD>("USPCE_CTE_DASHBOARD").ToList());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 3
0
        public List <USPCE_CTE_GRUPOS> ListarEstadisticas(string estado = "TODOS")
        {
            try
            {
                using (var ctx = new ContextoAplicacion())
                {
                    var ord = ctx.Database.SqlQuery <USPCE_CTE_GRUPOS>("USPCE_CTE_GRUPOS @p0", estado).ToList();

                    return(ord);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 4
0
        public ResponseModel Guardar(NotificacionViewModel model)
        {
            var      rm    = new ResponseModel();
            DateTime fecha = DateTime.Now;

            try
            {
                using (var ctx = new ContextoAplicacion())
                {
                    var notificacion = new Notificacion()
                    {
                        //notificacion.NotificacionId = model.NotificacionId;
                        TITULO = model.TITULO,
                        CUERPO_NOTIFICACION = model.CUERPO_NOTIFICACION,
                        PRIORIDAD           = 3,
                        FECHA = fecha
                    };

                    var newNotification = ctx.CTE_NOTIFICACION.Add(notificacion);
                    ctx.Entry(notificacion).State = EntityState.Added;

                    var clienteNotificacion = new CTE_NOTIFICACION_CLIENTE()
                    {
                        CuentaUsuarioId = model.CuentaUsuarioId,
                        NotificacionId  = newNotification.NotificacionId,
                        FECHA_LECTURA   = fecha,
                        LEIDA           = false
                    };

                    var newClienteNotifica = ctx.CTE_NOTIFICACION_CLIENTE.Add(clienteNotificacion);
                    ctx.Entry(clienteNotificacion).State = EntityState.Added;
                    ctx.SaveChanges();
                    //return Json(new { success = true });
                    rm.SetResponse(true);

                    //var clientes = new SelectList(db.CTE_CUENTA_USUARIO.ToList(), "CuentaUsuarioId", "NOMBRE_USUARIO");
                    //ViewData["Clientes"] = clientes;
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(rm);
        }
Esempio n. 5
0
        public List <CTE_NOTIFICACION_GRUPO> Listar()
        {
            var grupo = new List <CTE_NOTIFICACION_GRUPO>();

            try
            {
                using (var ctx = new ContextoAplicacion())
                {
                    grupo = ctx.CTE_NOTIFICACION_GRUPO.ToList();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(grupo);
        }
Esempio n. 6
0
        public AnexGRIDResponde Listar(AnexGRID grid)
        {
            try
            {
                using (var ctx = new ContextoAplicacion())
                {
                    ctx.Configuration.LazyLoadingEnabled = false;
                    grid.Inicializar();

                    var query = ctx.CTE_NOTIFICACION.Where(x => x.NotificacionId == 5);
                    //var query = ctx.CTE_NOTIFICACION.ToList();
                    // Ordenamiento
                    if (grid.columna == "id")
                    {
                        query = grid.columna_orden == "DESC" ? query.OrderByDescending(x => x.NotificacionId)
                                                             : query.OrderBy(x => x.NotificacionId);
                    }

                    if (grid.columna == "TITULO")
                    {
                        query = grid.columna_orden == "DESC" ? query.OrderByDescending(x => x.TITULO)
                                                             : query.OrderBy(x => x.TITULO);
                    }

                    if (grid.columna == "FECHA")
                    {
                        query = grid.columna_orden == "DESC" ? query.OrderByDescending(x => x.FECHA)
                                                             : query.OrderBy(x => x.FECHA);
                    }


                    var Notificacion = query.Skip(grid.pagina)
                                       .Take(grid.limite)
                                       .ToList();

                    var total = query.Count();

                    grid.SetData(Notificacion, total);
                }
            }catch (Exception ex)
            {
                throw;
            }

            return(grid.responde());
        }