Example #1
0
        /// <summary>
        /// notificaciones preventivas
        /// </summary>
        /// <returns></returns>
        public ActionResult Notificaciones()
        {
            List <DetalleFase> list = new List <DetalleFase>();
            LPersonaCasas      pl   = new LPersonaCasas();

            list = pl.GetNotiPreventivas(5);
            Session["Notificaciones"] = list;


            var listdif = list.Select(x => x.Codigo).Distinct().ToList();
            List <DetalleFase> distinctPeople = new List <DetalleFase>();

            //list.GroupBy(p => p.CodCliente)
            //.Select(g => g.FirstOrDefault())
            //  .ToList();
            foreach (var j in listdif)
            {
                distinctPeople.Add(list.Where(s => s.Codigo == j).OrderByDescending(r => r.Fecha).FirstOrDefault());
            }


            distinctPeople.ToList().ForEach(emp =>
            {
                emp.CodCliente    = emp.CodCliente + ":" + list.Where(s => s.Codigo == emp.Codigo).Select(p => p.CantidadCouta).FirstOrDefault();
                emp.CantidadCouta = list.Where(x => x.Codigo == emp.Codigo).Count();
            });
            ViewBag.lista = distinctPeople;
            return(View());
        }
Example #2
0
        public ActionResult Getdatos(string id = "")
        {
            List <DetalleFase> lists = new List <DetalleFase>();
            LPersonaCasas      pl    = new LPersonaCasas();

            lists = pl.GetNotiPreventivas(5);
            var           op       = lists.Where(s => s.CodCliente == id).FirstOrDefault();
            var           detalles = lists.Where(p => p.CodCliente == id).ToList();
            MNotificacion n        = new MNotificacion()
            {
                CodCliente = op.CodCliente,
                Nombre     = op.NombreCompleto,
                Telefono   = op.Telefono,
                Detalles   = detalles,
                Tipos      = Util.GetTipos()
            };

            return(Json(n));
        }