// Token: 0x06000013 RID: 19 RVA: 0x00002974 File Offset: 0x00000B74 protected Permission GetPermission(string pageurl) { Permission permission = new Permission(); foreach (Permission permission2 in this.permlist) { if (FPUtils.InArray(pageurl, permission2.flagpage, "\r\n")) { if (permission.id == 0) { permission.id = permission2.id; } if (permission.isadd == 0) { permission.isadd = permission2.isadd; } if (permission.isupdate == 0) { permission.isupdate = permission2.isupdate; } if (permission.isdelete == 0) { permission.isdelete = permission2.isdelete; } } } return(permission); }
// Token: 0x06000096 RID: 150 RVA: 0x0000E908 File Offset: 0x0000CB08 protected List <ExamQuestion> GetQuestionList(ExamResultTopic resultinfo) { SqlParam sqlParam = DbHelper.MakeAndWhere("id", WhereType.In, resultinfo.questionlist); List <ExamQuestion> list = DbHelper.ExecuteList <ExamQuestion>(new SqlParam[] { sqlParam }); int[] array = FPUtils.SplitInt(resultinfo.questionlist); string[] array2 = FPUtils.SplitString(resultinfo.answerlist, "§", array.Length); string[] array3 = FPUtils.SplitString(resultinfo.scorelist, "|", array.Length); string[] array4 = FPUtils.SplitString(resultinfo.optionlist, "|", array.Length); List <ExamQuestion> list2 = new List <ExamQuestion>(); SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeAndWhere("qid", WhereType.In, resultinfo.questionlist), DbHelper.MakeAndWhere("uid", this.userid) }; List <ExamNote> list3 = DbHelper.ExecuteList <ExamNote>(sqlparams); int num = 0; foreach (int num2 in array) { foreach (ExamQuestion examQuestion in list) { if (examQuestion.id == num2) { examQuestion.useranswer = array2[num]; examQuestion.userscore = (double)FPUtils.StrToFloat(array3[num]); examQuestion.optionlist = array4[num]; if (examQuestion.type == 1 || examQuestion.type == 2) { examQuestion.answer = this.OptionAnswer(examQuestion.optionlist, examQuestion.answer); } foreach (ExamNote examNote in list3) { if (examNote.qid == examQuestion.id) { examQuestion.note = examNote.note; } } if (this.examloglist.ContainsKey(examQuestion.sortid)) { ExamLogInfo examLogInfo = this.examloglist[examQuestion.sortid]; if (FPUtils.InArray(examQuestion.id, examLogInfo.favlist)) { examQuestion.isfav = 1; } } list2.Add(examQuestion); } } num++; } return(list2); }
// 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: 0x0600006C RID: 108 RVA: 0x0000B3BC File Offset: 0x000095BC protected override void View() { SqlParam sqlParam = DbHelper.MakeAndWhere("id", WhereType.In, this.examuser); List <UserInfo> list = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam }); string text = ""; string text2 = ""; foreach (int num in FPUtils.SplitInt(this.examuser)) { foreach (UserInfo userInfo in list) { if (num == userInfo.id && !FPUtils.InArray(num, text2)) { if (text != "") { text += ","; } if (userInfo.realname != "") { text += userInfo.realname; } else { text += userInfo.username; } if (text2 != "") { text2 += ","; } text2 += num; } } } Hashtable hashtable = new Hashtable(); hashtable["error"] = 0; hashtable["uname"] = text; base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); }
// Token: 0x06000099 RID: 153 RVA: 0x0000ED58 File Offset: 0x0000CF58 private string OptionAnswer(string optionlist, string answer) { string[] array = FPUtils.SplitString("A,B,C,D,E,F"); int[] array2 = FPUtils.SplitInt(optionlist); string text = ""; for (int i = 0; i < array2.Length; i++) { if (FPUtils.InArray(array[array2[i]], answer)) { if (text != "") { text += ","; } text += array[i]; } } return(text); }
// Token: 0x060000D9 RID: 217 RVA: 0x000155E0 File Offset: 0x000137E0 protected override void View() { this.examconfig = ExamConifgs.GetExamConfig(); this.sortinfo = SortBll.GetSortInfo(this.sortid); if (this.sortinfo.id == 0) { this.ShowErr("对不起,该题库不存在或已被删除。"); } else { SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeAndWhere("sortid", this.sortid), DbHelper.MakeAndWhere("uid", this.userid) }; this.examloginfo = DbHelper.ExecuteModel <ExamLogInfo>(sqlparams); if (this.examloginfo.sortid != 0) { this.channelid = this.examloginfo.channelid; this.examloginfo.questions = this.sortinfo.posts; this.examloglist = ExamBll.GetExamLogList(this.channelid, this.userid); string text = ""; if (this.action == "wrong") { this.pagenav = string.Concat(new object[] { "错题(", this.sortinfo.name, ")共", this.examloginfo.wrongs, "道题目" }); text = this.examloginfo.wronglist; } else if (this.action == "note") { this.pagenav = string.Concat(new object[] { "笔记(", this.sortinfo.name, ")共", this.examloginfo.notes, "道题目" }); text = this.examloginfo.notelist; } else if (this.action == "fav") { this.pagenav = string.Concat(new object[] { "收藏(", this.sortinfo.name, ")共", this.examloginfo.favs, "道题目" }); text = this.examloginfo.favlist; } if (text != "") { SqlParam sqlParam = DbHelper.MakeAndWhere("id", WhereType.In, text); OrderByParam orderby = DbHelper.MakeOrderBy("type", OrderBy.ASC); this.questionlist = DbHelper.ExecuteList <ExamQuestion>(orderby, new SqlParam[] { sqlParam }); SqlParam[] sqlparams2 = new SqlParam[] { DbHelper.MakeAndWhere("qid", WhereType.In, text), DbHelper.MakeAndWhere("uid", this.userid) }; List <ExamNote> list = DbHelper.ExecuteList <ExamNote>(sqlparams2); for (int i = 0; i < this.questionlist.Count; i++) { if (FPUtils.InArray(this.questionlist[i].id, this.examloginfo.favlist)) { this.questionlist[i].isfav = 1; } foreach (ExamNote examNote in list) { if (examNote.qid == this.questionlist[i].id) { this.questionlist[i].note = examNote.note; } } if (this.examloglist.ContainsKey(this.questionlist[i].sortid)) { ExamLogInfo examLogInfo = this.examloglist[this.questionlist[i].sortid]; if (FPUtils.InArray(this.questionlist[i].id, examLogInfo.qidlist)) { int[] array = FPUtils.SplitInt(examLogInfo.qidlist); string[] array2 = FPUtils.SplitString(examLogInfo.optionlist, "|", array.Length); string[] array3 = FPUtils.SplitString(examLogInfo.answerlist, "§", array.Length); for (int j = 0; j < array.Length; j++) { if (array[j] == this.questionlist[i].id) { this.questionlist[i].useranswer = array3[j]; this.questionlist[i].optionlist = array2[j]; this.questionlist[i].answer = this.OptionAnswer(array2[j], this.questionlist[i].answer); } } } } } } } } }
// 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: 0x06000084 RID: 132 RVA: 0x0000D2E8 File Offset: 0x0000B4E8 protected override void View() { if (this.ispost) { if (!this.isfile) { this.ShowErr("请选择要导入的本地Excel表文件"); } else { 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表文件类型"); } else { 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); string text = ""; string text2 = ""; string text3 = ""; if (excelTable.Rows.Count > 0) { int num = excelTable.Rows.Count - 1; for (int i = 0; i < num; i++) { DataRow dataRow = excelTable.Rows[num - i]; string text4 = dataRow.ItemArray[0].ToString().Trim(); if (!(text4 == "")) { SqlParam sqlParam = DbHelper.MakeAndWhere("username", text4); UserInfo userInfo = DbHelper.ExecuteModel <UserInfo>(new SqlParam[] { sqlParam }); if (userInfo.id == 0) { userInfo.username = text4; userInfo.realname = dataRow.ItemArray[1].ToString().Trim(); userInfo.password = FPUtils.MD5(dataRow.ItemArray[2].ToString().Trim()); userInfo.roleid = this.GetRoleId(dataRow.ItemArray[3].ToString().Trim()); userInfo.departid = this.GetDepartId(dataRow.ItemArray[4].ToString().Trim()); userInfo.nickname = dataRow.ItemArray[5].ToString().Trim(); userInfo.id = DbHelper.ExecuteInsert <UserInfo>(userInfo); } else { if (!string.IsNullOrEmpty(dataRow.ItemArray[1].ToString().Trim())) { userInfo.realname = dataRow.ItemArray[1].ToString().Trim(); } if (!string.IsNullOrEmpty(dataRow.ItemArray[2].ToString().Trim())) { userInfo.password = FPUtils.MD5(dataRow.ItemArray[2].ToString().Trim()); } if (!string.IsNullOrEmpty(dataRow.ItemArray[3].ToString().Trim())) { userInfo.roleid = this.GetRoleId(dataRow.ItemArray[3].ToString().Trim()); } if (!string.IsNullOrEmpty(dataRow.ItemArray[4].ToString().Trim())) { userInfo.departid = this.GetDepartId(dataRow.ItemArray[4].ToString().Trim()); } if (!string.IsNullOrEmpty(dataRow.ItemArray[5].ToString().Trim())) { userInfo.nickname = dataRow.ItemArray[5].ToString().Trim(); } DbHelper.ExecuteUpdate <UserInfo>(userInfo); } if (text != "") { text += ","; } text += userInfo.id; } } if (File.Exists(mapPath + "\\" + fileName)) { File.Delete(mapPath + "\\" + fileName); } if (text != "") { if (this.examuser != "") { this.examuser += ","; } this.examuser += text; } SqlParam sqlParam2 = DbHelper.MakeAndWhere("id", WhereType.In, this.examuser); List <UserInfo> list = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam2 }); foreach (int num2 in FPUtils.SplitInt(this.examuser)) { foreach (UserInfo userInfo2 in list) { if (num2 == userInfo2.id && !FPUtils.InArray(num2, text3)) { if (text2 != "") { text2 += ","; } if (userInfo2.realname != "") { text2 += userInfo2.realname; } else { text2 += userInfo2.username; } if (text3 != "") { text3 += ","; } text3 += num2; } } } } Hashtable hashtable = new Hashtable(); hashtable["uname"] = text2; hashtable["examuser"] = text3; base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); } } } }
// Token: 0x060000CB RID: 203 RVA: 0x0001420C File Offset: 0x0001240C protected override void View() { ExamQuestion examQuestion = DbHelper.ExecuteModel <ExamQuestion>(this.qid); if (examQuestion.id == 0) { this.ShowErrMsg("对不起,该题目不存在或已被删除。"); } SortInfo sortInfo = SortBll.GetSortInfo(examQuestion.sortid); if (this.option == 1) { foreach (int num in FPUtils.SplitInt(sortInfo.parentlist)) { if (num != 0) { ExamLogInfo examLogInfo = ExamBll.GetExamLogInfo(this.userid, num); if (examLogInfo.sortid == 0) { examLogInfo.sortid = examQuestion.sortid; examLogInfo.channelid = examQuestion.channelid; examLogInfo.uid = this.userid; examLogInfo.favs = 1; if (num == sortInfo.id) { examLogInfo.curfavs = 1; } examLogInfo.favlist = this.qid.ToString(); DbHelper.ExecuteInsert <ExamLogInfo>(examLogInfo); } else { examLogInfo.favs++; if (num == sortInfo.id) { examLogInfo.curfavs++; } ExamLogInfo examLogInfo2 = examLogInfo; examLogInfo2.favlist += ((examLogInfo.favlist == "") ? this.qid.ToString() : ("," + this.qid.ToString())); DbHelper.ExecuteUpdate <ExamLogInfo>(examLogInfo); } } } } else if (this.option == -1) { foreach (int num in FPUtils.SplitInt(sortInfo.parentlist)) { if (num != 0) { ExamLogInfo examLogInfo = ExamBll.GetExamLogInfo(this.userid, num); if (examLogInfo.sortid != 0) { if (FPUtils.InArray(this.qid, examLogInfo.favlist)) { examLogInfo.favs--; if (num == sortInfo.id) { examLogInfo.curfavs--; } string text = ""; foreach (int num2 in FPUtils.SplitInt(examLogInfo.favlist)) { if (num2 != this.qid) { text += ((text == "") ? num2.ToString() : ("," + num2.ToString())); } } examLogInfo.favlist = text; DbHelper.ExecuteUpdate <ExamLogInfo>(examLogInfo); } } } } } Hashtable hashtable = new Hashtable(); hashtable["error"] = 0; hashtable["message"] = ""; hashtable["action"] = this.option; base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); }
// Token: 0x0600005C RID: 92 RVA: 0x00009838 File Offset: 0x00007A38 protected bool IsSelected(int tid) { return(FPUtils.InArray(tid, this.examtopic.questionlist)); }
// Token: 0x060000AF RID: 175 RVA: 0x0000DD18 File Offset: 0x0000BF18 protected bool isPermission(int id) { return(FPUtils.InArray(id, this.roleinfo.permission)); }
// Token: 0x06000306 RID: 774 RVA: 0x0000C054 File Offset: 0x0000A254 protected override void View() { this.regconfig = RegConfigs.GetRegConfig(); if (this.ispost) { UserInfo userInfo = UserBll.GetUserInfo(this.userid); if (userInfo.isemail == 1) { this.ShowErr("您的邮箱已通过了验证。"); } else { string @string = FPRequest.GetString("email"); if (@string == "") { this.ShowErr("您还没有设定邮箱。"); } else if (!FPUtils.IsEmail(@string)) { this.ShowErr("Email格式不正确"); } else if (DbHelper.ExecuteCount <UserInfo>(string.Format("[email]='{0}' AND [id]<>{1}", @string, this.userid)) > 0) { this.ShowErr("邮箱: \"" + @string + "\" 已经被其他用户使用"); } else { string emailHostName = this.GetEmailHostName(@string); if (this.regconfig.accessemail.Trim() != "") { if (!FPUtils.InArray(emailHostName, this.regconfig.accessemail, "|")) { this.ShowErr("本站点只允许使用以下域名的Email地址:" + this.regconfig.accessemail); return; } } else if (this.regconfig.censoremail.Trim() != "") { if (FPUtils.InArray(@string, this.regconfig.censoremail, "|")) { this.ShowErr("本站点不允许使用以下域名的Email地址: " + this.regconfig.censoremail); return; } } userInfo.authstr = WMSUtils.CreateAuthStr(20); SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeSet("isemail", 0), DbHelper.MakeSet("email", @string), DbHelper.MakeSet("authflag", 1), DbHelper.MakeSet("authstr", userInfo.authstr), DbHelper.MakeSet("authtime", DbUtils.GetDateTime()), DbHelper.MakeAndWhere("id", this.userid) }; DbHelper.ExecuteUpdate <UserInfo>(sqlparams); string newValue = string.Concat(new string[] { "<pre style=\"width:100%;word-wrap:break-word\"><a href=\"http://", this.domain, this.rawpath, "activationuser.aspx?authstr=", userInfo.authstr, "\" target=\"_blank\">http://", this.domain, this.rawpath, "activationuser.aspx?authstr=", userInfo.authstr, "</a></pre>" }); MsgTempInfo msgTemplate = MsgTempBll.GetMsgTemplate("email_register"); msgTemplate.content = msgTemplate.content.Replace("【用户名】", userInfo.username).Replace("【邮箱帐号】", @string).Replace("【激活链接】", newValue); Email.Send(@string, msgTemplate.name, msgTemplate.content); base.ResetUser(); base.AddMsg("您的注册邮箱[" + @string + "]将收到一封认证邮件,请登录您的邮箱查收,并点击邮件中的链接完成激活。"); } } } }
// Token: 0x060000D6 RID: 214 RVA: 0x00015284 File Offset: 0x00013484 protected override void View() { ExamQuestion examQuestion = DbHelper.ExecuteModel <ExamQuestion>(this.qid); if (examQuestion.id == 0) { this.ShowErrMsg("对不起,该题目不存在或已被删除。"); } SortInfo sortInfo = SortBll.GetSortInfo(examQuestion.sortid); if (sortInfo.id == 0) { this.ShowErrMsg("对不起,该题目题库不存在或已被删除。"); } foreach (int num in FPUtils.SplitInt(sortInfo.parentlist)) { if (num != 0) { ExamLogInfo examLogInfo = ExamBll.GetExamLogInfo(this.userid, num); if (examLogInfo.sortid == 0) { examLogInfo.sortid = examQuestion.sortid; examLogInfo.channelid = examQuestion.channelid; examLogInfo.uid = this.userid; examLogInfo.notes = 1; examLogInfo.notelist = this.qid.ToString(); if (num == sortInfo.id) { examLogInfo.curnotes = 1; } DbHelper.ExecuteInsert <ExamLogInfo>(examLogInfo); } else { if (!FPUtils.InArray(this.qid, examLogInfo.notelist)) { examLogInfo.notes++; ExamLogInfo examLogInfo2 = examLogInfo; examLogInfo2.notelist += ((examLogInfo.notelist == "") ? this.qid.ToString() : ("," + this.qid.ToString())); if (num != sortInfo.id) { examLogInfo.curnotes++; } } DbHelper.ExecuteUpdate <ExamLogInfo>(examLogInfo); } } } SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeAndWhere("qid", this.qid), DbHelper.MakeAndWhere("uid", this.userid) }; ExamNote examNote = DbHelper.ExecuteModel <ExamNote>(sqlparams); examNote.uid = this.userid; examNote.qid = this.qid; examNote.note = this.note; if (examNote.id > 0) { DbHelper.ExecuteUpdate <ExamNote>(examNote); } else { DbHelper.ExecuteInsert <ExamNote>(examNote); } 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: 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: 0x06000010 RID: 16 RVA: 0x00002374 File Offset: 0x00000574 protected override void OnInit(EventArgs e) { base.OnInit(e); if (this.sysconfig.adminpath != "") { this.adminpath = this.webpath + this.sysconfig.adminpath + "/"; } if (this.Session["FP_OLUSERINFO"] != null) { if (!this.IsTimeOut()) { this.user = (this.Session["FP_OLUSERINFO"] as UserInfo); this.role = (this.Session["FP_ROLEINFO"] as RoleInfo); this.permlist = (this.Session["FP_PERMISSION"] as List <Permission>); } else { this.user = UserBll.CreateGuestUser(); this.Session["FP_OLUSERINFO"] = this.user; this.role = RoleBll.GetRoleInfo(this.user.roleid); this.Session["FP_ROLEINFO"] = this.role; this.permlist = new PermissionBll().GetPermissionList(this.role.permission); this.Session["FP_PERMISSION"] = this.permlist; } } else { this.user = UserBll.GetOnlineUser(this.sysconfig.passwordkey, this.sysconfig.onlinetimeout); this.Session["FP_OLUSERINFO"] = this.user; this.role = RoleBll.GetRoleInfo(this.user.roleid); this.Session["FP_ROLEINFO"] = this.role; this.permlist = new PermissionBll().GetPermissionList(this.role.permission); this.Session["FP_PERMISSION"] = this.permlist; } this.userid = this.user.id; this.roleid = this.user.roleid; this.departid = this.user.departid; this.username = this.user.username; if (this.role.desktopurl == "") { this.role.desktopurl = "main.aspx"; } UserBll.UpdateOnlineState(this.userid, this.sysconfig.onlinetimeout, this.sysconfig.onlinefrequency); this.iscuserr = FPUtils.InArray(this.cururl, this.sysconfig.customerrors); this.permission = this.GetPermission(this.cururl); if (this.roleid == 1 || this.permission.id > 0) { this.isperm = true; } if (this.roleid == 1 || this.role.isadmin == 1) { this.isadmin = true; } if (this.roleid != 1 && this.siteconfig.closed == 1 && this.pagename != "login.aspx" && this.pagename != "logout.aspx") { MessageBox.Show(this.siteconfig.closedreason); } if (this.roleid != 1 && this.siteconfig.ipaccess.Trim() != "" && this.pagename != "login.aspx" && this.pagename != "logout.aspx" && this.ip != "127.0.0.1") { string[] iparray = FPUtils.SplitString(this.siteconfig.ipaccess, "\n"); if (!FPUtils.InIPArray(this.ip, iparray)) { MessageBox.Show("抱歉,系统设置了IP访问限制,您所在的IP地址无权访问本站点。"); } } if (this.roleid != 1 && this.siteconfig.ipdenyaccess.Trim() != "" && this.pagename != "login.aspx" && this.pagename != "logout.aspx" && this.ip != "127.0.0.1") { string[] iparray = FPUtils.SplitString(this.siteconfig.ipdenyaccess, "\n"); if (FPUtils.InIPArray(this.ip, iparray)) { MessageBox.Show("对不起,您所在的IP地址已被禁止访问本站点。"); } } if (this.roleid != 1 && this.siteconfig.roles.Trim() != "" && this.pagename != "login.aspx" && this.pagename != "logout.aspx") { if (!FPUtils.InArray(this.roleid, this.siteconfig.roles)) { MessageBox.Show("对不起,您没有权限访问该站点。"); } } this.isseccode = FPUtils.InArray(this.cururl, this.sysconfig.verifypage.Replace("|", ",")); if (this.isseccode) { this.isvalid = (string.Compare(this.Session["FP_VERIFY"].ToString().ToLower(), FPRequest.GetString("verify").ToLower(), true) != 0); } this.isvip = (this.user.vipdays > 0); }
// Token: 0x06000024 RID: 36 RVA: 0x0000349C File Offset: 0x0000169C public static void UpdateExamLog(SortInfo sortinfo, int uid, ExamQuestion question, bool iswrong) { foreach (int num in FPUtils.SplitInt(sortinfo.parentlist)) { if (num != 0) { ExamLogInfo examLogInfo = ExamBll.GetExamLogInfo(uid, num); if (examLogInfo.sortid == 0) { examLogInfo.sortid = num; examLogInfo.uid = uid; examLogInfo.channelid = sortinfo.channelid; examLogInfo.answers = 1; examLogInfo.wrongs = (iswrong ? 1 : 0); if (num == sortinfo.id) { examLogInfo.curwrongs = (iswrong ? 1 : 0); } examLogInfo.qidlist = question.id.ToString(); examLogInfo.optionlist = question.optionlist; examLogInfo.answerlist = question.useranswer; examLogInfo.scorelist = (iswrong ? "0" : "1"); examLogInfo.wronglist = (iswrong ? question.id.ToString() : ""); DbHelper.ExecuteInsert <ExamLogInfo>(examLogInfo); } else { if (FPUtils.InArray(question.id, examLogInfo.qidlist)) { int[] array2 = FPUtils.SplitInt(examLogInfo.qidlist); string[] array3 = FPUtils.SplitString(examLogInfo.optionlist, "|", array2.Length); int[] array4 = FPUtils.SplitInt(examLogInfo.scorelist, ",", array2.Length); string[] array5 = FPUtils.SplitString(examLogInfo.answerlist, "§", array2.Length); string text = ""; string text2 = ""; string text3 = ""; for (int j = 0; j < array2.Length; j++) { if (array2[j] == question.id) { if (array4[j] == 1 && iswrong) { array4[j] = 0; array5[j] = question.useranswer; array3[j] = question.optionlist; examLogInfo.wrongs++; if (num == sortinfo.id) { examLogInfo.curwrongs++; } if (examLogInfo.wronglist != "") { ExamLogInfo examLogInfo2 = examLogInfo; examLogInfo2.wronglist += ","; } ExamLogInfo examLogInfo3 = examLogInfo; examLogInfo3.wronglist += question.id; } else if (array4[j] == 0 && !iswrong) { array4[j] = 1; array5[j] = question.useranswer; array3[j] = question.optionlist; examLogInfo.wrongs--; if (num == sortinfo.id) { examLogInfo.curwrongs--; } string text4 = ""; foreach (int num2 in FPUtils.SplitInt(examLogInfo.wronglist)) { if (num2 != question.id) { if (text4 != "") { text4 += ","; } text4 += num2; } } examLogInfo.wronglist = text4; } } if (text != "") { text += ","; } text += array4[j]; if (text2 != "") { text2 += "§"; } text2 += array5[j]; if (text3 != "") { text3 += "|"; } text3 += array3[j]; } examLogInfo.scorelist = text; examLogInfo.answerlist = text2; examLogInfo.optionlist = text3; } else { examLogInfo.answers++; examLogInfo.wrongs += (iswrong ? 1 : 0); if (num == sortinfo.id) { examLogInfo.curwrongs += (iswrong ? 1 : 0); } ExamLogInfo examLogInfo4 = examLogInfo; examLogInfo4.qidlist += ((examLogInfo.qidlist == "") ? question.id.ToString() : ("," + question.id.ToString())); if (iswrong) { ExamLogInfo examLogInfo5 = examLogInfo; examLogInfo5.scorelist += ((examLogInfo.scorelist == "") ? "0" : ",0"); ExamLogInfo examLogInfo6 = examLogInfo; examLogInfo6.wronglist += ((examLogInfo.wronglist == "") ? question.id.ToString() : ("," + question.id.ToString())); } else { ExamLogInfo examLogInfo7 = examLogInfo; examLogInfo7.scorelist += ((examLogInfo.scorelist == "") ? "1" : ",1"); } ExamLogInfo examLogInfo8 = examLogInfo; examLogInfo8.answerlist += ((examLogInfo.answerlist == "") ? question.useranswer : ("§" + question.useranswer)); ExamLogInfo examLogInfo9 = examLogInfo; examLogInfo9.optionlist += ((examLogInfo.optionlist == "") ? question.optionlist : ("|" + question.optionlist)); } DbHelper.ExecuteUpdate <ExamLogInfo>(examLogInfo); } } } }
// Token: 0x06000037 RID: 55 RVA: 0x00003C7C File Offset: 0x00001E7C private bool IsWaterMark(string _fileExt) { return(SysConfigs.GetConfig().allowwatermark > 0 && FPUtils.InArray(_fileExt.ToLower(), "bmp,jpg,png")); }
// Token: 0x06000036 RID: 54 RVA: 0x00003C58 File Offset: 0x00001E58 private bool IsImage(string _fileExt) { return(FPUtils.InArray(_fileExt.ToLower(), "bmp,jpg,gif,png")); }
// 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: 0x0600031F RID: 799 RVA: 0x0000D54C File Offset: 0x0000B74C protected override void View() { if (this.reurl == "") { this.reurl = "login.aspx"; } this.regconfig = RegConfigs.GetRegConfig(); if (this.ispost) { if (this.userid > 0) { this.ShowErr("对不起,系统不允许重复注册用户。"); } else if (this.regconfig.regstatus != 1) { this.ShowErr("对不起,系统目前暂不允许新用户注册。"); } else { if (this.regconfig.regctrl > 0) { SqlParam sqlParam = DbHelper.MakeAndWhere("regip", FPRequest.GetIP()); UserInfo userInfo = DbHelper.ExecuteModel <UserInfo>(new SqlParam[] { sqlParam }); if (userInfo.id > 0) { int num = this.StrDateDiffHours(userInfo.joindatetime, this.regconfig.regctrl); if (num < 0) { this.ShowErr("抱歉,系统设置了IP注册间隔限制,您必须在 " + (num * -1).ToString() + " 小时后才可以重新注册"); return; } } } if (this.regconfig.ipregctrl.Trim() != "") { string[] iparray = FPUtils.SplitString(this.regconfig.ipregctrl, "|"); if (FPUtils.InIPArray(FPRequest.GetIP(), iparray)) { this.ShowErr("抱歉,系统设置了IP注册限制,您所在的IP段不允许注册。"); return; } } string @string = FPRequest.GetString("username"); string string2 = FPRequest.GetString("password"); string text = FPRequest.GetString("email").Trim().ToLower(); string string3 = FPRequest.GetString("realname"); string string4 = FPRequest.GetString("idcard"); string text2 = FPRequest.GetString("mobile").Trim(); if (@string.Equals("")) { this.ShowErr("用户名不能为空。"); } else if (@string.Length < 3) { this.ShowErr("对不起,用户名不能小于3个字符"); } else if (@string.Length > 20) { this.ShowErr("对不起,用户名不能大于20个字符"); } else if (!FPUtils.IsSafeSqlString(@string)) { this.ShowErr("对不起,您使用的用户名有敏感字符"); } else if (this.InRestrictArray(@string, this.regconfig.restrict)) { this.ShowErr("对不起,该用户名:" + @string + " 不允许使用"); } else if (UserBll.CheckUserName(@string)) { this.ShowErr("该用户名已经存在,请使用别的用户名。"); } else if (string2.Equals("")) { this.ShowErr("密码不能为空"); } else if (string2 != FPRequest.GetString("repeat")) { this.ShowErr("对不起,两次输入密码不相同"); } else if (this.regconfig.email == 1 && text == "") { this.ShowErr("Email不能为空"); } else if (text.Trim() != "" && !FPUtils.IsEmail(text)) { this.ShowErr("Email格式不正确"); } else { if (text.Trim() != "") { if (DbHelper.ExecuteCount <UserInfo>("[email]='" + text + "'") > 0) { this.ShowErr("邮箱: \"" + text + "\" 已经被其他用户使用"); return; } } string emailHostName = this.GetEmailHostName(text); if (text.Trim() != "" && this.regconfig.accessemail.Trim() != "") { if (!FPUtils.InArray(emailHostName, this.regconfig.accessemail, "|")) { this.ShowErr("本站点只允许使用以下域名的Email地址注册:" + this.regconfig.accessemail); return; } } else if (text.Trim() != "" && this.regconfig.censoremail.Trim() != "") { if (FPUtils.InArray(text, this.regconfig.censoremail, "|")) { this.ShowErr("本站点不允许使用以下域名的Email地址注册: " + this.regconfig.censoremail); return; } } if (this.regconfig.realname == 1) { if (string3.Equals("")) { this.ShowErr("真实姓名不能为空"); return; } } if (this.InRestrictArray(string3, this.regconfig.restrict)) { this.ShowErr("对不起,该姓名:[" + string3 + "]不允许使用"); } else { if (this.regconfig.mobile == 1) { if (text2.Equals("")) { this.ShowErr("手机号码不能为空"); return; } } if (text2.Trim().Length > 20) { this.ShowErr("手机号码不能大于20个字符"); } else if (text2.Trim() != "" && !Regex.IsMatch(text2.Trim(), "^[\\d|-]+$")) { this.ShowErr("手机号码中含有非法字符"); } else { if (this.regconfig.rules == 1) { if (FPRequest.GetInt("rules", 0) != 1) { this.ShowErr("对不起,您没有选择同意网站许可协议"); return; } } if (this.isseccode) { if (FPRequest.GetString("verify").Equals("")) { this.ShowErr("验证码不能为空"); return; } if (!this.isvalid) { this.ShowErr("验证码错误"); return; } } this.iuser = FPRequest.GetModel <UserInfo>(); this.iuser.password = FPUtils.MD5(this.iuser.password); this.iuser.credits = this.regconfig.credit; this.iuser.regip = FPRequest.GetIP(); this.iuser.joindatetime = DbUtils.GetDateTime(); if (this.regconfig.regverify == 1) { this.iuser.authstr = ""; this.iuser.authflag = 1; this.iuser.roleid = 3; } else if (this.regconfig.regverify == 2) { this.iuser.authstr = WMSUtils.CreateAuthStr(20); this.iuser.authflag = 1; this.iuser.roleid = 3; string newValue = string.Concat(new string[] { "<pre style=\"width:100%;word-wrap:break-word\"><a href=\"http://", this.domain, this.rawpath, "activationuser.aspx?authstr=", this.iuser.authstr, "\" target=\"_blank\">http://", this.domain, this.rawpath, "activationuser.aspx?authstr=", this.iuser.authstr, "</a></pre>" }); MsgTempInfo msgTemplate = MsgTempBll.GetMsgTemplate("email_register"); msgTemplate.content = msgTemplate.content.Replace("【用户名】", this.iuser.username).Replace("【邮箱帐号】", this.iuser.email).Replace("【激活链接】", newValue); Email.Send(text, msgTemplate.name, msgTemplate.content); } else { this.iuser.authstr = ""; this.iuser.authflag = 0; this.iuser.roleid = 5; } this.iuser.id = DbHelper.ExecuteInsert <UserInfo>(this.iuser); if (this.iuser.id > 0) { if (this.regconfig.credit > 0 && this.iuser.credits > 0) { UserBll.Credit_AddLog(this.iuser.id, "用户注册", 0, this.iuser.credits); } if (this.regconfig.regverify == 1) { base.AddMsg("注册成功, 但需要等待管理员审核后您的帐户才能生效。"); } else if (this.regconfig.regverify == 2) { base.AddMsg("您的注册邮箱[" + this.iuser.email + "]将收到一封认证邮件,请登录您的邮箱查收,并点击邮件中的链接完成激活。激活成功后,可以使用站内所有功能,再次感谢您的加入。"); } else { base.AddMsg("注册成功, 请点击下面链接返回登录。"); } } else { this.ShowErr("注册失败,请检查输入是否正确。"); } } } } } } }
// Token: 0x06000058 RID: 88 RVA: 0x00007EC8 File Offset: 0x000060C8 public static string CopyDirectory(string sourcePath, string targetPath, string vpath, string appfiles) { string text = ""; DirectoryInfo directoryInfo = new DirectoryInfo(sourcePath); if (!Directory.Exists(targetPath)) { Directory.CreateDirectory(targetPath); } foreach (FileInfo fileInfo in directoryInfo.GetFiles()) { if (fileInfo.Extension == ".dll") { fileInfo.CopyTo(FPUtils.GetMapPath(WebConfig.WebPath + "bin/" + fileInfo.Name), true); if (!FPUtils.InArray("bin/" + fileInfo.Name, appfiles)) { if (text != "") { text += ","; } text = text + "bin/" + fileInfo.Name; } } else if (fileInfo.Extension == ".sql") { fileInfo.CopyTo(targetPath + "\\" + fileInfo.Name, true); if (fileInfo.Name.ToLower().EndsWith("access.sql") && DbConfigs.DbType == DbType.Access) { string sqlstring = FPFile.ReadFile(fileInfo.FullName); DbHelper.ExecuteSql(sqlstring); } else if (fileInfo.Name.ToLower().EndsWith("sqlserver.sql") && DbConfigs.DbType == DbType.SqlServer) { string sqlstring = FPFile.ReadFile(fileInfo.FullName); DbHelper.ExecuteSql(sqlstring); } if (!FPUtils.InArray("bin/" + fileInfo.Name, appfiles)) { if (text != "") { text += ","; } text = text + "bin/" + fileInfo.Name; } } else { if (!FPUtils.InArray("bin/" + fileInfo.Name, appfiles)) { if (text != "") { text += ","; } text = text + "bin/" + fileInfo.Name; } fileInfo.CopyTo(targetPath + "\\" + fileInfo.Name, true); } } foreach (DirectoryInfo directoryInfo2 in directoryInfo.GetDirectories()) { string text2 = appupdate.CopyDirectory(directoryInfo2.FullName, targetPath + "\\" + directoryInfo2.Name, vpath + directoryInfo2.Name + "/", appfiles); if (text2 != "") { if (text != "") { text += ","; } text += text2; } } return(text); }
// Token: 0x06000042 RID: 66 RVA: 0x000064B8 File Offset: 0x000046B8 protected override void View() { 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) { if (this.action == "delete") { string @string = FPRequest.GetString("chkid"); if (DbHelper.ExecuteDelete <ExamResult>(@string) > 0) { SqlParam sqlParam = DbHelper.MakeAndWhere("resultid", WhereType.In, @string); DbHelper.ExecuteDelete <ExamResultTopic>(new SqlParam[] { sqlParam }); } } } if (this.examinfo.examdeparts == "" && this.examinfo.examuser == "" && this.examinfo.examroles == "") { List <SqlParam> list = new List <SqlParam>(); list.Add(DbHelper.MakeAndWhere("examid", this.examid)); if (this.keyword != "") { string text = "0"; SqlParam sqlParam2 = DbHelper.MakeAndWhere(string.Format("([username] LIKE '%{0}%' OR [realname] LIKE '%{0}%')", this.keyword), WhereType.Custom, ""); List <UserInfo> list2 = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam2 }); foreach (UserInfo userInfo in list2) { if (text != "") { text += ","; } text += userInfo.id; } list.Add(DbHelper.MakeAndWhere("uid", WhereType.In, text)); } if (this.action == "export") { OrderByParam[] orderbys = new OrderByParam[] { DbHelper.MakeOrderBy("score", OrderBy.DESC), DbHelper.MakeOrderBy("id", OrderBy.ASC) }; this.examresultlist = DbHelper.ExecuteList <ExamResult>(orderbys, list.ToArray()); } else { this.examresultlist = DbHelper.ExecuteList <ExamResult>(this.pager, list.ToArray()); } } else { string text = ""; if (this.examinfo.examroles != "") { SqlParam sqlParam2 = DbHelper.MakeAndWhere("roleid", WhereType.In, this.examinfo.examroles); List <UserInfo> list2 = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam2 }); foreach (UserInfo userInfo in list2) { if (!FPUtils.InArray(userInfo.id, text)) { ExamResult examResult = new ExamResult(); examResult.uid = userInfo.id; examResult.examid = this.examid; examResult.status = -1; this.examresultlist.Add(examResult); if (text != "") { text += ","; } text += userInfo.id; } } } if (this.examinfo.examdeparts != "") { SqlParam sqlParam2 = DbHelper.MakeAndWhere("departid", WhereType.In, this.examinfo.examdeparts); List <UserInfo> list2 = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam2 }); foreach (UserInfo userInfo in list2) { if (!FPUtils.InArray(userInfo.id, text)) { ExamResult examResult = new ExamResult(); examResult.uid = userInfo.id; examResult.examid = this.examid; examResult.status = -1; this.examresultlist.Add(examResult); if (text != "") { text += ","; } text += userInfo.id; } } } if (this.examinfo.examuser != "") { SqlParam sqlParam2 = DbHelper.MakeAndWhere("id", WhereType.In, this.examinfo.examuser); List <UserInfo> list2 = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam2 }); foreach (UserInfo userInfo in list2) { if (!FPUtils.InArray(userInfo.id, text)) { ExamResult examResult = new ExamResult(); examResult.uid = userInfo.id; examResult.examid = this.examid; examResult.status = -1; this.examresultlist.Add(examResult); if (text != "") { text += ","; } text += userInfo.id; } } } SqlParam sqlParam3 = DbHelper.MakeAndWhere("examid", this.examid); OrderByParam orderby = DbHelper.MakeOrderBy("id", OrderBy.ASC); List <ExamResult> list3 = DbHelper.ExecuteList <ExamResult>(orderby, new SqlParam[] { sqlParam3 }); int num = 0; foreach (ExamResult examResult2 in this.examresultlist) { foreach (ExamResult examResult3 in list3) { if (examResult3.uid == examResult2.uid) { this.examresultlist[num].id = examResult3.id; this.examresultlist[num].score = examResult3.score; this.examresultlist[num].starttime = examResult3.starttime; this.examresultlist[num].examdatetime = examResult3.examdatetime; this.examresultlist[num].utime = examResult3.utime; this.examresultlist[num].status = examResult3.status; this.examresultlist[num].questions++; this.examresultlist[num].ip = examResult3.ip; } } num++; } if (this.keyword != "") { list3 = new List <ExamResult>(); foreach (ExamResult examResult2 in this.examresultlist) { if (examResult2.IUser.username.Contains(this.keyword) || examResult2.IUser.realname.Contains(this.keyword)) { list3.Add(examResult2); } } this.examresultlist = new List <ExamResult>(); foreach (ExamResult examResult2 in list3) { this.examresultlist.Add(examResult2); } } if (this.action != "export" && this.action != "report") { this.pager.total = this.examresultlist.Count; int num2 = (this.pager.pageindex - 1) * this.pager.pagesize; int count = this.pager.pagesize; if (num2 + this.pager.pagesize > this.pager.total) { count = this.pager.total - num2; } this.examresultlist = this.examresultlist.GetRange(num2, count); } } if (this.ispost) { if (this.action == "export") { 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("所在部门"); hssfrow.CreateCell(3).SetCellValue("考试得分"); hssfrow.CreateCell(4).SetCellValue("开始时间"); hssfrow.CreateCell(5).SetCellValue("考试用时"); hssfrow.CreateCell(6).SetCellValue("考试状态"); hssfrow.CreateCell(7).SetCellValue(""); hssfrow.Height = 400; hssfsheet.SetColumnWidth(2, 6000); hssfsheet.SetColumnWidth(4, 6000); for (int i = 0; i < 7; 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 num3 = 1; foreach (ExamResult examResult2 in this.examresultlist) { HSSFRow hssfrow2 = hssfsheet.CreateRow(num3); hssfrow2.Height = 300; hssfrow2.CreateCell(0).SetCellValue(examResult2.IUser.username); hssfrow2.CreateCell(1).SetCellValue(examResult2.IUser.realname); hssfrow2.CreateCell(2).SetCellValue(examResult2.IUser.Department.name); hssfrow2.CreateCell(3).SetCellValue(examResult2.score.ToString()); if (examResult2.status >= 0) { hssfrow2.CreateCell(4).SetCellValue(examResult2.examdatetime.ToString("yyyy-MM-dd HH:mm:dd")); hssfrow2.CreateCell(5).SetCellValue((examResult2.utime / 60 + 1).ToString() + "分钟"); } else { hssfrow2.CreateCell(4).SetCellValue(""); hssfrow2.CreateCell(5).SetCellValue(""); } if (examResult2.status == 1) { hssfrow2.CreateCell(6).SetCellValue("已交卷"); } else if (examResult2.status == 2) { hssfrow2.CreateCell(6).SetCellValue("已阅卷"); } else if (examResult2.status == 0) { hssfrow2.CreateCell(6).SetCellValue("未交卷"); } else { hssfrow2.CreateCell(6).SetCellValue("缺考"); } hssfrow2.CreateCell(7).SetCellValue(""); for (int i = 0; i < 7; i++) { hssfrow2.Cells[i].CellStyle = hssfcellStyle2; } num3++; } 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.examinfo.name + "成绩表.xls")); base.Response.BinaryWrite(memoryStream.GetBuffer()); base.Response.Flush(); base.Response.End(); } } else if (this.action == "report") { AsposeWordApp asposeWordApp = new AsposeWordApp(); asposeWordApp.Open(FPUtils.GetMapPath("images\\examreport.doc")); asposeWordApp.InsertText("examtitle", this.examinfo.name); asposeWordApp.InsertText("username", this.user.realname); asposeWordApp.InsertText("total", this.examinfo.total.ToString() + "分"); if (this.examinfo.islimit == 1) { asposeWordApp.InsertText("examtime", this.examinfo.starttime.ToString("yyyy-MM-dd HH:mm")); } else { asposeWordApp.InsertText("examtime", "不限制"); } asposeWordApp.InsertText("exampass", (this.examinfo.passmark * this.examinfo.total / 100.0).ToString() + "分"); asposeWordApp.InsertText("qtime", this.examinfo.examtime.ToString() + "分钟"); asposeWordApp.InsertText("examuser", this.examinfo.exams.ToString() + "人"); if (this.examinfo.exams > 0) { asposeWordApp.InsertText("examavg", (this.examinfo.score / (double)this.examinfo.exams).ToString("0.0")); } else { asposeWordApp.InsertText("examavg", "0"); } int[] array = new int[5]; foreach (ExamResult examResult2 in this.examresultlist) { if (examResult2.score < 60.0) { array[0]++; } else if (examResult2.score >= 60.0 && examResult2.score < 70.0) { array[1]++; } else if (examResult2.score >= 70.0 && examResult2.score < 80.0) { array[2]++; } else if (examResult2.score >= 80.0 && examResult2.score < 90.0) { array[3]++; } else if (examResult2.score >= 90.0) { array[4]++; } } int i = 1; foreach (int num4 in array) { asposeWordApp.InsertText("s" + i, num4.ToString() + "人"); asposeWordApp.InsertText("p" + i, (num4 / this.examinfo.exams * 100).ToString("0.0") + "%"); i++; } asposeWordApp.Save(base.Response, this.examinfo.name + "_考试分析报告.doc"); } } base.SaveRightURL(); } }
// 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); } } } } }
// Token: 0x06000036 RID: 54 RVA: 0x00004444 File Offset: 0x00002644 protected override void View() { this.examconfig = ExamConifgs.GetExamConfig(); if (this.id > 0) { this.examinfo = DbHelper.ExecuteModel <ExamInfo>(this.id); if (this.examinfo.id == 0) { this.ShowErr("对不起,该试卷不存在或已被删除。"); return; } this.sortid = this.examinfo.sortid; } this.sortinfo = SortBll.GetSortInfo(this.sortid); if (this.sortinfo.id == 0) { this.ShowErr("对不起,该栏目不存在或已被删除。"); } else { if (this.examinfo.islimit == 0) { this.examinfo.starttime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm")); this.examinfo.endtime = this.examinfo.starttime.AddMinutes((double)this.examinfo.examtime); } if (this.ispost) { if (this.action == "saveas") { this.examinfo.name = this.examinfo.name + "_复制"; this.examinfo.score = 0.0; this.examinfo.exams = 0; int examid = DbHelper.ExecuteInsert <ExamInfo>(this.examinfo); SqlParam sqlParam = DbHelper.MakeAndWhere("examid", this.id); List <ExpInfo> list = DbHelper.ExecuteList <ExpInfo>(OrderBy.ASC, new SqlParam[] { sqlParam }); int num = 0; foreach (ExpInfo expInfo in list) { list[num].examid = examid; DbHelper.ExecuteInsert <ExpInfo>(list[num]); num++; } List <ExamTopic> list2 = DbHelper.ExecuteList <ExamTopic>(new SqlParam[] { sqlParam }); num = 0; foreach (ExamTopic examTopic in list2) { list2[num].examid = examid; DbHelper.ExecuteInsert <ExamTopic>(list2[num]); num++; } base.AddMsg("考试另存成功!"); } else { this.examinfo.islimit = 0; this.examinfo.showanswer = 0; this.examinfo.allowdelete = 0; this.examinfo.iscopy = 0; this.examinfo.examtype = 0; this.examinfo.channelid = this.sortinfo.channelid; this.examinfo.examroles = ""; this.examinfo = FPRequest.GetModel <ExamInfo>(this.examinfo); if (this.examinfo.name == "") { this.ShowErr("考试名称不能为空。"); return; } if (this.examinfo.papers <= 0) { this.examinfo.papers = 1; } if (this.examinfo.islimit == 1) { if (this.examinfo.endtime <= this.examinfo.starttime) { this.ShowErr("对不起,考试结束时间必须大于开始时间。"); return; } TimeSpan timeSpan = new TimeSpan(this.examinfo.endtime.Ticks); TimeSpan ts = new TimeSpan(this.examinfo.starttime.Ticks); TimeSpan timeSpan2 = timeSpan.Subtract(ts).Duration(); this.examinfo.examtime = Convert.ToInt32(timeSpan2.TotalMinutes); } if (this.examinfo.id > 0) { DbHelper.ExecuteUpdate <ExamInfo>(this.examinfo); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamResult] SET [examname]='{1}' WHERE [examid]={2}|", DbConfigs.Prefix, DbUtils.RegEsc(this.examinfo.name), this.examinfo.id); if (DbConfigs.DbType == DbType.Access) { stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamResult] SET [passmark]={1},[examtime]={2},[examtype]={3},[showanswer]={4},[allowdelete]={5},[islimit]={6},[endtime]=#{7}# WHERE [examid]={8} AND [status]=0", new object[] { DbConfigs.Prefix, this.examinfo.passmark, this.examinfo.examtime, this.examinfo.examtype, this.examinfo.showanswer, this.examinfo.allowdelete, this.examinfo.islimit, this.examinfo.endtime, this.examinfo.id }); } else { stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamResult] SET [passmark]={1},[examtime]={2},[examtype]={3},[showanswer]={4},[allowdelete]={5},[islimit]={6},[endtime]='{7}' WHERE [examid]={8} AND [status]=0", new object[] { DbConfigs.Prefix, this.examinfo.passmark, this.examinfo.examtime, this.examinfo.examtype, this.examinfo.showanswer, this.examinfo.allowdelete, this.examinfo.islimit, this.examinfo.endtime, this.examinfo.id }); } DbHelper.ExecuteSql(stringBuilder.ToString()); base.AddMsg("更新考试成功!"); } else { this.examinfo.uid = this.userid; this.examinfo.id = DbHelper.ExecuteInsert <ExamInfo>(this.examinfo); ExamBll.AddExamLarge(this.examinfo.id); base.AddMsg("添加考试成功!"); } int num2 = 0; double num3; if (this.examinfo.examdeparts == "" && this.examinfo.examuser == "" && this.examinfo.examroles == "") { SqlParam sqlParam2 = DbHelper.MakeAndWhere("examid", this.examinfo.id); num2 = DbHelper.ExecuteCount <ExamResult>(new SqlParam[] { sqlParam2 }); num3 = FPUtils.StrToDouble(DbHelper.ExecuteSum <ExamResult>("score", new SqlParam[] { sqlParam2 })); } else { string text = ""; if (this.examinfo.examroles != "") { SqlParam sqlParam3 = DbHelper.MakeAndWhere("roleid", WhereType.In, this.examinfo.examroles); List <UserInfo> list3 = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam3 }); foreach (UserInfo userInfo in list3) { if (!FPUtils.InArray(userInfo.id, text)) { if (text != "") { text += ","; } text += userInfo.id; num2++; } } } if (this.examinfo.examdeparts != "") { SqlParam sqlParam3 = DbHelper.MakeAndWhere("departid", WhereType.In, this.examinfo.examdeparts); List <UserInfo> list3 = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam3 }); foreach (UserInfo userInfo in list3) { if (!FPUtils.InArray(userInfo.id, text)) { if (text != "") { text += ","; } text += userInfo.id; num2++; } } } if (this.examinfo.examuser != "") { SqlParam sqlParam3 = DbHelper.MakeAndWhere("id", WhereType.In, this.examinfo.examuser); List <UserInfo> list3 = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam3 }); foreach (UserInfo userInfo in list3) { if (!FPUtils.InArray(userInfo.id, text)) { if (text != "") { text += ","; } text += userInfo.id; num2++; } } } string sqlstring = string.Format("DELETE FROM [{0}Exam_ExamResult] WHERE [examid]={1} AND [uid] NOT IN({2})", DbConfigs.Prefix, this.examinfo.id, text); DbHelper.ExecuteSql(sqlstring); SqlParam[] sqlparams = new SqlParam[] { DbHelper.MakeAndWhere("examid", this.examinfo.id), DbHelper.MakeAndWhere("uid", WhereType.NotIn, text) }; num3 = FPUtils.StrToDouble(DbHelper.ExecuteSum <ExamResult>("score", sqlparams)); } string sqlstring2 = string.Format("UPDATE [{0}Exam_ExamInfo] SET [exams]={1},[score]={2} WHERE [id]={3}", new object[] { DbConfigs.Prefix, num2, num3, this.examinfo.id }); DbHelper.ExecuteSql(sqlstring2); } if (this.tabactive == 1) { this.link = "exammanage.aspx?sortid=" + this.sortid; } else { this.link = string.Concat(new object[] { "examadd.aspx?sortid=", this.sortid, "&tabactive=", this.tabactive, "&id=", this.examinfo.id }); } } else { this.rolelist = DbHelper.ExecuteList <RoleInfo>(); SqlParam sqlParam4 = DbHelper.MakeAndWhere("id", WhereType.In, this.sortinfo.types); OrderByParam orderby = DbHelper.MakeOrderBy("display", OrderBy.ASC); this.typelist = DbHelper.ExecuteList <TypeInfo>(orderby, new SqlParam[] { sqlParam4 }); this.zNodes = this.GetDepartTree(0); base.SaveRightURL(); } } }