Ejemplo n.º 1
0
 // Token: 0x06000078 RID: 120 RVA: 0x0000AAF4 File Offset: 0x00008CF4
 protected override void View()
 {
     this.channellist = ChannelBll.GetChannelList();
     if (this.channelid == 0 && this.channellist.Count > 0)
     {
         this.channelid = this.channellist[0].id;
     }
     if (this.ispost)
     {
         if (!this.isperm)
         {
             this.ShowErr("对不起,您没有权限操作。");
             return;
         }
         int @int = FPRequest.GetInt("id");
         if (this.action.Equals("delete"))
         {
             SortInfo sortInfo = DbHelper.ExecuteModel <SortInfo>(@int);
             if (DbHelper.ExecuteDelete <SortInfo>(@int) > 0)
             {
                 StringBuilder stringBuilder = new StringBuilder();
                 stringBuilder.AppendFormat("DELETE FROM [{0}WMS_SortInfo] WHERE [id] IN (SELECT [id] FROM [{0}WMS_SortInfo]  WHERE [parentlist] LIKE '{1},%');", DbConfigs.Prefix, sortInfo.parentlist);
                 stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [subcounts]=[subcounts]-1 WHERE [id]={1};", DbConfigs.Prefix, sortInfo.parentid);
                 DbHelper.ExecuteSql(stringBuilder.ToString());
             }
         }
         FPCache.Remove("FP_SORTTREE" + this.channelid.ToString());
         base.Response.Redirect("sortmanage.aspx?channelid=" + this.channelid);
     }
     this.sortlist = SortBll.GetSortList(this.channelid, 0);
     base.SaveRightURL();
 }
Ejemplo n.º 2
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);
         }
     }
 }
Ejemplo n.º 3
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());
        }
Ejemplo n.º 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();
 }
Ejemplo n.º 5
0
        // Token: 0x06000056 RID: 86 RVA: 0x00009518 File Offset: 0x00007718
        protected int GetQuestionCount(int sortid)
        {
            string childSorts = SortBll.GetChildSorts(sortid);

            SqlParam[] sqlparams = new SqlParam[]
            {
                DbHelper.MakeAndWhere("sortid", WhereType.In, childSorts),
                DbHelper.MakeAndWhere("type", this.examtopic.type)
            };
            return(DbHelper.ExecuteCount <ExamQuestion>(sqlparams));
        }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 7
0
 // Token: 0x06000040 RID: 64 RVA: 0x000062DC File Offset: 0x000044DC
 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)
         {
             string a       = FPRequest.GetString("action").ToLower();
             string @string = FPRequest.GetString("chkid");
             if (a == "delete")
             {
                 if (DbHelper.ExecuteDelete <ExamResult>(@string) > 0)
                 {
                     SqlParam sqlParam = DbHelper.MakeAndWhere("resultid", WhereType.In, @string);
                     DbHelper.ExecuteDelete <ExamResultTopic>(new SqlParam[]
                     {
                         sqlParam
                     });
                 }
             }
             else if (a == "change")
             {
                 SqlParam[] sqlparams = new SqlParam[]
                 {
                     DbHelper.MakeSet("ip", ""),
                     DbHelper.MakeSet("mac", ""),
                     DbHelper.MakeAndWhere("id", WhereType.In, @string)
                 };
                 DbHelper.ExecuteUpdate <ExamResult>(sqlparams);
             }
         }
         SqlParam[] sqlparams2 = new SqlParam[]
         {
             DbHelper.MakeAndWhere("examid", this.examid),
             DbHelper.MakeAndWhere("status", 0)
         };
         OrderByParam orderby = DbHelper.MakeOrderBy("id", OrderBy.DESC);
         this.examresultlist = DbHelper.ExecuteList <ExamResult>(orderby, sqlparams2);
         base.SaveRightURL();
     }
 }
Ejemplo n.º 8
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;
     }
 }
Ejemplo n.º 9
0
        // Token: 0x0600007C RID: 124 RVA: 0x0000C9F0 File Offset: 0x0000ABF0
        protected override void View()
        {
            this.sortinfo = SortBll.GetSortInfo(this.sortid);
            if (this.ispost)
            {
                if (this.targetid == 0)
                {
                    this.ShowErr("对不起,您没有选择移动至目标题库。");
                    return;
                }
                SqlParam[] sqlparams = new SqlParam[]
                {
                    DbHelper.MakeSet("sortid", this.targetid),
                    DbHelper.MakeAndWhere("id", WhereType.In, this.idlist)
                };
                DbHelper.ExecuteUpdate <ExamQuestion>(sqlparams);
                SortBll.UpdateSortPosts(this.sortid, -1);
                SortBll.UpdateSortPosts(this.targetid, 1);
                base.Response.Redirect(string.Concat(new object[]
                {
                    "questionmanage.aspx?channelid=",
                    this.channelid,
                    "&sortid=",
                    this.sortid,
                    "&pageindex=",
                    this.pageindex
                }));
            }
            SqlParam[] sqlparams2 = new SqlParam[]
            {
                DbHelper.MakeAndWhere("parentid", 0),
                DbHelper.MakeAndWhere("channelid", this.channelid),
                DbHelper.MakeAndWhere("id", WhereType.NotEqual, this.sortid)
            };
            OrderByParam orderby = DbHelper.MakeOrderBy("display", OrderBy.ASC);

            this.sortlist = DbHelper.ExecuteList <SortInfo>(orderby, sqlparams2);
        }
