示例#1
0
        /// <summary>
        /// 发送处理结果到提交者(用户)邮箱
        /// </summary>
        /// <param name="advice"></param>
        /// <param name="reply"></param>
        /// <param name="adviceType"></param>
        /// <returns></returns>
        public bool SendResultMailToAdvicer(Advice advice, AdviceReply reply, AdviceType adviceType, AdviceEmailConfigInfo info)
        {
            try
            {
                if (adviceType == null)
                {
                    adviceType = AdviceTypeHelper.GetAdviceType(advice.TypeID);
                }

                string     userEmail    = advice.Email;
                MailHelper mailHelper   = GetMailHelper(adviceType);
                string     siteFullName = GeneralConfigs.GetConfig().SiteFullName;
                //string body = "尊敬的{0}先生/女士:您好!<br><br>";
                //body += "我们于{1}接收到您的反馈信息({2}),有关部门已做出处理,现答复如下:<br><br>";
                //body += "{3}<br><br>";
                //body += "感谢您的参与!<br>";
                //body += "{4}";
                //body = string.Format(body, advice.Name, advice.CreateDate.ToLongDateString(), advice.Title, reply.Content, GeneralConfigs.GetConfig().SiteFullName+ "|" + SiteConfigs.GetConfig().RootUrl);
                info.EmailContent = info.EmailContent.Replace("{UserName}", advice.Name).Replace("{DateTime}", advice.CreateDate.ToLongDateString()).Replace("{Title}", advice.Title).Replace("{EmailContent}", reply.Content).Replace("{SiteFullName}", GeneralConfigs.GetConfig().SiteFullName);
                string subject  = info.EmailTitle.Replace("{SiteTitle}", GeneralConfigs.GetConfig().SiteTitle.Trim().Replace("\n", "")).Replace("{AdviceTitle}", advice.Title);
                string priority = "Normal";//过期提示,优先级别

                mailHelper.Send(userEmail, mailHelper.AdminEmail, subject, info.EmailContent, priority);

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 发送通知邮件给系统管理员"新反馈邮件通知受理人"
        /// </summary>
        /// <param name="adviceID">咨询投诉ID</param>
        public void SendNotifyMail(string adviceID)
        {
            //得到反馈类型
            Advice     advice     = GetAdvice(adviceID);
            AdviceType adviceType = AdviceTypeHelper.GetAdviceType(advice.TypeID);

            if (advice != null)
            {
                if (adviceType.MailMode != null && adviceType.MailMode != "")
                {
                    string[] mailMode = adviceType.MailMode.Split(new string[] { "0" }, StringSplitOptions.None);
                    //判断是否需要发送邮件
                    for (int i = 0; i < mailMode.Length; i++)
                    {
                        if (mailMode[i].Trim() != "")
                        {
                            if (Convert.ToInt32(mailMode[i]) == (int)MailMode.MailNotify)
                            {
                                AdviceEmailConfigs    adviceEmailConfigs = new AdviceEmailConfigs();
                                AdviceEmailConfigInfo info = adviceEmailConfigs["Accept"];
                                //取得所有受理人
                                string        content   = "Advice.Accept";
                                List <string> receivers = GetAllReceivers(adviceType.ID, content);
                                //转化为接收人列表
                                string     toEmail    = GetEmailByAccountID(receivers);
                                MailHelper mailHelper = GetMailHelper(adviceType);
                                string     body       = BuildSingleMailBody(advice.ID, "", info);
                                string     must       = "";    //必须回复
                                string     priority   = "Low"; //过期提示,优先级别
                                if (advice.MustHandle >= 1)
                                {
                                    must = "<b>此信息为必须回复;</b>";
                                    int days = GetWorkingDays(advice.CreateDate);
                                    if (days >= adviceType.RemindDays)
                                    {
                                        priority = "High";
                                    }
                                }
                                string subject = info.EmailTitle.Replace("{EmailTitle}", advice.Title) + must;
                                //发送邮件
                                mailHelper.Send(toEmail, mailHelper.AdminEmail, subject, body, priority);
                            }
                        }
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// 发送通知邮件给办理人(带办理备注)
        /// </summary>
        /// <param name="list">反馈信息ID集合</param>
        /// <param name="replyUserID"></param>
        /// <param name="adviceTypeID"></param>
        /// <param name="remark">办理备注</remark>
        /// <param name="priority">邮件优先级</remark>
        public void SendMailToHandler(List <string> list, string replyUserID, string adviceTypeID, string remark, string priority)
        {
            AdviceType adviceType  = AdviceTypeHelper.GetAdviceType(adviceTypeID);
            string     tmpMailMode = adviceType.MailMode;

            if (tmpMailMode == null || tmpMailMode == "")
            {
                return;
            }
            string[] mailMode = tmpMailMode.Split(new string[] { "0" }, StringSplitOptions.None);
            for (int i = 0; i < mailMode.Length; i++)
            {
                AdviceEmailConfigs    adviceEmailConfigs = new AdviceEmailConfigs();
                AdviceEmailConfigInfo info = adviceEmailConfigs["Handle"];
                //判断是否需要发送邮件
                if (Convert.ToInt32("0" + mailMode[i]) == (int)MailMode.MailHyperLink)
                {
                    //发送链接
                    if (replyUserID.Trim() != "")
                    {
                        string userEmail = AccountHelper.GetAccount(replyUserID, new string[] { "Email", "ID" }).Email;
                        Dictionary <string, string> dictionary = GetAdviceIDAndHtml(list);
                        MailHelper    mailHelper = GetMailHelper(adviceType);
                        StringBuilder sbBody     = new StringBuilder("");
                        if (!string.IsNullOrEmpty(remark))
                        {
                            sbBody.Append("办理备注:<br/>");
                            sbBody.Append(remark + "<br/>");
                        }
                        sbBody.Append(BuildEmailBody(dictionary, info));
                        string subject = info.EmailTitle.Replace("{EmailTitle}", "数量:" + dictionary.Count.ToString());
                        mailHelper.Send(userEmail, mailHelper.AdminEmail, subject, sbBody.ToString(), priority);
                    }
                }
                else if (Convert.ToInt32("0" + mailMode[i]) == (int)MailMode.HandleByMail)
                {
                    //发送直接办理邮件
                    foreach (string id in list)
                    {
                        SendHandleMail(id, replyUserID, adviceType, remark, priority, info);
                        //等待几秒
                    }
                }
            }
        }
示例#4
0
        /// <summary>
        /// 根据反馈获取审核信息
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        public Processing GetAdviceProcess(Advice a)
        {
            if (a == null)
            {
                return(null);
            }
            else
            {
                Processing p = new Processing();
                if (string.IsNullOrEmpty(a.ProcessState))
                {
                    p.CurLayerNO = "-1";
                }
                else
                {
                    p.CurLayerNO = a.ProcessState;
                }

                p.ProcessDirection = a.ProcessDirection;
                p.ObjectID         = a.ID;
                p.FromOtherSite    = false;
                p.AdviceState      = (AdviceState)a.State;
                if (We7Helper.IsNumber(a.ProcessState) && ((ProcessStates)int.Parse(a.ProcessState)) == ProcessStates.Unaudit)
                {
                    p.AdviceState = AdviceState.WaitAccept;
                }

                AdviceType type = AdviceTypeHelper.GetAdviceType(a.TypeID);
                if (type != null)
                {
                    if (!string.IsNullOrEmpty(type.ProcessEnd) && We7Helper.IsNumber(type.ProcessEnd))
                    {
                        p.ProcessEndAction = (ProcessEnding)(int.Parse(type.ProcessEnd));
                    }
                    p.ProcessTotalLayer = type.FlowSeries;
                }
                p = FillDataByFlowXml(p, (ProcessObject)a);
                return(p);
            }
        }
示例#5
0
        /// <summary>
        /// 创建一封邮件(带连接进入后台办理)
        /// </summary>
        /// <param name="id">反馈实体ID</param>
        /// <param name="html"></param>
        /// <returns></returns>
        string BuildSingleMailBody(string id, string html, AdviceEmailConfigInfo info)
        {
            Advice     a          = GetAdvice(id);
            AdviceType adviceType = AdviceTypeHelper.GetAdviceType(a.TypeID);
            string     must       = "";
            string     priority   = "";//过期提示,优先级别

            if (a.MustHandle >= 1)
            {
                must = "<b>此信息为必须回复;</b>";
                int days = GetWorkingDays(a.CreateDate);
                if (adviceType != null)
                {
                    if (days >= adviceType.RemindDays)
                    {
                        priority = "<b>此信息已超过" + days + "个工作日还未办理,请即刻办理!</b>";
                    }
                }
            }
            HttpRequest Request = HttpContext.Current.Request;
            string      rootUrl = "http://" + Request.Url.Host;

            if (Request.Url.Port != 80)
            {
                rootUrl += ":" + Request.Url.Port.ToString();
            }
            if (string.IsNullOrEmpty(html))
            {
                html = info.EmailContent;
            }
            html = html.Replace("{priority}", priority).Replace("{must}", must).Replace("{SiteUrl}", rootUrl).Replace("{id}", id).Replace("{title}", a.Title).Replace("{DateTime}", DateTime.Now.ToString()).Replace("{SiteFullName}", GeneralConfigs.GetConfig().SiteFullName);
            string handleUrl = rootUrl + "/admin/Advice/AdviceDetail.aspx?from=advice&ID=" + id;

            html = html.Replace("{HandleUrl}", handleUrl);

            return(html);
        }
示例#6
0
        /// <summary>
        /// 根据回复邮件更新反馈回复
        /// 此方法仅用于反射环境
        /// </summary>
        /// <param name="subject">标题</param>
        /// <param name="sn">反馈信息流水号</param>
        /// <param name="body">回复内容</param>
        /// <param name="replyTime">回复时间</param>
        /// <returns></returns>
        public bool UpdateReplyByEmail(string subject, string sn, string body, string replyTime, string rawManage, string user, string stateText)
        {
            int           start = sn.IndexOf("#");
            HelperFactory hf    = (HelperFactory)HttpContext.Current.Application[HelperFactory.ApplicationID];

            Assistant = hf.Assistant;
            AdviceReplyHelper arh = new AdviceReplyHelper();

            arh.Assistant = hf.Assistant;
            string adviceSN = sn.Remove(start, 1);

            if (adviceSN != "")
            {
                int intAdviceSN = 0;
                if (!int.TryParse(adviceSN, out intAdviceSN))
                {
                    return(false);
                }
                Criteria c = new Criteria(CriteriaType.Equals, "SN", adviceSN);
                if (Assistant.Count <Advice>(c) < 0)
                {
                    return(false);
                }
                else
                {
                    List <Advice> advice = Assistant.List <Advice>(c, null);
                    for (int i = 0; i < advice.Count; i++)
                    {
                        if (advice != null)
                        {
                            //处理反馈回复信息
                            AdviceReply adviceReply = new AdviceReply();
                            adviceReply.AdviceID = advice[i].ID;
                            adviceReply.Title    = subject;
                            adviceReply.Content  = body;
                            Account account = AccountHelper.GetAccountByEmail(user);
                            if (account == null)
                            {
                                return(true);
                            }
                            adviceReply.UserID     = account.ID;
                            adviceReply.MailBody   = rawManage;
                            adviceReply.CreateDate = DateTime.Now;
                            adviceReply.Updated    = DateTime.Now;

                            //更新反馈信息
                            advice[i].ReplyCount         += 1;//增加回复数
                            advice[i].Updated             = DateTime.Now;
                            advice[i].ToHandleTime        = Convert.ToDateTime(replyTime);
                            advice[i].ToOtherHandleUserID = adviceReply.UserID;
                            if (stateText == "上报办理")
                            {
                                advice[i].State        = (int)AdviceState.Checking;
                                advice[i].ProcessState = ((int)AdviceState.Checking).ToString();
                            }
                            else
                            {
                                advice[i].State        = (int)AdviceState.Finished;
                                advice[i].ProcessState = ((int)ProcessStates.Finished).ToString();
                            }
                            advice[i].IsRead = 1;

                            //处理反馈进度
                            Processing ap = ProcessingHelper.GetAdviceProcess(advice[i]);
                            if (ap == null)
                            {
                                ap                  = new Processing();
                                ap.ObjectID         = advice[i].ID;
                                ap.CurLayerNO       = "1";
                                ap.ProcessAccountID = adviceReply.UserID;
                                ap.ProcessDirection = "1";
                                ap.Remark           = "";
                                ap.CreateDate       = DateTime.Now;
                            }
                            ap.UpdateDate       = DateTime.Now;
                            ap.ProcessAccountID = adviceReply.UserID;
                            ap.ProcessDirection = advice[i].ProcessDirection = "1";

                            #region 孟添加
                            AdviceType adviceType = AdviceTypeHelper.GetAdviceType(advice[i].TypeID);
                            switch (advice[i].State)
                            {
                            case (int)AdviceState.All:
                                break;

                            case (int)AdviceState.WaitAccept:
                            case (int)AdviceState.WaitHandle:
                            case (int)AdviceState.Finished:
                                break;

                            case (int)AdviceState.Checking:
                                int auditLevel = 0;
                                if (We7Helper.IsNumber(advice[i].ProcessState))
                                {
                                    auditLevel = int.Parse(advice[i].ProcessState);
                                }
                                if (auditLevel < 0)
                                {
                                    auditLevel = 0;
                                }
                                auditLevel += 1;
                                if (auditLevel > adviceType.FlowSeries)
                                {
                                    advice[i].ProcessState = ((int)AdviceState.Finished).ToString();
                                    advice[i].State        = (int)AdviceState.Finished;
                                    advice[i].MustHandle   = 0;
                                }
                                else
                                {
                                    advice[i].ProcessState = auditLevel.ToString();
                                }
                                break;

                            default:
                                break;
                            }
                            ap.CurLayerNO = advice[i].ProcessState;
                            #endregion

                            OperationAdviceInfo(adviceReply, advice[i], ap);
                            if (advice[i].State == (int)AdviceState.Finished)
                            {
                                AdviceEmailConfigs    adviceEmailConfigs = new AdviceEmailConfigs();
                                AdviceEmailConfigInfo info = adviceEmailConfigs["ReplyUser"];
                                SendResultMailToAdvicer(advice[i], adviceReply, null, info);
                            }
                            if (stateText == "上报办理")
                            {
                                advice[i].State = (int)AdviceState.Checking;
                                AdviceReplyHelper.UpdateReplyByAdviceID(adviceReply, null);
                            }
                            else
                            {
                                advice[i].State = (int)AdviceState.Finished;
                            }
                            UpdateAdvice(advice[i], new string[] { "IsRead", "State", "ProcessState" });
                        }
                    }
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }