public static string GetTicketsViewItem(RestCommand command, int ticketID)
        {
            TicketsViewItem ticketsViewItem = TicketsView.GetTicketsViewItem(command.LoginUser, ticketID);

            if (ticketsViewItem.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(ticketsViewItem.GetXml("TicketsViewItem", true));
        }
Ejemplo n.º 2
0
        public static string UnSubscribeFromTicket(RestCommand command, int ticketIDOrNumber, int userId)
        {
            TicketsViewItem ticket = TicketsView.GetTicketsViewItemByIdOrNumber(command.LoginUser, ticketIDOrNumber);

            if (ticket == null || ticket.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }

            Subscriptions.RemoveSubscription(command.LoginUser, userId, ReferenceType.Tickets, ticket.TicketID);

            return(ticket.GetXml("Ticket", true));
        }
Ejemplo n.º 3
0
        public static string DeleteTicket(RestCommand command, int ticketIDOrNumber)
        {
            TicketsViewItem ticketViewItem = TicketsView.GetTicketsViewItemByIdOrNumber(command.LoginUser, ticketIDOrNumber);
            Ticket          ticket         = Tickets.GetTicket(command.LoginUser, ticketViewItem.TicketID);
            string          result         = ticketViewItem.GetXml("Ticket", true);

            if (ticket.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            ticket.Delete();
            ticket.Collection.Save();
            return(result);
        }
Ejemplo n.º 4
0
        // Customer Only Methods

        public static string GetCustomerTicket(RestCommand command, int ticketID)
        {
            TicketsViewItem ticket = TicketsView.GetTicketsViewItemByIdOrNumberForCustomer(command.LoginUser, (int)command.Organization.ParentID, ticketID);

            if (ticket.OrganizationID != command.Organization.ParentID || !ticket.GetIsCustomer(command.Organization.OrganizationID))
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }

            Tags tags = new Tags(command.LoginUser);

            tags.LoadByReference(ReferenceType.Tickets, ticket.TicketID, command.Organization.ParentID);

            return(ticket.GetXml("Ticket", true, tags));
        }