Ejemplo n.º 10
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);
     }
 }
Ejemplo n.º 11
0
        // Token: 0x06000031 RID: 49 RVA: 0x00003F4C File Offset: 0x0000214C
        public static string GetQuestionRandom(int channelid, int count, string type, int sortid, string qidlist)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("SELECT [id] FROM [{0}Exam_ExamQuestion] WHERE [status]=1", DbConfigs.Prefix);
            if (channelid > 0)
            {
                stringBuilder.AppendFormat(" AND [channelid]={0}", channelid);
            }
            if (type != "")
            {
                stringBuilder.AppendFormat(" AND [type] IN({0})", type);
            }
            if (sortid > 0)
            {
                SortInfo sortInfo   = SortBll.GetSortInfo(sortid);
                string   childSorts = SortBll.GetChildSorts(sortInfo);
                stringBuilder.AppendFormat(" AND [sortid] IN({0})", childSorts);
            }
            if (qidlist != "")
            {
                stringBuilder.AppendFormat(" AND [id] NOT IN({0})", qidlist);
            }
            IDataReader dataReader = DbHelper.ExecuteReader(CommandType.Text, stringBuilder.ToString());
            string      text       = "";

            while (dataReader.Read())
            {
                if (text != "")
                {
                    text += ",";
                }
                text += dataReader["id"].ToString();
            }
            dataReader.Close();
            return(QuestionBll.GetRandom(FPUtils.SplitString(text), count));
        }
Ejemplo n.º 12
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();
     }
 }
