private void btnAdd_Click(object sender, EventArgs e) { if (cboCourse.SelectedValue == null || txtFrontTitle.Text == "" || txtbackTitle.Text == "") { MessageBox.Show("请输入完整的题目信息!"); } else if (txtAnswer.Text == "") { MessageBox.Show("请输入正确答案!"); } else { try { fillBlankProblem fbp = new fillBlankProblem(cboCourse.SelectedValue.ToString(), txtFrontTitle.Text, txtbackTitle.Text, txtAnswer.Text); QuestionBll.AddfillBlankProblem(fbp); MessageBox.Show("添加成功!"); this.Close(); } catch (Exception ee) { MessageBox.Show("添加失败!" + ee); throw; } } }
protected void btnDelete_Click(object sender, EventArgs e) { QuestionBll qbll = new QuestionBll(); qbll.Delete(int.Parse(this.lblQuestionId.Text)); Response.Redirect("QuestionList.aspx"); }
private void btnAdd_Click(object sender, EventArgs e) { string RightWrong = "False"; if (cboCourse.SelectedValue == null || txtTitle.Text == "") { MessageBox.Show("请输入完整的题目信息!"); } else if (rdoRight.Checked == false && rdoWrong.Checked == false) { MessageBox.Show("请选择正确答案!"); } else { if (rdoRight.Checked == true) { RightWrong = "True"; } try { JudgeQuestionProblem jqp = new JudgeQuestionProblem(cboCourse.SelectedValue.ToString(), txtTitle.Text, RightWrong); QuestionBll.AddjudgeProblem(jqp); MessageBox.Show("添加成功!"); this.Close(); } catch (Exception ee) { MessageBox.Show("添加失败!" + ee); throw; } } }
private void btnAdd_Click(object sender, EventArgs e) { if (cboCourse.SelectedValue == null || txtTitle.Text == "" || txtAnswerA.Text == "" || txtAnswerB.Text == "" || txtAnswerC.Text == "" || txtAnswerD.Text == "") { MessageBox.Show("请输入完整的题目信息!"); } else if (cboAnswer.Text == "") { MessageBox.Show("请选择正确答案!"); } else { try { SingleMultiProblem smp = new SingleMultiProblem(cboCourse.SelectedValue.ToString(), txtTitle.Text, txtAnswerA.Text, txtAnswerB.Text, txtAnswerC.Text, txtAnswerD.Text, cboAnswer.Text); QuestionBll.AddsingleProblem(smp); MessageBox.Show("添加成功!"); this.Close(); } catch (Exception ee) { MessageBox.Show("添加失败!" + ee); throw; } } }
private void tabConQustion_SelectedIndexChanged(object sender, EventArgs e) { switch (tabConQustion.SelectedTab.Text) { case "单选题": dataGridView1.DataSource = QuestionBll.QuestionFillDs().Tables[0]; break; case "多选题": dataGridView2.DataSource = QuestionBll.QuestionFillDs().Tables[1]; break; case "判断题": dataGridView3.DataSource = QuestionBll.QuestionFillDs().Tables[2]; break; case "填空题": dataGridView4.DataSource = QuestionBll.QuestionFillDs().Tables[3]; break; case "问答题": dataGridView5.DataSource = QuestionBll.QuestionFillDs().Tables[4]; break; default: break; } }
private void tsbDel_Click(object sender, EventArgs e) { string Question = tabConQustion.SelectedTab.Text; switch (Question) { case "单选题": QuestionBll.Delete(dataGridView1, Question); dataGridView1.DataSource = QuestionBll.QuestionFillDs().Tables[0]; break; case "多选题": QuestionBll.Delete(dataGridView2, Question); dataGridView2.DataSource = QuestionBll.QuestionFillDs().Tables[1]; break; case "判断题": QuestionBll.Delete(dataGridView3, Question); dataGridView3.DataSource = QuestionBll.QuestionFillDs().Tables[2]; break; case "填空题": QuestionBll.Delete(dataGridView4, Question); dataGridView4.DataSource = QuestionBll.QuestionFillDs().Tables[3]; break; case "问答题": QuestionBll.Delete(dataGridView5, Question); dataGridView5.DataSource = QuestionBll.QuestionFillDs().Tables[4]; break; default: break; } }
private void frmQustionDataBase_Load(object sender, EventArgs e) { dataGridView1.DataSource = QuestionBll.QuestionFillDs().Tables[0]; dataGridView2.DataSource = QuestionBll.QuestionFillDs().Tables[1]; dataGridView3.DataSource = QuestionBll.QuestionFillDs().Tables[2]; dataGridView4.DataSource = QuestionBll.QuestionFillDs().Tables[3]; dataGridView5.DataSource = QuestionBll.QuestionFillDs().Tables[4]; }
protected void lbtnDoQuestion_Click(object sender, EventArgs e) { QuestionBll qbll = new QuestionBll(); QuestionModel qmodel = new QuestionModel(); qmodel.UserId = Context.User.Identity.Name; string content = txtContent.Text.Trim(); qmodel.Title = content.Substring(0, content.Length > 50 ? 50 : content.Length); qmodel.Content = content; qmodel.ContentType = NetShop.Common.ContentType.Maintenance; qmodel.ContentId = 0; qbll.Add(qmodel); ShowQuestionInfo(); }
public string GetUserQuestionList(string userId, string type) { switch (type.ToUpper()) { case "QUESTION": return(_javaScriptSerializer.Serialize(QuestionBll.GetList(userId))); case "ANSWER": return(_javaScriptSerializer.Serialize(QuestionBll.GetUserAnswerList(userId))); case "FAVOURITE": return(_javaScriptSerializer.Serialize(iMoocQA.Data.UserFavourite.GetUserFavourites(userId))); default: return(string.Empty); } }
public string Save(string userId, string title, string content) { var returnData = new ReturnData(); if (!string.IsNullOrEmpty(title) && !string.IsNullOrEmpty(content) && !string.IsNullOrEmpty(userId)) { QuestionBll.Save(userId, title, content); returnData.Status = "OK"; returnData.StatusContent = "发表成功"; } else { returnData.Status = "PARAERROR"; returnData.StatusContent = "参数错误"; } return(_javaScriptSerializer.Serialize(returnData)); }
public string Answer(string userId, string questionId, string content) { var returnData = new ReturnData(); if (!string.IsNullOrEmpty(userId) && !string.IsNullOrEmpty(questionId) && !string.IsNullOrEmpty(content)) { QuestionBll.Answer(userId, questionId, content); returnData.Status = "OK"; returnData.StatusContent = "回答成功"; } else { returnData.Status = "PARAERROR"; returnData.StatusContent = "参数错误"; } return(_javaScriptSerializer.Serialize(returnData)); }
// Token: 0x06000065 RID: 101 RVA: 0x0000A910 File Offset: 0x00008B10 protected string OptionInt(int ascount, int optiondisplay) { string text = ""; for (int i = 0; i < ascount; i++) { if (text != "") { text += ","; } text += i.ToString(); } if (optiondisplay == 0) { string[] array = FPUtils.SplitString(text); text = QuestionBll.GetRandom(array, array.Length); } return(text); }
private void btnAdd_Click(object sender, EventArgs e) { if (cboCourse.SelectedValue == null || txtTitle.Text == "" || txtAnswerA.Text == "" || txtAnswerB.Text == "" || txtAnswerC.Text == "" || txtAnswerD.Text == "") { MessageBox.Show("请输入完整的题目信息!"); } else if (ckbA.Checked == false && ckbB.Checked == false && ckbC.Checked == false && ckbD.Checked == false) { MessageBox.Show("请选择正确答案!"); } else { string answer = ""; if (ckbA.Checked == true) { answer += "A"; } if (ckbB.Checked == true) { answer += "B"; } if (ckbC.Checked == true) { answer += "C"; } if (ckbD.Checked == true) { answer += "D"; } try { SingleMultiProblem smp = new SingleMultiProblem(cboCourse.SelectedValue.ToString(), txtTitle.Text, txtAnswerA.Text, txtAnswerB.Text, txtAnswerC.Text, txtAnswerD.Text, answer); QuestionBll.AddmultiProblem(smp); MessageBox.Show("添加成功!"); this.Close(); } catch (Exception ee) { MessageBox.Show("添加失败!" + ee); throw; } } }
private void tsbAdd_Click(object sender, EventArgs e) { switch (tabConQustion.SelectedTab.Text) { case "单选题": frmSingleSelectAdd fssa = new frmSingleSelectAdd(); fssa.ShowDialog(); dataGridView1.DataSource = QuestionBll.QuestionFillDs().Tables[0]; break; case "多选题": frmMultiSelectAdd fmsa = new frmMultiSelectAdd(); fmsa.ShowDialog(); dataGridView2.DataSource = QuestionBll.QuestionFillDs().Tables[1]; break; case "判断题": frmJudgeAdd fja = new frmJudgeAdd(); fja.ShowDialog(); dataGridView3.DataSource = QuestionBll.QuestionFillDs().Tables[2]; break; case "填空题": frmFillBlankAdd ffba = new frmFillBlankAdd(); ffba.ShowDialog(); dataGridView4.DataSource = QuestionBll.QuestionFillDs().Tables[3]; break; case "问答题": frmQuestionAdd fqa = new frmQuestionAdd(); fqa.ShowDialog(); dataGridView5.DataSource = QuestionBll.QuestionFillDs().Tables[4]; break; default: break; } }
private void ShowInfo(int questionId) { QuestionBll qbll = new QuestionBll(); QuestionModel qmodel = qbll.GetModel(questionId); if (qmodel == null) { throw new Exception("没有找到相应的问题"); } else { this.lblQuestionId.Text = qmodel.QuestionId.ToString(); this.lblUserId.Text = qmodel.UserId; this.lblQContent.Text = qmodel.Content; this.lblQTitle.Text = qmodel.Title; this.lblAnswerId.Text = String.Empty; this.txtAContent.Text = String.Empty; this.txtATitle.Text = String.Empty; BindAnswers(); } }
public ActionResult AddQuestion(string title, string content) { var baseModel = new DataBaseModel(); var currentModel = CurrentModel; if (currentModel == null || currentModel.Id < 1) { baseModel.StateCode = "0001"; baseModel.StateDesc = "请先登陆"; } else if (title == null) { baseModel.StateCode = "0001"; baseModel.StateDesc = "标题为空"; } else if (content == null) { baseModel.StateCode = "0001"; baseModel.StateDesc = "内容为空"; } if (baseModel.StateCode == "") { return(Json(baseModel, JsonRequestBehavior.AllowGet)); } Debug.Assert(currentModel != null, "currentModel != null"); PiFQuestionInfoModel newQuestionInfo = new PiFQuestionInfoModel() { PiFQuestionTitle = title, PiFQuestionContent = content, PiFSendUserId = currentModel.Id, PiFSendUserName = currentModel.PiFUserName }; var resulte = new QuestionBll().AddQuestion(newQuestionInfo); return(Json(resulte, JsonRequestBehavior.DenyGet)); }
private void btnOK_Click(object sender, EventArgs e) { if (txtTime.Text == "") { MessageBox.Show("请输入考试时间!"); } else { if (ckbSingleProblem.Checked == true) { if (txtSingleMark.Text == "" || txtSingleCount.Text == "") { MessageBox.Show("请输入单选题详细信息!"); } else { if (Convert.ToInt32(txtSingleCount.Text) < QuestionBll.singleCount(cboCourse.SelectedValue.ToString())) { List <int> count = num(QuestionBll.singleCount(cboCourse.SelectedValue.ToString()), Convert.ToInt32(txtSingleCount.Text)); for (int i = 0; i < Convert.ToInt32(txtSingleCount.Text); i++) { pd.Add(new PaperDetail(PaperBll.GetPaperID(txtPaperName.Text), "singleProblem", count[i], Convert.ToInt32(txtSingleMark.Text), Convert.ToInt32(txtTime.Text))); } } else { MessageBox.Show("题库题目不足!"); } } } if (ckbMultiProblem.Checked == true) { if (txtMultiCount.Text == "" || txtMultiMark.Text == "") { MessageBox.Show("请输入多选题详细信息!"); } else { if (Convert.ToInt32(txtMultiCount.Text) < QuestionBll.multiCount(cboCourse.SelectedValue.ToString())) { List <int> count = num(QuestionBll.multiCount(cboCourse.SelectedValue.ToString()), Convert.ToInt32(txtMultiCount.Text)); for (int i = 0; i < Convert.ToInt32(txtMultiCount.Text); i++) { pd.Add(new PaperDetail(PaperBll.GetPaperID(txtPaperName.Text), "multiProblem", count[i], Convert.ToInt32(txtMultiMark.Text), Convert.ToInt32(txtTime.Text))); } } else { MessageBox.Show("题库题目不足!"); } } } if (ckbFillBlankProblem.Checked == true) { if (txtFillBlankCount.Text == "" || txtFillBlankMark.Text == "") { MessageBox.Show("请输入填空题详细信息!"); } else { if (Convert.ToInt32(txtFillBlankCount.Text) < QuestionBll.fillBlankCount(cboCourse.SelectedValue.ToString())) { List <int> count = num(QuestionBll.fillBlankCount(cboCourse.SelectedValue.ToString()), Convert.ToInt32(txtFillBlankCount.Text)); for (int i = 0; i < Convert.ToInt32(txtSingleCount.Text); i++) { pd.Add(new PaperDetail(PaperBll.GetPaperID(txtPaperName.Text), "fillBlankProblem", count[i], Convert.ToInt32(txtFillBlankMark.Text), Convert.ToInt32(txtTime.Text))); } } else { MessageBox.Show("题库题目不足!"); } } } if (ckbJudgeProblem.Checked == true) { if (txtJudgeCount.Text == "" || txtJudgeMark.Text == "") { MessageBox.Show("请输入判断题详细信息!"); } else { if (Convert.ToInt32(txtJudgeCount.Text) < QuestionBll.judgeCount(cboCourse.SelectedValue.ToString())) { List <int> count = num(QuestionBll.judgeCount(cboCourse.SelectedValue.ToString()), Convert.ToInt32(txtJudgeCount.Text)); for (int i = 0; i < Convert.ToInt32(txtJudgeCount.Text); i++) { pd.Add(new PaperDetail(PaperBll.GetPaperID(txtPaperName.Text), "judgeProblem", count[i], Convert.ToInt32(txtJudgeMark.Text), Convert.ToInt32(txtTime.Text))); } } else { MessageBox.Show("题库题目不足!"); } } } if (ckbQuestionProblem.Checked == true) { if (txtQuestionCount.Text == "" || txtQuestionMark.Text == "") { MessageBox.Show("请输入简答题详细信息!"); } else { if (Convert.ToInt32(txtQuestionCount.Text) < QuestionBll.questionCount(cboCourse.SelectedValue.ToString())) { List <int> count = num(QuestionBll.questionCount(cboCourse.SelectedValue.ToString()), Convert.ToInt32(txtQuestionCount.Text)); for (int i = 0; i < Convert.ToInt32(txtQuestionCount.Text); i++) { pd.Add(new PaperDetail(PaperBll.GetPaperID(txtPaperName.Text), "questionProblem", count[i], Convert.ToInt32(txtQuestionMark.Text), Convert.ToInt32(txtTime.Text))); } } else { MessageBox.Show("题库题目不足!"); } } } if (ckbSingleProblem.Checked == false && ckbQuestionProblem.Checked == false && ckbMultiProblem.Checked == false && ckbJudgeProblem.Checked == false && ckbFillBlankProblem.Checked == false) { MessageBox.Show("请选择试题!"); } dataGridView1.DataSource = PaperDetailBll.PaperDetailFillDs(pd, "questionProblem").Tables[0]; dataGridView2.DataSource = PaperDetailBll.PaperDetailFillDs(pd, "singleProblem").Tables[0]; dataGridView3.DataSource = PaperDetailBll.PaperDetailFillDs(pd, "multiProblem").Tables[0]; dataGridView4.DataSource = PaperDetailBll.PaperDetailFillDs(pd, "judgeProblem").Tables[0]; dataGridView5.DataSource = PaperDetailBll.PaperDetailFillDs(pd, "fillBlankProblem").Tables[0]; } }
// Token: 0x060000B8 RID: 184 RVA: 0x00011E2C File Offset: 0x0001002C protected override void View() { if (this.ispost) { if (!this.isperm) { this.ShowErrMsg("对不起,您没有权限阅卷。"); return; } this.examresult = ExamBll.GetExamResult(this.resultid); if (this.examresult.id == 0) { this.ShowErrMsg("对不起,该考试不存在或已被删除。"); return; } int status = this.examresult.status; this.examresult.status = 2; this.examresult.exnote = FPRequest.GetString("exnote"); if (DbHelper.ExecuteUpdate <ExamResult>(this.examresult) <= 0) { this.ShowErrMsg("保存出现错误。"); return; } List <ExamResultTopic> examResultTopicList = ExamBll.GetExamResultTopicList(this.resultid); int num = 0; double score = this.examresult.score; this.examresult.score = 0.0; this.examresult.score1 = 0.0; this.examresult.score2 = 0.0; this.examresult.wrongs = 0; foreach (ExamResultTopic examResultTopic in examResultTopicList) { if (examResultTopic.questions == 0) { num++; } else { int[] array = FPUtils.SplitInt(examResultTopic.questionlist); string[] array2 = FPUtils.SplitString(examResultTopic.answerlist, "§", array.Length); string[] array3 = FPUtils.SplitString(examResultTopic.scorelist, "|", array.Length); examResultTopicList[num].scorelist = ""; examResultTopicList[num].correctlist = ""; examResultTopicList[num].score = 0.0; int num2 = 0; foreach (ExamQuestion examQuestion in QuestionBll.GetQuestionList(examResultTopic.questionlist)) { string a = array2[num2]; if (examResultTopicList[num].scorelist != "") { ExamResultTopic examResultTopic2 = examResultTopicList[num]; examResultTopic2.scorelist += "|"; } double num3 = 0.0; if (examQuestion.type == 1 || examQuestion.type == 2) { num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id); this.examresult.score1 += num3; } else if (examQuestion.type == 3) { num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id); this.examresult.score1 += num3; } else if (examQuestion.type == 4) { num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id); this.examresult.score1 += num3; } else if (examQuestion.type == 5) { num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id); this.examresult.score2 += num3; } else if (examQuestion.type == 6) { num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id); this.examresult.score2 += num3; } this.examresult.score += num3; examResultTopicList[num].score += num3; ExamResultTopic examResultTopic3 = examResultTopicList[num]; examResultTopic3.scorelist += num3.ToString(); if (examResultTopicList[num].correctlist != "") { ExamResultTopic examResultTopic4 = examResultTopicList[num]; examResultTopic4.correctlist += "|"; } bool iswrong = false; if (num3 >= examResultTopic.perscore * 0.6) { ExamResultTopic examResultTopic5 = examResultTopicList[num]; examResultTopic5.correctlist += "1"; } else { ExamResultTopic examResultTopic6 = examResultTopicList[num]; examResultTopic6.correctlist += "0"; examResultTopicList[num].wrongs++; this.examresult.wrongs++; if (a == "") { this.examresult.unanswer++; } iswrong = true; } SortInfo sortInfo = SortBll.GetSortInfo(examQuestion.sortid); ExamBll.UpdateExamLog(sortInfo, this.examresult.uid, examQuestion, iswrong); num2++; } DbHelper.ExecuteUpdate <ExamResultTopic>(examResultTopicList[num]); num++; } } ExpInfo examExpByScore = ExamBll.GetExamExpByScore(this.examresult.score, this.examresult.examid); StringBuilder stringBuilder = new StringBuilder(); if (status == 0) { stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamResult] SET [score1]={1},[score2]={2},[score]={3},[wrongs]={4},[exp]={5} WHERE [id]={6}|", new object[] { DbConfigs.Prefix, this.examresult.score1, this.examresult.score2, this.examresult.score, this.examresult.wrongs, examExpByScore.exp, this.examresult.id }); stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [exams]=[exams]+1,[score]=[score]+{1} WHERE [id]={2}", DbConfigs.Prefix, this.examresult.score, this.examresult.examid); } else { stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamResult] SET [score1]={1},[score2]={2},[score]={3},[exp]={4} WHERE [id]={5}|", new object[] { DbConfigs.Prefix, this.examresult.score1, this.examresult.score2, this.examresult.score, examExpByScore.exp, this.examresult.id }); stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [score]=[score]-{1} WHERE [id]={2}|", DbConfigs.Prefix, score, this.examresult.examid); stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [score]=[score]+{1} WHERE [id]={2}", DbConfigs.Prefix, this.examresult.score, this.examresult.examid); stringBuilder.AppendFormat("UPDATE [{0}WMS_UserInfo] SET [exp]=[exp]-{1} WHERE [id]={2}", DbConfigs.Prefix, this.examresult.exp, this.examresult.uid); } this.msg = DbHelper.ExecuteSql(stringBuilder.ToString()); UserBll.UpdateUserExp(this.examresult.uid, examExpByScore.exp); if (this.msg != "") { this.ShowErrMsg(this.msg); return; } } Hashtable hashtable = new Hashtable(); hashtable["error"] = 0; hashtable["message"] = ""; base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); }
public string GetWithUser(string id, string userId) { var entity = QuestionBll.Get(id, userId); return(_javaScriptSerializer.Serialize(entity)); }
// Token: 0x060000A4 RID: 164 RVA: 0x0000F8A4 File Offset: 0x0000DAA4 protected override void View() { if (this.ispost) { this.examresult = ExamBll.GetExamResult(this.resultid); if (this.examresult.id == 0) { this.ShowErr("对不起,该考试不存在或已被删除。"); } else if (this.examresult.uid != this.userid) { this.ShowErr("对不起,您不是该考试的主人。"); } else if (this.examresult.status == 1) { this.ShowErr("对不起,该考试已完成,不能重复提交。"); } else { this.examresult.utime = FPRequest.GetInt("utime"); this.examresult.endtime = DbUtils.GetDateTime(); this.examresult.status = 1; if (DbHelper.ExecuteUpdate <ExamResult>(this.examresult) > 0) { List <ExamResultTopic> examResultTopicList = ExamBll.GetExamResultTopicList(this.resultid); int num = 0; foreach (ExamResultTopic examResultTopic in examResultTopicList) { if (examResultTopic.questions == 0) { num++; } else { examResultTopicList[num].answerlist = ""; examResultTopicList[num].scorelist = ""; examResultTopicList[num].correctlist = ""; List <ExamQuestion> questionList = QuestionBll.GetQuestionList(examResultTopic.questionlist); string[] array = FPUtils.SplitString(examResultTopic.optionlist, "|", questionList.Count); int num2 = 0; foreach (ExamQuestion examQuestion in questionList) { string text = FPRequest.GetString("answer_" + examQuestion.id); if (num2 == 0) { ExamResultTopic examResultTopic2 = examResultTopicList[num]; examResultTopic2.answerlist += text; } else { ExamResultTopic examResultTopic3 = examResultTopicList[num]; examResultTopic3.answerlist = examResultTopic3.answerlist + "§" + text; } if (examResultTopicList[num].scorelist != "") { ExamResultTopic examResultTopic4 = examResultTopicList[num]; examResultTopic4.scorelist += "|"; } examQuestion.optionlist = array[num2]; int num3 = 0; double num4 = 0.0; if (examQuestion.type == 1 || examQuestion.type == 2) { num3 = examQuestion.ascount; examQuestion.answer = this.OptionAnswer(array[num2], examQuestion.answer); if (text == examQuestion.answer && text != "") { num4 = examResultTopic.perscore; } this.examresult.score1 += num4; } else if (examQuestion.type == 3) { num3 = examQuestion.ascount; if (text == examQuestion.answer && text != "") { num4 = examResultTopic.perscore; } this.examresult.score1 += num4; } else if (examQuestion.type == 4) { string[] array2; if (examQuestion.upperflg == 1) { array2 = FPUtils.SplitString(examQuestion.answer, ","); } else { array2 = FPUtils.SplitString(examQuestion.answer.ToLower(), ","); } text = exampost.DelSameAnser(text); string[] array3; if (examQuestion.upperflg == 1) { array3 = FPUtils.SplitString(text, ",", array2.Length); } else { array3 = FPUtils.SplitString(text.ToLower(), ",", array2.Length); } if (examQuestion.orderflg == 1) { for (int i = 0; i < array3.Length; i++) { if (FPUtils.InArray(array3[i], array2[i], "|")) { num3++; } } } else { for (int i = 0; i < array3.Length; i++) { if (FPUtils.InArray(array3[i], examQuestion.answer.Replace("|", ","))) { num3++; } } } if (num3 > 0) { if (examQuestion.ascount <= 0) { examQuestion.ascount = 1; } num4 = Math.Round(examResultTopic.perscore / (double)examQuestion.ascount * (double)num3, 1); this.examresult.score2 += num4; } } else if (examQuestion.type == 5) { foreach (string value in FPUtils.SplitString(examQuestion.answerkey)) { if (text.IndexOf(value) >= 0) { num3++; } } if (num3 > 0 && text != "") { if (examQuestion.ascount > 0) { examQuestion.ascount = 1; } num4 = Math.Round(examResultTopic.perscore / (double)examQuestion.ascount * (double)num3, 1); this.examresult.score2 += num4; } } else if (examQuestion.type == 6) { for (int k = 0; k < examQuestion.title.Length; k++) { if (text.IndexOf(examQuestion.title.Substring(k, 1)) >= 0) { num3++; } } if (num3 > 0) { num4 = Math.Round(examResultTopic.perscore / (double)examQuestion.title.Length * (double)num3, 1); this.examresult.score2 += num4; } } this.examresult.score += num4; examResultTopicList[num].score += num4; ExamResultTopic examResultTopic5 = examResultTopicList[num]; examResultTopic5.scorelist += num4.ToString(); if (examResultTopicList[num].correctlist != "") { ExamResultTopic examResultTopic6 = examResultTopicList[num]; examResultTopic6.correctlist += "|"; } bool flag = false; if (num4 >= examResultTopic.perscore * 0.6) { ExamResultTopic examResultTopic7 = examResultTopicList[num]; examResultTopic7.correctlist += "1"; } else { ExamResultTopic examResultTopic8 = examResultTopicList[num]; examResultTopic8.correctlist += "0"; examResultTopicList[num].wrongs++; this.examresult.wrongs++; if (text == "") { this.examresult.unanswer++; } flag = true; } string sqlstring; if (flag) { sqlstring = string.Format("UPDATE [{0}Exam_ExamQuestion] SET [exams]=[exams]+1,[wrongs]=[wrongs]+1 WHERE [id]={1}", DbConfigs.Prefix, examQuestion.id); } else { sqlstring = string.Format("UPDATE [{0}Exam_ExamQuestion] SET [exams]=[exams]+1 WHERE [id]={1}", DbConfigs.Prefix, examQuestion.id); } DbHelper.ExecuteSql(sqlstring); examQuestion.useranswer = text; SortInfo sortInfo = SortBll.GetSortInfo(examQuestion.sortid); ExamBll.UpdateExamLog(sortInfo, this.userid, examQuestion, flag); num2++; } DbHelper.ExecuteUpdate <ExamResultTopic>(examResultTopicList[num]); num++; } } this.expinfo = ExamBll.GetExamExpByScore(this.examresult.score, this.examresult.examid); this.examresult.exnote = this.expinfo.comment; this.examresult.exp = this.expinfo.exp; this.examresult.getcredits = this.expinfo.credits; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamResult] SET [score1]={1},[score2]={2},[score]={3},[wrongs]={4},[exp]={5},[exnote]='{6}' WHERE [id]={7}|", new object[] { DbConfigs.Prefix, this.examresult.score1, this.examresult.score2, this.examresult.score, this.examresult.wrongs, this.examresult.exp, this.examresult.exnote, this.examresult.id }); stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [score]=[score]+{1} WHERE [id]={2}", DbConfigs.Prefix, this.examresult.score, this.examresult.examid); this.msg = DbHelper.ExecuteSql(stringBuilder.ToString()); if (this.examresult.exp > 0) { UserBll.UpdateUserExp(this.examresult.uid, this.examresult.exp); } if (this.examresult.getcredits > 0) { UserBll.UpdateUserCredit(new CreditInfo { uid = this.examresult.uid, name = "考试奖励积分", type = 0, credits = this.examresult.getcredits, doid = this.userid, doname = this.username }); } if (this.msg != "") { this.ShowErr(this.msg); } } } } }
public string Get(string id) { var entity = QuestionBll.Get(id); return(_javaScriptSerializer.Serialize(entity)); }
public string List(int index, int number) { var collection = QuestionBll.GetList(index, number); return(_javaScriptSerializer.Serialize(collection)); }
// Token: 0x060000E2 RID: 226 RVA: 0x000161B4 File Offset: 0x000143B4 protected override void View() { this.channelinfo = ChannelBll.GetChannelInfo("exam_question"); if (this.channelinfo.id == 0) { this.ShowErr("对不起,目前系统尚未创建题目库频道。"); } else if (this.ispost) { if (this.qidlist == "") { this.ShowErr("对不起,题目为空不能提交。"); } else { List <ExamQuestion> questionList = QuestionBll.GetQuestionList(this.qidlist); this.examresult.uid = this.userid; this.examresult.channelid = this.channelinfo.id; this.examresult.examid = 0; this.examresult.examtype = 0; this.examresult.showanswer = 1; this.examresult.allowdelete = 1; this.examresult.examname = ((this.testtype == 1) ? "专项智能练习" : "快速智能练习"); this.examresult.examtime = FPRequest.GetInt("utime") / 60; this.examresult.total = 100.0; this.examresult.passmark = 60.0; this.examresult.credits = 0; this.examresult.questions = questionList.Count; this.examresult.utime = FPRequest.GetInt("utime"); this.examresult.starttime = FPRequest.GetDateTime("starttime"); this.examresult.endtime = DbUtils.GetDateTime(); this.examresult.status = 1; this.examresult.id = DbHelper.ExecuteInsert <ExamResult>(this.examresult); if (this.examresult.id > 0) { ExamResultTopic examResultTopic = new ExamResultTopic(); examResultTopic.resultid = this.examresult.id; examResultTopic.type = 0; examResultTopic.title = ((this.testtype == 1) ? "专项智能练习" : "快速智能练习"); examResultTopic.perscore = Math.Round(this.examresult.total / (double)this.examresult.questions, 1); examResultTopic.display = 1; examResultTopic.questions = questionList.Count; examResultTopic.questionlist = this.qidlist; int num = 0; foreach (ExamQuestion examQuestion in QuestionBll.GetQuestionList(examResultTopic.questionlist)) { if (examResultTopic.optionlist != "") { ExamResultTopic examResultTopic2 = examResultTopic; examResultTopic2.optionlist += "|"; } if (examQuestion.type == 1 || examQuestion.type == 2) { ExamResultTopic examResultTopic3 = examResultTopic; examResultTopic3.optionlist += this.OptionInt(examQuestion.ascount); } else { ExamResultTopic examResultTopic4 = examResultTopic; examResultTopic4.optionlist += "*"; } string text = FPRequest.GetString("answer_" + examQuestion.id); if (num == 0) { ExamResultTopic examResultTopic5 = examResultTopic; examResultTopic5.answerlist += text; } else { ExamResultTopic examResultTopic6 = examResultTopic; examResultTopic6.answerlist = examResultTopic6.answerlist + "§" + text; } if (examResultTopic.scorelist != "") { ExamResultTopic examResultTopic7 = examResultTopic; examResultTopic7.scorelist += "|"; } int num2 = 0; double num3 = 0.0; if (examQuestion.type <= 3) { if (text == examQuestion.answer && text != "") { num2 = examQuestion.ascount; num3 = examResultTopic.perscore; this.examresult.score1 += num3; } } else if (examQuestion.type == 4) { string[] array; if (examQuestion.upperflg == 1) { array = FPUtils.SplitString(examQuestion.answer, ","); } else { array = FPUtils.SplitString(examQuestion.answer.ToLower(), ","); } text = testpost.DelSameAnser(text); string[] array2; if (examQuestion.upperflg == 1) { array2 = FPUtils.SplitString(text, ",", array.Length); } else { array2 = FPUtils.SplitString(text.ToLower(), ",", array.Length); } if (examQuestion.orderflg == 1) { for (int i = 0; i < array2.Length; i++) { if (FPUtils.InArray(array2[i], array[i], "|")) { num2++; } } } else { for (int i = 0; i < array2.Length; i++) { if (FPUtils.InArray(array2[i], examQuestion.answer.Replace("|", ","))) { num2++; } } } if (num2 > 0) { if (examQuestion.ascount <= 0) { examQuestion.ascount = 1; } num3 = Math.Round(examResultTopic.perscore / (double)examQuestion.ascount * (double)num2, 1); this.examresult.score2 += num3; } } else if (examQuestion.type == 5) { foreach (string value in FPUtils.SplitString(examQuestion.answerkey)) { if (text.IndexOf(value) >= 0) { num2++; } } if (num2 > 0 && text != "") { if (examQuestion.ascount > 0) { examQuestion.ascount = 1; } num3 = Math.Round(examResultTopic.perscore / (double)examQuestion.ascount * (double)num2, 1); this.examresult.score2 += num3; } } else if (examQuestion.type == 6) { for (int k = 0; k < examQuestion.title.Length; k++) { if (text.IndexOf(examQuestion.title.Substring(k, 1)) >= 0) { num2++; } } if (num2 > 0) { num3 = Math.Round(examResultTopic.perscore / (double)examQuestion.title.Length * (double)num2, 1); this.examresult.score2 += num3; } } this.examresult.score += num3; examResultTopic.score += num3; ExamResultTopic examResultTopic8 = examResultTopic; examResultTopic8.scorelist += num3.ToString(); if (examResultTopic.correctlist != "") { ExamResultTopic examResultTopic9 = examResultTopic; examResultTopic9.correctlist += "|"; } bool flag = false; if (num3 >= examResultTopic.perscore * 0.6) { ExamResultTopic examResultTopic10 = examResultTopic; examResultTopic10.correctlist += "1"; } else { ExamResultTopic examResultTopic11 = examResultTopic; examResultTopic11.correctlist += "0"; examResultTopic.wrongs++; this.examresult.wrongs++; if (text == "") { this.examresult.unanswer++; } flag = true; } string sqlstring; if (flag) { sqlstring = string.Format("UPDATE [{0}Exam_ExamQuestion] SET [exams]=[exams]+1,[wrongs]=[wrongs]+1 WHERE [id]={1}", DbConfigs.Prefix, examQuestion.id); } else { sqlstring = string.Format("UPDATE [{0}Exam_ExamQuestion] SET [exams]=[exams]+1 WHERE [id]={1}", DbConfigs.Prefix, examQuestion.id); } DbHelper.ExecuteSql(sqlstring); examQuestion.useranswer = text; SortInfo sortInfo = SortBll.GetSortInfo(examQuestion.sortid); ExamBll.UpdateExamLog(sortInfo, this.userid, examQuestion, flag); num++; } DbHelper.ExecuteInsert <ExamResultTopic>(examResultTopic); SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeSet("score1", this.examresult.score1), DbHelper.MakeSet("score2", this.examresult.score2), DbHelper.MakeSet("score", this.examresult.score), DbHelper.MakeSet("wrongs", this.examresult.wrongs), DbHelper.MakeAndWhere("id", this.examresult.id) }; DbHelper.ExecuteUpdate <ExamResult>(sqlparams); } } } }
// Token: 0x060000C8 RID: 200 RVA: 0x0001373C File Offset: 0x0001193C protected override void View() { base.Response.Expires = 0; base.Response.CacheControl = "no-cache"; base.Response.Cache.SetNoStore(); this.channelinfo = ChannelBll.GetChannelInfo("exam_question"); if (this.channelinfo.id == 0) { this.ShowErr("对不起,目前系统尚未创建题目库频道。"); } else { this.examinfo = DbHelper.ExecuteModel <ExamInfo>(this.examid); if (this.examinfo.id == 0) { this.ShowErr("对不起,该考试不存在或已被删除。"); } else { if (this.examinfo.status == 0) { if (!this.isperm && this.examinfo.uid != this.userid) { this.ShowErr("对不起,该考试已关闭。"); return; } } this.sortid = this.examinfo.sortid; this.sortinfo = SortBll.GetSortInfo(this.sortid); if (this.sortinfo.id == 0) { SqlParam sqlParam = DbHelper.MakeAndWhere("sortid", this.sortid); DbHelper.ExecuteDelete <ExamInfo>(new SqlParam[] { sqlParam }); this.ShowErr("对不起,考试栏目不存在或已被删除。"); } else if (this.ispost) { if (this.examinfo.examroles != "") { if (!base.ischecked(this.roleid, this.examinfo.examroles) && !this.isperm) { this.ShowErr("对不起,您所在的角色不允许参加本场考试。"); return; } } if (this.examinfo.examdeparts != "") { if (!base.ischecked(this.user.departid, this.examinfo.examdeparts) && !this.isperm) { this.ShowErr("对不起,您所在的部门不允许参加本场考试。"); return; } } if (this.examinfo.examuser != "") { if (!base.ischecked(this.userid, this.examinfo.examuser) && !this.isperm) { this.ShowErr("对不起,您不允许参加本场考试。"); return; } } if (this.examinfo.islimit == 1) { if (this.examinfo.starttime > DateTime.Now) { this.ShowErr("对不起,本场考试尚未到考试时间。"); return; } if (this.examinfo.endtime < DateTime.Now) { this.ShowErr("对不起,本场考试已超过考试期限。"); return; } } SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeAndWhere("examid", this.examid), DbHelper.MakeAndWhere("uid", this.userid), DbHelper.MakeAndWhere("status", 0) }; int num = DbHelper.ExecuteCount <ExamResult>(sqlparams); if (num > 0) { this.ShowErr("对不起,本场考试您已经考过但尚未完成,请到考试历史那里查找。"); } else { if (this.examinfo.repeats > 0) { SqlParam[] sqlparams2 = new SqlParam[] { DbHelper.MakeAndWhere("examid", this.examid), DbHelper.MakeAndWhere("uid", this.userid), DbHelper.MakeAndWhere("status", WhereType.GreaterThanEqual, 1) }; num = DbHelper.ExecuteCount <ExamResult>(sqlparams2); if (num >= this.examinfo.repeats) { this.ShowErr("对不起,本场考试限制次数为" + this.examinfo.repeats + "次,您已考完不能再考。"); return; } } if (this.examinfo.credits > 0 && !this.isperm && this.examinfo.uid != this.userid) { if (this.user.credits < this.examinfo.credits) { this.ShowErr("对不起,您的积分余额不足,不能参加本场考试。"); return; } UserBll.UpdateUserCredit(this.userid, "参加考试", 0, this.examinfo.credits * -1); } Random random = new Random(); int paper = random.Next(this.examinfo.papers) + 1; List <ExamTopic> examTopicList = ExamBll.GetExamTopicList(this.examid, paper); int num2 = 0; for (int i = 0; i < examTopicList.Count; i++) { examTopicList[i].questionlist = QuestionBll.GetTopicQuestion(this.channelinfo.id, examTopicList[i]); string[] array = FPUtils.SplitString(examTopicList[i].questionlist); if (this.examinfo.display == 0) { examTopicList[i].questionlist = QuestionBll.GetRandom(array, array.Length); } examTopicList[i].optionlist = ""; foreach (ExamQuestion examQuestion in QuestionBll.GetQuestionList(examTopicList[i].questionlist)) { if (examTopicList[i].optionlist != "") { ExamTopic examTopic = examTopicList[i]; examTopic.optionlist += "|"; } if (examQuestion.type == 1 || examQuestion.type == 2) { ExamTopic examTopic2 = examTopicList[i]; examTopic2.optionlist += this.OptionInt(examQuestion.ascount, this.examinfo.optiondisplay); } else { ExamTopic examTopic3 = examTopicList[i]; examTopic3.optionlist += "*"; } } num2 += array.Length; examTopicList[i].questions = array.Length; } ExamResult examResult = new ExamResult(); examResult.uid = this.userid; examResult.examid = this.examid; examResult.channelid = this.channelinfo.id; examResult.sortid = this.examinfo.sortid; examResult.examtype = this.examinfo.examtype; examResult.showanswer = this.examinfo.showanswer; examResult.allowdelete = this.examinfo.allowdelete; examResult.examname = this.examinfo.name; examResult.examtime = this.examinfo.examtime; examResult.total = this.examinfo.total; examResult.passmark = this.examinfo.passmark; examResult.credits = this.examinfo.credits; examResult.questions = num2; examResult.islimit = this.examinfo.islimit; if (examResult.islimit == 1) { examResult.starttime = this.examinfo.starttime; examResult.endtime = this.examinfo.endtime; } else { examResult.starttime = DbUtils.GetDateTime(); examResult.endtime = examResult.starttime.AddMinutes((double)this.examinfo.examtime); } examResult.examdatetime = DbUtils.GetDateTime(); examResult.status = 0; examResult.paper = paper; examResult.ip = this.ip; examResult.mac = ExamConifgs.GetMacAddress(this.ip); examResult.id = DbHelper.ExecuteInsert <ExamResult>(examResult); if (examResult.id > 0) { foreach (ExamTopic examTopic4 in examTopicList) { DbHelper.ExecuteInsert <ExamResultTopic>(new ExamResultTopic { resultid = examResult.id, type = examTopic4.type, title = examTopic4.title, perscore = examTopic4.perscore, display = examTopic4.display, questions = examTopic4.questions, questionlist = examTopic4.questionlist, optionlist = examTopic4.optionlist }); } if (this.examinfo.examdeparts == "" && this.examinfo.examuser == "" && this.examinfo.examroles == "") { string text = string.Format("UPDATE [{0}Exam_ExamInfo] SET [exams]=[exams]+1 WHERE [id]={1}", DbConfigs.Prefix, this.examid); DbHelper.ExecuteSql(text.ToString()); } } base.Response.Redirect("exam.aspx?resultid=" + examResult.id); } } } } }
// Token: 0x06000061 RID: 97 RVA: 0x00009A40 File Offset: 0x00007C40 protected override void View() { this.channelinfo = ChannelBll.GetChannelInfo("exam_question"); if (this.channelinfo.id == 0) { this.ShowErr("对不起,目前系统尚未创建题目库频道。"); } else if (this.ispost) { this.examinfo = DbHelper.ExecuteModel <ExamInfo>(this.examid); this.examinfo.passmark = this.examinfo.passmark * this.examinfo.total / 100.0; this.examtopiclist = ExamBll.GetExamTopicList(this.examid, this.paper); int num = 0; for (int i = 0; i < this.examtopiclist.Count; i++) { this.examtopiclist[i].questionlist = QuestionBll.GetTopicQuestion(this.channelinfo.id, this.examtopiclist[i]); string[] array = FPUtils.SplitString(this.examtopiclist[i].questionlist); if (this.examinfo.display == 0) { this.examtopiclist[i].questionlist = QuestionBll.GetRandom(array, array.Length); } num += array.Length; this.examtopiclist[i].questions = array.Length; } this.examinfo.questions = num; AsposeWordApp asposeWordApp = new AsposeWordApp(); if (this.papersize == "a4") { asposeWordApp.Open(FPUtils.GetMapPath("images\\exampaper_a4.doc")); } else { asposeWordApp.Open(FPUtils.GetMapPath("images\\exampaper_a3.doc")); } asposeWordApp.InsertText("examtitle", this.examinfo.name); asposeWordApp.InsertText("subtitle", this.GetPaper(this.paper)); asposeWordApp.MoveToBookmark("content"); DataTable dataTable = new DataTable(); DataColumn column = new DataColumn("s0", Type.GetType("System.String")); dataTable.Columns.Add(column); int num2 = 1; foreach (ExamTopic examTopic in this.examtopiclist) { column = new DataColumn("s" + num2, Type.GetType("System.String")); dataTable.Columns.Add(column); num2++; } column = new DataColumn("s" + num2, Type.GetType("System.String")); dataTable.Columns.Add(column); DataRow dataRow = dataTable.NewRow(); dataRow["s0"] = "题 号"; num2 = 1; foreach (ExamTopic examTopic in this.examtopiclist) { dataRow["s" + num2] = this.GetNum(num2); num2++; } dataRow["s" + num2] = "总 分"; dataTable.Rows.Add(dataRow); dataRow = dataTable.NewRow(); dataRow["s0"] = "得 分"; num2 = 1; foreach (ExamTopic examTopic in this.examtopiclist) { dataRow["s" + num2] = ""; num2++; } dataRow["s" + num2] = ""; dataTable.Rows.Add(dataRow); asposeWordApp.InsertTable(dataTable, true); asposeWordApp.InsertLineBreak(); num2 = 1; foreach (ExamTopic examTopic in this.examtopiclist) { asposeWordApp.InsertScoreTable(true, true, string.Concat(new object[] { examTopic.title, " (共", examTopic.questions, "题,每题", examTopic.perscore, "分,共", (double)examTopic.questions * examTopic.perscore, "分)" })); foreach (ExamQuestion examQuestion in this.GetQuestionList(examTopic.questionlist)) { if (examQuestion.type == 1 || examQuestion.type == 2) { if (this.papertype == 1) { asposeWordApp.Writeln(string.Concat(new object[] { num2, "、", examQuestion.title, " ", examQuestion.answer }), 12.0, false, "left"); asposeWordApp.Writeln(this.Option(asposeWordApp, examQuestion.option, examQuestion.ascount, examQuestion.optionlist), 12.0, false, "left"); if (examQuestion.explain != "") { asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left"); } } else { asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left"); asposeWordApp.Writeln(this.Option(asposeWordApp, examQuestion.option, examQuestion.ascount, examQuestion.optionlist), 12.0, false, "left"); } } else if (examQuestion.type == 3) { if (this.papertype == 1) { asposeWordApp.Writeln((string.Concat(new object[] { num2, "、", examQuestion.title, " (", examQuestion.answer }) == "Y") ? "正确" : "错误)", 12.0, false, "left"); if (examQuestion.explain != "") { asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left"); } } else { asposeWordApp.Writeln(string.Concat(new object[] { num2, "、", examQuestion.title, " ( )" }), 12.0, false, "left"); } } else if (examQuestion.type == 4) { if (this.papertype == 1) { asposeWordApp.Writeln(num2 + "、" + this.FmAnswer(examQuestion.title), 12.0, false, "left"); asposeWordApp.Writeln("答案:" + examQuestion.answer, 12.0, false, "left"); if (examQuestion.explain != "") { asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left"); } } else { asposeWordApp.Writeln(num2 + "、" + this.FmAnswer(examQuestion.title), 12.0, false, "left"); } } else if (examQuestion.type == 5) { if (this.papertype == 1) { asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left"); asposeWordApp.Writeln("答:" + examQuestion.answer, 12.0, false, "left"); if (examQuestion.explain != "") { asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left"); } } else { asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left"); asposeWordApp.InsertLineBreak(6); } } else if (examQuestion.type == 6) { asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left"); } num2++; } } if (this.papertype == 0) { asposeWordApp.InsertPagebreak(); asposeWordApp.Writeln("参考答案", 12.0, true, "center"); num2 = 1; foreach (ExamTopic examTopic in this.examtopiclist) { asposeWordApp.InsertLineBreak(); asposeWordApp.Writeln(examTopic.title, 12.0, true, "left"); foreach (ExamQuestion examQuestion in this.GetQuestionList(examTopic.questionlist)) { if (examQuestion.type == 3) { asposeWordApp.Write((num2 + "、" + examQuestion.answer == "Y") ? "正确" : "错误 ", 12.0, false, "left"); } else if (examQuestion.type == 6) { asposeWordApp.Write(num2 + "、请按题目打字 ", 12.0, false, "left"); } else { asposeWordApp.Write(string.Concat(new object[] { num2, "、", examQuestion.answer, " " }), 12.0, false, "left"); } num2++; } } } asposeWordApp.Save(base.Response, this.examinfo.name + this.GetPaper(this.paper) + ".doc"); } }
// Token: 0x060000DE RID: 222 RVA: 0x00015D6C File Offset: 0x00013F6C protected override void View() { this.examconfig = ExamConifgs.GetExamConfig(); if (this.examconfig.teststatus == 0) { this.ShowErr("对不起,考试系统已关闭了用户练习。"); } else { this.channelinfo = ChannelBll.GetChannelInfo("exam_question"); if (this.channelinfo.id == 0) { this.ShowErr("对不起,目前系统尚未创建题目库频道。"); } else { this.starttime = DbUtils.GetDateTime(); if (this.limit == 0) { this.limit = 50; } if (this.limit < 5) { this.ShowErr("为了更能准确体现您的能力,每次练习题目不能少于5题。"); } else if (this.limit > this.examconfig.testcount) { this.ShowErr("对不起,每次练习题目数不得超过" + this.examconfig.testcount + "题。"); } else { string questionRandom = QuestionBll.GetQuestionRandom(this.channelinfo.id, this.limit, this.type, this.sidlist); if (questionRandom != "") { SqlParam sqlParam = DbHelper.MakeAndWhere("id", WhereType.In, questionRandom); OrderByParam orderby = DbHelper.MakeOrderBy("type", OrderBy.ASC); this.questionlist = DbHelper.ExecuteList <ExamQuestion>(orderby, new SqlParam[] { sqlParam }); foreach (ExamQuestion examQuestion in this.questionlist) { if (this.qidlist != "") { this.qidlist += ","; } this.qidlist += examQuestion.id; } int num = this.examconfig.testtime * 60; int num2 = num / 3600; int num3 = (num - num2 * 3600) / 60; int num4 = (num - num2 * 3600 - num3 * 60) % 60; this.thetime = string.Concat(new string[] { num2.ToString("00"), ":", num3.ToString("00"), ":", num4.ToString("00") }); } else { this.ShowErr("对不起,抽起的题库没有题目。"); } } } } }
// Token: 0x060000C5 RID: 197 RVA: 0x000133F0 File Offset: 0x000115F0 protected override void View() { if (this.ispost) { this.examresult = ExamBll.GetExamResult(this.resultid); if (this.examresult.id == 0) { this.ShowErrMsg("对不起,该考试不存在或已被删除。"); return; } if (this.examresult.uid != this.userid) { this.ShowErrMsg("对不起,您不是该考试的主人。"); return; } if (this.examresult.status == 1) { this.ShowErrMsg("对不起,该考试已完成,不能重复提交。"); return; } this.examresult.utime = FPRequest.GetInt("utime"); if (DbHelper.ExecuteUpdate <ExamResult>(this.examresult) <= 0) { this.ShowErrMsg("保存出现错误。"); return; } List <ExamResultTopic> examResultTopicList = ExamBll.GetExamResultTopicList(this.resultid); int num = 0; foreach (ExamResultTopic examResultTopic in examResultTopicList) { if (examResultTopic.questions == 0) { num++; } else { examResultTopicList[num].answerlist = ""; int num2 = 0; foreach (ExamQuestion examQuestion in QuestionBll.GetQuestionList(examResultTopic.questionlist)) { string @string = FPRequest.GetString("answer_" + examQuestion.id); if (num2 == 0) { ExamResultTopic examResultTopic2 = examResultTopicList[num]; examResultTopic2.answerlist += @string; } else { ExamResultTopic examResultTopic3 = examResultTopicList[num]; examResultTopic3.answerlist = examResultTopic3.answerlist + "§" + @string; } num2++; } DbHelper.ExecuteUpdate <ExamResultTopic>(examResultTopicList[num]); num++; } } } Hashtable hashtable = new Hashtable(); hashtable["error"] = 0; hashtable["message"] = ""; base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); }
// Token: 0x06000052 RID: 82 RVA: 0x00008B8C File Offset: 0x00006D8C protected override void View() { this.examtopic = DbHelper.ExecuteModel <ExamTopic>(this.examtopicid); this.examinfo = DbHelper.ExecuteModel <ExamInfo>(this.examtopic.examid); this.sortinfo = SortBll.GetSortInfo(this.examinfo.sortid); this.channelinfo = ChannelBll.GetChannelInfo("exam_question"); this.channelid = this.channelinfo.id; this.sortlist = SortBll.GetSortList(this.channelid, 0); if (this.ispost) { string text = ""; string text2 = ""; SqlParam sqlParam = DbHelper.MakeAndWhere("channelid", this.channelid); List <SortInfo> list = DbHelper.ExecuteList <SortInfo>(new SqlParam[] { sqlParam }); int num = 0; foreach (SortInfo sortInfo in list) { int @int = FPRequest.GetInt("randomcount_" + sortInfo.id); if (@int > 0) { if (text != "") { text += ","; } text += sortInfo.id; if (text2 != "") { text2 += ","; } text2 += @int; num += @int; } } if (num > this.examtopic.questions - this.examtopic.curquestions) { this.ShowErr("设定的随机题数不能大于总随机题数。"); return; } if (this.action == "save") { SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeSet("randomsort", text), DbHelper.MakeSet("randomcount", text2), DbHelper.MakeSet("randoms", num), DbHelper.MakeAndWhere("id", this.examtopicid) }; DbHelper.ExecuteUpdate <ExamTopic>(sqlparams); base.AddMsg("随机题设置保存成功!"); this.examtopic.randomsort = text; this.examtopic.randomcount = text2; this.link = string.Concat(new object[] { "examtopicrandom.aspx?examtopicid=", this.examtopicid, "&paper=", this.paper }); } else if (this.action == "create") { string text3 = this.examtopic.questionlist; int[] array = FPUtils.SplitInt(text); int[] array2 = FPUtils.SplitInt(text2, ",", array.Length); for (int i = 0; i < array.Length; i++) { if (array2[i] > 0) { string questionRandom = QuestionBll.GetQuestionRandom(this.channelid, array2[i], this.examtopic.type.ToString(), array[i], text3); if (questionRandom != "") { text3 += ((text3 == "") ? questionRandom : ("," + questionRandom)); } } } this.examtopic.questionlist = text3; this.examtopic.curquestions = FPUtils.SplitInt(this.examtopic.questionlist).Length; SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeSet("questionlist", this.examtopic.questionlist), DbHelper.MakeSet("curquestions", this.examtopic.curquestions), DbHelper.MakeSet("randomsort", ""), DbHelper.MakeSet("randomcount", ""), DbHelper.MakeSet("randoms", 0), DbHelper.MakeAndWhere("id", this.examtopicid) }; DbHelper.ExecuteUpdate <ExamTopic>(sqlparams); base.AddMsg("生成随机题目成功!"); this.link = string.Concat(new object[] { "examtopicmanage.aspx?examid=", this.examtopic.examid, "&paper=", this.paper, "&examtopicid=", this.examtopicid }); } } int[] array3 = FPUtils.SplitInt(this.examtopic.randomsort); int[] array4 = FPUtils.SplitInt(this.examtopic.randomcount, ",", array3.Length); for (int i = 0; i < array3.Length; i++) { this.randomlist.Add(array3[i], array4[i]); } SqlParam sqlParam2 = DbHelper.MakeAndWhere("id", WhereType.In, this.examtopic.questionlist); this.questionlist = DbHelper.ExecuteList <ExamQuestion>(new SqlParam[] { sqlParam2 }); foreach (ExamQuestion examQuestion in this.questionlist) { if (this.curlist.ContainsKey(examQuestion.sortid)) { this.curlist[examQuestion.sortid] = this.curlist[examQuestion.sortid] + 1; } else { this.curlist.Add(examQuestion.sortid, 1); } } base.SaveRightURL(); }
// Token: 0x06000076 RID: 118 RVA: 0x0000BE54 File Offset: 0x0000A054 protected override void View() { this.examconfig = ExamConifgs.GetExamConfig(); this.sortinfo = SortBll.GetSortInfo(this.sortid); if (this.sortinfo.id <= 0) { this.ShowErr("该题库已被删除或不存在"); } else { if (this.channelid == 0) { this.channelid = this.sortinfo.channelid; } string childSorts = SortBll.GetChildSorts(this.sortinfo); List <SqlParam> list = new List <SqlParam>(); list.Add(DbHelper.MakeAndWhere("sortid", WhereType.In, childSorts)); if (this.type > 0) { list.Add(DbHelper.MakeAndWhere("type", this.type)); } if (this.keyword != "") { list.Add(DbHelper.MakeAndWhere("title", WhereType.Like, this.keyword)); } if (this.ispost) { if (this.action == "delete") { string @string = FPRequest.GetString("chkid"); string questionSorts = QuestionBll.GetQuestionSorts(@string); SortBll.UpdateSortPosts(questionSorts, -1); DbHelper.ExecuteDelete <ExamQuestion>(@string); } else if (this.action == "clear") { DbHelper.ExecuteDelete <ExamQuestion>(new SqlParam[] { list[0] }); } else if (this.action == "move") { string @string = FPRequest.GetString("chkid"); if (@string == "") { this.ShowErr("对不起,您未选择任何选项"); return; } base.Response.Redirect(string.Concat(new object[] { "questionmove.aspx?channelid=", this.channelid, "&sortid=", this.sortid, "&pageindex=", this.pager.pageindex, "&chkid=", @string })); } else if (this.action == "export") { List <ExamQuestion> list2 = DbHelper.ExecuteList <ExamQuestion>(list.ToArray()); HSSFWorkbook hssfworkbook = new HSSFWorkbook(); HSSFSheet hssfsheet = hssfworkbook.CreateSheet("Sheet1"); HSSFCellStyle hssfcellStyle = hssfworkbook.CreateCellStyle(); hssfcellStyle.Alignment = CellHorizontalAlignment.CENTER; hssfcellStyle.VerticalAlignment = CellVerticalAlignment.CENTER; hssfcellStyle.BorderTop = CellBorderType.THIN; hssfcellStyle.BorderRight = CellBorderType.THIN; hssfcellStyle.BorderLeft = CellBorderType.THIN; hssfcellStyle.BorderBottom = CellBorderType.THIN; hssfcellStyle.DataFormat = 0; HSSFFont hssffont = hssfworkbook.CreateFont(); hssffont.Boldweight = short.MaxValue; hssfcellStyle.SetFont(hssffont); HSSFRow hssfrow = hssfsheet.CreateRow(0); hssfrow.CreateCell(0).SetCellValue("题目类型"); hssfrow.CreateCell(1).SetCellValue("题目标题"); hssfrow.CreateCell(2).SetCellValue("选项A"); hssfrow.CreateCell(3).SetCellValue("选项B"); hssfrow.CreateCell(4).SetCellValue("选项C"); hssfrow.CreateCell(5).SetCellValue("选项D"); hssfrow.CreateCell(6).SetCellValue("选项E"); hssfrow.CreateCell(7).SetCellValue("选项F"); hssfrow.CreateCell(8).SetCellValue("正确答案"); hssfrow.CreateCell(9).SetCellValue("答案关键词"); hssfrow.CreateCell(10).SetCellValue("答案解释"); hssfrow.CreateCell(11).SetCellValue("难易程度"); hssfrow.CreateCell(12).SetCellValue("随机题目"); hssfrow.CreateCell(13).SetCellValue("所在题库"); hssfrow.CreateCell(14).SetCellValue(""); hssfrow.Height = 400; hssfsheet.SetColumnWidth(1, 6000); for (int i = 0; i < 14; i++) { hssfrow.Cells[i].CellStyle = hssfcellStyle; } HSSFCellStyle hssfcellStyle2 = hssfworkbook.CreateCellStyle(); hssfcellStyle2.Alignment = CellHorizontalAlignment.CENTER; hssfcellStyle2.VerticalAlignment = CellVerticalAlignment.CENTER; hssfcellStyle2.BorderTop = CellBorderType.THIN; hssfcellStyle2.BorderRight = CellBorderType.THIN; hssfcellStyle2.BorderLeft = CellBorderType.THIN; hssfcellStyle2.BorderBottom = CellBorderType.THIN; hssfcellStyle2.DataFormat = 0; int num = 1; foreach (ExamQuestion examQuestion in list2) { HSSFRow hssfrow2 = hssfsheet.CreateRow(num); hssfrow2.Height = 300; hssfrow2.CreateCell(0).SetCellValue(this.TypeStr(examQuestion.type)); hssfrow2.CreateCell(1).SetCellValue(examQuestion.title.Trim()); if (examQuestion.type == 1 || examQuestion.type == 2) { string[] array = FPUtils.SplitString(examQuestion.content, "§", 6); int num2 = 0; foreach (string cellValue in array) { hssfrow2.CreateCell(2 + num2).SetCellValue(cellValue); num2++; } } else if (examQuestion.type == 4) { if (examQuestion.upperflg == 1) { hssfrow2.CreateCell(2).SetCellValue("区分大小写"); } else { hssfrow2.CreateCell(2).SetCellValue(""); } if (examQuestion.orderflg == 1) { hssfrow2.CreateCell(3).SetCellValue("区分顺序"); } else { hssfrow2.CreateCell(3).SetCellValue(""); } hssfrow2.CreateCell(4).SetCellValue(""); hssfrow2.CreateCell(5).SetCellValue(""); hssfrow2.CreateCell(6).SetCellValue(""); hssfrow2.CreateCell(7).SetCellValue(""); } else { hssfrow2.CreateCell(2).SetCellValue(examQuestion.content.Trim()); hssfrow2.CreateCell(3).SetCellValue(""); hssfrow2.CreateCell(4).SetCellValue(""); hssfrow2.CreateCell(5).SetCellValue(""); hssfrow2.CreateCell(6).SetCellValue(""); hssfrow2.CreateCell(7).SetCellValue(""); } hssfrow2.CreateCell(8).SetCellValue(examQuestion.answer.Trim()); hssfrow2.CreateCell(9).SetCellValue(examQuestion.answerkey.Trim()); hssfrow2.CreateCell(10).SetCellValue(examQuestion.explain.Trim()); hssfrow2.CreateCell(11).SetCellValue(this.DifficultyStr(examQuestion.difficulty)); hssfrow2.CreateCell(12).SetCellValue((examQuestion.status == 1) ? "是" : "否"); hssfrow2.CreateCell(13).SetCellValue(""); hssfrow2.CreateCell(14).SetCellValue(""); for (int i = 0; i < 14; i++) { hssfrow2.Cells[i].CellStyle = hssfcellStyle2; } num++; } using (MemoryStream memoryStream = new MemoryStream()) { hssfworkbook.Write(memoryStream); memoryStream.Flush(); memoryStream.Position = 0L; hssfsheet.Dispose(); hssfworkbook.Dispose(); base.Response.ContentType = "application/vnd.ms-excel"; base.Response.ContentEncoding = Encoding.UTF8; base.Response.Charset = ""; base.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(this.sortinfo.name + "题库.xls")); base.Response.BinaryWrite(memoryStream.GetBuffer()); base.Response.Flush(); base.Response.End(); } } } this.questionlist = DbHelper.ExecuteList <ExamQuestion>(this.pager, list.ToArray()); if (this.sortinfo.posts != this.pager.total) { string sqlstring = string.Format("UPDATE [{0}WMS_SortInfo] SET [posts]={1} WHERE [id]={2}", DbConfigs.Prefix, this.pager.total, this.sortid); DbHelper.ExecuteSql(sqlstring); } base.SaveRightURL(); } }