Example #1
0
 // Token: 0x0600009D RID: 157 RVA: 0x0000EF1C File Offset: 0x0000D11C
 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);
         this.channelid   = this._examinfo.channelid;
         this.channelinfo = ChannelBll.GetChannelInfo(this.channelid);
         if (this.channelinfo.id == 0)
         {
             this.ShowErr("对不起,该试题题库不存在或已被删除。");
         }
         else
         {
             this._examinfo.views++;
             SqlParam[] sqlparams = new SqlParam[]
             {
                 DbHelper.MakeSet("views", this._examinfo.views),
                 DbHelper.MakeAndWhere("id", this._examinfo.id)
             };
             DbHelper.ExecuteUpdate <ExamInfo>(sqlparams);
         }
     }
 }
Example #2
0
        // Token: 0x06000059 RID: 89 RVA: 0x00009654 File Offset: 0x00007854
        protected override void View()
        {
            this.channelinfo  = ChannelBll.GetChannelInfo("exam_question");
            this.examtopic    = DbHelper.ExecuteModel <ExamTopic>(this.examtopicid);
            this.examinfo     = DbHelper.ExecuteModel <ExamInfo>(this.examtopic.examid);
            this.examsortinfo = SortBll.GetSortInfo(this.examinfo.sortid);
            List <SqlParam> list = new List <SqlParam>();

            list.Add(DbHelper.MakeAndWhere("channelid", this.channelinfo.id));
            list.Add(DbHelper.MakeAndWhere("type", this.examtopic.type));
            if (this.sortid > 0)
            {
                SortInfo sortInfo   = SortBll.GetSortInfo(this.sortid);
                string   childSorts = SortBll.GetChildSorts(sortInfo);
                list.Add(DbHelper.MakeAndWhere("sortid", WhereType.In, childSorts));
            }
            if (this.select > 0)
            {
                list.Add(DbHelper.MakeAndWhere("id", WhereType.In, this.examtopic.questionlist));
            }
            if (this.keyword != "")
            {
                list.Add(DbHelper.MakeAndWhere("title", WhereType.Like, this.keyword));
            }
            this.questionlist = DbHelper.ExecuteList <ExamQuestion>(this.pager, list.ToArray());
        }
Example #3
0
 // Token: 0x060000D4 RID: 212 RVA: 0x0001522C File Offset: 0x0001342C
 protected override void View()
 {
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
 }
Example #4
0
 // Token: 0x0600007F RID: 127 RVA: 0x0000CD04 File Offset: 0x0000AF04
 protected override void View()
 {
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     this.examtopic   = DbHelper.ExecuteModel <ExamTopic>(this.examtopicid);
     this.examinfo    = DbHelper.ExecuteModel <ExamInfo>(this.examtopic.examid);
     this.sortinfo    = SortBll.GetSortInfo(this.examinfo.sortid);
     this.zNodes      = this.GetSortTree(this.channelinfo.id, 0);
     base.SaveRightURL();
 }
Example #5
0
 // Token: 0x0600009B RID: 155 RVA: 0x0000EE9C File Offset: 0x0000D09C
 protected override void View()
 {
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
     else
     {
         this.examresultlist = ExamBll.GetExamResultList(this.channelinfo.id, this.userid);
     }
 }