Ejemplo n.º 13
0
        // Token: 0x0600006D RID: 109 RVA: 0x00009C14 File Offset: 0x00007E14
        protected override void View()
        {
            if (this.id > 0)
            {
                this.sortinfo  = DbHelper.ExecuteModel <SortInfo>(this.id);
                this.parentid  = this.sortinfo.parentid;
                this.channelid = this.sortinfo.channelid;
                this.appid     = this.sortinfo.appid;
            }
            else
            {
                SortInfo sortInfo = SortBll.GetSortInfo(this.parentid);
                this.appid = sortInfo.appid;
            }
            if (this.ispost)
            {
                this.sortinfo.hidden = 0;
                this.sortinfo.types  = "";
                this.sortinfo        = FPRequest.GetModel <SortInfo>(this.sortinfo);
                if (this.sortinfo.channelid == 0)
                {
                    this.ShowErr("请选择栏目频道。");
                    return;
                }
                if (this.sortinfo.name == "")
                {
                    this.ShowErr("栏目名称不能为空。");
                    return;
                }
                if (this.isfile)
                {
                    HttpPostedFile postedFile = FPRequest.Files["uploadimg"];
                    UpLoad         upLoad     = new UpLoad();
                    string         json       = upLoad.FileSaveAs(postedFile, "image", this.user, false, false, 16, 16);
                    JsonData       jsonData   = JsonMapper.ToObject(json);
                    if (jsonData["error"].ToString() == "")
                    {
                        if (this.sortinfo.icon != "")
                        {
                            if (File.Exists(FPUtils.GetMapPath(this.sortinfo.icon)))
                            {
                                File.Delete(FPUtils.GetMapPath(this.sortinfo.icon));
                            }
                        }
                        this.sortinfo.icon = jsonData["filename"].ToString();
                    }
                }
                string   text      = "0";
                SortInfo sortInfo2 = new SortInfo();
                if (this.sortinfo.id > 0)
                {
                    if (DbHelper.ExecuteUpdate <SortInfo>(this.sortinfo) > 0)
                    {
                        if (this.sortinfo.parentid != this.parentid)
                        {
                            text = this.sortinfo.parentlist;
                            if (this.sortinfo.parentid > 0)
                            {
                                sortInfo2 = DbHelper.ExecuteModel <SortInfo>(this.sortinfo.parentid);
                                this.sortinfo.parentlist = sortInfo2.parentlist + "," + this.sortinfo.id;
                            }
                            else
                            {
                                this.sortinfo.parentlist = "0," + this.sortinfo.id.ToString();
                            }
                            StringBuilder stringBuilder = new StringBuilder();
                            stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [parentlist]='{1}' WHERE [id]={2}|", DbConfigs.Prefix, this.sortinfo.parentlist, this.sortinfo.id);
                            if (DbConfigs.DbType == DbType.Access)
                            {
                                stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [parentlist] =REPLACE([parentlist], '{1}', '{2}', 1, 1) WHERE [id] IN (SELECT [id] FROM [{0}WMS_SortInfo]  WHERE [parentlist] LIKE '{3},%')|", new object[]
                                {
                                    DbConfigs.Prefix,
                                    text,
                                    this.sortinfo.parentlist,
                                    text
                                });
                            }
                            else
                            {
                                stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [parentlist] =STUFF([parentlist],1,{1},'{2}') WHERE [id] IN (SELECT [id] FROM [{0}WMS_SortInfo]  WHERE [parentlist] LIKE '{3},%')|", new object[]
                                {
                                    DbConfigs.Prefix,
                                    text.Length,
                                    this.sortinfo.parentlist,
                                    text
                                });
                            }
                            stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [subcounts]=[subcounts]-1 WHERE [id]={1}|", DbConfigs.Prefix, this.parentid);
                            stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [subcounts]=[subcounts]+1 WHERE [id]={1}", DbConfigs.Prefix, this.sortinfo.parentid);
                            DbHelper.ExecuteSql(stringBuilder.ToString());
                        }
                        if (this.sortinfo.channelid != this.channelid && this.parentid == 0)
                        {
                            string sqlstring = string.Format("UPDATE [{0}WMS_SortInfo] SET [channelid]={1} WHERE [id] IN (SELECT [id] FROM [{0}WMS_SortInfo]  WHERE [parentlist] LIKE '{2},%')", DbConfigs.Prefix, this.sortinfo.channelid, this.sortinfo.parentlist);
                            DbHelper.ExecuteSql(sqlstring);
                        }
                    }
                    base.AddMsg("更新栏目成功!");
                }
                else
                {
                    SqlParam[] sqlparams = new SqlParam[]
                    {
                        DbHelper.MakeAndWhere("parentid", this.parentid),
                        DbHelper.MakeAndWhere("channelid", this.channelid)
                    };
                    this.sortinfo.display = FPUtils.StrToInt(DbHelper.ExecuteMax <SortInfo>("display", sqlparams).ToString()) + 1;
                    this.id = DbHelper.ExecuteInsert <SortInfo>(this.sortinfo);
                    if (this.id > 0)
                    {
                        if (this.sortinfo.parentid > 0)
                        {
                            sortInfo2 = DbHelper.ExecuteModel <SortInfo>(this.sortinfo.parentid);
                            text      = sortInfo2.parentlist + "," + this.id;
                        }
                        else
                        {
                            text = text + "," + this.id;
                        }
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [parentlist]='{1}' WHERE [id]={2}|", DbConfigs.Prefix, text, this.id);
                        stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [subcounts]=[subcounts]+1 WHERE [id]={1}", DbConfigs.Prefix, this.sortinfo.parentid);
                        DbHelper.ExecuteSql(stringBuilder.ToString());
                    }
                    base.AddMsg("添加栏目成功!");
                }
                FPCache.Remove("FP_SORTTREE" + this.sortinfo.channelid);
                this.link = "sortmanage.aspx?channelid=" + this.sortinfo.channelid;
            }
            SqlParam[] sqlparams2 = new SqlParam[]
            {
                DbHelper.MakeAndWhere("parentid", 0),
                DbHelper.MakeAndWhere("channelid", this.channelid),
                DbHelper.MakeAndWhere("id", WhereType.NotEqual, this.id)
            };
            OrderByParam orderby = DbHelper.MakeOrderBy("display", OrderBy.ASC);

            this.channellist = DbHelper.ExecuteList <ChannelInfo>(orderby, new SqlParam[0]);
            this.sortlist    = DbHelper.ExecuteList <SortInfo>(orderby, sqlparams2);
            this.sortapplist = DbHelper.ExecuteList <SortAppInfo>(OrderBy.ASC);
            SqlParam sqlParam = DbHelper.MakeAndWhere("parentid", 0);

            this.typelist = DbHelper.ExecuteList <TypeInfo>(orderby, new SqlParam[]
            {
                sqlParam
            });
            base.SaveRightURL();
        }
Ejemplo n.º 14
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();
     }
 }
