Exemplo n.º 1
0
        /// <summary>
        /// 设置邮件星标/取消星标
        /// </summary>
        /// <param name="keyValue">主键</param>
        /// <param name="asterisk">星标:0-取消星标1-星标</param>
        public void SteriskEmail(string keyValue, int sterisk = 1)
        {
            EmailAddresseeEntity emailAddresseeEntity = new EmailAddresseeEntity();

            emailAddresseeEntity.F_AddresseeId = keyValue;
            emailAddresseeEntity.F_IsHighlight = sterisk;
            new RepositoryFactory().BaseRepository().Update(emailAddresseeEntity);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除未读、星标、收件
        /// </summary>
        /// <param name="keyValue">主键</param>
        public void RemoveAddresseeForm(string keyValue)
        {
            EmailAddresseeEntity emailAddresseeEntity = new EmailAddresseeEntity();

            emailAddresseeEntity.F_AddresseeId = keyValue;
            emailAddresseeEntity.F_DeleteMark  = 1;
            new RepositoryFactory().BaseRepository().Update(emailAddresseeEntity);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 设置邮件已读/未读
        /// </summary>
        /// <param name="keyValue">主键</param>
        /// <param name="IsRead">是否已读:0-未读1-已读</param>
        public void ReadEmail(string keyValue, int IsRead = 1)
        {
            EmailAddresseeEntity emailAddresseeEntity = new EmailAddresseeEntity();

            emailAddresseeEntity.F_AddresseeId = keyValue;
            emailAddresseeEntity.F_IsRead      = IsRead;
            emailAddresseeEntity.F_ReadCount   = emailAddresseeEntity.F_ReadCount + 1;
            emailAddresseeEntity.F_ReadDate    = DateTime.Now;
            new RepositoryFactory().BaseRepository().Update(emailAddresseeEntity);
        }
Exemplo n.º 4
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;
                }
            }
        }