Пример #1
0
 // Token: 0x0600004C RID: 76 RVA: 0x000080D4 File Offset: 0x000062D4
 protected override void View()
 {
     this.examconfig = ExamConifgs.GetExamConfig();
     this.examinfo   = DbHelper.ExecuteModel <ExamInfo>(this.examid);
     if (this.examinfo.id == 0)
     {
         this.ShowErr("对不起,该试卷不存在或已被删除。");
     }
     else
     {
         this.sortid   = this.examinfo.sortid;
         this.sortinfo = SortBll.GetSortInfo(this.sortid);
         if (this.ispost)
         {
             string    @string   = FPRequest.GetString("action");
             int       @int      = FPRequest.GetInt("examtopicid");
             int       int2      = FPRequest.GetInt("tid");
             ExamTopic examTopic = DbHelper.ExecuteModel <ExamTopic>(@int);
             if (@string == "delete")
             {
                 DbHelper.ExecuteDelete <ExamTopic>(@int);
                 if (this.paper == 1)
                 {
                     StringBuilder stringBuilder = new StringBuilder();
                     stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [total]=[total]-{1},[questions]=[questions]-{2} WHERE [id]={3}", new object[]
                     {
                         DbConfigs.Prefix,
                         examTopic.perscore * (double)examTopic.questions,
                         examTopic.questions,
                         this.examid
                     });
                     DbHelper.ExecuteSql(stringBuilder.ToString());
                 }
             }
             else if (@string == "addpaper")
             {
                 if (this.examinfo.papers == 4)
                 {
                     this.ShowErr("对不起,一场考试最多只能添加4份试卷。");
                     return;
                 }
                 string text = string.Format("UPDATE [{0}Exam_ExamInfo] SET [papers]=[papers]+1 WHERE [id]={1}", DbConfigs.Prefix, this.examid);
                 DbHelper.ExecuteSql(text);
                 this.paper = this.examinfo.papers + 1;
             }
             else if (@string == "delpaper")
             {
                 if (this.examinfo.papers == 1)
                 {
                     this.ShowErr("对不起,一场考试必须有一份试卷。");
                     return;
                 }
                 StringBuilder stringBuilder = new StringBuilder();
                 stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [papers]=[papers]-1 WHERE [id]={1}", DbConfigs.Prefix, this.examid);
                 stringBuilder.AppendFormat("DELETE FROM [{0}Exam_ExamTopic] WHERE [examid]={1} AND [paper]={2}", DbConfigs.Prefix, this.examid, this.paper);
                 stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamTopic] SET [paper]=[paper]-1 WHERE [examid]={1} AND [paper]>{2}", DbConfigs.Prefix, this.examid, this.paper);
                 DbHelper.ExecuteSql(stringBuilder.ToString());
                 this.examinfo.papers = this.examinfo.papers - 1;
                 if (this.paper > this.examinfo.papers)
                 {
                     this.paper = this.examinfo.papers;
                 }
                 List <ExamTopic> examTopicList = ExamBll.GetExamTopicList(this.examid, 1);
                 double           num           = 0.0;
                 int num2 = 0;
                 foreach (ExamTopic examTopic2 in examTopicList)
                 {
                     num  += examTopic2.perscore * (double)examTopic2.questions;
                     num2 += examTopic2.questions;
                 }
                 string sqlstring = string.Format("UPDATE [{0}Exam_ExamInfo] SET [questions]={1},[total]={2} WHERE [id]={3}", new object[]
                 {
                     DbConfigs.Prefix,
                     num2,
                     num,
                     this.examid
                 });
                 DbHelper.ExecuteSql(sqlstring);
             }
             else if (@string == "saveas")
             {
                 if (this.examinfo.papers == 4)
                 {
                     this.ShowErr("对不起,一场考试最多只能添加4份试卷。");
                     return;
                 }
                 string text = string.Format("UPDATE [{0}Exam_ExamInfo] SET [papers]=[papers]+1 WHERE [id]={1}", DbConfigs.Prefix, this.examid);
                 DbHelper.ExecuteSql(text);
                 this.examtopiclist   = ExamBll.GetExamTopicList(this.examid, this.paper);
                 this.examinfo.papers = this.examinfo.papers + 1;
                 for (int i = 0; i < this.examtopiclist.Count; i++)
                 {
                     this.examtopiclist[i].paper = this.examinfo.papers;
                     DbHelper.ExecuteInsert <ExamTopic>(this.examtopiclist[i]);
                 }
             }
             else if (@string == "deletetopic")
             {
                 string text2 = "";
                 foreach (int num3 in FPUtils.SplitInt(examTopic.questionlist))
                 {
                     if (int2 != num3 && num3 > 0)
                     {
                         if (text2 != "")
                         {
                             text2 += ",";
                         }
                         text2 += num3;
                     }
                 }
                 examTopic.questionlist = text2;
                 if (examTopic.questionlist.Length > 0)
                 {
                     examTopic.curquestions = FPUtils.SplitInt(examTopic.questionlist).Length;
                 }
                 else
                 {
                     examTopic.curquestions = 0;
                 }
                 SqlParam[] sqlparams = new SqlParam[]
                 {
                     DbHelper.MakeSet("questionlist", examTopic.questionlist),
                     DbHelper.MakeSet("curquestions", examTopic.curquestions),
                     DbHelper.MakeAndWhere("id", @int)
                 };
                 DbHelper.ExecuteUpdate <ExamTopic>(sqlparams);
             }
             else if (@string == "display")
             {
                 this.examtopiclist = ExamBll.GetExamTopicList(this.examid, this.paper);
                 string text = "";
                 foreach (ExamTopic examTopic3 in this.examtopiclist)
                 {
                     DataTable dataTable = new DataTable();
                     dataTable.Columns.Add("display", typeof(int));
                     dataTable.Columns.Add("qid", typeof(int));
                     foreach (int num4 in FPUtils.SplitInt(examTopic3.questionlist))
                     {
                         DataRow dataRow = dataTable.NewRow();
                         dataRow["display"] = FPRequest.GetInt("display_" + num4);
                         dataRow["qid"]     = num4;
                         dataTable.Rows.Add(dataRow);
                     }
                     string text3 = "";
                     foreach (DataRow dataRow2 in dataTable.Select("1=1", "display asc"))
                     {
                         if (text3 != "")
                         {
                             text3 += ",";
                         }
                         text3 += dataRow2["qid"].ToString();
                     }
                     if (text != "")
                     {
                         text += "|";
                     }
                     text += string.Format("UPDATE [{0}Exam_ExamTopic] SET [questionlist]='{1}' WHERE [id]={2}", DbConfigs.Prefix, text3, examTopic3.id);
                 }
                 DbHelper.ExecuteSql(text);
             }
             base.Response.Redirect(this.pagename + string.Format("?examid={0}&paper={1}&examtopicid={2}", this.examid, this.paper, @int));
         }
         this.examtopiclist = ExamBll.GetExamTopicList(this.examid, this.paper);
         SqlParam[] sqlparams2 = new SqlParam[]
         {
             DbHelper.MakeAndWhere("examid", this.examid),
             DbHelper.MakeAndWhere("paper", this.paper)
         };
         this.examinfo.questions = FPUtils.StrToInt(DbHelper.ExecuteSum <ExamTopic>("questions", sqlparams2));
         base.SaveRightURL();
     }
 }
