public JsonResult QuitarFavorita(int IdNotificacion) { Notificaciones bll = new Notificaciones(); var response = bll.DeleteFavorite(IdNotificacion); return(Json(response, JsonRequestBehavior.AllowGet)); }
public PartialViewResult NotificationComments(int id) { Notificacion.BLL.Notificaciones n = new Notificacion.BLL.Notificaciones(); var comments = n.GetNotificationComments(id); return(PartialView(comments)); }
public JsonResult AddComment(RH.Entidades.Notificacion_Comentarios comment) { Notificaciones bll = new Notificaciones(); var id = bll.AddComment(comment); return(Json(id, JsonRequestBehavior.AllowGet)); }
public JsonResult NotificationDetails(int id) { Notificacion.BLL.Notificaciones ctx = new Notificacion.BLL.Notificaciones(); var not = ctx.GetNotificationDetails(id); return(Json(not, JsonRequestBehavior.AllowGet)); }
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)); }
public PartialViewResult GetComment(int IdComentario) { Notificaciones bll = new Notificaciones(); var comment = bll.GetComment(IdComentario); return(PartialView(comment)); }
public JsonResult MarkAsRead(int id) { Notificacion.BLL.Notificaciones ctx = new Notificacion.BLL.Notificaciones(); var status = ctx.MarcarComoLeida(id); return(Json(status, JsonRequestBehavior.AllowGet)); }
public PartialViewResult GetComment(int id) { Notificacion.BLL.Notificaciones n = new Notificacion.BLL.Notificaciones(); var comment = n.GetComment(id); return(PartialView(comment)); }
public JsonResult AddComment(Notificacion_Comentarios comment) { Notificacion.BLL.Notificaciones n = new Notificacion.BLL.Notificaciones(); var result = n.AddComment(comment); return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult MarcarComoFavorita(int IdNotificacion) { Notificaciones bll = new Notificaciones(); var response = bll.AddFavorite(IdNotificacion); return(Json(response, JsonRequestBehavior.AllowGet)); }
public JsonResult DesarchivarNotificacion(int IdNotificacion) { Notificaciones bll = new Notificaciones(); var response = bll.DesarchivarNotificacion(IdNotificacion); return(Json(response, JsonRequestBehavior.AllowGet)); }
public PartialViewResult NotificationDetails(int IdNotificacion) { Notificaciones ctx = new Notificaciones(); var notificacion = ctx.GetNotificationDetails(IdNotificacion); notificacion.Comentarios = ctx.GetNotificationComments(IdNotificacion); return(PartialView(notificacion)); }
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 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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
//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); }
public void DeleteFavorite(int id) { Notificacion.BLL.Notificaciones n = new Notificacion.BLL.Notificaciones(); n.DeleteFavorite(id); }