// Token: 0x0600007C RID: 124 RVA: 0x0000C9F0 File Offset: 0x0000ABF0 protected override void View() { this.sortinfo = SortBll.GetSortInfo(this.sortid); if (this.ispost) { if (this.targetid == 0) { this.ShowErr("对不起,您没有选择移动至目标题库。"); return; } SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeSet("sortid", this.targetid), DbHelper.MakeAndWhere("id", WhereType.In, this.idlist) }; DbHelper.ExecuteUpdate <ExamQuestion>(sqlparams); SortBll.UpdateSortPosts(this.sortid, -1); SortBll.UpdateSortPosts(this.targetid, 1); base.Response.Redirect(string.Concat(new object[] { "questionmanage.aspx?channelid=", this.channelid, "&sortid=", this.sortid, "&pageindex=", this.pageindex })); } SqlParam[] sqlparams2 = new SqlParam[] { DbHelper.MakeAndWhere("parentid", 0), DbHelper.MakeAndWhere("channelid", this.channelid), DbHelper.MakeAndWhere("id", WhereType.NotEqual, this.sortid) }; OrderByParam orderby = DbHelper.MakeOrderBy("display", OrderBy.ASC); this.sortlist = DbHelper.ExecuteList <SortInfo>(orderby, sqlparams2); }
// 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: 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: 0x06000071 RID: 113 RVA: 0x0000B6F8 File Offset: 0x000098F8 protected override void View() { this.sortinfo = SortBll.GetSortInfo(this.sortid); if (this.ispost) { if (!this.isfile) { this.ShowErr("请选择要导入的本地Excel表文件"); return; } string mapPath = FPUtils.GetMapPath(this.webpath + "cache"); string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName); string a = Path.GetExtension(fileName).ToLower(); if (a != ".xls") { this.ShowErr("该文件不是Excel表文件类型"); return; } if (!Directory.Exists(mapPath)) { Directory.CreateDirectory(mapPath); } if (File.Exists(mapPath + "\\" + fileName)) { File.Delete(mapPath + "\\" + fileName); } FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName); DataTable excelTable = FPExcel.GetExcelTable(mapPath + "\\" + fileName); if (excelTable.Columns.Count < 14) { this.ShowErr("对不起,Excel表格列不得少于14。"); return; } if (excelTable.Rows.Count > 0) { int num = excelTable.Rows.Count - 1; for (int i = 0; i < excelTable.Rows.Count; i++) { DataRow dataRow = excelTable.Rows[num - i]; ExamQuestion examQuestion = new ExamQuestion(); examQuestion.uid = this.userid; examQuestion.channelid = this.sortinfo.channelid; examQuestion.type = this.TypeInt(dataRow.ItemArray[0].ToString()); examQuestion.title = dataRow.ItemArray[1].ToString(); if (examQuestion.type != 0 && !(examQuestion.title == "")) { for (int j = 0; j < 6; j++) { if (dataRow.ItemArray[2 + j].ToString() != "") { ExamQuestion examQuestion2 = examQuestion; examQuestion2.content += ((examQuestion.content == "") ? dataRow.ItemArray[2 + j].ToString() : ("§" + dataRow.ItemArray[2 + j].ToString())); } } if (examQuestion.type == 1 || examQuestion.type == 2) { examQuestion.answer = dataRow.ItemArray[8].ToString().Trim().ToUpper(); examQuestion.ascount = FPUtils.SplitString(examQuestion.content, "§").Length; } else if (examQuestion.type == 3) { if (FPUtils.InArray(dataRow.ItemArray[8].ToString().Trim(), "y,Y,正确,对")) { examQuestion.answer = "Y"; } else { examQuestion.answer = "N"; } examQuestion.ascount = 2; } else if (examQuestion.type == 4) { foreach (string a2 in FPUtils.SplitString(examQuestion.content, "§")) { if (a2 == "区分大小写") { examQuestion.upperflg = 1; } else if (a2 == "区分顺序") { examQuestion.orderflg = 1; } } examQuestion.answer = dataRow.ItemArray[8].ToString().Trim(); examQuestion.ascount = FPUtils.SplitString(examQuestion.answer).Length; } else { examQuestion.answer = dataRow.ItemArray[8].ToString().Trim(); examQuestion.ascount = 1; } examQuestion.answerkey = dataRow.ItemArray[9].ToString(); examQuestion.explain = dataRow.ItemArray[10].ToString(); examQuestion.difficulty = this.DifficultyInt(dataRow.ItemArray[11].ToString().Trim()); examQuestion.status = ((dataRow.ItemArray[12].ToString().Trim() == "否") ? 0 : 1); examQuestion.sortid = this.GetSortId(dataRow.ItemArray[13].ToString()); if (examQuestion.sortid == 0) { examQuestion.sortid = this.sortid; } DbHelper.ExecuteInsert <ExamQuestion>(examQuestion); SortBll.UpdateSortPosts(examQuestion.sortid, 1); } } } if (File.Exists(mapPath + "\\" + fileName)) { File.Delete(mapPath + "\\" + fileName); } base.Response.Redirect("questionmanage.aspx?sortid=" + this.sortid); } 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(); } }