Пример #2
0
 // Token: 0x06000061 RID: 97 RVA: 0x00009A40 File Offset: 0x00007C40
 protected override void View()
 {
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
     else if (this.ispost)
     {
         this.examinfo          = DbHelper.ExecuteModel <ExamInfo>(this.examid);
         this.examinfo.passmark = this.examinfo.passmark * this.examinfo.total / 100.0;
         this.examtopiclist     = ExamBll.GetExamTopicList(this.examid, this.paper);
         int num = 0;
         for (int i = 0; i < this.examtopiclist.Count; i++)
         {
             this.examtopiclist[i].questionlist = QuestionBll.GetTopicQuestion(this.channelinfo.id, this.examtopiclist[i]);
             string[] array = FPUtils.SplitString(this.examtopiclist[i].questionlist);
             if (this.examinfo.display == 0)
             {
                 this.examtopiclist[i].questionlist = QuestionBll.GetRandom(array, array.Length);
             }
             num += array.Length;
             this.examtopiclist[i].questions = array.Length;
         }
         this.examinfo.questions = num;
         AsposeWordApp asposeWordApp = new AsposeWordApp();
         if (this.papersize == "a4")
         {
             asposeWordApp.Open(FPUtils.GetMapPath("images\\exampaper_a4.doc"));
         }
         else
         {
             asposeWordApp.Open(FPUtils.GetMapPath("images\\exampaper_a3.doc"));
         }
         asposeWordApp.InsertText("examtitle", this.examinfo.name);
         asposeWordApp.InsertText("subtitle", this.GetPaper(this.paper));
         asposeWordApp.MoveToBookmark("content");
         DataTable  dataTable = new DataTable();
         DataColumn column    = new DataColumn("s0", Type.GetType("System.String"));
         dataTable.Columns.Add(column);
         int num2 = 1;
         foreach (ExamTopic examTopic in this.examtopiclist)
         {
             column = new DataColumn("s" + num2, Type.GetType("System.String"));
             dataTable.Columns.Add(column);
             num2++;
         }
         column = new DataColumn("s" + num2, Type.GetType("System.String"));
         dataTable.Columns.Add(column);
         DataRow dataRow = dataTable.NewRow();
         dataRow["s0"] = "题  号";
         num2          = 1;
         foreach (ExamTopic examTopic in this.examtopiclist)
         {
             dataRow["s" + num2] = this.GetNum(num2);
             num2++;
         }
         dataRow["s" + num2] = "总  分";
         dataTable.Rows.Add(dataRow);
         dataRow       = dataTable.NewRow();
         dataRow["s0"] = "得  分";
         num2          = 1;
         foreach (ExamTopic examTopic in this.examtopiclist)
         {
             dataRow["s" + num2] = "";
             num2++;
         }
         dataRow["s" + num2] = "";
         dataTable.Rows.Add(dataRow);
         asposeWordApp.InsertTable(dataTable, true);
         asposeWordApp.InsertLineBreak();
         num2 = 1;
         foreach (ExamTopic examTopic in this.examtopiclist)
         {
             asposeWordApp.InsertScoreTable(true, true, string.Concat(new object[]
             {
                 examTopic.title,
                 "  (共",
                 examTopic.questions,
                 "题,每题",
                 examTopic.perscore,
                 "分,共",
                 (double)examTopic.questions * examTopic.perscore,
                 "分)"
             }));
             foreach (ExamQuestion examQuestion in this.GetQuestionList(examTopic.questionlist))
             {
                 if (examQuestion.type == 1 || examQuestion.type == 2)
                 {
                     if (this.papertype == 1)
                     {
                         asposeWordApp.Writeln(string.Concat(new object[]
                         {
                             num2,
                             "、",
                             examQuestion.title,
                             "  ",
                             examQuestion.answer
                         }), 12.0, false, "left");
                         asposeWordApp.Writeln(this.Option(asposeWordApp, examQuestion.option, examQuestion.ascount, examQuestion.optionlist), 12.0, false, "left");
                         if (examQuestion.explain != "")
                         {
                             asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left");
                         }
                     }
                     else
                     {
                         asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left");
                         asposeWordApp.Writeln(this.Option(asposeWordApp, examQuestion.option, examQuestion.ascount, examQuestion.optionlist), 12.0, false, "left");
                     }
                 }
                 else if (examQuestion.type == 3)
                 {
                     if (this.papertype == 1)
                     {
                         asposeWordApp.Writeln((string.Concat(new object[]
                         {
                             num2,
                             "、",
                             examQuestion.title,
                             "  (",
                             examQuestion.answer
                         }) == "Y") ? "正确" : "错误)", 12.0, false, "left");
                         if (examQuestion.explain != "")
                         {
                             asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left");
                         }
                     }
                     else
                     {
                         asposeWordApp.Writeln(string.Concat(new object[]
                         {
                             num2,
                             "、",
                             examQuestion.title,
                             "  (    )"
                         }), 12.0, false, "left");
                     }
                 }
                 else if (examQuestion.type == 4)
                 {
                     if (this.papertype == 1)
                     {
                         asposeWordApp.Writeln(num2 + "、" + this.FmAnswer(examQuestion.title), 12.0, false, "left");
                         asposeWordApp.Writeln("答案:" + examQuestion.answer, 12.0, false, "left");
                         if (examQuestion.explain != "")
                         {
                             asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left");
                         }
                     }
                     else
                     {
                         asposeWordApp.Writeln(num2 + "、" + this.FmAnswer(examQuestion.title), 12.0, false, "left");
                     }
                 }
                 else if (examQuestion.type == 5)
                 {
                     if (this.papertype == 1)
                     {
                         asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left");
                         asposeWordApp.Writeln("答:" + examQuestion.answer, 12.0, false, "left");
                         if (examQuestion.explain != "")
                         {
                             asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left");
                         }
                     }
                     else
                     {
                         asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left");
                         asposeWordApp.InsertLineBreak(6);
                     }
                 }
                 else if (examQuestion.type == 6)
                 {
                     asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left");
                 }
                 num2++;
             }
         }
         if (this.papertype == 0)
         {
             asposeWordApp.InsertPagebreak();
             asposeWordApp.Writeln("参考答案", 12.0, true, "center");
             num2 = 1;
             foreach (ExamTopic examTopic in this.examtopiclist)
             {
                 asposeWordApp.InsertLineBreak();
                 asposeWordApp.Writeln(examTopic.title, 12.0, true, "left");
                 foreach (ExamQuestion examQuestion in this.GetQuestionList(examTopic.questionlist))
                 {
                     if (examQuestion.type == 3)
                     {
                         asposeWordApp.Write((num2 + "、" + examQuestion.answer == "Y") ? "正确" : "错误  ", 12.0, false, "left");
                     }
                     else if (examQuestion.type == 6)
                     {
                         asposeWordApp.Write(num2 + "、请按题目打字  ", 12.0, false, "left");
                     }
                     else
                     {
                         asposeWordApp.Write(string.Concat(new object[]
                         {
                             num2,
                             "、",
                             examQuestion.answer,
                             "  "
                         }), 12.0, false, "left");
                     }
                     num2++;
                 }
             }
         }
         asposeWordApp.Save(base.Response, this.examinfo.name + this.GetPaper(this.paper) + ".doc");
     }
 }