Example #6
0
 // Token: 0x060000CE RID: 206 RVA: 0x0001462C File Offset: 0x0001282C
 protected override void View()
 {
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
     else
     {
         string commandText = string.Format("SELECT SUM([curfavs]) AS [total] FROM [{0}Exam_ExamLogInfo] WHERE [channelid]={1} AND [uid]={2}", DbConfigs.Prefix, this.channelinfo.id, this.userid);
         this.total       = FPUtils.StrToInt(DbHelper.ExecuteScalar(commandText));
         this.userexamlog = ExamBll.GetExamLogList(this.channelinfo.id, this.userid);
         List <SortAppInfo> sortAppList = SortBll.GetSortAppList("exam_");
         foreach (SortAppInfo sortAppInfo in sortAppList)
         {
             if (this.sortappidlist != "")
             {
                 this.sortappidlist += ",";
             }
             this.sortappidlist += sortAppInfo.id;
         }
         SqlParam[] sqlparams = new SqlParam[]
         {
             DbHelper.MakeAndWhere("parentid", 0),
             DbHelper.MakeAndWhere("channelid", this.channelinfo.id),
             DbHelper.MakeAndWhere("appid", WhereType.In, this.sortappidlist),
             DbHelper.MakeAndWhere("hidden", 0)
         };
         OrderByParam    orderby = DbHelper.MakeOrderBy("display", OrderBy.ASC);
         List <SortInfo> list    = DbHelper.ExecuteList <SortInfo>(orderby, sqlparams);
         foreach (SortInfo sortInfo in list)
         {
             ExamLogInfo examLogInfo;
             if (this.userexamlog.ContainsKey(sortInfo.id))
             {
                 examLogInfo = this.userexamlog[sortInfo.id];
             }
             else
             {
                 examLogInfo = new ExamLogInfo();
             }
             examLogInfo.sortid    = sortInfo.id;
             examLogInfo.sortname  = sortInfo.name;
             examLogInfo.questions = sortInfo.posts;
             examLogInfo.subcounts = sortInfo.subcounts;
             this.examloglist.Add(examLogInfo);
         }
     }
 }
Example #7
0
 // Token: 0x0600009F RID: 159 RVA: 0x0000F068 File Offset: 0x0000D268
 protected override void View()
 {
     this.channelinfo = ChannelBll.GetChannelInfo(this.channelid);
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("考试频道不存在或已被删除。");
     }
     else
     {
         this.sortlist = SortBll.GetSortList(this.channelid, 0);
         List <SqlParam> list = new List <SqlParam>();
         list.Add(DbHelper.MakeAndWhere("status", 1));
         if (this.channelid > 0)
         {
             list.Add(DbHelper.MakeAndWhere("channelid", this.channelid));
         }
         if (this.sortid > 0)
         {
             string childSorts = SortBll.GetChildSorts(this.sortid);
             list.Add(DbHelper.MakeAndWhere("sortid", WhereType.In, childSorts));
         }
         if (FPUtils.IsNumericArray(this.typeid))
         {
             StringBuilder stringBuilder = new StringBuilder();
             foreach (int num in FPUtils.SplitInt(this.typeid))
             {
                 if (!string.IsNullOrEmpty(stringBuilder.ToString()))
                 {
                     stringBuilder.Append(" OR ");
                 }
                 stringBuilder.AppendFormat("(','+[typelist]+',') LIKE '%,{0},%'", num);
             }
             list.Add(DbHelper.MakeAndWhere("(" + stringBuilder.ToString() + ")", WhereType.Custom, ""));
         }
         list.Add(DbHelper.MakeAndWhere(string.Format("(([examroles]='' AND [examdeparts]='' AND [examuser]='') OR (','+[examroles]+',') LIKE '%,{0},%' OR (','+[examdeparts]+',') LIKE '%,{1},%' OR (','+[examuser]+',') LIKE '%,{2},%')", this.roleid, this.departid, this.userid), WhereType.Custom, ""));
         this._examlist = DbHelper.ExecuteList <ExamInfo>(this.pager, list.ToArray());
         this.pagenav   = this.channelinfo.name;
     }
 }
Example #8
0
 // Token: 0x060000E6 RID: 230 RVA: 0x00016C80 File Offset: 0x00014E80
 protected override void View()
 {
     this.examconfig  = ExamConifgs.GetExamConfig();
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
     else
     {
         List <SortAppInfo> sortAppList = SortBll.GetSortAppList("exam_");
         string             text        = "";
         foreach (SortAppInfo sortAppInfo in sortAppList)
         {
             if (text != "")
             {
                 text += ",";
             }
             text += sortAppInfo.id;
         }
         this.zNodes = this.GetSortTree(this.channelinfo.id, 0, text);
     }
 }
