示例#1
0
        public JsonResult QuitarFavorita(int IdNotificacion)
        {
            Notificaciones bll      = new Notificaciones();
            var            response = bll.DeleteFavorite(IdNotificacion);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public PartialViewResult NotificationComments(int id)
        {
            Notificacion.BLL.Notificaciones n = new Notificacion.BLL.Notificaciones();
            var comments = n.GetNotificationComments(id);

            return(PartialView(comments));
        }
示例#3
0
        public JsonResult AddComment(RH.Entidades.Notificacion_Comentarios comment)
        {
            Notificaciones bll = new Notificaciones();
            var            id  = bll.AddComment(comment);

            return(Json(id, JsonRequestBehavior.AllowGet));
        }
示例#4
0
        public JsonResult NotificationDetails(int id)
        {
            Notificacion.BLL.Notificaciones ctx = new Notificacion.BLL.Notificaciones();
            var not = ctx.GetNotificationDetails(id);

            return(Json(not, JsonRequestBehavior.AllowGet));
        }
示例#5
0
        public JsonResult GetDataForPrint(int[] idNotificaciones)
        {
            Notificaciones ctx           = new Notificaciones();
            var            notifications = ctx.GetNotifications(idNotificaciones);

            foreach (var notification in notifications)
            {
                notification.FechaString = notification.Fecha.ToString("dd/MM/yyyy");
                var body = "";
                body = notification.Contenido.Replace("<ul class='collection'>", "");
                body = body.Replace("</ul>", "");
                string[] stringsep = new string[] { "</li>" };
                var      data      = body.Split(stringsep, StringSplitOptions.None);
                notification.Datos = new List <string>();
                foreach (var item in data)
                {
                    var value = item;
                    value = value.Replace("<li class='collection-item'><b>", "");
                    value = value.Replace("</b> <span class='secondary-content'>", "");
                    value = value.Replace("</span>", "");
                    notification.Datos.Add(value);
                }
            }
            return(Json(notifications, JsonRequestBehavior.AllowGet));
        }
示例#6
0
        public PartialViewResult GetComment(int IdComentario)
        {
            Notificaciones bll     = new Notificaciones();
            var            comment = bll.GetComment(IdComentario);

            return(PartialView(comment));
        }
示例#7
0
        public JsonResult MarkAsRead(int id)
        {
            Notificacion.BLL.Notificaciones ctx = new Notificacion.BLL.Notificaciones();
            var status = ctx.MarcarComoLeida(id);

            return(Json(status, JsonRequestBehavior.AllowGet));
        }
示例#8
0
        public PartialViewResult GetComment(int id)
        {
            Notificacion.BLL.Notificaciones n = new Notificacion.BLL.Notificaciones();
            var comment = n.GetComment(id);

            return(PartialView(comment));
        }
示例#9
0
        public JsonResult AddComment(Notificacion_Comentarios comment)
        {
            Notificacion.BLL.Notificaciones n = new Notificacion.BLL.Notificaciones();
            var result = n.AddComment(comment);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#10
0
        public JsonResult MarcarComoFavorita(int IdNotificacion)
        {
            Notificaciones bll      = new Notificaciones();
            var            response = bll.AddFavorite(IdNotificacion);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
示例#11
0
        public JsonResult DesarchivarNotificacion(int IdNotificacion)
        {
            Notificaciones bll      = new Notificaciones();
            var            response = bll.DesarchivarNotificacion(IdNotificacion);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
示例#12
0
        public PartialViewResult NotificationDetails(int IdNotificacion)
        {
            Notificaciones ctx          = new Notificaciones();
            var            notificacion = ctx.GetNotificationDetails(IdNotificacion);

            notificacion.Comentarios = ctx.GetNotificationComments(IdNotificacion);
            return(PartialView(notificacion));
        }
示例#13
0
        public PartialViewResult Notifications(int numPage = 0, int filtro = 0, int extra = 0, string keyword = "")
        {
            Notificacion.BLL.Notificaciones ctx   = new Notificacion.BLL.Notificaciones();
            List <NotificacionDatos>        model = null;

            var records = numPage * 20;

            switch (filtro)
            {
            case 0:     //bandeja de entrada
                model = ctx.GetNotifications();
                break;

            case 1:     //favoritas
                model = ctx.GetFavoritas();
                break;

            case 2:     //status
                model = ctx.GetNotificationsByStatus(extra);
                break;

            case 3:     //tipo
                model = ctx.GetNotificationsByType(extra);
                break;

            default:
                model = ctx.GetNotifications();
                break;
            }

            if (keyword != "")
            {
                keyword = keyword.ToUpper();
                model   = model.Where(x => x.Titulo.ToUpper().Contains(keyword) || x.Contenido.ToUpper().Contains(keyword) || x.Cliente.ToUpper().Contains(keyword)).ToList();
            }

            var paginas = (double)model.Count / (double)20;

            ViewBag.NumPaginas = Math.Ceiling(paginas);



            ViewBag.PaginaActiva = numPage;
            ViewBag.TotalRecords = model.Count;
            model = model.OrderByDescending(x => x.Fecha).ToList();
            model = model.Skip(records).Take(20).ToList();
            ViewBag.FirstRecord = records + 1;
            ViewBag.LastRecord  = records + model.Count;

            return(PartialView(model));
        }
示例#14
0
        public JsonResult GetLatest(DateTime date)
        {
            var userSession = Session["usuario"] as SYA_Usuarios;
            var user        = ControlAcceso.GetUsuarioEnSession();

            Notificaciones bd   = new Notificaciones();
            var            list = bd.getNuevas(user).Where(x => x.Fecha >= date);

            foreach (var item in list)
            {
                item.image = ControlUsuario.GetProfilePictureOfUser(item.IdUsuario);
            }
            return(Json(list, JsonRequestBehavior.AllowGet));
        }
示例#15
0
        public JsonResult QuitarFavoritas(int[] notificaciones)
        {
            Notificaciones bll     = new Notificaciones();
            var            updated = new List <int>();

            foreach (var id in notificaciones)
            {
                var response = bll.DeleteFavorite(id);
                if (response)
                {
                    updated.Add(id);
                }
            }
            return(Json(updated, JsonRequestBehavior.AllowGet));
        }
示例#16
0
        public JsonResult ArchivarNotificaciones(int[] idsNotificacion)
        {
            Notificaciones bll          = new Notificaciones();
            var            actualizados = new List <int>();

            foreach (var id in idsNotificacion)
            {
                var actualizado = bll.ArchivarNotificacion(id);
                if (actualizado)
                {
                    actualizados.Add(id);
                }
            }
            return(Json(actualizados, JsonRequestBehavior.AllowGet));
        }
示例#17
0
        public JsonResult DesarchivarNotificaciones(int[] idsNotificacion)
        {
            Notificaciones bll     = new Notificaciones();
            var            updated = new List <int>();

            foreach (var id in idsNotificacion)
            {
                var response = bll.DesarchivarNotificacion(id);
                if (response)
                {
                    updated.Add(id);
                }
            }
            return(Json(updated, JsonRequestBehavior.AllowGet));
        }
示例#18
0
        public JsonResult GetNotificationBody(int id)
        {
            Notificacion.BLL.Notificaciones ctx = new Notificacion.BLL.Notificaciones();
            var lista  = new List <string>();
            var cuerpo = ctx.GetNotificationBody(id);
            var list   = new List <string>();

            cuerpo = cuerpo.Replace("<ul class=\"collection\">", "");
            cuerpo = cuerpo.Replace("</ul>", "");
            string[] stringsep = new string[] { "</li>" };
            var      array     = cuerpo.Split(stringsep, StringSplitOptions.None);

            foreach (var item in array)
            {
                var dato = "";
                dato = item.Replace("<li class='collection-item'><b>", "");
                dato = dato.Replace("</b> <span class='secondary-content'>", "");
                dato = dato.Replace("</span></li>", "");
                list.Add(dato);
            }

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
示例#19
0
        public PartialViewResult GetListaNotificaciones(int[] filtros, int bandeja = 1, int numPage = 0, string keyword = "")
        {
            Notificaciones           ctx   = new Notificaciones();
            List <NotificacionDatos> model = null;
            var records     = numPage * 20;
            var userSession = Session["usuario"] as SYA_Usuarios;

            var user = ControlAcceso.GetUsuarioEnSession();

            switch (bandeja)
            {
            case 1:     //Entrada
                model = ctx.GetBandejaEntrada(user);
                break;

            case 2:     //Favoritas
                model = ctx.GetFavoritas(user);
                break;

            case 3:     //Nuevas
                model = ctx.getNuevas(user);
                break;

            case 4:     //Archivadas
                model = ctx.GetNotificationsArchivadas(user);
                break;
            }

            double paginas     = 0;
            int    totalRecors = 0;
            int    firstRecord = 0;
            int    lastRecord  = 0;

            if (model != null)
            {
                if (keyword != "")
                {
                    keyword = keyword.ToUpper();
                    model   = model.Where(x => x.Titulo.ToUpper().Contains(keyword) || x.Usuario.ToUpper().Contains(keyword) || x.Cliente.ToUpper().Contains(keyword)).ToList();
                }

                if (filtros != null)
                {
                    model = model.Where(x => filtros.Contains(x.Tipo)).ToList();
                }

                paginas     = (double)model.Count / (double)20;
                totalRecors = model.Count;

                model = model.OrderByDescending(x => x.Fecha).ToList();
                model = model.Skip(records).Take(20).ToList();

                firstRecord = model.Count == 0 ? 0 : records + 1;
                lastRecord  = records + model.Count;
            }


            ViewBag.NumPaginas = Math.Ceiling(paginas);

            ViewBag.PaginaActiva = numPage;
            ViewBag.TotalRecords = totalRecors;

            ViewBag.FirstRecord = firstRecord;
            ViewBag.LastRecord  = lastRecord;

            return(PartialView(model));
        }
示例#20
0
        //public JsonResult GetLatest(DateTime date)
        //{
        //    Notificacion.BLL.Notificaciones bd = new Notificacion.BLL.Notificaciones();
        //    var list = bd.GetLatest(date);
        //    foreach(var item in list)
        //    {
        //        item.image = ControlUsuario.GetProfilePictureOfUser(item.IdUsuario);
        //    }
        //    return Json(list, JsonRequestBehavior.AllowGet);
        //}

        public void AddFavorite(int id)
        {
            Notificacion.BLL.Notificaciones n = new Notificacion.BLL.Notificaciones();
            n.AddFavorite(id);
        }
示例#21
0
 public void DeleteFavorite(int id)
 {
     Notificacion.BLL.Notificaciones n = new Notificacion.BLL.Notificaciones();
     n.DeleteFavorite(id);
 }