public ActionResult AddComment(TaksComentarios comment, int idE = 0, int idR = 0) { // idE = idEmisor // idR = idReceptor int error = 0; TaksComentarios c; comment.Creadopor = int.Parse(Session["IdUser"].ToString()); comment.Id_Usuario = int.Parse(Session["IdUser"].ToString()); comment.FAlta = DateTime.Now; comment.Activo = true; error = tickets.InsertComment(comment); c = tickets.GetComment(comment.IdTaksComentario); /* * //if (comment.Creadopor == 3045 || comment.Creadopor == 3030 || comment.Creadopor == 1) * //{ * //---notify.CreateNotification(string.Format("ha comentado en el ticket ({0})", c.TaksAdmon.Asunto), string.Format("\"{0}\"", c.Comentario), c.IdTaks.ToString(), c.TaksAdmon.Creadopor, int.Parse(Session["IdUser"].ToString()), "question_answer"); * //notify.CreateNotification(string.Format("ha comentado en el ticket ({0})", c.TaksAdmon.Asunto), string.Format("\"{0}\"", c.Comentario), Url.Action("TicketDetail", "Tickets", new { ticketID = c.IdTaks }), c.TaksAdmon.Creadopor, int.Parse(Session["IdUser"].ToString()), "question_answer", true); * //} * //else * //{ * //---notify.CreateNotification(string.Format("ha comentado en el ticket ({0})", c.TaksAdmon.Asunto), string.Format("\"{0}\"", c.Comentario), c.IdTaks.ToString(), 3045, int.Parse(Session["IdUser"].ToString()), "question_answer"); * //---notify.CreateNotification(string.Format("ha comentado en el ticket ({0})", c.TaksAdmon.Asunto), string.Format("\"{0}\"", c.Comentario), c.IdTaks.ToString(), 3030, int.Parse(Session["IdUser"].ToString()), "question_answer"); * //---notify.CreateNotification(string.Format("ha comentado en el ticket ({0})", c.TaksAdmon.Asunto), string.Format("\"{0}\"", c.Comentario), c.IdTaks.ToString(), 1, int.Parse(Session["IdUser"].ToString()), "question_answer"); * //notify.CreateNotification(string.Format("ha comentado en el ticket ({0})", c.TaksAdmon.Asunto), string.Format("\"{0}\"", c.Comentario), Url.Action("TicketDetail", "Tickets", new { ticketID = c.IdTaks }), 3045, int.Parse(Session["IdUser"].ToString()), "question_answer", true); * //notify.CreateNotification(string.Format("ha comentado en el ticket ({0})", c.TaksAdmon.Asunto), string.Format("\"{0}\"", c.Comentario), Url.Action("TicketDetail", "Tickets", new { ticketID = c.IdTaks }), 3030, int.Parse(Session["IdUser"].ToString()), "question_answer", true); * //notify.CreateNotification(string.Format("ha comentado en el ticket ({0})", c.TaksAdmon.Asunto), string.Format("\"{0}\"", c.Comentario), Url.Action("TicketDetail", "Tickets", new { ticketID = c.IdTaks }), 1, int.Parse(Session["IdUser"].ToString()), "question_answer", true); * //} */ if (c.Usuarios1.Id_Area == c.TaksAdmon.Usuarios.Id_Area) //Si quien comenta es de la misma área que creó el ticket >>> enviar noitificaciones al área que atiende { foreach (Usuarios u in tickets.GetUsuariosArea(c.TaksAdmon.Id_CA_Area.Value)) { notify.CreateNotification(string.Format("ha comentado en el ticket ({0})", c.TaksAdmon.Asunto), string.Format("\"{0}\"", c.Comentario), Url.Action("TicketDetail", "Tickets", new { ticketID = c.IdTaks }), u.Id_Usuario, int.Parse(Session["IdUser"].ToString()), "question_answer", true); } } else //si quien comenta es el área que atiende >>> enviar notificaciones al área que solicita ayuda { foreach (Usuarios u in tickets.GetUsuariosAreaByUser(c.TaksAdmon.Creadopor)) { notify.CreateNotification(string.Format("ha comentado en el ticket ({0})", c.TaksAdmon.Asunto), string.Format("\"{0}\"", c.Comentario), Url.Action("TicketDetail", "Tickets", new { ticketID = c.IdTaks }), u.Id_Usuario, int.Parse(Session["IdUser"].ToString()), "question_answer", true); } } return(JavaScript("ShowConfirmation()")); }