/// <summary> /// Internal Method to run an Action, independently from the module. /// </summary> internal static ApiCallResponse ActionRun <TEntity>(Int64 objectId, ParaObjects.Action action, ParaCredentials pc) where TEntity : ParaEntity { var doc = XmlGenerator.GenerateActionXml <TEntity>(action); var ar = ApiCallFactory.ObjectCreateUpdate <TEntity>(pc, doc, objectId); return(ar); }
/// <summary> /// Generate the XML needed to run an action. /// </summary> static public XmlDocument GenerateActionXml(Action obj, string module) { var doc = new XmlDocument(); var objNode = doc.CreateElement("Action"); var actionWrapperNode = doc.CreateElement(module); var actionNode = doc.CreateElement("Action"); var attribute = doc.CreateAttribute("id"); attribute.Value = obj.Id.ToString(); objNode.Attributes.Append(attribute); if (obj.TimeSpentHours > 0) { XmlGenerateElement(doc, objNode, "TimeSpentHours", obj.TimeSpentHours.ToString()); } if (obj.TimeSpentMinutes > 0) { XmlGenerateElement(doc, objNode, "TimeSpentMinutes", obj.TimeSpentMinutes.ToString()); } if (obj.EmailCustList != null) { if (obj.EmailCustList.Count > 0) { XmlGenerateElementFromArray(doc, objNode, "EmailCustList", obj.EmailCustList, ","); } } if (obj.EmailCsrList != null) { if (obj.EmailCsrList.Count > 0) { XmlGenerateElementFromArray(doc, objNode, "EmailCsrList", obj.EmailCsrList, ","); } } if (module == "Ticket") { XmlGenerateElement(doc, objNode, "ShowToCust", obj.ShowToCust.ToString().ToLower()); } if (obj.Comment != null) { if (string.IsNullOrEmpty(obj.Comment) == false) { XmlGenerateElement(doc, objNode, "Comment", obj.Comment); } } if (obj.EmailText != null) { if (string.IsNullOrEmpty(obj.EmailText) == false) { XmlGenerateElement(doc, objNode, "EmailText", obj.EmailText); } } if (obj.AssignToQueue != null && obj.AssignToQueue > 0) { XmlGenerateElement(doc, objNode, "AssignToQueue", obj.AssignToQueue.ToString()); } if (obj.AssignToCsr != null && obj.AssignToCsr > 0) { XmlGenerateElement(doc, objNode, "AssignToCsr", obj.AssignToCsr.ToString()); } if (obj.Action_Attachments != null && obj.Action_Attachments.Any()) { var node = XmlGenerateAttachmentNodes(doc, "Action_Attachments", obj.Action_Attachments); objNode.AppendChild(node); } actionNode.AppendChild(objNode); actionWrapperNode.AppendChild(actionNode); doc.AppendChild(actionWrapperNode); return(doc); }
static public XmlDocument GenerateActionXml <TEntity>(Action obj) where TEntity : ParaEntity { return(GenerateActionXml(obj, typeof(TEntity).Name)); }
/// <summary> /// Run an action on a ticket. /// If you need to add an attachment, run the AttachmentToAction method first! /// </summary> /// <param name="ticketId">Id of the ticket</param> /// <param name="action">Action object, which should be one of the Actions retrieved in GetAvailableTicketActions.</param> /// <returns></returns> public static ApiCallResponse RunAction(long ticketId, Action action) { return Service.RunActionOn<Ticket>(ticketId, action); }
/// <summary> /// Before running an action, attachments need to be uploaded to the server and a GUID retrieved /// This requires an API call first, and must occur before the action is run /// The GUID returned is temporary, and will expire after a while /// </summary> /// <param name="action"></param> public static void AddAttachmentToAction(Action action) { action.AddAttachment(Service, "Contents of the file", "text/plain", "attachment1.txt"); }
public static ApiCallResponse ActionRun(Int64 assetId, Action action, ParaCredentials creds) { var ar = ApiUtils.ActionRun <ParaObjects.Asset>(assetId, action, creds); return(ar); }
public ApiCallResponse RunActionOn <TEntity>(long entityId, ParaObjects.Action action) where TEntity : ParaEntity, IActionRunner, new() { return(ApiUtils.ActionRun <TEntity>(entityId, action, Credentials)); }
/// <summary> /// Before running an action, attachments need to be uploaded to the server and a GUID retrieved /// This requires an API call first, and must occur before the action is run /// The GUID returned is temporary, and will expire after a while /// </summary> /// <param name="action"></param> public static void AddAttachmentToAction(Action action) { action.AddAttachment(Service, "Contents of the file", "text/plain", "attachment1.txt"); }
/// <summary> /// Run an action on a ticket. /// If you need to add an attachment, run the AttachmentToAction method first! /// </summary> /// <param name="ticketId">Id of the ticket</param> /// <param name="action">Action object, which should be one of the Actions retrieved in GetAvailableTicketActions.</param> /// <returns></returns> public static ApiCallResponse RunAction(long ticketId, Action action) { return(Service.RunActionOn <Ticket>(ticketId, action)); }
public static ApiCallResponse ActionRun(Int64 ticketId, Action action, ParaCredentials pc) { var ar = ApiUtils.ActionRun <ParaObjects.Ticket>(ticketId, action, pc); return(ar); }