Example #9
0
        // Token: 0x06000052 RID: 82 RVA: 0x00008B8C File Offset: 0x00006D8C
        protected override void View()
        {
            this.examtopic   = DbHelper.ExecuteModel <ExamTopic>(this.examtopicid);
            this.examinfo    = DbHelper.ExecuteModel <ExamInfo>(this.examtopic.examid);
            this.sortinfo    = SortBll.GetSortInfo(this.examinfo.sortid);
            this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
            this.channelid   = this.channelinfo.id;
            this.sortlist    = SortBll.GetSortList(this.channelid, 0);
            if (this.ispost)
            {
                string          text     = "";
                string          text2    = "";
                SqlParam        sqlParam = DbHelper.MakeAndWhere("channelid", this.channelid);
                List <SortInfo> list     = DbHelper.ExecuteList <SortInfo>(new SqlParam[]
                {
                    sqlParam
                });
                int num = 0;
                foreach (SortInfo sortInfo in list)
                {
                    int @int = FPRequest.GetInt("randomcount_" + sortInfo.id);
                    if (@int > 0)
                    {
                        if (text != "")
                        {
                            text += ",";
                        }
                        text += sortInfo.id;
                        if (text2 != "")
                        {
                            text2 += ",";
                        }
                        text2 += @int;
                        num   += @int;
                    }
                }
                if (num > this.examtopic.questions - this.examtopic.curquestions)
                {
                    this.ShowErr("设定的随机题数不能大于总随机题数。");
                    return;
                }
                if (this.action == "save")
                {
                    SqlParam[] sqlparams = new SqlParam[]
                    {
                        DbHelper.MakeSet("randomsort", text),
                        DbHelper.MakeSet("randomcount", text2),
                        DbHelper.MakeSet("randoms", num),
                        DbHelper.MakeAndWhere("id", this.examtopicid)
                    };
                    DbHelper.ExecuteUpdate <ExamTopic>(sqlparams);
                    base.AddMsg("随机题设置保存成功!");
                    this.examtopic.randomsort  = text;
                    this.examtopic.randomcount = text2;
                    this.link = string.Concat(new object[]
                    {
                        "examtopicrandom.aspx?examtopicid=",
                        this.examtopicid,
                        "&paper=",
                        this.paper
                    });
                }
                else if (this.action == "create")
                {
                    string text3  = this.examtopic.questionlist;
                    int[]  array  = FPUtils.SplitInt(text);
                    int[]  array2 = FPUtils.SplitInt(text2, ",", array.Length);
                    for (int i = 0; i < array.Length; i++)
                    {
                        if (array2[i] > 0)
                        {
                            string questionRandom = QuestionBll.GetQuestionRandom(this.channelid, array2[i], this.examtopic.type.ToString(), array[i], text3);
                            if (questionRandom != "")
                            {
                                text3 += ((text3 == "") ? questionRandom : ("," + questionRandom));
                            }
                        }
                    }
                    this.examtopic.questionlist = text3;
                    this.examtopic.curquestions = FPUtils.SplitInt(this.examtopic.questionlist).Length;
                    SqlParam[] sqlparams = new SqlParam[]
                    {
                        DbHelper.MakeSet("questionlist", this.examtopic.questionlist),
                        DbHelper.MakeSet("curquestions", this.examtopic.curquestions),
                        DbHelper.MakeSet("randomsort", ""),
                        DbHelper.MakeSet("randomcount", ""),
                        DbHelper.MakeSet("randoms", 0),
                        DbHelper.MakeAndWhere("id", this.examtopicid)
                    };
                    DbHelper.ExecuteUpdate <ExamTopic>(sqlparams);
                    base.AddMsg("生成随机题目成功!");
                    this.link = string.Concat(new object[]
                    {
                        "examtopicmanage.aspx?examid=",
                        this.examtopic.examid,
                        "&paper=",
                        this.paper,
                        "&examtopicid=",
                        this.examtopicid
                    });
                }
            }
            int[] array3 = FPUtils.SplitInt(this.examtopic.randomsort);
            int[] array4 = FPUtils.SplitInt(this.examtopic.randomcount, ",", array3.Length);
            for (int i = 0; i < array3.Length; i++)
            {
                this.randomlist.Add(array3[i], array4[i]);
            }
            SqlParam sqlParam2 = DbHelper.MakeAndWhere("id", WhereType.In, this.examtopic.questionlist);

            this.questionlist = DbHelper.ExecuteList <ExamQuestion>(new SqlParam[]
            {
                sqlParam2
            });
            foreach (ExamQuestion examQuestion in this.questionlist)
            {
                if (this.curlist.ContainsKey(examQuestion.sortid))
                {
                    this.curlist[examQuestion.sortid] = this.curlist[examQuestion.sortid] + 1;
                }
                else
                {
                    this.curlist.Add(examQuestion.sortid, 1);
                }
            }
            base.SaveRightURL();
        }
