/// <summary>
        /// Create an EmailDocumentEntity object based on DocumentEntity object
        /// </summary>
        /// <param name="documentEntity"> Document Entity object to be converted</param>
        /// <returns> Converted EmailDocumentEntity </returns>
        private static EmailDocumentEntity ConvertDocumentEntityToEmailDocumentEntity(DocumentEntity documentEntity)
        {
            EmailDocumentEntity emailDocumentEntity = new EmailDocumentEntity
            {
                DocumentID = documentEntity.DocumentID,
                MIMEType= documentEntity.MIMEType,                
            };

            emailDocumentEntity.Files.AddRange(documentEntity.Files);
            emailDocumentEntity.Tags.AddRange(documentEntity.Tags);

            return emailDocumentEntity;
        }
        /// <summary>
        /// Obtain list of email document object specific properties from document entities. (Document entities are deserialized from EDRM XML)
        /// </summary>
        /// <param name="documentEntities">emailDocumentEntities</param>
        /// <returns> email document entities </returns>
        private IEnumerable<EmailDocumentEntity> InitializeEmailDocumentEntity(IEnumerable<DocumentEntity> documentEntities)
        {
            List<EmailDocumentEntity> emailDocumentEntities = new List<EmailDocumentEntity>();
            TagEntity tagEntity = null;
            foreach (DocumentEntity documentEntity in documentEntities)
            {
                EmailDocumentEntity emailDocument = ConvertDocumentEntityToEmailDocumentEntity(documentEntity);

                #region Unused logical properties - use them when required.                
                /*
                 * Below are logical properties in a email document entity - they are not needed in current system, hence to improve performance commenting out this code.
                 * This shall be used need basis
                 * 
                tagEntity = documentEntity.Tags.FirstOrDefault<TagEntity>(p => p.TagName.ToString().Equals(Constants.TagNameDateReceived));
                emailDocument.DateReceived = (tagEntity != null)? (DateTime)ConvertTypeAndSuppressError(tagEntity.TagValue, typeof(DateTime)):DateTime.MinValue;

                tagEntity = documentEntity.Tags.FirstOrDefault<TagEntity>(p => p.TagName.ToString().Equals(Constants.TagNameDateSent));
                emailDocument.DateSent = (tagEntity != null)?(DateTime)ConvertTypeAndSuppressError(tagEntity.TagValue, typeof(DateTime)):DateTime.MinValue;

                tagEntity = documentEntity.Tags.FirstOrDefault<TagEntity>(p => p.TagName.ToString().Equals(Constants.TagNameFrom));
                emailDocument.From =(tagEntity != null)? tagEntity.TagValue.ToString() : string.Empty;

                tagEntity = documentEntity.Tags.FirstOrDefault<TagEntity>(p => p.TagName.ToString().Equals(Constants.TagNameIsDeliveryReceiptSet));
                emailDocument.IsDeliveryReceiptSet = (tagEntity != null)?(Boolean)ConvertTypeAndSuppressError(tagEntity.TagValue.ToString(), typeof(Boolean)):false;

                tagEntity = documentEntity.Tags.FirstOrDefault<TagEntity>(p => p.TagName.ToString().Equals(Constants.TagNameIsReadReceiptSet));
                emailDocument.IsReadReceiptSet = (tagEntity != null)?(Boolean)ConvertTypeAndSuppressError(tagEntity.TagValue.ToString(), typeof(Boolean)):false;                

                tagEntity = documentEntity.Tags.FirstOrDefault<TagEntity>(p => p.TagName.ToString().Equals(Constants.TagNameSubject));
                emailDocument.Subject = (tagEntity != null)?tagEntity.TagValue.ToString():string.Empty;

                tagEntity = documentEntity.Tags.FirstOrDefault<TagEntity>(p => p.TagName.ToString().Equals(Constants.TagNameTo));
                emailDocument.To = (tagEntity != null)?tagEntity.TagValue.ToString() : string.Empty;
                 */
                #endregion

                tagEntity = documentEntity.Tags.FirstOrDefault(p => p.TagName.ToString(CultureInfo.InvariantCulture).Equals(Constants.TagNameMessageId));
                emailDocument.MessageID = (tagEntity != null) ? tagEntity.TagValue : string.Empty;

                emailDocumentEntities.Add(emailDocument);
            }
            return emailDocumentEntities;            
        }
