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)); }
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)); }