Example #10
0
 // Token: 0x060000BD RID: 189 RVA: 0x00012850 File Offset: 0x00010A50
 protected override void View()
 {
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
     else
     {
         string sqlstring = string.Format("SELECT COUNT([uid]) FROM (SELECT DISTINCT [uid] FROM [{0}Exam_ExamResult] WHERE [channelid]={1} AND [status]>0) AS TA", DbConfigs.Prefix, this.channelinfo.id);
         this.examusers   = this.GetScalarTotal(sqlstring);
         sqlstring        = string.Format("SELECT AVG([score]) FROM [{0}Exam_ExamResult] WHERE [channelid]={1} AND [uid]={2} AND [status]>0", DbConfigs.Prefix, this.channelinfo.id, this.userid);
         this.avg_my      = this.GetScalarTotal(sqlstring);
         sqlstring        = string.Format("SELECT AVG([score]) FROM [{0}Exam_ExamResult] WHERE [channelid]={1} AND [status]>0", DbConfigs.Prefix, this.channelinfo.id);
         this.avg_total   = this.GetScalarTotal(sqlstring);
         sqlstring        = string.Format("SELECT COUNT(*) FROM (SELECT [uid],AVG([score]) AS [scoreavg] FROM [{0}Exam_ExamResult] WHERE [channelid]={1} AND [status]>0 GROUP BY [uid]) AS TA WHERE [scoreavg]>{2}", DbConfigs.Prefix, this.channelinfo.id, this.avg_my);
         this.avg_display = FPUtils.StrToInt(this.GetScalarTotal(sqlstring)) + 1;
         sqlstring        = string.Format("SELECT SUM([answers]) AS [answers],SUM([wrongs]) AS [wrongs] FROM [{0}Exam_ExamLogInfo] WHERE [channelid]={1}", DbConfigs.Prefix, this.channelinfo.id);
         ExamLogInfo examLogInfo = this.GetExamLogInfo(sqlstring);
         this.accuracy_total   = examLogInfo.accuracy;
         sqlstring             = string.Format("SELECT SUM([answers]) AS [answers],SUM([wrongs]) AS [wrongs] FROM [{0}Exam_ExamLogInfo] WHERE [channelid]={1} AND [uid]={2}", DbConfigs.Prefix, this.channelinfo.id, this.userid);
         examLogInfo           = this.GetExamLogInfo(sqlstring);
         this.accuracy_my      = examLogInfo.accuracy;
         sqlstring             = string.Format("SELECT COUNT(*) FROM (SELECT [uid],SUM(wrongs) AS [wrongs] FROM [{0}Exam_ExamLogInfo] WHERE [channelid]={1} GROUP BY [uid]) AS TA WHERE [wrongs]<{2}", DbConfigs.Prefix, this.channelinfo.id, examLogInfo.wrongs);
         this.accuracy_display = FPUtils.StrToInt(this.GetScalarTotal(sqlstring)) + 1;
         SqlParam[] sqlparams = new SqlParam[]
         {
             DbHelper.MakeAndWhere("channelid", this.channelinfo.id),
             DbHelper.MakeAndWhere("status", WhereType.GreaterThan, 0),
             DbHelper.MakeAndWhere("uid", this.userid)
         };
         List <ExamResult> list = DbHelper.ExecuteList <ExamResult>(OrderBy.ASC, sqlparams);
         int num = 1;
         foreach (ExamResult examResult in list)
         {
             if (this.examresult != "")
             {
                 this.examresult += ",";
             }
             this.examresult += string.Format("['', {0}]", examResult.score);
             num++;
         }
         this.userexamlog = ExamBll.GetExamLogList(this.channelinfo.id, this.userid);
         List <SortAppInfo> sortAppList = SortBll.GetSortAppList("exam_");
         foreach (SortAppInfo sortAppInfo in sortAppList)
         {
             if (this.sortappidlist != "")
             {
                 this.sortappidlist += ",";
             }
             this.sortappidlist += sortAppInfo.id;
         }
         SqlParam[] sqlparams2 = new SqlParam[]
         {
             DbHelper.MakeAndWhere("parentid", 0),
             DbHelper.MakeAndWhere("channelid", this.channelinfo.id),
             DbHelper.MakeAndWhere("appid", WhereType.In, this.sortappidlist),
             DbHelper.MakeAndWhere("hidden", 0)
         };
         OrderByParam    orderby = DbHelper.MakeOrderBy("display", OrderBy.ASC);
         List <SortInfo> list2   = DbHelper.ExecuteList <SortInfo>(orderby, sqlparams2);
         foreach (SortInfo sortInfo in list2)
         {
             if (this.userexamlog.ContainsKey(sortInfo.id))
             {
                 examLogInfo = this.userexamlog[sortInfo.id];
             }
             else
             {
                 examLogInfo = new ExamLogInfo();
             }
             examLogInfo.sortid    = sortInfo.id;
             examLogInfo.sortname  = sortInfo.name;
             examLogInfo.questions = sortInfo.posts;
             examLogInfo.subcounts = sortInfo.subcounts;
             this.examloglist.Add(examLogInfo);
         }
     }
 }
