コード例 #1
0
    protected void Btnadd_Click(object sender, EventArgs e)
    {
        string Qestion = Request.Form["textareaItem"].Trim();

        if (Qestion != "")
        {
            int    qtype    = DDLqtype.SelectedIndex; //0为单选题,1为多选题,2为判断题
            int    qscore   = Int32.Parse(DDLqscore.SelectedValue);
            string qanalyze = TextBoxqanalyze.Text;
            string qanswer  = GetQanswer();

            LearnSite.Model.Quiz model = new LearnSite.Model.Quiz();
            model.Qanalyze = HttpUtility.HtmlEncode(qanalyze);//分析编码
            model.Qanswer  = qanswer;
            model.Qscore   = qscore;
            model.Qtype    = qtype;
            model.Question = HttpUtility.HtmlEncode(Qestion);//题目编码
            model.Qclass   = DDLclass.SelectedValue;
            model.Qselect  = false;
            LearnSite.BLL.Quiz bll = new LearnSite.BLL.Quiz();
            bll.Add(model);
            Labelmsg.Text        = "添加试题成功!";
            TextBoxqanalyze.Text = "";
            //ClearKindeditor();
        }
        else
        {
            Labelmsg.Text = "请先添加试题!";
        }
    }
コード例 #2
0
ファイル: quizedit.aspx.cs プロジェクト: dalinhuang/learnsite
    protected void Btnedit_Click(object sender, EventArgs e)
    {
        string Qestion = FCKeditor1.Value;
        if (Qestion != "")
        {
            int Qid = Int32.Parse(Request.QueryString["Qid"].ToString());
            int qtype = DDLqtype.SelectedIndex;  //0为单选题,1为多选题,2为判断题
            int qscore = Int32.Parse(DDLqscore.SelectedValue);
            string qanalyze = TextBoxqanalyze.Text;
            string qanswer = GetQanswer();

            LearnSite.Model.Quiz model = new LearnSite.Model.Quiz();
            model.Qid = Qid;
            model.Qanalyze = HttpUtility.HtmlEncode(qanalyze);//分析编码
            model.Qanswer = qanswer;
            model.Qscore = qscore;
            model.Qtype = qtype;
            model.Question = HttpUtility.HtmlEncode(Qestion);//题目编码
            LearnSite.BLL.Quiz bll = new LearnSite.BLL.Quiz();
            bll.Update(model);
            Labelmsg.Text = "修改试题成功!";
            Response.Redirect("~/Quiz/quiz.aspx", false);
        }
        else
        {
            Labelmsg.Text = "请先添加试题!";
        }
    }
コード例 #3
0
    private void ShowQuiz()
    {
        int Qid = Int32.Parse(Request.QueryString["Qid"].ToString());

        LearnSite.BLL.Quiz   bll   = new LearnSite.BLL.Quiz();
        LearnSite.Model.Quiz model = new LearnSite.Model.Quiz();
        model = bll.GetModel(Qid);
        DDLqtype.SelectedIndex  = model.Qtype.Value;
        DDLqscore.SelectedValue = model.Qscore.ToString();
        mcontent.InnerText      = HttpUtility.HtmlDecode(model.Question);
        SetQtype(model.Qtype.Value, model.Qanswer);
        TextBoxqanalyze.Text = model.Qanalyze;
        DDLqtype.Enabled     = false;
        string qclass = model.Qclass;

        if (qclass != "")
        {
            int dd = DDLclass.Items.Count;
            for (int i = 0; i < dd; i++)
            {
                if (DDLclass.Items[i].Text == qclass)
                {
                    DDLclass.SelectedValue = qclass;
                    break;
                }
            }
        }
    }
コード例 #4
0
    protected void Btnedit_Click(object sender, EventArgs e)
    {
        string Qestion = mcontent.InnerText;

        if (Qestion != "")
        {
            int    Qid      = Int32.Parse(Request.QueryString["Qid"].ToString());
            int    qtype    = DDLqtype.SelectedIndex; //0为单选题,1为多选题,2为判断题
            int    qscore   = Int32.Parse(DDLqscore.SelectedValue);
            string qanalyze = TextBoxqanalyze.Text;
            string qanswer  = GetQanswer();

            LearnSite.Model.Quiz model = new LearnSite.Model.Quiz();
            model.Qid      = Qid;
            model.Qanalyze = HttpUtility.HtmlEncode(qanalyze);//分析编码
            model.Qanswer  = qanswer;
            model.Qscore   = qscore;
            model.Qtype    = qtype;
            model.Question = HttpUtility.HtmlEncode(Qestion);//题目编码
            model.Qclass   = DDLclass.SelectedValue;
            model.Qselect  = false;
            LearnSite.BLL.Quiz bll = new LearnSite.BLL.Quiz();
            bll.Update(model);
            System.Threading.Thread.Sleep(500);
            Session["classtype"] = DDLclass.SelectedValue;
            Response.Redirect("~/Quiz/quiz.aspx", false);
        }
        else
        {
            Labelmsg.Text = "请先添加试题!";
        }
    }
