コード例 #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 ListQuiz()
    {
        int    Qtype  = DDLqtype.SelectedIndex;
        string Qclass = DDLclass.SelectedValue;

        LearnSite.BLL.Quiz bll = new LearnSite.BLL.Quiz();
        if (Qclass == "全部显示")
        {
            GVQuiz.DataSource = bll.GetListByQtype(Qtype);
        }
        else
        {
            GVQuiz.DataSource = bll.GetListByQtypeQclass(Qtype, Qclass);
        }
        if (Qtype == 2)
        {
            GVQuiz.PageSize = 20;
        }
        else
        {
            GVQuiz.PageSize = 10;
        }
        GVQuiz.AllowPaging = true;
        if (Session["pageindex"] != null)
        {
            GVQuiz.PageIndex = int.Parse(Session["pageindex"].ToString());
        }
        GVQuiz.DataBind();
        if (GVQuiz.Rows.Count == 0)
        {
            Btnexport.Visible = false;
        }
    }
コード例 #4
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;
                }
            }
        }
    }
コード例 #5
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 = "请先添加试题!";
        }
    }
コード例 #6
0
ファイル: quizstart.aspx.cs プロジェクト: pyteach/Learnsite
    private void listQuiz()
    {
        string Rnum = cook.Snum;

        int Qgrade = cook.Sgrade;
        int Qclass = cook.Sclass;

        LearnSite.Model.QuizGrade qmodel = new LearnSite.Model.QuizGrade();
        LearnSite.BLL.QuizGrade   qbll   = new LearnSite.BLL.QuizGrade();
        qmodel = qbll.GetModelByQobjRclass(Qgrade, Qclass);
        if (qmodel != null)
        {
            if (qmodel.Qopen.Value)
            {
                string selectclass = qmodel.Qclass;
                if (!string.IsNullOrEmpty(selectclass))
                {
                    bool isok = true;
                    if (isok)
                    {
                        LearnSite.BLL.Quiz bll = new LearnSite.BLL.Quiz();
                        DataListonly.DataSource = bll.GetListByQtypeNum(0, qmodel.Qonly.Value, selectclass);
                        DataListonly.DataBind();
                        DataListmore.DataSource = bll.GetListByQtypeNum(1, qmodel.Qmore.Value, selectclass);
                        DataListmore.DataBind();
                        DataListjudge.DataSource = bll.GetListByQtypeNum(2, qmodel.Qjudge.Value, selectclass);
                        DataListjudge.DataBind();
                        Btnquiz.Enabled = true;
                        if (string.IsNullOrEmpty(qmodel.Qanswer.ToString()))
                        {
                            Session[Rnum + "quizQanswer"] = "false";
                        }
                        else
                        {
                            Session[Rnum + "quizQanswer"] = qmodel.Qanswer.ToString();
                        }
                    }
                    selectclass         = selectclass.Replace("'", "");
                    showscope.InnerHtml = Qgrade.ToString() + "年级试题范围:<br />" + selectclass.Replace(",", "<br />");//增加试题范围提示
                }
                else
                {
                    Labelmsg.Text = "老师没有选择试题范围!";
                }
            }
            else
            {
                Btnquiz.Enabled = false;
                Labelmsg.Text   = "测验暂停,请咨询老师开启!";
            }
        }
        else
        {
            Btnquiz.Enabled = false;
            Labelmsg.Text   = "请咨询老师设置本班测验!";
        }
    }
コード例 #7
0
 protected void GVQuiz_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Del")
     {
         int index = Convert.ToInt32(e.CommandArgument);
         int Qid   = Convert.ToInt32(((GridView)sender).DataKeys[index].Values["Qid"].ToString());
         LearnSite.BLL.Quiz bll = new LearnSite.BLL.Quiz();
         bll.Delete(Qid);//删除本试题
         System.Threading.Thread.Sleep(1000);
         ListQuiz();
     }
 }
コード例 #8
0
ファイル: quiz.aspx.cs プロジェクト: dalinhuang/learnsite
 protected void GVQuiz_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Del")
     {
         int index = Convert.ToInt32(e.CommandArgument);
         int Qid = Convert.ToInt32(((GridView)sender).DataKeys[index].Values["Qid"].ToString());
         LearnSite.BLL.Quiz bll = new LearnSite.BLL.Quiz();
         bll.Delete(Qid);//删除本试题
         System.Threading.Thread.Sleep(1000);
         ListQuiz();
     }
 }