Example #11
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");
     }
 }
Example #12
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);
                 }
             }
         }
     }
 }
Example #13
0
 // 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);
             }
         }
     }
 }
Example #14
0
 // Token: 0x06000039 RID: 57 RVA: 0x00005364 File Offset: 0x00003564
 protected override void View()
 {
     this.examconfiginfo = ExamConifgs.GetExamConfig();
     if (this.ispost)
     {
         if (this.action == "save")
         {
             this.examconfiginfo.showanswer = 0;
             this.examconfiginfo            = FPRequest.GetModel <ExamConfig>(this.examconfiginfo);
             if (this.examconfiginfo.testcount == 0)
             {
                 this.examconfiginfo.testcount = 80;
             }
             if (this.examconfiginfo.testtime == 0)
             {
                 this.examconfiginfo.testtime = 60;
             }
             ExamConifgs.SaveConfig(this.examconfiginfo);
             base.AddMsg("考试配置保存成功。");
         }
         else if (this.action == "reset" || this.action == "clear")
         {
             ChannelInfo channelInfo = new ChannelInfo();
             channelInfo = ChannelBll.GetChannelInfo("exam_question");
             if (channelInfo.id > 0)
             {
                 SortAppInfo sortAppInfo = SortBll.GetSortAppInfo("exam_question");
                 if (sortAppInfo.id > 0)
                 {
                     SqlParam        sqlParam = DbHelper.MakeAndWhere("appid", sortAppInfo.id);
                     List <SortInfo> sortlist = DbHelper.ExecuteList <SortInfo>(new SqlParam[]
                     {
                         sqlParam
                     });
                     SortBll.ResetSortPosts <ExamQuestion>(sortlist);
                     sqlParam = DbHelper.MakeAndWhere("type", WhereType.In, "1,2");
                     List <ExamQuestion> list = DbHelper.ExecuteList <ExamQuestion>(new SqlParam[]
                     {
                         sqlParam
                     });
                     for (int i = 0; i < list.Count; i++)
                     {
                         string text = "";
                         int    num  = 0;
                         foreach (string text2 in FPUtils.SplitString(list[i].content, "§"))
                         {
                             if (text2 != "")
                             {
                                 if (text != "")
                                 {
                                     text += "§";
                                 }
                                 text += text2;
                                 num++;
                             }
                         }
                         list[i].content = text;
                         list[i].ascount = num;
                         DbHelper.ExecuteUpdate <ExamQuestion>(list[i]);
                     }
                     base.AddMsg("题库统计重置成功。");
                 }
             }
         }
         else if (this.action == "clear")
         {
             DbHelper.ExecuteDelete <ExamQuestion>(new SqlParam[0]);
             SortAppInfo sortAppInfo = SortBll.GetSortAppInfo("exam_question");
             if (sortAppInfo.id > 0)
             {
                 SqlParam        sqlParam = DbHelper.MakeAndWhere("appid", sortAppInfo.id);
                 List <SortInfo> sortlist = DbHelper.ExecuteList <SortInfo>(new SqlParam[]
                 {
                     sqlParam
                 });
                 SortBll.ResetSortPosts <ExamQuestion>(sortlist);
             }
             base.AddMsg("题库清空成功。");
         }
     }
 }
