Ejemplo n.º 1
0
        public static string CreateCustomerTicket(RestCommand command)
        {
            Tickets tickets = new Tickets(command.LoginUser);
            Ticket  ticket  = tickets.AddNewTicket();

            ticket.OrganizationID = (int)command.Organization.ParentID;
            ticket.TicketSource   = "API";
            ticket.NeedsIndexing  = true;
            string description = string.Empty;
            int?   contactID   = null;
            int?   customerID  = null;

            ticket.FullReadFromXml(command.Data, true, ref description, ref contactID, ref customerID);
            ticket.Collection.Save();
            ticket.UpdateCustomFieldsFromXml(command.Data);

            Actions actions = new Actions(command.LoginUser);

            Data.Action action = actions.AddNewAction();
            action.ActionTypeID       = null;
            action.Name               = "Description";
            action.SystemActionTypeID = SystemActionType.Description;
            action.Description        = description;
            action.IsVisibleOnPortal  = ticket.IsVisibleOnPortal;
            action.IsKnowledgeBase    = ticket.IsKnowledgeBase;
            action.TicketID           = ticket.TicketID;
            actions.Save();

            tickets.AddOrganization(command.Organization.OrganizationID, ticket.TicketID);
            UpdateFieldsOfSeparateTable(command, ticket, true);
            return(TicketsView.GetTicketsViewItem(command.LoginUser, ticket.TicketID).GetXml("Ticket", true));
        }