private void getold() { if (DDLgrade.Items.Count > 0 && DDLgrade.SelectedValue != "") { string hidstr = tcook.Hid.ToString(); string sgrade = DDLgrade.SelectedValue; if (LearnSite.Common.WordProcess.IsNum(sgrade)) { int Qobj = int.Parse(sgrade); LearnSite.BLL.QuizGrade bll = new LearnSite.BLL.QuizGrade(); LearnSite.Model.QuizGrade model = new LearnSite.Model.QuizGrade(); model = bll.GetModelByQobjQhid(Qobj, Int32.Parse(hidstr)); if (model != null) { Session[hidstr + "oldselect"] = model.Qclass; DDLOnly.SelectedValue = model.Qonly.ToString(); DDLMore.SelectedValue = model.Qmore.ToString(); DDLJudge.SelectedValue = model.Qjudge.ToString(); Quizpower.Checked = model.Qopen.Value; if (model.Qanswer != null) { Quizanswer.Checked = model.Qanswer.Value; } } } } }
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 = "请咨询老师设置本班测验!"; } }
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; } } }
protected void BtnSelect_Click(object sender, EventArgs e) { string hidstr = tcook.Hid.ToString(); string selectstr = SelectClass(); if (selectstr != "" && DDLgrade.SelectedValue != "") { int Qobj = int.Parse(DDLgrade.SelectedValue); LearnSite.BLL.QuizGrade bll = new LearnSite.BLL.QuizGrade(); LearnSite.Model.QuizGrade model = new LearnSite.Model.QuizGrade(); model.Qobj = Qobj; model.Qclass = selectstr; model.Qhid = Int32.Parse(hidstr); model.Qonly = Int32.Parse(DDLOnly.SelectedValue); model.Qmore = Int32.Parse(DDLMore.SelectedValue); model.Qjudge = Int32.Parse(DDLJudge.SelectedValue); model.Qopen = Quizpower.Checked; model.Qanswer = Quizanswer.Checked; string qid = bll.ExistsQobj(Qobj, Int32.Parse(hidstr)); if (qid != "") { model.Qid = Int32.Parse(qid); bll.Update(model);//如果存在则更新设置 } else { bll.Add(model);//如果不存在则添加设置 } string quizstr = "暂停"; if (Quizpower.Checked) { quizstr = "启用"; } Labelmsg.Text = "你给" + DDLgrade.SelectedValue + "年级选择的测验类型为:" + selectstr + "<br/><br/>单选题数:" + DDLOnly.SelectedValue + "多选题数:" + DDLMore.SelectedValue + "判断题数:" + DDLJudge.SelectedValue + "<br/><br/>当前年级测验开关状态:" + quizstr; } else { Labelmsg.Text = "提交选择失败!请至少选择一项"; } }