コード例 #1
0
ファイル: AdviceDetail.aspx.cs プロジェクト: jiaping/JPCMS
 /// <summary>
 /// 审核通过
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void ReportButton_Click(object sender, EventArgs e)
 {
     if (OperationInfo(AdviceState.Checking))
     {
         Advice      a     = ThisAdvice;
         AdviceReply reply = AdviceReplyHelper.GetAdviceReplyByAdviceID(AdviceID);
         if (reply == null)
         {
             reply            = new AdviceReply();
             reply.AdviceID   = AdviceID;
             reply.Suggest    = ToAdviceTextBox.Text;
             reply.UserID     = AccountID;
             reply.CreateDate = DateTime.Now;
             reply.Updated    = DateTime.Now;
         }
         reply.Content = We7Helper.ConvertPageBreakFromVisualToChar(ReplyContentTextBox.Value);
         AdviceReplyHelper.UpdateReplyByAdviceID(reply, null);
         if (a.State == (int)AdviceState.Finished)
         {
             if (chbSendEmail.Checked)
             {
                 AdviceEmailConfigs    adviceEmailConfigs = new AdviceEmailConfigs();
                 AdviceEmailConfigInfo info = adviceEmailConfigs["ReplyUser"];
                 AdviceHelper.SendResultMailToAdvicer(a, reply, null, info);
             }
         }
         Messages.ShowMessage(" :) 审核成功!");
         //记录日志
         string content = string.Format("审核通过了留言反馈:“{0}”的详细信息", AdviceID);
         AddLog("留言反馈详细信息", content);
         Response.Write("<script>alert('审核成功!');location.href='AdviceList.aspx?adviceTypeID=" + ThisAdvice.TypeID + "';</script>");
         //Initialize();
     }
 }
コード例 #2
0
ファイル: AdviceDetail.aspx.cs プロジェクト: jiaping/JPCMS
        /// <summary>
        /// 操作信息
        /// </summary>
        /// <returns></returns>
        protected bool OperationInfo(AdviceState state, string direction, bool saveReply)
        {
            try
            {
                AdviceType adviceType = AdviceTypeHelper.GetAdviceType(AdviceTypeID);
                Advice     a          = ThisAdvice;

                //处理反馈回复信息
                AdviceReply adviceReply = null;
                if (saveReply)
                {
                    adviceReply            = new AdviceReply();
                    adviceReply.AdviceID   = AdviceID;
                    adviceReply.Content    = We7Helper.ConvertPageBreakFromVisualToChar(ReplyContentTextBox.Value);
                    adviceReply.Suggest    = ToAdviceTextBox.Text;
                    adviceReply.UserID     = AccountID;
                    adviceReply.CreateDate = DateTime.Now;
                    adviceReply.Updated    = DateTime.Now;

                    //增加回复数
                    a.ReplyCount += 1;
                }

                //更新反馈信息
                a.Updated      = DateTime.Now;
                a.ToHandleTime = DateTime.Now;
                if (UserIDTextBox.Text.Trim() != "")
                {
                    a.ToOtherHandleUserID = UserIDTextBox.Text.ToString();
                }
                else
                {
                    a.ToOtherHandleUserID = AccountID;
                }
                a.State = (int)state;

                //处理反馈进度
                Advice     oldAdvice = AdviceHelper.GetAdvice(AdviceID);
                Processing ap        = ProcessHelper.GetAdviceProcess(oldAdvice);
                ap.UpdateDate       = DateTime.Now;
                ap.ProcessAccountID = AccountID;
                ap.ApproveName      = AccountHelper.GetAccount(AccountID, new string[] { "LastName" }).LastName;
                ap.ProcessDirection = direction.ToString();
                ap.Remark           = ToAdviceTextBox.Text;
                if (state == AdviceState.WaitHandle)
                {
                    a.ProcessState = ((int)state).ToString();
                    string myText   = "请 {0} 办理一下反馈“{1}”。";
                    string userName = AccountHelper.GetAccount(UserIDTextBox.Text, new string[] { "LastName" }).LastName;
                    ap.Remark = string.Format(myText, userName, a.Title) + "<br>" + ap.Remark;
                }
                switch (state)
                {
                case AdviceState.All:
                    break;

                case AdviceState.WaitAccept:
                case AdviceState.WaitHandle:
                case AdviceState.Finished:
                    break;

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

                default:
                    break;
                }
                ap.CurLayerNO  = a.ProcessState;
                ap.AdviceState = (AdviceState)a.State;

                AdviceHelper.OperationAdviceInfo(adviceReply, oldAdvice, ap);
                if (state == AdviceState.WaitHandle)
                {
                    AdviceHelper.UpdateAdvice(a, new string[] { "ToHandleTime", "ToOtherHandleUserID" });
                }

                if (state == AdviceState.Finished)
                {
                    AdviceEmailConfigs    adviceEmailConfigs = new AdviceEmailConfigs();
                    AdviceEmailConfigInfo info = adviceEmailConfigs["ReplyUser"];
                    AdviceHelper.SendResultMailToAdvicer(a, adviceReply, adviceType, info);
                }
                return(true);
            }
            catch (Exception ex)
            {
                Messages.ShowError(" 信息操作失败!原因:" + ex.Message);
                return(false);
            }
        }