Ejemplo n.º 15
0
 // Token: 0x0600003B RID: 59 RVA: 0x000056A4 File Offset: 0x000038A4
 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.sortinfo.id == 0)
         {
             this.ShowErr("对不起,该栏目不存在或已被删除。");
         }
         else
         {
             this.expinfo = DbHelper.ExecuteModel <ExpInfo>(this.id);
             if (this.ispost)
             {
                 if (this.action == "add")
                 {
                     this.expinfo        = FPRequest.GetModel <ExpInfo>(this.expinfo);
                     this.expinfo.examid = this.examid;
                     DbHelper.ExecuteInsert <ExpInfo>(this.expinfo);
                 }
                 else if (this.action == "default")
                 {
                     ExpInfo expInfo = new ExpInfo();
                     expInfo.examid     = this.examid;
                     expInfo.scorelower = 0;
                     expInfo.scoreupper = 60;
                     expInfo.exp        = 0;
                     expInfo.comment    = "您的成绩不及格,加油哦";
                     DbHelper.ExecuteInsert <ExpInfo>(expInfo);
                     expInfo.scorelower = 60;
                     expInfo.scoreupper = 70;
                     expInfo.exp        = 1;
                     expInfo.comment    = "您的成绩免强及格,仍需努力哦";
                     DbHelper.ExecuteInsert <ExpInfo>(expInfo);
                     expInfo.scorelower = 70;
                     expInfo.scoreupper = 80;
                     expInfo.exp        = 2;
                     expInfo.comment    = "您的成绩中等水平,努力更上一台价";
                     DbHelper.ExecuteInsert <ExpInfo>(expInfo);
                     expInfo.scorelower = 80;
                     expInfo.scoreupper = 90;
                     expInfo.exp        = 3;
                     expInfo.comment    = "您的成绩中上水平,努力保持";
                     DbHelper.ExecuteInsert <ExpInfo>(expInfo);
                     expInfo.scorelower = 90;
                     expInfo.scoreupper = 100;
                     expInfo.exp        = 4;
                     expInfo.comment    = "您的成绩不错,不要骄傲";
                     DbHelper.ExecuteInsert <ExpInfo>(expInfo);
                 }
                 else if (this.action == "update")
                 {
                     this.expinfo = FPRequest.GetModel <ExpInfo>(this.expinfo, "exp_");
                     DbHelper.ExecuteUpdate <ExpInfo>(this.expinfo);
                 }
                 else if (this.action == "delete")
                 {
                     DbHelper.ExecuteDelete <ExpInfo>(FPRequest.GetString("eid"));
                 }
                 base.Response.Redirect(this.pagename + "?examid=" + this.examid);
             }
             SqlParam sqlParam = DbHelper.MakeAndWhere("examid", this.examid);
             this.explist = DbHelper.ExecuteList <ExpInfo>(OrderBy.ASC, new SqlParam[]
             {
                 sqlParam
             });
             base.SaveRightURL();
         }
     }
 }
