Exemple #1
0
        public ActionResult UploadFile(HttpPostedFileBase file, TaksComentarios c, int ticketID = 0)
        {
            TaksDocumentos doc = new TaksDocumentos();

            //c.Comentario = message;
            //TaksAdmon t = tickets.GetRawTicket(ticketID);

            if (ticketID == 0)
            {
                return(Redirect(Url.Action("TicketDetail", "Tickets", new { id = ticketID })));
            }

            file.SaveAs(Server.MapPath("~/signalr/Tickets/" + file.FileName));

            doc.IdTaks = ticketID;
            doc.IdTaksTipoDocumento = 1;
            doc.Nombre        = file.FileName;
            doc.NombreVirtual = file.FileName;
            doc.Id_Ftp        = 1;
            doc.FAlta         = DateTime.Now;
            doc.Creadopor     = int.Parse(Session["IdUser"].ToString());
            doc.Activo        = true;

            tickets.InsertFile(doc);
            //tickets.InsertServicio(t);
            //return Redirect(Url.Action("TicketDetail", "Tickets", new { id = ticketID }));
            return(AddComment(c));
        }
Exemple #2
0
        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()"));
        }