コード例 #5
0
ファイル: Quiz.cs プロジェクト: dalinhuang/learnsite
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<LearnSite.Model.Quiz> DataTableToList(DataTable dt)
 {
     List<LearnSite.Model.Quiz> modelList = new List<LearnSite.Model.Quiz>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         LearnSite.Model.Quiz model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new LearnSite.Model.Quiz();
             if(dt.Rows[n]["Qid"].ToString()!="")
             {
                 model.Qid=int.Parse(dt.Rows[n]["Qid"].ToString());
             }
             if(dt.Rows[n]["Qtype"].ToString()!="")
             {
                 model.Qtype=int.Parse(dt.Rows[n]["Qtype"].ToString());
             }
             model.Question=dt.Rows[n]["Question"].ToString();
             model.Qanswer=dt.Rows[n]["Qanswer"].ToString();
             model.Qanalyze=dt.Rows[n]["Qanalyze"].ToString();
             if(dt.Rows[n]["Qscore"].ToString()!="")
             {
                 model.Qscore=int.Parse(dt.Rows[n]["Qscore"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
コード例 #6
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LearnSite.Model.Quiz> DataTableToList(DataTable dt)
        {
            List <LearnSite.Model.Quiz> modelList = new List <LearnSite.Model.Quiz>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LearnSite.Model.Quiz model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LearnSite.Model.Quiz();
                    if (dt.Rows[n]["Qid"].ToString() != "")
                    {
                        model.Qid = int.Parse(dt.Rows[n]["Qid"].ToString());
                    }
                    if (dt.Rows[n]["Qtype"].ToString() != "")
                    {
                        model.Qtype = int.Parse(dt.Rows[n]["Qtype"].ToString());
                    }
                    model.Question = dt.Rows[n]["Question"].ToString();
                    model.Qanswer  = dt.Rows[n]["Qanswer"].ToString();
                    model.Qanalyze = dt.Rows[n]["Qanalyze"].ToString();
                    if (dt.Rows[n]["Qscore"].ToString() != "")
                    {
                        model.Qscore = int.Parse(dt.Rows[n]["Qscore"].ToString());
                    }
                    model.Qclass = dt.Rows[n]["Qclass"].ToString();
                    if (dt.Rows[n]["Qselect"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Qselect"].ToString() == "1") || (dt.Rows[n]["Qselect"].ToString().ToLower() == "true"))
                        {
                            model.Qselect = true;
                        }
                        else
                        {
                            model.Qselect = false;
                        }
                    }
                    if (dt.Rows[n]["Qright"].ToString() != "")
                    {
                        model.Qright = int.Parse(dt.Rows[n]["Qright"].ToString());
                    }
                    if (dt.Rows[n]["Qwrong"].ToString() != "")
                    {
                        model.Qwrong = int.Parse(dt.Rows[n]["Qwrong"].ToString());
                    }
                    if (dt.Rows[n]["Qaccuracy"].ToString() != "")
                    {
                        model.Qaccuracy = int.Parse(dt.Rows[n]["Qaccuracy"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LearnSite.Model.Quiz model)
 {
     dal.Update(model);
 }
コード例 #8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(LearnSite.Model.Quiz model)
 {
     return(dal.Add(model));
 }
コード例 #9
0
ファイル: quizedit.aspx.cs プロジェクト: dalinhuang/learnsite
 private void ShowQuiz()
 {
     int Qid =Int32.Parse( Request.QueryString["Qid"].ToString());
     LearnSite.BLL.Quiz bll = new LearnSite.BLL.Quiz();
     LearnSite.Model.Quiz model = new LearnSite.Model.Quiz();
     model = bll.GetModel(Qid);
     DDLqtype.SelectedIndex = model.Qtype.Value;
     DDLqscore.SelectedValue = model.Qscore.ToString();
     FCKeditor1.Value =HttpUtility.HtmlDecode( model.Question);
     SetQtype(model.Qtype.Value, model.Qanswer);
     TextBoxqanalyze.Text = model.Qanalyze;
     DDLqtype.Enabled = false;
 }