コード例 #9
0
    private void ListQuiz()
    {
        string Rnum   = cook.Snum;
        int    Qgrade = cook.Sgrade;
        int    Qclass = cook.Sclass;
        string myname = Server.UrlDecode(cook.Sname);

        LearnSite.BLL.QuizGrade qgbll = new LearnSite.BLL.QuizGrade();
        isanswer = qgbll.GetQanswer(Qgrade, Qclass);

        if (Request.QueryString["Rid"] != null)
        {
            int Rid = Int32.Parse(Request.QueryString["Rid"].ToString());
            LearnSite.BLL.Result   rbll   = new LearnSite.BLL.Result();
            LearnSite.Model.Result rmodel = new LearnSite.Model.Result();
            rmodel = rbll.GetModel(Rid);
            if (rmodel != null)
            {
                string mystr = rmodel.Rhistory;
                if (mystr != "")
                {
                    WrongsStr = rmodel.Rwrong.Split(',');
                    string[]           qmystr = mystr.Split(',');
                    LearnSite.BLL.Quiz bll    = new LearnSite.BLL.Quiz();
                    GVQuiz.DataSource = bll.GetListByQidArray(qmystr);
                    GVQuiz.DataBind();
                    Labeltitle.Text = " 〖" + myname + " 随机生成的" + rmodel.Rdate.Value.ToShortDateString() + "号历史记录试卷参考答案〗";
                }
            }
            //显示本次测验试卷参考答案
        }
        else
        {
            if (Session[Rnum + "quizQids"] != null)
            {
                WrongsStr = Session[Rnum + "quizWrong"].ToString().Split(',');//将错题号保存
                string[]           qstr = (string[])Session[Rnum + "quizQids"];
                LearnSite.BLL.Quiz bll  = new LearnSite.BLL.Quiz();
                GVQuiz.DataSource = bll.GetListByQidArray(qstr);
                GVQuiz.DataBind();

                // Labelmsg.Text = "所有题编号:" + Session[Rnum + "quizRightWrong"].ToString() + "<br/>正确题编号:" + Session[Rnum + "quizRight"].ToString() + "<br/>错误题编号:" + Session[Rnum + "quizWrong"].ToString();
            }
            if (Session[Rnum + "quizrnd"] != null)
            {
                Labeltitle.Text           = " 〖" + myname + " 随机生成的" + Session[Rnum + "quizrnd"].ToString() + "号试卷参考答案〗";
                Session[Rnum + "quizrnd"] = null;
            }
        }
    }
コード例 #10
0
ファイル: quizview.aspx.cs プロジェクト: dalinhuang/learnsite
 private void ListQuiz()
 {
     string Rnum = Request.Cookies["StudentCookies"].Values["Snum"].ToString();
     if (Session[Rnum+"quizQids"] != null)
     {
         string[] qstr = (string[])Session[Rnum+"quizQids"];
         LearnSite.BLL.Quiz bll = new LearnSite.BLL.Quiz();
         GVQuiz.DataSource = bll.GetListByQidArray(qstr);
         GVQuiz.DataBind();
     }
     if (Session[Rnum+"quizrnd"] != null)
     {
         string myname = "";
         if (Request.Cookies["StudentCookies"] != null)
         {
            myname= Server.UrlDecode(Request.Cookies["StudentCookies"].Values["Sname"].ToString());
         }
         Labeltitle.Text = " 〖"+myname+" 随机生成的" + Session[Rnum+"quizrnd"].ToString()+ "号试卷参考答案〗";
     }
 }
コード例 #11
0
ファイル: quizstart.aspx.cs プロジェクト: pyteach/Learnsite
    private void finished()
    {
        string Rnum = cook.Snum;

        Session[Rnum + "quizRight"] = "-1";
        Session[Rnum + "quizWrong"] = "-1";
        int allscore = CalculateOnly(Rnum) + CalculateMore(Rnum) + CalculateJudge(Rnum);

        Labelallscore.Text = allscore.ToString();

        if (allscore > 0)
        {
            string Quizrights = Session[Rnum + "quizRight"].ToString();
            string Quizwrongs = Session[Rnum + "quizWrong"].ToString();
            string Quizqids   = Quizrights + "," + Quizwrongs;
            Session[Rnum + "quizRightWrong"] = Quizqids;
            LearnSite.BLL.Quiz qbll = new LearnSite.BLL.Quiz();
            qbll.UpdateQright(Quizrights);
            qbll.UpdateQwrong(Quizwrongs);
            System.Threading.Thread.Sleep(200);
            qbll.UpdateQaccuracy(Quizqids);
        }
    }
コード例 #12
0
 private void listonly()
 {
     int qtype = 0;
     int num = LearnSite.Common.XmlHelp.QuizOnly();
     LearnSite.BLL.Quiz bll = new LearnSite.BLL.Quiz();
     DataListonly.DataSource = bll.GetListByQtypeNum(qtype, num);
     DataListonly.DataBind();
 }
コード例 #13
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;
 }
コード例 #14
0
ファイル: quiz.aspx.cs プロジェクト: dalinhuang/learnsite
 private void ListQuiz()
 {
     int Qtype = DDLqtype.SelectedIndex;
     LearnSite.BLL.Quiz bll = new LearnSite.BLL.Quiz();
     GVQuiz.DataSource = bll.GetListByQtype(Qtype);
     if (Qtype == 2)
         GVQuiz.PageSize = 20;
     else
         GVQuiz.PageSize = 10;
     GVQuiz.AllowPaging = true;
     GVQuiz.DataBind();
     if (GVQuiz.Rows.Count == 0)
     {
         Btnexport.Visible = false;
     }
 }