Пример #3
0
 // 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();
     }
 }
Пример #4
0
 // Token: 0x060000C8 RID: 200 RVA: 0x0001373C File Offset: 0x0001193C
 protected override void View()
 {
     base.Response.Expires      = 0;
     base.Response.CacheControl = "no-cache";
     base.Response.Cache.SetNoStore();
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
     else
     {
         this.examinfo = DbHelper.ExecuteModel <ExamInfo>(this.examid);
         if (this.examinfo.id == 0)
         {
             this.ShowErr("对不起,该考试不存在或已被删除。");
         }
         else
         {
             if (this.examinfo.status == 0)
             {
                 if (!this.isperm && this.examinfo.uid != this.userid)
                 {
                     this.ShowErr("对不起,该考试已关闭。");
                     return;
                 }
             }
             this.sortid   = this.examinfo.sortid;
             this.sortinfo = SortBll.GetSortInfo(this.sortid);
             if (this.sortinfo.id == 0)
             {
                 SqlParam sqlParam = DbHelper.MakeAndWhere("sortid", this.sortid);
                 DbHelper.ExecuteDelete <ExamInfo>(new SqlParam[]
                 {
                     sqlParam
                 });
                 this.ShowErr("对不起,考试栏目不存在或已被删除。");
             }
             else if (this.ispost)
             {
                 if (this.examinfo.examroles != "")
                 {
                     if (!base.ischecked(this.roleid, this.examinfo.examroles) && !this.isperm)
                     {
                         this.ShowErr("对不起,您所在的角色不允许参加本场考试。");
                         return;
                     }
                 }
                 if (this.examinfo.examdeparts != "")
                 {
                     if (!base.ischecked(this.user.departid, this.examinfo.examdeparts) && !this.isperm)
                     {
                         this.ShowErr("对不起,您所在的部门不允许参加本场考试。");
                         return;
                     }
                 }
                 if (this.examinfo.examuser != "")
                 {
                     if (!base.ischecked(this.userid, this.examinfo.examuser) && !this.isperm)
                     {
                         this.ShowErr("对不起,您不允许参加本场考试。");
                         return;
                     }
                 }
                 if (this.examinfo.islimit == 1)
                 {
                     if (this.examinfo.starttime > DateTime.Now)
                     {
                         this.ShowErr("对不起,本场考试尚未到考试时间。");
                         return;
                     }
                     if (this.examinfo.endtime < DateTime.Now)
                     {
                         this.ShowErr("对不起,本场考试已超过考试期限。");
                         return;
                     }
                 }
                 SqlParam[] sqlparams = new SqlParam[]
                 {
                     DbHelper.MakeAndWhere("examid", this.examid),
                     DbHelper.MakeAndWhere("uid", this.userid),
                     DbHelper.MakeAndWhere("status", 0)
                 };
                 int num = DbHelper.ExecuteCount <ExamResult>(sqlparams);
                 if (num > 0)
                 {
                     this.ShowErr("对不起,本场考试您已经考过但尚未完成,请到考试历史那里查找。");
                 }
                 else
                 {
                     if (this.examinfo.repeats > 0)
                     {
                         SqlParam[] sqlparams2 = new SqlParam[]
                         {
                             DbHelper.MakeAndWhere("examid", this.examid),
                             DbHelper.MakeAndWhere("uid", this.userid),
                             DbHelper.MakeAndWhere("status", WhereType.GreaterThanEqual, 1)
                         };
                         num = DbHelper.ExecuteCount <ExamResult>(sqlparams2);
                         if (num >= this.examinfo.repeats)
                         {
                             this.ShowErr("对不起,本场考试限制次数为" + this.examinfo.repeats + "次,您已考完不能再考。");
                             return;
                         }
                     }
                     if (this.examinfo.credits > 0 && !this.isperm && this.examinfo.uid != this.userid)
                     {
                         if (this.user.credits < this.examinfo.credits)
                         {
                             this.ShowErr("对不起,您的积分余额不足,不能参加本场考试。");
                             return;
                         }
                         UserBll.UpdateUserCredit(this.userid, "参加考试", 0, this.examinfo.credits * -1);
                     }
                     Random           random        = new Random();
                     int              paper         = random.Next(this.examinfo.papers) + 1;
                     List <ExamTopic> examTopicList = ExamBll.GetExamTopicList(this.examid, paper);
                     int              num2          = 0;
                     for (int i = 0; i < examTopicList.Count; i++)
                     {
                         examTopicList[i].questionlist = QuestionBll.GetTopicQuestion(this.channelinfo.id, examTopicList[i]);
                         string[] array = FPUtils.SplitString(examTopicList[i].questionlist);
                         if (this.examinfo.display == 0)
                         {
                             examTopicList[i].questionlist = QuestionBll.GetRandom(array, array.Length);
                         }
                         examTopicList[i].optionlist = "";
                         foreach (ExamQuestion examQuestion in QuestionBll.GetQuestionList(examTopicList[i].questionlist))
                         {
                             if (examTopicList[i].optionlist != "")
                             {
                                 ExamTopic examTopic = examTopicList[i];
                                 examTopic.optionlist += "|";
                             }
                             if (examQuestion.type == 1 || examQuestion.type == 2)
                             {
                                 ExamTopic examTopic2 = examTopicList[i];
                                 examTopic2.optionlist += this.OptionInt(examQuestion.ascount, this.examinfo.optiondisplay);
                             }
                             else
                             {
                                 ExamTopic examTopic3 = examTopicList[i];
                                 examTopic3.optionlist += "*";
                             }
                         }
                         num2 += array.Length;
                         examTopicList[i].questions = array.Length;
                     }
                     ExamResult examResult = new ExamResult();
                     examResult.uid         = this.userid;
                     examResult.examid      = this.examid;
                     examResult.channelid   = this.channelinfo.id;
                     examResult.sortid      = this.examinfo.sortid;
                     examResult.examtype    = this.examinfo.examtype;
                     examResult.showanswer  = this.examinfo.showanswer;
                     examResult.allowdelete = this.examinfo.allowdelete;
                     examResult.examname    = this.examinfo.name;
                     examResult.examtime    = this.examinfo.examtime;
                     examResult.total       = this.examinfo.total;
                     examResult.passmark    = this.examinfo.passmark;
                     examResult.credits     = this.examinfo.credits;
                     examResult.questions   = num2;
                     examResult.islimit     = this.examinfo.islimit;
                     if (examResult.islimit == 1)
                     {
                         examResult.starttime = this.examinfo.starttime;
                         examResult.endtime   = this.examinfo.endtime;
                     }
                     else
                     {
                         examResult.starttime = DbUtils.GetDateTime();
                         examResult.endtime   = examResult.starttime.AddMinutes((double)this.examinfo.examtime);
                     }
                     examResult.examdatetime = DbUtils.GetDateTime();
                     examResult.status       = 0;
                     examResult.paper        = paper;
                     examResult.ip           = this.ip;
                     examResult.mac          = ExamConifgs.GetMacAddress(this.ip);
                     examResult.id           = DbHelper.ExecuteInsert <ExamResult>(examResult);
                     if (examResult.id > 0)
                     {
                         foreach (ExamTopic examTopic4 in examTopicList)
                         {
                             DbHelper.ExecuteInsert <ExamResultTopic>(new ExamResultTopic
                             {
                                 resultid     = examResult.id,
                                 type         = examTopic4.type,
                                 title        = examTopic4.title,
                                 perscore     = examTopic4.perscore,
                                 display      = examTopic4.display,
                                 questions    = examTopic4.questions,
                                 questionlist = examTopic4.questionlist,
                                 optionlist   = examTopic4.optionlist
                             });
                         }
                         if (this.examinfo.examdeparts == "" && this.examinfo.examuser == "" && this.examinfo.examroles == "")
                         {
                             string text = string.Format("UPDATE [{0}Exam_ExamInfo] SET [exams]=[exams]+1 WHERE [id]={1}", DbConfigs.Prefix, this.examid);
                             DbHelper.ExecuteSql(text.ToString());
                         }
                     }
                     base.Response.Redirect("exam.aspx?resultid=" + examResult.id);
                 }
             }
         }
     }
 }