Exemple #1
0
        public ActionResult AddTicket(TaksAdmon ticket)
        {
            int error = 0;
            int newID = 0;

            if (ticket.IdTaksTipo == -1 || ticket.Id_CA_Area == -1 || ticket.IdTaksTipo == -1)
            {
                ViewBag.Empresas  = tickets.DataSourceEmpresas();
                ViewBag.Areas     = tickets.ListAreas();
                ViewBag.TaskTipos = tickets.ListTaskTipo();
                return(View("~/Views/Tickets/CreateNew.cshtml", ticket));
            }

            ticket.IdEstatusTaks = 2;
            ticket.Creadopor     = int.Parse(Session["IdUser"].ToString());
            ticket.FAlta         = DateTime.Now;
            ticket.Activo        = true;
            error = tickets.InsertTicket(ticket, out newID);
            foreach (Usuarios u in tickets.GetUsuariosArea(ticket.Id_CA_Area.Value))
            {
                notify.CreateNotification("ha creado un nuevo ticket: ", ticket.Asunto, Url.Action("TicketDetail", "Tickets", new { ticketID = newID }), u.Id_Usuario, ticket.Creadopor, "receipt", true);
            }
            //notify.CreateNotification("ha creado un nuevo ticket: ", ticket.Asunto, Url.Action("TicketDetail", "Tickets", new { ticketID = newID }), 3045, ticket.Creadopor, "receipt");
            //notify.CreateNotification("ha creado un nuevo ticket: ", ticket.Asunto, Url.Action("TicketDetail", "Tickets", new { ticketID = newID }), 1, ticket.Creadopor, "receipt");
            //notify.CreateNotification("ha creado un nuevo ticket: ", ticket.Asunto, Url.Action("TicketDetail", "Tickets", new { ticketID = newID }), 3030, ticket.Creadopor, "receipt");
            return(Redirect(string.Format("TicketDetail?ticketID={0}&status={1}", newID, 1)));
        }
Exemple #2
0
        public ActionResult AlterStatus(int id, int status)
        {
            int       error; //If 0 then error
            TaksAdmon info = tickets.GetRawTicket(id);

            if (info.IdEstatusTaks != 3 && info.IdEstatusTaks != 4) //Cuando el ticket no se ha cerrado aún
            {
                switch (status)
                {
                case 2:
                    info.IdEstatusTaks = status;
                    break;

                case 3:
                    info.IdEstatusTaks = status;
                    info.FCierre       = DateTime.Now;
                    //notify.CreateNotification(string.Format("ha marcado tu ticket ({0}) como", info.Asunto), "Aprobado", info.IdTaks.ToString(), info.Creadopor, int.Parse(Session["IdUser"].ToString()), "check_circle");
                    notify.CreateNotification(string.Format("ha marcado tu ticket ({0}) como", info.Asunto), "Completado", Url.Action("TicketDetail", "Tickets", new { ticketID = info.IdTaks }), info.Creadopor, int.Parse(Session["IdUser"].ToString()), "check_circle", true);
                    break;

                case 4:
                    info.IdEstatusTaks = status;
                    info.FCierre       = DateTime.Now;
                    //notify.CreateNotification(string.Format("ha marcado tu ticket ({0}) como", info.Asunto), "Rechazado", info.IdTaks.ToString(), info.Creadopor, int.Parse(Session["IdUser"].ToString()), "check_circle");
                    notify.CreateNotification(string.Format("ha marcado tu ticket ({0}) como", info.Asunto), "Cancelado", Url.Action("TicketDetail", "Tickets", new { ticketID = info.IdTaks }), info.Creadopor, int.Parse(Session["IdUser"].ToString()), "check_circle", true);
                    break;

                case 5:
                    if (info.IdEstatusTaks != 5)
                    {
                        info.IdEstatusTaks = status;
                        //notify.CreateNotification("ha revisado tu ticket ", string.Format("({0})", info.Asunto), info.IdTaks.ToString(), info.Creadopor, int.Parse(Session["IdUser"].ToString()), "cancel");
                        notify.CreateNotification("ha revisado tu ticket ", string.Format("({0})", info.Asunto), Url.Action("TicketDetail", "Tickets", new { ticketID = info.IdTaks }), info.Creadopor, int.Parse(Session["IdUser"].ToString()), "cancel", true);
                    }
                    break;
                }
            }
            else if (status == 3 || status == 4) //Cuando se ha cerrado el ticket, actualizar
            {
                info.IdEstatusTaks = status;
                switch (status)
                {
                case 3:
                    //notify.CreateNotification(string.Format("ha marcado tu ticket ({0}) como", info.Asunto), "Aprobado", info.IdTaks.ToString(), info.Creadopor, int.Parse(Session["IdUser"].ToString()), "check_circle");
                    notify.CreateNotification(string.Format("ha marcado tu ticket ({0}) como", info.Asunto), "Completado", Url.Action("TicketDetail", "Tickets", new { ticketID = info.IdTaks }), info.Creadopor, int.Parse(Session["IdUser"].ToString()), "check_circle", true);
                    break;

                case 4:
                    //notify.CreateNotification(string.Format("ha marcado tu ticket ({0}) como", info.Asunto), "Rechazado", info.IdTaks.ToString(), info.Creadopor, int.Parse(Session["IdUser"].ToString()), "cancel");
                    notify.CreateNotification(string.Format("ha marcado tu ticket ({0}) como", info.Asunto), "Cancelado", Url.Action("TicketDetail", "Tickets", new { ticketID = info.IdTaks }), info.Creadopor, int.Parse(Session["IdUser"].ToString()), "cancel", true);
                    break;
                }

                info.FCierre    = DateTime.Now;
                info.IdAtencion = int.Parse(Session["IdUser"].ToString());
            }

            error = tickets.ChangeStatus(info); //Cambiamos el estado del ticket

            return(Json(new
            {
                msg = "Successfully added "
            }));
        }