示例#1
0
        public static string GetTicketAutomationTriggersViewItem(RestCommand command, int triggerID)
        {
            TicketAutomationTriggersViewItem ticketAutomationTriggersViewItem = TicketAutomationTriggersView.GetTicketAutomationTriggersViewItem(command.LoginUser, triggerID);

            if (ticketAutomationTriggersViewItem.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(ticketAutomationTriggersViewItem.GetXml("TicketAutomationTriggersViewItem", true));
        }
示例#2
0
        public static string GetTicketAutomationTriggersView(RestCommand command)
        {
            TicketAutomationTriggersView ticketAutomationTriggersView = new TicketAutomationTriggersView(command.LoginUser);

            ticketAutomationTriggersView.LoadByOrganizationID(command.Organization.OrganizationID);

            if (command.Format == RestFormat.XML)
            {
                return(ticketAutomationTriggersView.GetXml("TicketAutomationTriggersView", "TicketAutomationTriggersViewItem", true, command.Filters));
            }
            else
            {
                throw new RestException(HttpStatusCode.BadRequest, "Invalid data format");
            }
        }
示例#3
0
        public TriggerData GetTrigger(int triggerID)
        {
            TicketAutomationTriggersViewItem trigger = TicketAutomationTriggersView.GetTicketAutomationTriggersViewItem(UserSession.LoginUser, triggerID);

            if (trigger.OrganizationID != UserSession.LoginUser.OrganizationID)
            {
                return(null);
            }

            TicketAutomationActions actions = new TicketAutomationActions(UserSession.LoginUser);

            actions.LoadByTrigger(triggerID);

            TicketAutomationTriggerLogic logic = new TicketAutomationTriggerLogic(UserSession.LoginUser);

            logic.LoadByTrigger(triggerID);

            TriggerData result = new TriggerData();

            result.Trigger    = trigger.GetProxy();
            result.LogicItems = logic.GetTicketAutomationTriggerLogicItemProxies();
            result.Actions    = actions.GetTicketAutomationActionProxies();
            return(result);
        }