Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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)
        {
            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;
                            advice[i].State  = (int)AdviceState.Finished;
                            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.Remark = adviceReply.Content;
                            ap.ProcessDirection    = advice[i].ProcessDirection = "1";
                            advice[i].ProcessState = ((int)ProcessStates.Finished).ToString();
                            ap.CurLayerNO          = advice[i].ProcessState;
                            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);
                            }
                            UpdateAdvice(advice[i], new string[] { "IsRead" });
                        }
                    }
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }