// Token: 0x06000059 RID: 89 RVA: 0x00009654 File Offset: 0x00007854 protected override void View() { this.channelinfo = ChannelBll.GetChannelInfo("exam_question"); this.examtopic = DbHelper.ExecuteModel <ExamTopic>(this.examtopicid); this.examinfo = DbHelper.ExecuteModel <ExamInfo>(this.examtopic.examid); this.examsortinfo = SortBll.GetSortInfo(this.examinfo.sortid); List <SqlParam> list = new List <SqlParam>(); list.Add(DbHelper.MakeAndWhere("channelid", this.channelinfo.id)); list.Add(DbHelper.MakeAndWhere("type", this.examtopic.type)); if (this.sortid > 0) { SortInfo sortInfo = SortBll.GetSortInfo(this.sortid); string childSorts = SortBll.GetChildSorts(sortInfo); list.Add(DbHelper.MakeAndWhere("sortid", WhereType.In, childSorts)); } if (this.select > 0) { list.Add(DbHelper.MakeAndWhere("id", WhereType.In, this.examtopic.questionlist)); } if (this.keyword != "") { list.Add(DbHelper.MakeAndWhere("title", WhereType.Like, this.keyword)); } this.questionlist = DbHelper.ExecuteList <ExamQuestion>(this.pager, list.ToArray()); }
// Token: 0x06000056 RID: 86 RVA: 0x00009518 File Offset: 0x00007718 protected int GetQuestionCount(int sortid) { string childSorts = SortBll.GetChildSorts(sortid); SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeAndWhere("sortid", WhereType.In, childSorts), DbHelper.MakeAndWhere("type", this.examtopic.type) }; return(DbHelper.ExecuteCount <ExamQuestion>(sqlparams)); }
// Token: 0x0600009F RID: 159 RVA: 0x0000F068 File Offset: 0x0000D268 protected override void View() { this.channelinfo = ChannelBll.GetChannelInfo(this.channelid); if (this.channelinfo.id == 0) { this.ShowErr("考试频道不存在或已被删除。"); } else { this.sortlist = SortBll.GetSortList(this.channelid, 0); List <SqlParam> list = new List <SqlParam>(); list.Add(DbHelper.MakeAndWhere("status", 1)); if (this.channelid > 0) { list.Add(DbHelper.MakeAndWhere("channelid", this.channelid)); } if (this.sortid > 0) { string childSorts = SortBll.GetChildSorts(this.sortid); list.Add(DbHelper.MakeAndWhere("sortid", WhereType.In, childSorts)); } if (FPUtils.IsNumericArray(this.typeid)) { StringBuilder stringBuilder = new StringBuilder(); foreach (int num in FPUtils.SplitInt(this.typeid)) { if (!string.IsNullOrEmpty(stringBuilder.ToString())) { stringBuilder.Append(" OR "); } stringBuilder.AppendFormat("(','+[typelist]+',') LIKE '%,{0},%'", num); } list.Add(DbHelper.MakeAndWhere("(" + stringBuilder.ToString() + ")", WhereType.Custom, "")); } list.Add(DbHelper.MakeAndWhere(string.Format("(([examroles]='' AND [examdeparts]='' AND [examuser]='') OR (','+[examroles]+',') LIKE '%,{0},%' OR (','+[examdeparts]+',') LIKE '%,{1},%' OR (','+[examuser]+',') LIKE '%,{2},%')", this.roleid, this.departid, this.userid), WhereType.Custom, "")); this._examlist = DbHelper.ExecuteList <ExamInfo>(this.pager, list.ToArray()); this.pagenav = this.channelinfo.name; } }
// Token: 0x06000031 RID: 49 RVA: 0x00003F4C File Offset: 0x0000214C public static string GetQuestionRandom(int channelid, int count, string type, int sortid, string qidlist) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat("SELECT [id] FROM [{0}Exam_ExamQuestion] WHERE [status]=1", DbConfigs.Prefix); if (channelid > 0) { stringBuilder.AppendFormat(" AND [channelid]={0}", channelid); } if (type != "") { stringBuilder.AppendFormat(" AND [type] IN({0})", type); } if (sortid > 0) { SortInfo sortInfo = SortBll.GetSortInfo(sortid); string childSorts = SortBll.GetChildSorts(sortInfo); stringBuilder.AppendFormat(" AND [sortid] IN({0})", childSorts); } if (qidlist != "") { stringBuilder.AppendFormat(" AND [id] NOT IN({0})", qidlist); } IDataReader dataReader = DbHelper.ExecuteReader(CommandType.Text, stringBuilder.ToString()); string text = ""; while (dataReader.Read()) { if (text != "") { text += ","; } text += dataReader["id"].ToString(); } dataReader.Close(); return(QuestionBll.GetRandom(FPUtils.SplitString(text), count)); }
// Token: 0x0600003D RID: 61 RVA: 0x000059E8 File Offset: 0x00003BE8 protected override void View() { this.sortinfo = SortBll.GetSortInfo(this.sortid); if (this.sortinfo.id == 0) { this.ShowErr("对不起,该试卷库不存在或已被删除。"); } else { if (this.channelid == 0) { this.channelid = this.sortinfo.channelid; } if (this.ispost) { string @string = FPRequest.GetString("chkid"); if (this.action == "delete") { string examSorts = ExamBll.GetExamSorts(@string); SortBll.UpdateSortPosts(examSorts, -1); DbHelper.ExecuteDelete <ExamInfo>(@string); SqlParam sqlParam = DbHelper.MakeAndWhere("examid", WhereType.In, @string); DbHelper.ExecuteDelete <ExamTopic>(new SqlParam[] { sqlParam }); } else if (this.action == "sum") { SqlParam sqlParam2 = DbHelper.MakeAndWhere("id", WhereType.In, @string); List <ExamInfo> list = DbHelper.ExecuteList <ExamInfo>(new SqlParam[] { sqlParam2 }); string text = ""; foreach (ExamInfo examInfo in list) { int num = 0; double num2 = 0.0; if (examInfo.examdeparts == "" && examInfo.examuser == "" && examInfo.examroles == "") { SqlParam sqlParam3 = DbHelper.MakeAndWhere("examid", examInfo.id); num = DbHelper.ExecuteCount <ExamResult>(new SqlParam[] { sqlParam3 }); num2 = FPUtils.StrToDouble(DbHelper.ExecuteSum <ExamResult>("score", new SqlParam[] { sqlParam3 })); } else { string text2 = ""; if (examInfo.examroles != "") { SqlParam sqlParam4 = DbHelper.MakeAndWhere("roleid", WhereType.In, examInfo.examroles); List <UserInfo> list2 = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam4 }); foreach (UserInfo userInfo in list2) { if (!FPUtils.InArray(userInfo.id, text2)) { if (text2 != "") { text2 += ","; } text2 += userInfo.id; num++; } } } if (examInfo.examdeparts != "") { SqlParam sqlParam4 = DbHelper.MakeAndWhere("departid", WhereType.In, examInfo.examdeparts); List <UserInfo> list2 = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam4 }); foreach (UserInfo userInfo in list2) { if (!FPUtils.InArray(userInfo.id, text2)) { if (text2 != "") { text2 += ","; } text2 += userInfo.id; num++; } } } if (examInfo.examuser != "") { SqlParam sqlParam4 = DbHelper.MakeAndWhere("id", WhereType.In, examInfo.examuser); List <UserInfo> list2 = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam4 }); foreach (UserInfo userInfo in list2) { if (!FPUtils.InArray(userInfo.id, text2)) { if (text2 != "") { text2 += ","; } text2 += userInfo.id; num++; } } } string sqlstring = string.Format("DELETE FROM [{0}Exam_ExamResult] WHERE [examid]={1} AND [uid] NOT IN({2})", DbConfigs.Prefix, examInfo.id, text2); DbHelper.ExecuteSql(sqlstring); SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeAndWhere("examid", examInfo.id), DbHelper.MakeAndWhere("uid", WhereType.In, text2) }; num2 = FPUtils.StrToDouble(DbHelper.ExecuteSum <ExamResult>("score", sqlparams)); } List <ExamTopic> examTopicList = ExamBll.GetExamTopicList(examInfo.id, 1); double num3 = 0.0; int num4 = 0; foreach (ExamTopic examTopic in examTopicList) { num3 += examTopic.perscore * (double)examTopic.questions; num4 += examTopic.questions; } if (text != "") { text += "|"; } text += string.Format("UPDATE [{0}Exam_ExamInfo] SET [exams]={1},[score]={2},[questions]={3},[total]={4} WHERE [id]={5}", new object[] { DbConfigs.Prefix, num, num2, num4, num3, examInfo.id }); } DbHelper.ExecuteSql(text); } } string childSorts = SortBll.GetChildSorts(this.sortinfo); List <SqlParam> list3 = new List <SqlParam>(); list3.Add(DbHelper.MakeAndWhere("sortid", WhereType.In, childSorts)); if (this.keyword != "") { list3.Add(DbHelper.MakeAndWhere("name", WhereType.Like, this.keyword)); } if (this.starttime != "" && this.isDate(this.starttime)) { list3.Add(DbHelper.MakeAndWhere("islimit", 1)); list3.Add(DbHelper.MakeAndWhere("starttime", WhereType.LessThanEqual, this.starttime)); } if (this.endtime != "" && this.isDate(this.endtime)) { list3.Add(DbHelper.MakeAndWhere("islimit", 1)); list3.Add(DbHelper.MakeAndWhere("endtime", WhereType.GreaterThanEqual, this.endtime)); } if (this.typeid > 0) { this.typeinfo = DbHelper.ExecuteModel <TypeInfo>(this.typeid); this.pagenav = "|" + this.typeinfo.name + "," + this.rawurl; list3.Add(DbHelper.MakeAndWhere(string.Format("(','+[typeid]+',') LIKE '%,{0},%'", this.typeid), WhereType.Custom, "")); } this.examlist = DbHelper.ExecuteList <ExamInfo>(this.pager, list3.ToArray()); base.SaveRightURL(); } }
// Token: 0x06000080 RID: 128 RVA: 0x0000CD80 File Offset: 0x0000AF80 private string GetSortTree(int channelid, int parentid) { List <SortInfo> sortList = SortBll.GetSortList(channelid, parentid); string text = ""; foreach (SortInfo sortInfo in sortList) { if (base.ischecked(sortInfo.id, this.role.sorts) || this.roleid == 1) { string text2 = string.Format("examtopicselect.aspx?examtopicid={0}&sortid={1}&paper={2}", this.examtopicid, sortInfo.id, this.paper); string childSorts = SortBll.GetChildSorts(sortInfo.id); SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeAndWhere("sortid", WhereType.In, childSorts), DbHelper.MakeAndWhere("type", this.examtopic.type) }; int num = DbHelper.ExecuteCount <ExamQuestion>(sqlparams); if (text != "") { text += ","; } if (sortInfo.subcounts > 0) { object obj = text; text = string.Concat(new object[] { obj, "{ id: ", sortInfo.id, ", pId: ", parentid, ", name: \"", sortInfo.name, "(", num, ")\",open:true, url: \"", text2, "\", target: \"frmmaindetail\", icon: \"", this.webpath, (this.sysconfig.adminpath == "") ? "" : (this.sysconfig.adminpath + "/"), "images/folders.gif\" }" }); string sortTree = this.GetSortTree(channelid, sortInfo.id); if (sortTree != "") { text = text + "," + sortTree; } } else { object obj = text; text = string.Concat(new object[] { obj, "{ id: ", sortInfo.id, ", pId: ", parentid, ", name: \"", sortInfo.name, "(", num, ")\",open:true, url: \"", text2, "\", target: \"frmmaindetail\", icon: \"", this.webpath, (this.sysconfig.adminpath == "") ? "" : (this.sysconfig.adminpath + "/"), "images/folder.gif\" }" }); } } } return(text); }
// 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(); } }