Ejemplo n.º 1
0
        /// <summary>
        /// 加载信息
        /// </summary>
        protected void LoadInfo()
        {
            ddl_Class.DataSource     = NewsAction.NewsClass.Where(p => p.IsLeafClass && p.ModelID == 3);
            ddl_Class.DataTextField  = "ClassName";
            ddl_Class.DataValueField = "ID";
            ddl_Class.DataBind();

            ddl_Class.SelectedValue = cls.ToS();

            ddl_Author.DataSource     = UserView.GetModelList();
            ddl_Author.DataTextField  = "UserName";
            ddl_Author.DataValueField = "ID";
            ddl_Author.DataBind();

            Question qu = QuestionView.GetModelByID(id.ToS());


            if (id > 0)
            {
                ddl_Class.SelectedValue = qu.ClassID.ToS();
                txt_Title.Text          = qu.Title;
                //ddl_Author.Text = qu.UserID.ToS();
                ddl_Author.SelectedValue = qu.UserID.ToS();
                txt_ClickCount.Text      = qu.ClickCount.ToS();
                txt_Content.Text         = qu.Content;

                rp_list.DataSource = AnswerView.GetModelList(string.Format("QuestionID={0} order by id", qu.ID));
                rp_list.DataBind();
            }
        }
Ejemplo n.º 2
0
        protected void DeleteAnswer(int id)
        {
            AnswerView.DelByID(id);

            Class    cls = ClassView.GetModelByID(WS.RequestString("class"));
            Question qu  = QuestionView.GetModelByID(WS.RequestString("id"));

            if (cls.ID > 0 && qu.ID > 0)
            {
                CreatePage.CreateContentPage(qu, cls);
            }
            rp_list.DataSource = AnswerView.GetModelList(string.Format("QuestionID={0} order by id", WS.RequestString("id")));
            rp_list.DataBind();
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            User u = UserAction.opuser;

            if (u.ID <= 0)
            {
                Js.AlertAndGoback("对不起,您没有登录,请登录后回答!");
                return;
            }

            int    qid     = WS.RequestInt("qid");
            string content = WS.RequestString("content");

            if (qid <= 0)
            {
                Js.AlertAndGoback("对不起,参数错误,如有疑问,请联系管理员!");
                return;
            }

            Class cls = QuestionView.GetModelByID(qid.ToS()).GetClass();

            if (UserAction.HasPostRight(cls.ID) == false)
            {
                Js.AlertAndGoback("对不起,对于本栏目您没有回答权限,如有疑问,请联系管理员!");
                return;
            }

            Answer a = new Answer();

            a.Agree      = 0;
            a.AnswerTime = DateTime.Now;
            a.Content    = content;
            a.QuestionID = qid;
            a.UserID     = u.ID;
            a.UserName   = u.UserName;

            AnswerView.Insert(a);


            Question q = QuestionView.GetModelByID(a.QuestionID.ToS());

            CreatePage.CreateContentPage(q, q.GetClass());//创建内容页



            string url = BasePage.GetQuestionUrl(q, q.GetClass());

            Js.AlertAndChangUrl("回答成功!", url);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            Class cls = ClassView.GetModelByID(ddl_Class.SelectedValue);

            Question qu = QuestionView.GetModelByID(WS.RequestString("id"));

            qu.ClassID    = ddl_Class.SelectedValue.ToInt32();
            qu.Title      = txt_Title.Text.TrimDbDangerousChar();
            qu.UserID     = ddl_Author.SelectedValue.ToInt32();
            qu.UserName   = ddl_Author.SelectedItem.Text;
            qu.ClickCount = txt_ClickCount.Text.ToInt32(0);
            if (qu.ID <= 0)
            {
                qu.AskTime = DateTime.Now;
            }
            qu.Content = txt_Content.Text.TrimDbDangerousChar();

            qu.Title = txt_Title.Text;
            qu.ZtID  = 0;

            if (qu.ID > 0)
            {
                QuestionView.Update(qu);
            }
            else
            {
                QuestionView.Insert(qu);
            }



            //生成页面

            CreatePage.CreateContentPage(qu, cls);

            Question pre = GetPreQuestion(qu, cls);

            if (pre != null)
            {
                CreatePage.CreateContentPage(pre, cls);
            }
            CreatePage.CreateListPage(cls, 1);


            Js.AlertAndChangUrl("保存成功!", url);
        }