Ejemplo n.º 16
0
 // Token: 0x06000069 RID: 105 RVA: 0x0000AB4C File Offset: 0x00008D4C
 protected override void View()
 {
     this.examconfig = ExamConifgs.GetExamConfig();
     if (this.id > 0)
     {
         this.questioninfo = DbHelper.ExecuteModel <ExamQuestion>(this.id);
         this.sortid       = this.questioninfo.sortid;
         this.type         = this.questioninfo.type;
         this.ascount      = this.questioninfo.ascount;
         if (this.type == 1 || this.type == 2 || this.type == 3)
         {
             this.questioninfo.answer = this.questioninfo.answer.ToLower();
         }
     }
     this.sortinfo = SortBll.GetSortInfo(this.sortid);
     if (this.examid > 0 && this.examtopicid > 0)
     {
         this.reurl = string.Concat(new object[]
         {
             "examtopicmanage.aspx?examid=",
             this.examid,
             "&examtopicid=",
             this.examtopicid
         });
     }
     if (this.examid > 0)
     {
         this.reurl = "examtopicmanage.aspx?examid=" + this.examid;
     }
     else if (this.examtopicid > 0)
     {
         this.reurl = "examtopicselect.aspx?examtopicid=" + this.examtopicid;
     }
     else
     {
         this.reurl = string.Concat(new object[]
         {
             "questionmanage.aspx?sortid=",
             this.sortid,
             "&type=",
             this.backtype
         });
     }
     if (this.ispost)
     {
         this.questioninfo.upperflg = 0;
         this.questioninfo.orderflg = 0;
         this.questioninfo.status   = 0;
         this.questioninfo.isclear  = 0;
         this.questioninfo          = FPRequest.GetModel <ExamQuestion>(this.questioninfo);
         if (this.questioninfo.isclear == 1)
         {
             this.questioninfo.title = questionadd.GetTextFromHTML(this.questioninfo.title);
         }
         this.questioninfo.channelid = this.sortinfo.channelid;
         if (this.questioninfo.type == 1 || this.questioninfo.type == 2)
         {
             this.questioninfo.ascount = FPRequest.GetInt("ascount" + this.questioninfo.type);
             this.questioninfo.content = "";
             for (int i = 0; i < this.questioninfo.ascount; i++)
             {
                 if (this.questioninfo.content != "")
                 {
                     ExamQuestion examQuestion = this.questioninfo;
                     examQuestion.content += "§";
                 }
                 if (this.questioninfo.isclear == 1)
                 {
                     ExamQuestion examQuestion2 = this.questioninfo;
                     examQuestion2.content += questionadd.GetTextFromHTML(FPRequest.GetString(string.Concat(new object[]
                     {
                         "option",
                         this.questioninfo.type,
                         "_",
                         i.ToString()
                     })));
                 }
                 else
                 {
                     ExamQuestion examQuestion3 = this.questioninfo;
                     examQuestion3.content += FPRequest.GetString(string.Concat(new object[]
                     {
                         "option",
                         this.questioninfo.type,
                         "_",
                         i.ToString()
                     }));
                 }
             }
         }
         else if (this.questioninfo.type == 3)
         {
             this.questioninfo.ascount = 2;
             this.questioninfo.content = "";
         }
         else if (this.questioninfo.type == 4)
         {
             this.questioninfo.ascount = FPUtils.SplitString(this.questioninfo.answer).Length;
             this.questioninfo.content = "";
         }
         else if (this.questioninfo.type == 5)
         {
             this.questioninfo.ascount = FPUtils.SplitString(this.questioninfo.answerkey).Length;
             this.questioninfo.content = "";
         }
         this.questioninfo.answer = FPRequest.GetString("answer" + this.questioninfo.type);
         if (this.questioninfo.id > 0)
         {
             DbHelper.ExecuteUpdate <ExamQuestion>(this.questioninfo);
             base.AddMsg("更新试题成功!");
         }
         else
         {
             this.questioninfo.uid = this.userid;
             this.questioninfo.id  = DbHelper.ExecuteInsert <ExamQuestion>(this.questioninfo);
             SortBll.UpdateSortPosts(this.questioninfo.sortid, 1);
             if (this.examid > 0)
             {
                 ExamTopic examTopic = DbHelper.ExecuteModel <ExamTopic>(this.examtopicid);
                 if (examTopic.curquestions >= examTopic.questions)
                 {
                     this.ShowErr("该大题题目数已满,不能再添加");
                     return;
                 }
                 examTopic.questionlist = ((examTopic.questionlist == "") ? this.questioninfo.id.ToString() : (examTopic.questionlist + "," + this.questioninfo.id));
                 examTopic.curquestions = FPUtils.SplitInt(examTopic.questionlist).Length;
                 SqlParam[] sqlparams = new SqlParam[]
                 {
                     DbHelper.MakeSet("questionlist", examTopic.questionlist),
                     DbHelper.MakeSet("curquestions", examTopic.curquestions),
                     DbHelper.MakeAndWhere("id", this.examtopicid)
                 };
                 DbHelper.ExecuteUpdate <ExamTopic>(sqlparams);
             }
             base.AddMsg("添加试题成功!");
         }
         if (this.action == "continue")
         {
             this.link = string.Format("questionadd.aspx?sortid={0}&examid={1}&examtopicid={2}&type={3}", new object[]
             {
                 this.sortid,
                 this.examid,
                 this.examtopicid,
                 this.backtype
             });
         }
         else
         {
             this.link = this.reurl;
         }
         if (File.Exists(FPUtils.GetMapPath(string.Concat(new object[]
         {
             this.webpath,
             "cache/qtxt_",
             this.id,
             ".jpg"
         }))))
         {
             File.Delete(FPUtils.GetMapPath(string.Concat(new object[]
             {
                 this.webpath,
                 "cache/qtxt_",
                 this.id,
                 ".jpg"
             })));
         }
     }
     base.SaveRightURL();
 }
Ejemplo n.º 17
0
 // 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);
                 }
             }
         }
     }
 }
Ejemplo n.º 18
0
 // 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();
     }
 }
