// Token: 0x06000049 RID: 73 RVA: 0x00007D4C File Offset: 0x00005F4C protected override void View() { ExamTopic examTopic = DbHelper.ExecuteModel <ExamTopic>(this.tid); if (!FPUtils.InArray(this.qid, examTopic.questionlist) && this.tid > 0 && this.qid > 0 && this.option == 1) { if (examTopic.curquestions >= examTopic.questions - examTopic.randoms) { this.ShowErrMsg("该大题题目数已满,不能再添加题目"); return; } examTopic.questionlist = ((examTopic.questionlist == "") ? this.qid.ToString() : (examTopic.questionlist + "," + this.qid)); examTopic.curquestions = FPUtils.SplitInt(examTopic.questionlist).Length; SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeSet("questionlist", examTopic.questionlist), DbHelper.MakeSet("curquestions", examTopic.curquestions), DbHelper.MakeAndWhere("id", this.tid) }; DbHelper.ExecuteUpdate <ExamTopic>(sqlparams); } if (this.tid > 0 && this.qid > 0 && this.option == -1) { string text = ""; foreach (int num in FPUtils.SplitInt(examTopic.questionlist)) { if (this.qid != num && num != 0) { if (text != "") { text += ","; } text += num; } } examTopic.questionlist = text; examTopic.curquestions = FPUtils.SplitInt(examTopic.questionlist).Length; SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeSet("questionlist", examTopic.questionlist), DbHelper.MakeSet("curquestions", examTopic.curquestions), DbHelper.MakeAndWhere("id", this.tid) }; DbHelper.ExecuteUpdate <ExamTopic>(sqlparams); } Hashtable hashtable = new Hashtable(); hashtable["error"] = 0; hashtable["curquestions"] = examTopic.curquestions; hashtable["questionlist"] = examTopic.questionlist; hashtable["action"] = this.option; base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); }
// Token: 0x06000033 RID: 51 RVA: 0x00004124 File Offset: 0x00002324 public static string GetTopicQuestion(int channelid, ExamTopic examtopic) { string text = examtopic.questionlist; string type; if (examtopic.type == -1) { type = "1,2"; } else { type = examtopic.type.ToString(); } if (examtopic.curquestions < examtopic.questions) { if (examtopic.randoms > 0) { int[] array = FPUtils.SplitInt(examtopic.randomsort); int[] array2 = FPUtils.SplitInt(examtopic.randomcount, ",", array.Length); for (int i = 0; i < array.Length; i++) { if (array2[i] > 0) { string questionRandom = QuestionBll.GetQuestionRandom(channelid, array2[i], type, array[i], text); if (questionRandom != "") { text += ((text == "") ? questionRandom : ("," + questionRandom)); } } } if (examtopic.questions - examtopic.curquestions - examtopic.randoms > 0) { string questionRandom = QuestionBll.GetQuestionRandom(channelid, examtopic.questions - examtopic.curquestions - examtopic.randoms - 1, type, "", text); if (questionRandom != "") { text += ((text == "") ? questionRandom : ("," + questionRandom)); } } } else { int count = examtopic.questions - examtopic.curquestions; string questionRandom = QuestionBll.GetQuestionRandom(channelid, count, type, "", text); if (questionRandom != "") { text += ((text == "") ? questionRandom : ("," + questionRandom)); } } } return(text); }
// Token: 0x0600001C RID: 28 RVA: 0x000031D4 File Offset: 0x000013D4 public static void AddExamLarge(int examid) { ExamTopic examTopic = new ExamTopic(); examTopic.type = 1; examTopic.title = "第一题、单选题"; examTopic.examid = examid; examTopic.perscore = 2.0; examTopic.display = 1; examTopic.questions = 30; examTopic.paper = 1; DbHelper.ExecuteInsert <ExamTopic>(examTopic); examTopic.type = 2; examTopic.title = "第二题、多选题"; examTopic.examid = examid; examTopic.perscore = 4.0; examTopic.display = 2; examTopic.questions = 10; examTopic.paper = 1; DbHelper.ExecuteInsert <ExamTopic>(examTopic); }
// Token: 0x0600004C RID: 76 RVA: 0x000080D4 File Offset: 0x000062D4 protected override void View() { this.examconfig = ExamConifgs.GetExamConfig(); this.examinfo = DbHelper.ExecuteModel <ExamInfo>(this.examid); if (this.examinfo.id == 0) { this.ShowErr("对不起,该试卷不存在或已被删除。"); } else { this.sortid = this.examinfo.sortid; this.sortinfo = SortBll.GetSortInfo(this.sortid); if (this.ispost) { string @string = FPRequest.GetString("action"); int @int = FPRequest.GetInt("examtopicid"); int int2 = FPRequest.GetInt("tid"); ExamTopic examTopic = DbHelper.ExecuteModel <ExamTopic>(@int); if (@string == "delete") { DbHelper.ExecuteDelete <ExamTopic>(@int); if (this.paper == 1) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [total]=[total]-{1},[questions]=[questions]-{2} WHERE [id]={3}", new object[] { DbConfigs.Prefix, examTopic.perscore * (double)examTopic.questions, examTopic.questions, this.examid }); DbHelper.ExecuteSql(stringBuilder.ToString()); } } else if (@string == "addpaper") { if (this.examinfo.papers == 4) { this.ShowErr("对不起,一场考试最多只能添加4份试卷。"); return; } string text = string.Format("UPDATE [{0}Exam_ExamInfo] SET [papers]=[papers]+1 WHERE [id]={1}", DbConfigs.Prefix, this.examid); DbHelper.ExecuteSql(text); this.paper = this.examinfo.papers + 1; } else if (@string == "delpaper") { if (this.examinfo.papers == 1) { this.ShowErr("对不起,一场考试必须有一份试卷。"); return; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [papers]=[papers]-1 WHERE [id]={1}", DbConfigs.Prefix, this.examid); stringBuilder.AppendFormat("DELETE FROM [{0}Exam_ExamTopic] WHERE [examid]={1} AND [paper]={2}", DbConfigs.Prefix, this.examid, this.paper); stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamTopic] SET [paper]=[paper]-1 WHERE [examid]={1} AND [paper]>{2}", DbConfigs.Prefix, this.examid, this.paper); DbHelper.ExecuteSql(stringBuilder.ToString()); this.examinfo.papers = this.examinfo.papers - 1; if (this.paper > this.examinfo.papers) { this.paper = this.examinfo.papers; } List <ExamTopic> examTopicList = ExamBll.GetExamTopicList(this.examid, 1); double num = 0.0; int num2 = 0; foreach (ExamTopic examTopic2 in examTopicList) { num += examTopic2.perscore * (double)examTopic2.questions; num2 += examTopic2.questions; } string sqlstring = string.Format("UPDATE [{0}Exam_ExamInfo] SET [questions]={1},[total]={2} WHERE [id]={3}", new object[] { DbConfigs.Prefix, num2, num, this.examid }); DbHelper.ExecuteSql(sqlstring); } else if (@string == "saveas") { if (this.examinfo.papers == 4) { this.ShowErr("对不起,一场考试最多只能添加4份试卷。"); return; } string text = string.Format("UPDATE [{0}Exam_ExamInfo] SET [papers]=[papers]+1 WHERE [id]={1}", DbConfigs.Prefix, this.examid); DbHelper.ExecuteSql(text); this.examtopiclist = ExamBll.GetExamTopicList(this.examid, this.paper); this.examinfo.papers = this.examinfo.papers + 1; for (int i = 0; i < this.examtopiclist.Count; i++) { this.examtopiclist[i].paper = this.examinfo.papers; DbHelper.ExecuteInsert <ExamTopic>(this.examtopiclist[i]); } } else if (@string == "deletetopic") { string text2 = ""; foreach (int num3 in FPUtils.SplitInt(examTopic.questionlist)) { if (int2 != num3 && num3 > 0) { if (text2 != "") { text2 += ","; } text2 += num3; } } examTopic.questionlist = text2; if (examTopic.questionlist.Length > 0) { examTopic.curquestions = FPUtils.SplitInt(examTopic.questionlist).Length; } else { examTopic.curquestions = 0; } SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeSet("questionlist", examTopic.questionlist), DbHelper.MakeSet("curquestions", examTopic.curquestions), DbHelper.MakeAndWhere("id", @int) }; DbHelper.ExecuteUpdate <ExamTopic>(sqlparams); } else if (@string == "display") { this.examtopiclist = ExamBll.GetExamTopicList(this.examid, this.paper); string text = ""; foreach (ExamTopic examTopic3 in this.examtopiclist) { DataTable dataTable = new DataTable(); dataTable.Columns.Add("display", typeof(int)); dataTable.Columns.Add("qid", typeof(int)); foreach (int num4 in FPUtils.SplitInt(examTopic3.questionlist)) { DataRow dataRow = dataTable.NewRow(); dataRow["display"] = FPRequest.GetInt("display_" + num4); dataRow["qid"] = num4; dataTable.Rows.Add(dataRow); } string text3 = ""; foreach (DataRow dataRow2 in dataTable.Select("1=1", "display asc")) { if (text3 != "") { text3 += ","; } text3 += dataRow2["qid"].ToString(); } if (text != "") { text += "|"; } text += string.Format("UPDATE [{0}Exam_ExamTopic] SET [questionlist]='{1}' WHERE [id]={2}", DbConfigs.Prefix, text3, examTopic3.id); } DbHelper.ExecuteSql(text); } base.Response.Redirect(this.pagename + string.Format("?examid={0}&paper={1}&examtopicid={2}", this.examid, this.paper, @int)); } this.examtopiclist = ExamBll.GetExamTopicList(this.examid, this.paper); SqlParam[] sqlparams2 = new SqlParam[] { DbHelper.MakeAndWhere("examid", this.examid), DbHelper.MakeAndWhere("paper", this.paper) }; this.examinfo.questions = FPUtils.StrToInt(DbHelper.ExecuteSum <ExamTopic>("questions", sqlparams2)); base.SaveRightURL(); } }
// Token: 0x06000069 RID: 105 RVA: 0x0000AB4C File Offset: 0x00008D4C protected override void View() { this.examconfig = ExamConifgs.GetExamConfig(); if (this.id > 0) { this.questioninfo = DbHelper.ExecuteModel <ExamQuestion>(this.id); this.sortid = this.questioninfo.sortid; this.type = this.questioninfo.type; this.ascount = this.questioninfo.ascount; if (this.type == 1 || this.type == 2 || this.type == 3) { this.questioninfo.answer = this.questioninfo.answer.ToLower(); } } this.sortinfo = SortBll.GetSortInfo(this.sortid); if (this.examid > 0 && this.examtopicid > 0) { this.reurl = string.Concat(new object[] { "examtopicmanage.aspx?examid=", this.examid, "&examtopicid=", this.examtopicid }); } if (this.examid > 0) { this.reurl = "examtopicmanage.aspx?examid=" + this.examid; } else if (this.examtopicid > 0) { this.reurl = "examtopicselect.aspx?examtopicid=" + this.examtopicid; } else { this.reurl = string.Concat(new object[] { "questionmanage.aspx?sortid=", this.sortid, "&type=", this.backtype }); } if (this.ispost) { this.questioninfo.upperflg = 0; this.questioninfo.orderflg = 0; this.questioninfo.status = 0; this.questioninfo.isclear = 0; this.questioninfo = FPRequest.GetModel <ExamQuestion>(this.questioninfo); if (this.questioninfo.isclear == 1) { this.questioninfo.title = questionadd.GetTextFromHTML(this.questioninfo.title); } this.questioninfo.channelid = this.sortinfo.channelid; if (this.questioninfo.type == 1 || this.questioninfo.type == 2) { this.questioninfo.ascount = FPRequest.GetInt("ascount" + this.questioninfo.type); this.questioninfo.content = ""; for (int i = 0; i < this.questioninfo.ascount; i++) { if (this.questioninfo.content != "") { ExamQuestion examQuestion = this.questioninfo; examQuestion.content += "§"; } if (this.questioninfo.isclear == 1) { ExamQuestion examQuestion2 = this.questioninfo; examQuestion2.content += questionadd.GetTextFromHTML(FPRequest.GetString(string.Concat(new object[] { "option", this.questioninfo.type, "_", i.ToString() }))); } else { ExamQuestion examQuestion3 = this.questioninfo; examQuestion3.content += FPRequest.GetString(string.Concat(new object[] { "option", this.questioninfo.type, "_", i.ToString() })); } } } else if (this.questioninfo.type == 3) { this.questioninfo.ascount = 2; this.questioninfo.content = ""; } else if (this.questioninfo.type == 4) { this.questioninfo.ascount = FPUtils.SplitString(this.questioninfo.answer).Length; this.questioninfo.content = ""; } else if (this.questioninfo.type == 5) { this.questioninfo.ascount = FPUtils.SplitString(this.questioninfo.answerkey).Length; this.questioninfo.content = ""; } this.questioninfo.answer = FPRequest.GetString("answer" + this.questioninfo.type); if (this.questioninfo.id > 0) { DbHelper.ExecuteUpdate <ExamQuestion>(this.questioninfo); base.AddMsg("更新试题成功!"); } else { this.questioninfo.uid = this.userid; this.questioninfo.id = DbHelper.ExecuteInsert <ExamQuestion>(this.questioninfo); SortBll.UpdateSortPosts(this.questioninfo.sortid, 1); if (this.examid > 0) { ExamTopic examTopic = DbHelper.ExecuteModel <ExamTopic>(this.examtopicid); if (examTopic.curquestions >= examTopic.questions) { this.ShowErr("该大题题目数已满,不能再添加"); return; } examTopic.questionlist = ((examTopic.questionlist == "") ? this.questioninfo.id.ToString() : (examTopic.questionlist + "," + this.questioninfo.id)); examTopic.curquestions = FPUtils.SplitInt(examTopic.questionlist).Length; SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeSet("questionlist", examTopic.questionlist), DbHelper.MakeSet("curquestions", examTopic.curquestions), DbHelper.MakeAndWhere("id", this.examtopicid) }; DbHelper.ExecuteUpdate <ExamTopic>(sqlparams); } base.AddMsg("添加试题成功!"); } if (this.action == "continue") { this.link = string.Format("questionadd.aspx?sortid={0}&examid={1}&examtopicid={2}&type={3}", new object[] { this.sortid, this.examid, this.examtopicid, this.backtype }); } else { this.link = this.reurl; } if (File.Exists(FPUtils.GetMapPath(string.Concat(new object[] { this.webpath, "cache/qtxt_", this.id, ".jpg" })))) { File.Delete(FPUtils.GetMapPath(string.Concat(new object[] { this.webpath, "cache/qtxt_", this.id, ".jpg" }))); } } base.SaveRightURL(); }
// 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); } } } } }