Beispiel #1
0
        private void LoadAttachments(MailEntity mail, Message message)
        {
            ExtraEntity extra; //ExtraType: (0 = attachment) (1 = embbed object) (2 = unknown)

            foreach (MimePart attachment in message.Attachments)
            {
                extra            = new ExtraEntity();
                extra.ExtraType  = 0;
                extra.FileType   = attachment.MimeType;
                extra.Name       = attachment.Filename;
                extra.Size       = (UInt32)attachment.Size;
                extra.Data       = attachment.BinaryContent;
                extra.MailEntity = mail;
                mail.Extras.Add(extra);
            }

            foreach (MimePart embeddedPart in message.EmbeddedObjects)
            {
                if (embeddedPart.Filename != "")
                {
                    extra                    = new ExtraEntity();
                    extra.ExtraType          = 1;
                    extra.FileType           = embeddedPart.MimeType;
                    extra.Name               = embeddedPart.Filename;
                    extra.Size               = (UInt32)embeddedPart.Size;
                    extra.Data               = embeddedPart.BinaryContent;
                    extra.MailEntity         = mail;
                    extra.EmbObjectContentId = this.TrimAngularBrackets(embeddedPart.ContentId);
                    mail.Extras.Add(extra);
                }
            }

            foreach (MimePart unknownPart in message.UnknownDispositionMimeParts)
            {
                if (unknownPart.Filename != "")
                {
                    extra                    = new ExtraEntity();
                    extra.ExtraType          = 2;
                    extra.FileType           = unknownPart.MimeType;
                    extra.Name               = unknownPart.Filename;
                    extra.Size               = (UInt32)unknownPart.Size;
                    extra.Data               = unknownPart.BinaryContent;
                    extra.EmbObjectContentId = this.TrimAngularBrackets(unknownPart.ContentId);
                    extra.MailEntity         = mail;

                    mail.Extras.Add(extra);
                }
            }
        }
Beispiel #2
0
        public static Extra FindByID(Int64 id, ISession session)
        {
            ExtraEntity extraEntity = session.CreateCriteria <ExtraEntity>()
                                      .Add(Restrictions.Eq("Id", id))
                                      .UniqueResult <ExtraEntity>();

            if (extraEntity == null)
            {
                return(null);
            }
            else
            {
                return(new Extra(extraEntity));
            }
        }
Beispiel #3
0
 public Extra(ExtraEntity entity)
 {
     this.Entity = entity;
 }