private AttachmentItem PackageImage(MemoryStream memoryStream, RegistrationModel model)
        {
            AttachmentItem item = new AttachmentItem();
            MemoryStream   m    = new MemoryStream();

            m.Seek(0, SeekOrigin.Begin);
            memoryStream.Seek(0, SeekOrigin.Begin);
            memoryStream.CopyTo(m);
            m.Seek(0, SeekOrigin.Begin);
            memoryStream.Seek(0, SeekOrigin.Begin);
            item.Content  = m;
            item.MimeType = DriveApiService.GetMimeType(Path.GetExtension(model.FileName));
            item.Name     = model.FileName;

            return(item);
        }
        private AttachmentItem PackageImage(MemoryStream memoryStream, string orgfilename)
        {
            AttachmentItem item = new AttachmentItem();
            MemoryStream   m    = new MemoryStream();

            m.Seek(0, SeekOrigin.Begin);
            memoryStream.Seek(0, SeekOrigin.Begin);
            memoryStream.CopyTo(m);
            m.Seek(0, SeekOrigin.Begin);
            memoryStream.Seek(0, SeekOrigin.Begin);
            item.Content  = m;
            item.MimeType = DriveApiService.GetMimeType(Path.GetExtension(orgfilename));
            item.Name     = orgfilename;

            return(item);
        }
Exemple #3
0
        private List <AttachmentItem> PackageImages(List <StateTaxRegistrationInternal> internalregs)
        {
            List <AttachmentItem> items = new List <AttachmentItem>();

            foreach (StateTaxRegistrationInternal inreg in internalregs)
            {
                AttachmentItem aitem = new AttachmentItem();
                MemoryStream   m     = new MemoryStream();
                m.Seek(0, SeekOrigin.Begin);
                inreg.InternalMemStream.CopyTo(m);
                m.Seek(0, SeekOrigin.Begin);
                aitem.Content  = m;
                aitem.MimeType = DriveApiService.GetMimeType(Path.GetExtension(inreg.FileName));
                aitem.Name     = inreg.FileName;
                items.Add(aitem);
            }


            return(items);
        }