Example #1
0
        public void UpdateZendeskTicketWithPDFFile(string pdf64String, string rmaFileName, string amazonBucketURL)
        {
            long.TryParse(TicketNo, out long updateTicketNo);
            bool validURL = amazonBucketURL == string.Empty ? false : true;

            if (updateTicketNo != 0)
            {
                if (pdf64String != string.Empty)
                {
                    byte[] buffer = Convert.FromBase64String(pdf64String);
                    using (MemoryStream stream = new MemoryStream(buffer))
                    {
                        using (MemoryFile file = new MemoryFile(stream, "application/pdf", rmaFileName + ".pdf"))
                        {
                            helper.UpdateZendeskTicketWithPDFFile(updateTicketNo, file, rmaFileName, amazonBucketURL, true, validURL);
                        }
                    }
                }
                else
                {
                    helper.UpdateZendeskTicketWithPDFFile(updateTicketNo, null, rmaFileName, amazonBucketURL, false, validURL);
                }
            }
            else
            {
                throw new Exception("Invalid Zendesk Ticket No. attempting to update"); // prevent invalid tickets from being update due to parsing error
            }
        }
Example #2
0
        public void DownloadRMAPDFManually(string pdf64String, string rmaFileName)
        {
            if (pdf64String != string.Empty)
            {
                byte[]       buffer = Convert.FromBase64String(pdf64String);
                MemoryStream stream = new MemoryStream(buffer);

                using (MemoryFile file = new MemoryFile(stream, "application/pdf", rmaFileName + ".pdf"))
                {
                    HttpContext.Current.Response.Clear();
                    HttpContext.Current.Response.ContentType = "application/pdf";
                    HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=\"" + file.FileName + "\";");
                    HttpContext.Current.Response.OutputStream.Write(buffer, 0, buffer.Length);
                    HttpContext.Current.Response.Flush();
                    HttpContext.Current.Response.End();
                }
            }
        }
Example #3
0
        public long?CreateNewZendeskTicketWithPDFFile(string pdf64String, string rmaFileName, string amazonBucketURL, string emailTo, string customerName, string extDocNo)
        {
            long?newZendeskTicket = 0;
            bool validURL         = amazonBucketURL == string.Empty ? false : true;

            if (pdf64String != string.Empty)
            {
                byte[] buffer = Convert.FromBase64String(pdf64String);
                using (MemoryStream stream = new MemoryStream(buffer))
                {
                    using (MemoryFile file = new MemoryFile(stream, "application/pdf", rmaFileName + ".pdf"))
                    {
                        newZendeskTicket = helper.CreateNewZendeskTicketWithPDFFile(file, rmaFileName, amazonBucketURL, emailTo, customerName, true, extDocNo, validURL);
                    }
                }
            }
            else
            {
                newZendeskTicket = helper.CreateNewZendeskTicketWithPDFFile(null, rmaFileName, amazonBucketURL, emailTo, customerName, false, extDocNo, validURL);
            }

            return(newZendeskTicket);
        }