Ejemplo n.º 19
0
        // Token: 0x06000079 RID: 121 RVA: 0x0000AC4C File Offset: 0x00008E4C
        protected string ShowChildSort(int parentid, string tree)
        {
            List <SortInfo> sortList      = SortBll.GetSortList(this.channelid, parentid);
            StringBuilder   stringBuilder = new StringBuilder();

            tree = "│  " + tree;
            foreach (SortInfo sortInfo in sortList)
            {
                stringBuilder.AppendLine("<tr class=\"tlist\" onmouseover=\"curcolor=this.style.backgroundColor;this.style.backgroundColor='#cbe3f4'\" onmouseout=\"this.style.backgroundColor=curcolor\">");
                stringBuilder.AppendLine("<td align=\"center\">" + sortInfo.id + "</td>");
                stringBuilder.AppendLine("<td align=\"left\">" + tree);
                string text = "";
                if (sortInfo.hidden == 1)
                {
                    text = "_hidden";
                }
                if (sortInfo.icon == "")
                {
                    if (sortInfo.subcounts > 0)
                    {
                        sortInfo.icon = string.Concat(new string[]
                        {
                            this.webpath,
                            (this.sysconfig.adminpath == "") ? "" : (this.sysconfig.adminpath + "/"),
                            "images/folders",
                            text,
                            ".gif"
                        });
                    }
                    else
                    {
                        sortInfo.icon = string.Concat(new string[]
                        {
                            this.webpath,
                            (this.sysconfig.adminpath == "") ? "" : (this.sysconfig.adminpath + "/"),
                            "images/folder",
                            text,
                            ".gif"
                        });
                    }
                }
                stringBuilder.Append("<img src=\"" + sortInfo.icon + "\" width=\"16\" height=\"16\"  />");
                if (sortInfo.subcounts > 0)
                {
                    stringBuilder.Append("<span style=\"font-weight:bold;\">" + sortInfo.name + "</span></td>");
                }
                else
                {
                    stringBuilder.Append(sortInfo.name + "</td>");
                }
                stringBuilder.AppendLine("<td>" + sortInfo.markup + "</td>");
                if (sortInfo.SortAppInfo.name != "")
                {
                    stringBuilder.AppendLine("<td>" + sortInfo.SortAppInfo.name + "</td>");
                }
                else
                {
                    stringBuilder.AppendLine("<td>无</td>");
                }
                stringBuilder.AppendLine(string.Concat(new object[]
                {
                    "<td><a style=\"color: #1317fc\"  href=\"sortadd.aspx?channelid=",
                    this.channelid,
                    "&parentid=",
                    sortInfo.id,
                    "\">添加子栏目</a></td>"
                }));
                stringBuilder.AppendLine(string.Concat(new object[]
                {
                    "<td><a style=\"color: #1317fc\"  href=\"sortadd.aspx?channelid=",
                    this.channelid,
                    "&id=",
                    sortInfo.id,
                    "\">编辑</a></td>"
                }));
                stringBuilder.AppendLine("<td><a id=\"submitdel\" onclick=\"DeleteSort(" + sortInfo.id + ")\" href=\"#\">删除</a></td>");
                stringBuilder.AppendLine(string.Concat(new object[]
                {
                    "<td><a style=\"color: #1317fc\"  href=\"sortdisplay.aspx?channelid=",
                    this.channelid,
                    "&parentid=",
                    sortInfo.parentid,
                    "\">排序</a></td></tr>"
                }));
                stringBuilder.Append(this.ShowChildSort(sortInfo.id, tree));
            }
            return(stringBuilder.ToString());
        }