示例#3
0
        /// <summary>
        /// Transform data from base class to derved class entity.
        /// </summary>
        /// <param name="emailDocument"> base class entity emailDocumentEntity to be transformed </param>
        /// <returns> final outlook email document entity </returns>
        private static OutlookEMailDocumentEntity TransformEmailDocumentEntityToOutlookEMailDocument(EmailDocumentEntity emailDocument)
        {
            OutlookEMailDocumentEntity outlookEMailDocumentEntity = new OutlookEMailDocumentEntity
            {
                DocumentID = emailDocument.DocumentID,
                MIMEType   = emailDocument.MIMEType,
            };

            outlookEMailDocumentEntity.Files.AddRange(emailDocument.Files);
            outlookEMailDocumentEntity.Tags.AddRange(emailDocument.Tags);
            outlookEMailDocumentEntity.MessageID = emailDocument.MessageID;

            #region Unused logical properties - use them when required.

            /*
             * Below are logical properties in a email document entity - they are not needed in current system, hence to improve performance commenting out this code.
             * This shall be used need basis
             * outlookEMailDocumentEntity.DateReceived = emailDocument.DateReceived;
             * outlookEMailDocumentEntity.DateSent = emailDocument.DateSent;
             * outlookEMailDocumentEntity.From = emailDocument.From;
             * outlookEMailDocumentEntity.IsDeliveryReceiptSet = emailDocument.IsDeliveryReceiptSet;
             * outlookEMailDocumentEntity.IsReadReceiptSet = emailDocument.IsReadReceiptSet;
             * outlookEMailDocumentEntity.Subject = emailDocument.Subject;
             * outlookEMailDocumentEntity.To = emailDocument.To;
             *
             */

            #endregion

            return(outlookEMailDocumentEntity);
        }
        /// <summary>
        /// Transform data from base class to derved class entity.
        /// </summary>
        /// <param name="emailDocument"> base class entity emailDocumentEntity to be transformed </param>
        /// <returns> final lotus notes email document entity </returns>
        private LotusNotesEMailDocumentEntity TransformEmailDocumentEntityToLotusNotesEmailDocumentEntity(EmailDocumentEntity emailDocument)
        {
            LotusNotesEMailDocumentEntity lotusNotesEmailDocumentEntity = new LotusNotesEMailDocumentEntity
            {
                DocumentID = emailDocument.DocumentID,
                MIMEType = emailDocument.MIMEType
            };

            lotusNotesEmailDocumentEntity.Files.AddRange(emailDocument.Files);
            lotusNotesEmailDocumentEntity.Tags.AddRange(emailDocument.Tags);
            lotusNotesEmailDocumentEntity.MessageID = emailDocument.MessageID;
           
            #region Unused logical properties - use them when required.                
            /*
            * Below are logical properties in a email document entity - they are not needed in current system, hence to improve performance commenting out this code.
            * This shall be used need basis

            lotusNotesEmailDocumentEntity.DateReceived = emailDocument.DateReceived;
            lotusNotesEmailDocumentEntity.DateSent = emailDocument.DateSent;
            lotusNotesEmailDocumentEntity.From = emailDocument.From;
            lotusNotesEmailDocumentEntity.IsDeliveryReceiptSet = emailDocument.IsDeliveryReceiptSet;
            lotusNotesEmailDocumentEntity.IsReadReceiptSet = emailDocument.IsReadReceiptSet;            
            lotusNotesEmailDocumentEntity.Subject = emailDocument.Subject;
            lotusNotesEmailDocumentEntity.To = emailDocument.To;
           */
            #endregion

            return lotusNotesEmailDocumentEntity;
        }