Beispiel #1
0
 /// <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();
     }
 }
Beispiel #2
0
        /// <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);
            }
        }
Beispiel #3
0
        void SaveArticle()
        {
            try
            {
                if (CDHelper.Config.EnableLoginAuhenCode == "true" && this.ValidateTextBox.Text != Request.Cookies["AreYouHuman"].Value)
                {
                    Messages.ShowError("错误:您输入的验证码不正确,请重新输入!");
                    // Clear the input and create a new random code.
                    this.ValidateTextBox.Text             = "";
                    Response.Cookies["AreYouHuman"].Value = CaptchaImage.GenerateRandomCode();
                    return;
                }

                string ownerId = OwnerID;
                if (ownerId == null)
                {
                    ownerId = ChannelDropDownList.SelectedValue;
                }

                if (String.IsNullOrEmpty(ownerId))
                {
                    Messages.ShowError("文章栏目不能为空!");
                    return;
                }

                Article a = ThisArticle;
                a.Description = DescriptionTextBox.Value;
                a.Title       = TitleTextBox.Value;
                a.SubTitle    = SubTitleTextBox.Value;
                a.Color       = ddlColor.SelectedValue;
                a.FontStyle   = chkItalic.Checked ? "Italic" : "";
                a.FontWeight  = chkBold.Checked ? "Bold" : "";
                //a.ID = ArticleID;
                if (IndexTextBox.Value.Trim() == "")
                {
                    a.Index = 0;
                }
                else
                {
                    a.Index = Convert.ToInt32(IndexTextBox.Value);
                }
                a.Source        = SourceTextBox.Value;
                a.AllowComments = AllowCommentsCheckBox.Checked ? 1 : 0;
                //if (IsShowCheckBox.Checked)
                //{
                //    a.EnumState = StateMgr.StateInitialize();
                //    a.EnumState = StateMgr.StateProcess(a.EnumState, EnumLibrary.Business.HomeRecommend, 1);
                //}
                //a.IsShow = IsShowCheckBox.Checked ? 1 : 0;
                a.Author      = AuthorTextBox.Value;
                a.State       = Convert.ToInt32(StateDropDownList.SelectedValue);
                a.ContentType = Convert.ToInt32(ActicleTypeDropDownList.SelectedValue);
                //a.IsImage = (TypeOfArticle)a.ContentType == TypeOfArticle.QuoteArticle || (TypeOfArticle)a.ContentType == TypeOfArticle.ShareArticle ? 1 : 0;
                a.ContentUrl     = ContentUrlTextBox.Value;
                a.Content        = We7Helper.ConvertPageBreakFromVisualToChar(ContentTextBox.Value);
                a.KeyWord        = KeywordTextBox.Value;
                a.DescriptionKey = DescriptionKeyTextBox.Value;

                if (GeneralConfigs.GetConfig().AllowParentArticle&& !string.IsNullOrEmpty(ParentArticleID.Value))
                {
                    a.ParentID = ParentArticleID.Value;
                }
                else
                {
                    a.ParentID = We7Helper.EmptyGUID;
                }

                if (UpdatedTextBox.Value.Trim() == "")
                {
                    a.Updated = DateTime.Now;
                }
                else
                {
                    a.Updated = Convert.ToDateTime(UpdatedTextBox.Value);
                }
                if (txtInvalidDate.Value != "")
                {
                    a.Overdue = Convert.ToDateTime(txtInvalidDate.Value.Trim());
                }
                else
                {
                    GeneralConfigInfo si = GeneralConfigs.GetConfig();
                    int OverdueDateTime  = si.OverdueDateTime;
                    a.Overdue = a.Updated.AddDays(OverdueDateTime);
                }
                if (ArticleID == null)
                {
                    a.AccountID = AccountID;
                    a.OwnerID   = ownerId;
                    Channel ch = ChannelHelper.GetChannel(ownerId, null);
                    if (ch.FullUrl != null && ch.FullUrl != "")
                    {
                        a.ChannelFullUrl = ch.FullUrl;
                    }
                    if (ch.Process != null && ch.Process == "1")
                    {
                        a.State = 2;
                    }
                    //a.ChannelName = ch.ChannelName;
                    /*这儿把上面一句注了,改成了下面的。上面一句与老系统不兼容*/
                    a.ChannelName     = ch.Name;
                    a.FullChannelPath = ch.FullPath;
                    //int type = StateMgr.GetStateValue(ch.EnumState, EnumLibrary.Business.ChannelContentType);
                    //a.EnumState = StateMgr.StateProcess(a.EnumState, EnumLibrary.Business.ArticleType, type);
                    // a.State = 0;

                    //如果禁用
                    if (StateDropDownList.SelectedValue == "0")
                    {
                        a.state = 0;
                    }
                    Article article = ArticleHelper.AddArticles(a);
                    // 往全文检索里插入数据

                    ArticleIndexHelper.InsertData(article.ID, 0);

                    #region 自动提交一审(mxy2011-10-18)
                    if (ch.Process != null && ch.Process == "1" && StateDropDownList.SelectedValue != "0")
                    {
                        Processing ap = ArticleProcessHelper.GetArticleProcess(article);
                        if (ap.ArticleState != ArticleStates.Checking)
                        {
                            string accName = AccountHelper.GetAccount(AccountID, new string[] { "LastName" }).LastName;
                            ap.ProcessState     = ProcessStates.FirstAudit;
                            ap.ProcessDirection = ((int)ProcessAction.Next).ToString();
                            ap.ProcessAccountID = AccountID;
                            ap.ApproveName      = accName;
                            ArticleProcessHelper.SaveFlowInfoToDB(article, ap);
                        }
                    }
                    #endregion

                    //记录日志
                    string content = string.Format("新建文章:“{0}”", a.Title);
                    AddLog("新建文章", content);
                }
                else
                {
                    Channel  ch     = ChannelHelper.GetChannel(ownerId, null);
                    string[] fields = new string[] { "Description", "Title", "Content", "Updated", "Index", "Source", "AllowComments", "Author", "State", "IsShow", "IsImage", "SubTitle", "ContentUrl", "ContentType", "IsDeleted", "Overdue", "KeyWord", "DescriptionKey", "ParentID", "FullChannelPath", "ChannelFullUrl", "Color", "FontWeight", "FontStyle" };

                    ArticleHelper.UpdateArticle(a, fields);

                    // 往全文检索里更新数据
                    ArticleIndexHelper.InsertData(a.ID, 0);

                    if (ch.Process != null && ch.Process == "1" && StateDropDownList.SelectedValue != "0")
                    {
                        Processing ap = ArticleProcessHelper.GetArticleProcess(a);
                        if (ap.ArticleState != ArticleStates.Checking && ap.ProcessState != ProcessStates.EndAudit)
                        {
                            //编辑审核启用
                            if (ch.Process != null && ch.Process == "1" && StateDropDownList.SelectedValue != "0")
                            {
                                a.State = 2;
                                ArticleHelper.UpdateArticle(a, new string[] { "State" });
                            }

                            string accName = AccountHelper.GetAccount(AccountID, new string[] { "LastName" }).LastName;
                            ap.ProcessState     = ProcessStates.FirstAudit;
                            ap.ProcessDirection = ((int)ProcessAction.Next).ToString();
                            ap.ProcessAccountID = AccountID;
                            ap.ApproveName      = accName;
                            ArticleProcessHelper.SaveFlowInfoToDB(a, ap);
                        }
                    }
                    //记录日志
                    string content = string.Format("修改了文章“{0}”", a.Title);
                    AddLog("编辑文章", content);
                }

                string rawurl = We7Helper.RemoveParamFromUrl(Request.RawUrl, "saved");
                if (!String.IsNullOrEmpty(ArticleID))
                {
                    rawurl = We7Helper.AddParamToUrl(rawurl, "saved", "1");
                    rawurl = We7Helper.AddParamToUrl(rawurl, "Submit", "1");
                }
                else
                {
                    rawurl = We7Helper.RemoveParamFromUrl(Request.RawUrl, "oid");
                    rawurl = We7Helper.RemoveParamFromUrl(rawurl, "ParentID");
                    rawurl = We7Helper.AddParamToUrl(rawurl, "id", a.ID);
                    rawurl = We7Helper.AddParamToUrl(rawurl, "Submit", "0");
                }

                Response.Redirect(rawurl);
            }
            catch (FormatException)
            {
                Messages.ShowError("无法保存文章信息:可能是文章排序或修改日期格式不正确。");
                return;
            }
            catch (Exception ex)
            {
                Messages.ShowError("无法保存文章信息:" + ex.Message);
            }
        }