Ejemplo n.º 20
0
        // Token: 0x060000B8 RID: 184 RVA: 0x00011E2C File Offset: 0x0001002C
        protected override void View()
        {
            if (this.ispost)
            {
                if (!this.isperm)
                {
                    this.ShowErrMsg("对不起,您没有权限阅卷。");
                    return;
                }
                this.examresult = ExamBll.GetExamResult(this.resultid);
                if (this.examresult.id == 0)
                {
                    this.ShowErrMsg("对不起,该考试不存在或已被删除。");
                    return;
                }
                int status = this.examresult.status;
                this.examresult.status = 2;
                this.examresult.exnote = FPRequest.GetString("exnote");
                if (DbHelper.ExecuteUpdate <ExamResult>(this.examresult) <= 0)
                {
                    this.ShowErrMsg("保存出现错误。");
                    return;
                }
                List <ExamResultTopic> examResultTopicList = ExamBll.GetExamResultTopicList(this.resultid);
                int    num   = 0;
                double score = this.examresult.score;
                this.examresult.score  = 0.0;
                this.examresult.score1 = 0.0;
                this.examresult.score2 = 0.0;
                this.examresult.wrongs = 0;
                foreach (ExamResultTopic examResultTopic in examResultTopicList)
                {
                    if (examResultTopic.questions == 0)
                    {
                        num++;
                    }
                    else
                    {
                        int[]    array  = FPUtils.SplitInt(examResultTopic.questionlist);
                        string[] array2 = FPUtils.SplitString(examResultTopic.answerlist, "§", array.Length);
                        string[] array3 = FPUtils.SplitString(examResultTopic.scorelist, "|", array.Length);
                        examResultTopicList[num].scorelist   = "";
                        examResultTopicList[num].correctlist = "";
                        examResultTopicList[num].score       = 0.0;
                        int num2 = 0;
                        foreach (ExamQuestion examQuestion in QuestionBll.GetQuestionList(examResultTopic.questionlist))
                        {
                            string a = array2[num2];
                            if (examResultTopicList[num].scorelist != "")
                            {
                                ExamResultTopic examResultTopic2 = examResultTopicList[num];
                                examResultTopic2.scorelist += "|";
                            }
                            double num3 = 0.0;
                            if (examQuestion.type == 1 || examQuestion.type == 2)
                            {
                                num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id);
                                this.examresult.score1 += num3;
                            }
                            else if (examQuestion.type == 3)
                            {
                                num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id);
                                this.examresult.score1 += num3;
                            }
                            else if (examQuestion.type == 4)
                            {
                                num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id);
                                this.examresult.score1 += num3;
                            }
                            else if (examQuestion.type == 5)
                            {
                                num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id);
                                this.examresult.score2 += num3;
                            }
                            else if (examQuestion.type == 6)
                            {
                                num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id);
                                this.examresult.score2 += num3;
                            }
                            this.examresult.score          += num3;
                            examResultTopicList[num].score += num3;
                            ExamResultTopic examResultTopic3 = examResultTopicList[num];
                            examResultTopic3.scorelist += num3.ToString();
                            if (examResultTopicList[num].correctlist != "")
                            {
                                ExamResultTopic examResultTopic4 = examResultTopicList[num];
                                examResultTopic4.correctlist += "|";
                            }
                            bool iswrong = false;
                            if (num3 >= examResultTopic.perscore * 0.6)
                            {
                                ExamResultTopic examResultTopic5 = examResultTopicList[num];
                                examResultTopic5.correctlist += "1";
                            }
                            else
                            {
                                ExamResultTopic examResultTopic6 = examResultTopicList[num];
                                examResultTopic6.correctlist += "0";
                                examResultTopicList[num].wrongs++;
                                this.examresult.wrongs++;
                                if (a == "")
                                {
                                    this.examresult.unanswer++;
                                }
                                iswrong = true;
                            }
                            SortInfo sortInfo = SortBll.GetSortInfo(examQuestion.sortid);
                            ExamBll.UpdateExamLog(sortInfo, this.examresult.uid, examQuestion, iswrong);
                            num2++;
                        }
                        DbHelper.ExecuteUpdate <ExamResultTopic>(examResultTopicList[num]);
                        num++;
                    }
                }
                ExpInfo       examExpByScore = ExamBll.GetExamExpByScore(this.examresult.score, this.examresult.examid);
                StringBuilder stringBuilder  = new StringBuilder();
                if (status == 0)
                {
                    stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamResult] SET [score1]={1},[score2]={2},[score]={3},[wrongs]={4},[exp]={5} WHERE [id]={6}|", new object[]
                    {
                        DbConfigs.Prefix,
                        this.examresult.score1,
                        this.examresult.score2,
                        this.examresult.score,
                        this.examresult.wrongs,
                        examExpByScore.exp,
                        this.examresult.id
                    });
                    stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [exams]=[exams]+1,[score]=[score]+{1} WHERE [id]={2}", DbConfigs.Prefix, this.examresult.score, this.examresult.examid);
                }
                else
                {
                    stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamResult] SET [score1]={1},[score2]={2},[score]={3},[exp]={4} WHERE [id]={5}|", new object[]
                    {
                        DbConfigs.Prefix,
                        this.examresult.score1,
                        this.examresult.score2,
                        this.examresult.score,
                        examExpByScore.exp,
                        this.examresult.id
                    });
                    stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [score]=[score]-{1} WHERE [id]={2}|", DbConfigs.Prefix, score, this.examresult.examid);
                    stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [score]=[score]+{1} WHERE [id]={2}", DbConfigs.Prefix, this.examresult.score, this.examresult.examid);
                    stringBuilder.AppendFormat("UPDATE [{0}WMS_UserInfo] SET [exp]=[exp]-{1} WHERE [id]={2}", DbConfigs.Prefix, this.examresult.exp, this.examresult.uid);
                }
                this.msg = DbHelper.ExecuteSql(stringBuilder.ToString());
                UserBll.UpdateUserExp(this.examresult.uid, examExpByScore.exp);
                if (this.msg != "")
                {
                    this.ShowErrMsg(this.msg);
                    return;
                }
            }
            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();
        }
Ejemplo n.º 21
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);
                 }
             }
         }
     }
 }
Ejemplo n.º 22
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);
             }
         }
     }
 }
Ejemplo n.º 23
0
        // 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();
        }
Ejemplo n.º 24
0
 // Token: 0x06000044 RID: 68 RVA: 0x000078AC File Offset: 0x00005AAC
 protected override void View()
 {
     this.sortinfo = SortBll.GetSortInfo(this.sortid);
 }
Ejemplo n.º 25
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();
        }
Ejemplo n.º 26
0
        // 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();
        }
