Example #1
0
        /// <summary>
        /// 彻底删除已发
        /// </summary>
        /// <param name="keyValue">主键</param>
        public void ThoroughRemoveSentForm(string keyValue)
        {
            EmailContentEntity emailContentEntity = new EmailContentEntity();

            emailContentEntity.F_ContentId  = keyValue;
            emailContentEntity.F_DeleteMark = 2;
            this.BaseRepository().Update(emailContentEntity);
        }
Example #2
0
 /// <summary>
 /// 保存邮件表单(发送、存入草稿、草稿编辑)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="emailContentEntity">邮件实体</param>
 /// <param name="addresssIds">收件人</param>
 /// <param name="copysendIds">抄送人</param>
 /// <param name="bccsendIds">密送人</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, EmailContentEntity emailContentEntity, string addresssIds, string copysendIds, string bccsendIds)
 {
     try
     {
         string[] arrayaddresssId = addresssIds.Split(',');
         string[] arraycopysendId = copysendIds.Split(',');
         string[] arraybccsendId  = bccsendIds.Split(',');
         emailContentEntity.F_AddresssHtml = addresssIds;
         emailContentEntity.F_CopysendHtml = copysendIds;
         emailContentEntity.F_BccsendHtml  = bccsendIds;
         service.SaveForm(keyValue, emailContentEntity, arrayaddresssId, arraycopysendId, arraybccsendId);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #3
0
        /// <summary>
        /// 彻底删除邮件
        /// </summary>
        /// <param name="keyValue">主键</param>
        /// <param name="emailType">邮件类型:unreadMail  starredMail  draftMail  recycleMail  addresseeMail  sendMail</param>
        public void ThoroughRemoveForm(string keyValue, string emailType)
        {
            try
            {
                switch (emailType)
                {
                case "unreadMail":
                    break;

                case "starredMail":
                    break;

                case "draftMail":
                    service.RemoveDraftForm(keyValue);
                    break;

                case "recycleMail":
                    EmailContentEntity emailcontententity = this.GetEntity(keyValue);
                    if (emailcontententity == null)
                    {
                        service.ThoroughRemoveAddresseeForm(keyValue);
                    }
                    else
                    {
                        service.ThoroughRemoveSentForm(keyValue);
                    }
                    break;

                case "addresseeMail":
                    service.ThoroughRemoveAddresseeForm(keyValue);
                    break;

                case "sendMail":
                    service.ThoroughRemoveSentForm(keyValue);
                    break;

                default:
                    break;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #4
0
        /// <summary>
        /// 邮件实体
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <returns></returns>
        public EmailContentEntity GetEntity(string keyValue)
        {
            EmailContentEntity emailContentEntity = service.GetEntity(keyValue);

            return(emailContentEntity);
        }
Example #5
0
        /// <summary>
        /// 保存邮件表单(发送、存入草稿、草稿编辑)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="emailContentEntity">邮件实体</param>
        /// <param name="addresssIds">收件人</param>
        /// <param name="copysendIds">抄送人</param>
        /// <param name="bccsendIds">密送人</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, EmailContentEntity emailContentEntity, string[] addresssIds, string[] copysendIds, string[] bccsendIds)
        {
            if (emailContentEntity.F_SendState == 0)
            {
                if (!string.IsNullOrEmpty(keyValue))
                {
                    emailContentEntity.Modify(keyValue);
                    this.BaseRepository().Update(emailContentEntity);
                }
                else
                {
                    emailContentEntity.Create();
                    this.BaseRepository().Insert(emailContentEntity);
                }
            }
            else
            {
                IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();
                try
                {
                    if (!string.IsNullOrEmpty(keyValue))
                    {
                        emailContentEntity.Modify(keyValue);
                        db.Update(emailContentEntity);
                    }
                    else
                    {
                        emailContentEntity.Create();
                        db.Insert(emailContentEntity);
                    }

                    #region 收件人
                    foreach (var item in addresssIds)
                    {
                        EmailAddresseeEntity emailAddresseeEntity = new EmailAddresseeEntity();
                        emailAddresseeEntity.Create();
                        emailAddresseeEntity.F_ContentId      = emailContentEntity.F_ContentId;
                        emailAddresseeEntity.F_RecipientId    = item;
                        emailAddresseeEntity.F_RecipientState = 0;
                        db.Insert(emailAddresseeEntity);
                    }
                    #endregion

                    #region 抄送人
                    foreach (var item in copysendIds)
                    {
                        EmailAddresseeEntity emailAddresseeEntity = new EmailAddresseeEntity();
                        emailAddresseeEntity.Create();
                        emailAddresseeEntity.F_ContentId      = emailContentEntity.F_ContentId;
                        emailAddresseeEntity.F_RecipientId    = item;
                        emailAddresseeEntity.F_RecipientState = 1;
                        db.Insert(emailAddresseeEntity);
                    }
                    #endregion

                    #region  密送人
                    foreach (var item in bccsendIds)
                    {
                        EmailAddresseeEntity emailAddresseeEntity = new EmailAddresseeEntity();
                        emailAddresseeEntity.Create();
                        emailAddresseeEntity.F_ContentId      = emailContentEntity.F_ContentId;
                        emailAddresseeEntity.F_RecipientId    = item;
                        emailAddresseeEntity.F_RecipientState = 2;
                        db.Insert(emailAddresseeEntity);
                    }
                    #endregion

                    db.Commit();
                }
                catch (System.Exception)
                {
                    db.Rollback();
                    throw;
                }
            }
        }