public ActionResult QuestShow() { M_Exam_Sys_Questions model = questBll.GetSelect(Mid); if (model == null) { function.WriteErrMsg("试题不存在"); return(null); } DataTable dt = questBll.SelByIDSForExam(model.p_id.ToString()); dt.DefaultView.RowFilter = "pid>0"; dt.DefaultView.Sort = "order desc"; ViewBag.questDt = dt.DefaultView.ToTable(); return(View(model)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindType(); int id = DataConverter.CLng(Request.QueryString["id"]); M_Exam_Sys_Questions mq = bq.GetSelect(id); if (mq != null && mq.p_id > 0) { this.ddlType.SelectedValue = mq.p_Type.ToString(); ddlType.Enabled = false; this.shuming.Text = mq.p_shuming.ToString(); hfpid.Value = mq.p_id.ToString(); txtP_Content.Text = mq.p_Content; hffilename.Value = mq.p_Shipin; txtCourse.Text = mq.p_defaultScores.ToString(); hfParentId.Value = mq.parentId.ToString(); ddlNumber1.SelectedValue = mq.p_ChoseNum.ToString(); hfoption.Value = SafeSC.ReadFileStr(M_Exam_Sys_Questions.OptionDir + mq.p_id + ".opt"); hfanw.Value = mq.p_Answer; } else { ddlType.Enabled = true; hfParentId.Value = Request.QueryString["p_Id"]; } option(); } Call.SetBreadCrumb(Master, "<li>教育模块</li><li><a href='QuestionManage.aspx'>在线考试系统</a></li><li>课程管理</li>"); }
public ActionResult AddSmallQuest() { int Pid = DataConverter.CLng(Request.QueryString["pid"]); M_Exam_Sys_Questions questMod = questBll.GetSelect(Mid); if (questMod.p_id <= 0 && Pid > 0) { M_Exam_Sys_Questions pMod = questBll.GetSelect(Pid); questMod.p_Difficulty = pMod.p_Difficulty; questMod.p_Class = pMod.p_Class; questMod.Tagkey = pMod.Tagkey; questMod.IsShare = pMod.IsShare; questMod.p_defaultScores = pMod.p_defaultScores; questMod.Jiexi = pMod.Jiexi; questMod.Version = pMod.Version; } return(View(questMod)); }
public VM_Question(HttpContext ctx) { this.ctx = ctx; gradeDT = new B_GradeOption().GetGradeList(6, 0); verDT = verBll.Sel(); if (Mid > 0) { questMod = questBll.GetSelect(Mid); } }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void EBtnSubmit_Click(object sender, EventArgs e) { string[] cont = GetContent(); bq = new B_Exam_Sys_Questions(); int id = DataConverter.CLng(hfpid.Value); M_Exam_Sys_Questions questions = bq.GetSelect(id); questions.p_Shipin = hffilename.Value; questions.p_shuming = this.shuming.Text; questions.p_Content = this.txtP_Content.Text; questions.p_ChoseNum = DataConverter.CLng(ddlNumber1.SelectedValue); questions.p_defaultScores = DataConverter.CFloat(txtCourse.Text); if (cont != null && cont.Length > 0) { questions.p_Answer = cont[1]; } if (cont != null && cont.Length > 0) { SafeSC.WriteFile(M_Exam_Sys_Questions.OptionDir + id + ".opt", cont[0]); } //questions.p_Optioninfo = cont[0]; if (id > 0) //修改 { bool result = bq.GetUpdate(questions); if (result) { function.WriteSuccessMsg("修改成功!"); Response.Write("<script>window.close();</script>"); } else { function.WriteErrMsg("修改失败!"); } } else //添加 { questions.p_Type = DataConverter.CLng(ddlType.SelectedValue); questions.p_Inputer = badmin.GetAdminLogin().AdminName; //当前登录ID questions.p_CreateTime = DateTime.Now.Date; questions.p_Views = 1; questions.parentId = DataConverter.CLng(hfParentId.Value); int result = bq.GetInsert(questions); if (result > 0) { Response.Write("<script>alert('添加成功!');window.close();</script>"); } else { function.WriteErrMsg("添加失败!"); } } }
public VM_Question(M_UserInfo mu) { gradeDT = B_GradeOption.GetGradeList(6, 0); verDT = verBll.Sel(); if (Mid > 0) { questMod = questBll.GetSelect(Mid); if (questMod.UserID != mu.UserID) { function.WriteErrMsg("你无权修改该试题"); } } }
public void MyBind() { M_Exam_Sys_Questions model = questionBll.GetSelect(QID); if (model == null) { function.WriteErrMsg("无效id!"); } Title_L.Text = model.p_title; Grade_L.Text = B_GradeOption.GetGradeOption(model.p_Views).GradeName; Diff_L.Text = questionBll.GetDiffStr(model.p_Difficulty); QType_L.Text = M_Exam_Sys_Questions.GetTypeStr(model.p_Type); if (!string.IsNullOrEmpty(model.Tagkey)) { KeyWord_L.Text = knowBll.GetNamesByIDS(model.Tagkey); } Content_Li.Text = model.p_Content; if (model.p_Type == 10) { Content_Li.Text = model.LargeContent; Option_Li.Visible = false; Quest_RPT.Visible = true; DataTable dt = questionBll.SelByIDSForExam(model.p_id.ToString()); dt.DefaultView.RowFilter = "pid>0"; dt.DefaultView.Sort = "order desc"; Quest_RPT.DataSource = dt; Quest_RPT.DataBind(); } else { Option_Li.Text = questionBll.GetSubmit(model.p_id, model.p_Type, ref AngularJS); } Socre_L.Text = model.p_defaultScores.ToString(); QuestNum_L.Text = model.p_ChoseNum.ToString(); Answer_L.Text = model.p_Answer; AnswerHtml_Li.Text = model.p_shuming; Jiexi_Li.Text = model.Jiexi; }
//自动校验答案 private M_Exam_Answer CheckIsRight(M_Exam_Answer answerMod) { M_Exam_Sys_Questions questMod = questBll.GetSelect(answerMod.QID); if (string.IsNullOrEmpty(questMod.p_Answer)) { answerMod.IsRight = NOAUDIT; return(answerMod); } switch (questMod.MyQType) { case M_Exam_Sys_Questions.QType.Radio: answerMod.IsRight = answerMod.Answer.Equals(questMod.p_Answer) ? RIGHT : ERROR; break; case M_Exam_Sys_Questions.QType.Multi: //检测是否包含指定选项,数量不能有差异,顺序可以不计 { answerMod.Answer = answerMod.Answer.TrimEnd(','); string[] answerArr = answerMod.Answer.Split(','); string[] rightArr = questMod.p_Answer.Split('|'); if (answerArr.Length != rightArr.Length) { answerMod.IsRight = ERROR; break; } foreach (string answer in answerArr) { if (!rightArr.Contains(answer)) { answerMod.IsRight = ERROR; break; } } answerMod.IsRight = RIGHT; } break; case M_Exam_Sys_Questions.QType.FillBlank: { //检测是否包含指定选项,数量不能有差异,需要按顺序 answerMod.Answer = answerMod.Answer.TrimEnd("|".ToCharArray()); string[] answerArr = Regex.Split(answerMod.Answer, Regex.Escape("|||")); string[] rightArr = questMod.p_Answer.Split('|'); if (answerArr.Length != rightArr.Length) { answerMod.IsRight = ERROR; break; } for (int i = 0; i < answerArr.Length; i++) { if (answerArr[i] != rightArr[i]) { answerMod.IsRight = ERROR; break; } } answerMod.IsRight = RIGHT; } break; case M_Exam_Sys_Questions.QType.Answer: { //解析题如果答案相符则计对,否则人工审核 answerMod.Answer = answerMod.Answer.Trim().TrimStart("解:".ToCharArray()); answerMod.IsRight = answerMod.Answer.Equals(questMod.p_Answer) ? RIGHT : NOAUDIT; } break; } return(answerMod); }
protected void Page_Load(object sender, EventArgs e) { Call.HideBread(Master); if (!IsPostBack) { if (NodeID > 0) { M_Exam_Class nodeMod = nodeBll.GetSelect(NodeID); CurNode_L.Text = "[" + nodeMod.C_ClassName + "]"; } else { nodetr.Style.Remove("display"); } if (Grade > 0) { CurNode_L.Text += "[" + B_GradeOption.GetGradeOption(Grade).GradeName + "]"; Grade_Radio.SelectedValue = Grade.ToString(); } //-------------- GetQuesType(); InitQuestGrade(); if (Mid > 0) { SaveNew_Btn.Visible = true; M_Exam_Sys_Questions questMod = questBll.GetSelect(Mid); if (questMod != null && questMod.p_id > 0) { txtP_title.Text = questMod.p_title; //rblDiff.SelectedValue = questMod.p_Difficulty.ToString(); Diffcult_T.Text = questMod.p_Difficulty.ToString("f2"); AnswerHtml_T.Text = questMod.p_shuming; Grade_Radio.SelectedValue = questMod.p_Views.ToString(); if (!string.IsNullOrEmpty(questMod.Tagkey)) { TagKey_T.Value = knowBll.GetNamesByIDS(questMod.Tagkey); } //TagKey_T.Text = questMod.Tagkey; NodeID_Hid.Value = questMod.p_Class.ToString(); txtP_Content.Text = questMod.p_Content; if (questMod.p_Type == 10) { txtP_Content.Text = questMod.LargeContent; } txtDefaSocre.Text = questMod.p_defaultScores.ToString(); Qinfo_Hid.Value = questMod.Qinfo; ddlNumber1.SelectedValue = questMod.p_ChoseNum.ToString(); Optioninfo_Hid.Value = SafeSC.ReadFileStr(questMod.GetOPDir()); Answer_T.Text = questMod.p_Answer; txtJiexi.Value = questMod.Jiexi; IsShare_Chk.Checked = questMod.IsShare == 1; Version_Rad.SelectedValue = questMod.Version.ToString(); function.Script(this, "SetRadVal('qtype_rad'," + questMod.p_Type + ");"); } } else { if (NodeID > 0) { NodeID_Hid.Value = NodeID.ToString(); } } } }
public ActionResult QuestView() { M_Exam_Sys_Questions questMod = questBll.GetSelect(Mid); return(View(questMod)); }