Ejemplo n.º 27
0
        // Token: 0x06000055 RID: 85 RVA: 0x0000924C File Offset: 0x0000744C
        protected string ShowChildSort(int parentid, string tree)
        {
            List <SortInfo> sortList      = SortBll.GetSortList(this.channelid, parentid);
            StringBuilder   stringBuilder = new StringBuilder();

            tree = "│  " + tree;
            foreach (SortInfo sortInfo in sortList)
            {
                if (base.ischecked(sortInfo.id, this.role.sorts) || this.roleid == 1)
                {
                    stringBuilder.Append("<tr class=\"tlist\" onmouseover=\"curcolor=this.style.backgroundColor;this.style.backgroundColor='#cbe3f4'\" onmouseout=\"this.style.backgroundColor=curcolor\">");
                    stringBuilder.AppendLine("<td align=\"left\">" + tree);
                    string text = "";
                    if (sortInfo.hidden == 1)
                    {
                        text = "_hidden";
                    }
                    if (sortInfo.icon != "")
                    {
                        stringBuilder.AppendLine("<img src=\"" + sortInfo.icon + "\" width=\"16\" height=\"16\"  />");
                    }
                    else if (sortInfo.subcounts > 0)
                    {
                        stringBuilder.AppendLine(string.Concat(new string[]
                        {
                            "<img src=\"",
                            this.adminpath,
                            "images/folders",
                            text,
                            ".gif\" width=\"16\" height=\"16\"  />"
                        }));
                    }
                    else
                    {
                        stringBuilder.AppendLine(string.Concat(new string[]
                        {
                            "<img src=\"",
                            this.adminpath,
                            "images/folder",
                            text,
                            ".gif\" width=\"16\" height=\"16\"  />"
                        }));
                    }
                    stringBuilder.AppendLine(string.Concat(new object[]
                    {
                        sortInfo.name,
                        "(",
                        this.GetQuestionCount(sortInfo.id),
                        ")</td>"
                    }));
                    stringBuilder.AppendLine("<td>" + this.GetCurCount(sortInfo.id) + "</td>");
                    stringBuilder.AppendLine(string.Concat(new object[]
                    {
                        "<td><input id=\"randomcount_",
                        sortInfo.id,
                        "\" name=\"randomcount_",
                        sortInfo.id,
                        "\" value=\"",
                        this.GetRandomCount(sortInfo.id),
                        "\" type=\"text\" /> </td>"
                    }));
                    stringBuilder.AppendLine("</tr>");
                    stringBuilder.Append(this.ShowChildSort(sortInfo.id, tree));
                }
            }
            return(stringBuilder.ToString());
        }
Ejemplo n.º 28
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);
         }
     }
 }
Ejemplo n.º 29
0
 // Token: 0x0600008E RID: 142 RVA: 0x0000DE5C File Offset: 0x0000C05C
 protected override void View()
 {
     base.Response.Expires      = 0;
     base.Response.CacheControl = "no-cache";
     base.Response.Cache.SetNoStore();
     this.examconfig = ExamConifgs.GetExamConfig();
     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.examinfo = DbHelper.ExecuteModel <ExamInfo>(this.examresult.examid);
         if (this.examresult.islimit == 1)
         {
             if (this.examresult.starttime <= DateTime.Now && DateTime.Now <= this.examresult.endtime)
             {
                 TimeSpan timeSpan  = new TimeSpan(DateTime.Now.Ticks);
                 TimeSpan ts        = new TimeSpan(this.examresult.starttime.Ticks);
                 TimeSpan timeSpan2 = timeSpan.Subtract(ts).Duration();
                 this.examresult.utime = Convert.ToInt32(timeSpan2.TotalSeconds);
             }
             else
             {
                 this.examresult.utime = this.examresult.examtime * 60;
             }
             DbHelper.ExecuteUpdate <ExamResult>(this.examresult);
         }
         if (this.examresult.examtype == 1)
         {
             string macAddress = ExamConifgs.GetMacAddress(this.ip);
             if (this.examresult.ip != "")
             {
                 if (this.examresult.ip != this.ip || this.examresult.mac != macAddress)
                 {
                     this.ShowErr("对不起,请在固定位置上进行考试。");
                     return;
                 }
             }
             else
             {
                 SqlParam[] sqlparams = new SqlParam[]
                 {
                     DbHelper.MakeSet("ip", this.ip),
                     DbHelper.MakeSet("mac", macAddress),
                     DbHelper.MakeAndWhere("id", this.resultid)
                 };
                 DbHelper.ExecuteUpdate <ExamResult>(sqlparams);
             }
         }
         this.sortid              = this.examresult.sortid;
         this.sortinfo            = SortBll.GetSortInfo(this.sortid);
         this.examresult.passmark = this.examresult.passmark * this.examresult.total / 100.0;
         this.examtopiclist       = ExamBll.GetExamResultTopicList(this.resultid);
         this.questionlist        = new int[this.examresult.questions];
         int num  = this.examresult.examtime * 60 - this.examresult.utime;
         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")
         });
     }
 }
Ejemplo n.º 30
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("题库清空成功。");
         }
     }
 }