Example #15
0
 // Token: 0x060000DE RID: 222 RVA: 0x00015D6C File Offset: 0x00013F6C
 protected override void View()
 {
     this.examconfig = ExamConifgs.GetExamConfig();
     if (this.examconfig.teststatus == 0)
     {
         this.ShowErr("对不起,考试系统已关闭了用户练习。");
     }
     else
     {
         this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
         if (this.channelinfo.id == 0)
         {
             this.ShowErr("对不起,目前系统尚未创建题目库频道。");
         }
         else
         {
             this.starttime = DbUtils.GetDateTime();
             if (this.limit == 0)
             {
                 this.limit = 50;
             }
             if (this.limit < 5)
             {
                 this.ShowErr("为了更能准确体现您的能力,每次练习题目不能少于5题。");
             }
             else if (this.limit > this.examconfig.testcount)
             {
                 this.ShowErr("对不起,每次练习题目数不得超过" + this.examconfig.testcount + "题。");
             }
             else
             {
                 string questionRandom = QuestionBll.GetQuestionRandom(this.channelinfo.id, this.limit, this.type, this.sidlist);
                 if (questionRandom != "")
                 {
                     SqlParam     sqlParam = DbHelper.MakeAndWhere("id", WhereType.In, questionRandom);
                     OrderByParam orderby  = DbHelper.MakeOrderBy("type", OrderBy.ASC);
                     this.questionlist = DbHelper.ExecuteList <ExamQuestion>(orderby, new SqlParam[]
                     {
                         sqlParam
                     });
                     foreach (ExamQuestion examQuestion in this.questionlist)
                     {
                         if (this.qidlist != "")
                         {
                             this.qidlist += ",";
                         }
                         this.qidlist += examQuestion.id;
                     }
                     int num  = this.examconfig.testtime * 60;
                     int num2 = num / 3600;
                     int num3 = (num - num2 * 3600) / 60;
                     int num4 = (num - num2 * 3600 - num3 * 60) % 60;
                     this.thetime = string.Concat(new string[]
                     {
                         num2.ToString("00"),
                         ":",
                         num3.ToString("00"),
                         ":",
                         num4.ToString("00")
                     });
                 }
                 else
                 {
                     this.ShowErr("对不起,抽起的题库没有题目。");
                 }
             }
         }
     }
 }