⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 replyquestion.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.WebSite.User.Crm
{
    using PowerEasy.Components;
    using PowerEasy.Controls;
    using PowerEasy.Controls.Editor;
    using PowerEasy.Crm;
    using PowerEasy.Model.Crm;
    using PowerEasy.UserManage;
    using PowerEasy.Web.UI;
    using PowerEasy.WebSite.Controls;
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class ReplyQuestion : DynamicPage
    {
        protected Button BtnCancle2;
        protected Button BtnReply;
        protected Button BtnReturn;
        protected Button BtnSolved;
        protected FckEditorValidator FevReplyContent;
        protected HtmlForm form1;
        protected HiddenField HdnQuestionCreator;
        protected ImageButton IbtnEditUserQuestion;
        protected Image ImgReply2;
        protected Label Lbl_IP;
        protected Label LblAntiVirus;
        protected Label LblCreateTime;
        protected Label LblDBType;
        protected Label LblErrorCode;
        protected Label LblFireWall;
        protected Label LblProblemTips;
        protected Label LblProductVersion;
        protected Label LblQuestionContent;
        protected Label LblQuestionType;
        protected Label LblStatus;
        protected Label LblSystemType;
        protected Label LblTitle;
        protected Label LblUrl;
        protected HyperLink LnkCreator;
        private bool m_IsSolved;
        protected ObjectDataSource OdsReply;
        protected Panel PnlReplyContent;
        protected Repeater RptReply;
        protected ServiceCenterInfomation ServiceCenterInfomation1;
        protected PEeditor TxtQuestionContent;
        protected UserNavigation UserCenterNavigation;
        protected XmlDataSource XmlDataSource1;
        protected ExtendedSiteMapPath YourPosition;

        protected void BtnReply_Click(object sender, EventArgs e)
        {
            if (base.IsValid)
            {
                bool flag = false;
                ReplyInfo info = new ReplyInfo();
                info.Id = Reply.GetMaxId() + 1;
                info.QuestionId = BasePage.RequestInt32("ID");
                info.ReplyCreator = PEContext.Current.User.UserName;
                info.ReplyTime = DateTime.Now;
                info.ReplyContent = this.TxtQuestionContent.Value;
                if (Reply.Add(info))
                {
                    flag = PowerEasy.Crm.Question.UpdateCreateTime(info.ReplyTime, info.QuestionId);
                }
                if (flag)
                {
                    this.InitControls(PowerEasy.Crm.Question.GetQuestionById(BasePage.RequestInt32("ID")));
                    this.RptReply.DataBind();
                    this.TxtQuestionContent.Value = string.Empty;
                }
                else
                {
                    DynamicPage.WriteErrMsg("回复失败,请认真检查!");
                }
            }
        }

        protected void BtnSolved_Click(object sender, EventArgs e)
        {
            QuestionInfo questionById = PowerEasy.Crm.Question.GetQuestionById(BasePage.RequestInt32("ID"));
            questionById.ReplyCreator = PEContext.Current.User.UserName;
            questionById.ReplyTime = new DateTime?(DateTime.Now);
            questionById.IsReply = true;
            questionById.IsSolved = true;
            questionById.Score = 0;
            if (PowerEasy.Crm.Question.Update(questionById))
            {
                ReplyInfo info = new ReplyInfo();
                info.QuestionId = questionById.Id;
                info.Id = Reply.GetMaxId() + 1;
                info.ReplyCreator = questionById.ReplyCreator;
                info.ReplyTime = questionById.ReplyTime.Value;
                info.ReplyContent = "用户已把问题设为已解决!";
                if (Reply.Add(info))
                {
                    DynamicPage.WriteSuccessMsg("问题成功设为已解决!", "ReplyQuestion.aspx?ID=" + BasePage.RequestString("ID"));
                }
                else
                {
                    DynamicPage.WriteErrMsg("问题更新失败!");
                }
            }
        }

        protected void IbtnEditUserProblem_Click(object sender, ImageClickEventArgs e)
        {
            BasePage.ResponseRedirect("Question.aspx?Action=Modify&ID=" + BasePage.RequestString("ID"));
        }

        private void InitControls(QuestionInfo info)
        {
            this.Lbl_IP.Text = info.IP;
            this.LblAntiVirus.Text = info.AntiVirus;
            this.LblCreateTime.Text = info.QuestionCreateTime.ToString("yyyy-MM-dd HH:mm:ss");
            this.LblDBType.Text = info.ProductDBType;
            this.LblErrorCode.Text = info.ErrorCode;
            this.LblQuestionType.Text = info.TypeName;
            this.LblFireWall.Text = info.FireWall;
            this.LblQuestionContent.Text = info.QuestionContent;
            this.LblProblemTips.Text = info.ErrorText;
            this.LnkCreator.Text = info.QuestionCreator;
            this.HdnQuestionCreator.Value = info.QuestionCreator;
            this.LblProductVersion.Text = info.ProductVersion;
            this.LblStatus.Text = info.IsSolved ? "已解决" : "未解决";
            this.ImgReply2.Visible = !info.IsSolved;
            this.LblSystemType.Text = info.SystemType;
            this.LblTitle.Text = info.QuestionTitle;
            this.LblUrl.Text = !string.IsNullOrEmpty(info.Url) ? ("<a href='" + info.Url + "' target='_blank'>" + info.Url + "</a>") : "";
            this.BtnCancle2.Visible = info.IsSolved;
            this.PnlReplyContent.Visible = !info.IsSolved;
            if (info.IsSolved)
            {
                this.BtnSolved.Visible = false;
                this.IbtnEditUserQuestion.Visible = false;
            }
            else
            {
                this.BtnSolved.Visible = !Reply.HasOtherReplyer(info.Id);
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                if (Users.GetUsersByUserName(PEContext.Current.User.UserName).GroupId < 2)
                {
                    DynamicPage.WriteErrMsg("对不起,只有商业客户以上级别的用户才有权限访问该页!", "../Default.aspx");
                }
                if (BasePage.RequestInt32("ID") <= 0)
                {
                    DynamicPage.WriteErrMsg("请选择要回复的问题!", "MyQuestions.aspx");
                }
                else
                {
                    QuestionInfo questionById = PowerEasy.Crm.Question.GetQuestionById(BasePage.RequestInt32("ID"));
                    if (questionById.IsNull)
                    {
                        DynamicPage.WriteErrMsg("要回复的问题不存在!", "MyQuestions.aspx");
                    }
                    else if (!questionById.IsSolved && (string.Compare(questionById.QuestionCreator, PEContext.Current.User.UserName, true) != 0))
                    {
                        DynamicPage.WriteErrMsg("此问题不是用户提出的,不能回复!", "MyQuestions.aspx");
                    }
                    else
                    {
                        this.m_IsSolved = questionById.IsSolved;
                        this.InitControls(questionById);
                    }
                }
            }
        }

        protected void RptReply_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                ReplyInfo dataItem = (ReplyInfo) e.Item.DataItem;
                if (!dataItem.IsNull)
                {
                    Literal literal = (Literal) e.Item.FindControl("LtrReplyTitle");
                    if (string.Compare(dataItem.ReplyCreator, this.HdnQuestionCreator.Value, true) == 0)
                    {
                        literal.Text = "<img border='0' src='../images/Male.gif' />用户<b>" + dataItem.ReplyCreator + "&nbsp;&nbsp;</b>于<b>" + dataItem.ReplyTime.ToString("yyyy-MM-dd HH:mm:ss") + "</b>继续提问";
                    }
                    else
                    {
                        literal.Text = "<img border='0' src='../images/Admin.gif' />管理员<b>" + dataItem.ReplyCreator + "&nbsp;&nbsp;</b>于<b>" + dataItem.ReplyTime.ToString("yyyy-MM-dd HH:mm:ss") + "</b>回复";
                    }
                    Label label = (Label) e.Item.FindControl("ReplyContentLabel");
                    label.Text = dataItem.ReplyContent;
                    Image image = (Image) e.Item.FindControl("ImgReply");
                    image.Visible = !this.m_IsSolved;
                }
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -