예제 #1
0
        /// <summary>
        /// Uploads a text based file to the current ticket. You need to pass a string, and the mime type of a text based file (html, text, etc...).
        /// </summary>
        /// <param name="text">
        /// The content of the text based file.
        ///</param>
        /// <param name="creds">
        /// The parature credentials class for the APIs.
        /// </param>
        /// <param name="contentType">
        /// The type of content being uploaded, you have to make sure this is the right text.
        /// </param>
        /// <param name="fileName">
        /// The name you woule like the attachment to have.
        ///</param>
        public void AddAttachment(ParaService service, string text, string contentType, string fileName)
        {
            var encoding = new ASCIIEncoding();
            var bytes    = encoding.GetBytes(text);

            Ticket_Attachments.Add(service.UploadFile <Ticket>(bytes, contentType, fileName));
        }
예제 #2
0
        /// <summary>
        /// If you have an attachment and would like to delete, just pass the id here.
        /// </summary>
        public bool DeleteAttachment(string attachmentGuid)
        {
            if (Ticket_Attachments == null)
            {
                return(false);
            }

            var matchingAtt = Ticket_Attachments.FirstOrDefault(at => at.Guid == attachmentGuid);

            if (matchingAtt != null)
            {
                Ticket_Attachments.Remove(matchingAtt);
                if (Ticket_Attachments.Any() == false)
                {
                    AllowDeleteAllAttachments = true;
                }
                return(true);
            }

            return(false);
        }
예제 #3
0
 /// <summary>
 /// If you have an attachment and would like to replace the file, use this method. It will actually delete
 /// the existing attachment, and then add a new one to replace it.
 /// </summary>
 public void UpdateAttachment(ParaService service, Byte[] attachment, string attachmentGuid, string contentType, string fileName)
 {
     DeleteAttachment(attachmentGuid);
     Ticket_Attachments.Add(service.UploadFile <Ticket>(attachment, contentType, fileName));
 }
예제 #4
0
 public void AttachmentsUpdate(ParaCredentials creds, Byte[] attachment, string attachmentGuid, string contentType, string fileName)
 {
     AttachmentsDelete(attachmentGuid);
     Ticket_Attachments.Add(ApiHandler.Ticket.AddAttachment(creds, attachment, contentType, fileName));
 }
예제 #5
0
 public void AttachmentsAdd(ParaCredentials creds, string text, string contentType, string fileName)
 {
     Ticket_Attachments.Add(ApiHandler.Ticket.AddAttachment(creds, text, contentType, fileName));
 }
예제 #6
0
 ///  <summary>
 ///  Uploads an attachment to the current ticket.
 ///  The attachment will also be added to the current Ticket's attachments collection. To complete attachment, the Update method should be performed on the attachment.
 ///  </summary>
 ///  <param name="attachment">
 ///  The binary Byte array of the attachment you would like to add.
 /// </param>
 /// <param name="fileName"></param>
 public void AddAttachment(ParaService service, Byte[] attachment, string contentType, string fileName)
 {
     Ticket_Attachments.Add(service.UploadFile <Ticket>(attachment, contentType, fileName));
 }