コード例 #1
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("题库清空成功。");
         }
     }
 }
コード例 #2
0
 // Token: 0x06000057 RID: 87 RVA: 0x00007994 File Offset: 0x00005B94
 protected override void View()
 {
     this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.appid);
     if (this.appinfo.id == 0)
     {
         this.ShowErr("该应用不存在或已被删除。");
     }
     else
     {
         if (this.ispost)
         {
             string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
             string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a        = Path.GetExtension(fileName).ToLower();
             if (a != ".fpk" && a != ".zip")
             {
                 this.ShowErr("对不起,该文件不是方配系统应用更新文件类型。");
                 return;
             }
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + fileName))
             {
                 File.Delete(mapPath + "\\" + fileName);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + fileName, "");
             File.Delete(mapPath + "\\" + fileName);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\app.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                 this.ShowErr("应用配置文件不存在或有错误。");
                 return;
             }
             AppInfo appInfo = FPSerializer.Load <AppInfo>(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\app.config");
             if (this.appinfo.guid == "")
             {
                 this.ShowErr("对不起,该应用标识码错误,更新失败。");
                 return;
             }
             SqlParam sqlParam = DbHelper.MakeAndWhere("guid", this.appinfo.guid);
             this.appinfo = DbHelper.ExecuteModel <AppInfo>(new SqlParam[]
             {
                 sqlParam
             });
             if (this.appinfo.id == 0)
             {
                 this.ShowErr("对不起,该应用不存在或已被删除。");
                 return;
             }
             Version v  = new Version(FPUtils.StrToDecimal(appInfo.version).ToString("0.0"));
             Version v2 = new Version(FPUtils.StrToDecimal(this.appinfo.version).ToString("0.0"));
             if (v < v2)
             {
                 this.ShowErr("对不起,您更新的版本比安装版本还低,不能更新");
                 return;
             }
             this.appinfo.name    = appInfo.name;
             this.appinfo.version = appInfo.version;
             this.appinfo.notes   = appInfo.notes;
             this.appinfo.author  = appInfo.author;
             string mapPath2   = FPUtils.GetMapPath(this.webpath + this.appinfo.installpath);
             string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName);
             this.appinfo.files = appupdate.CopyDirectory(sourcePath, mapPath2, "", this.appinfo.files);
             if (DbHelper.ExecuteUpdate <AppInfo>(this.appinfo) > 0)
             {
                 foreach (string strContent in appInfo.sortapps.Split(new char[]
                 {
                     '|'
                 }))
                 {
                     string[] array2 = FPUtils.SplitString(strContent, ",", 4);
                     if (!(array2[0] == ""))
                     {
                         SqlParam[] sqlparams = new SqlParam[]
                         {
                             DbHelper.MakeAndWhere("appid", this.appinfo.id),
                             DbHelper.MakeAndWhere("name", array2[0])
                         };
                         SortAppInfo sortAppInfo = DbHelper.ExecuteModel <SortAppInfo>(sqlparams);
                         if (sortAppInfo.id > 0)
                         {
                             sortAppInfo.name      = array2[0];
                             sortAppInfo.markup    = array2[1];
                             sortAppInfo.indexpage = array2[2];
                             sortAppInfo.viewpage  = array2[3];
                             DbHelper.ExecuteUpdate <SortAppInfo>(sortAppInfo);
                         }
                         else
                         {
                             sortAppInfo.appid     = this.appinfo.id;
                             sortAppInfo.name      = array2[0];
                             sortAppInfo.markup    = array2[1];
                             sortAppInfo.indexpage = array2[2];
                             sortAppInfo.viewpage  = array2[3];
                             DbHelper.ExecuteInsert <SortAppInfo>(sortAppInfo);
                         }
                     }
                 }
             }
             Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
             CacheBll.RemoveSortCache();
             base.Response.Redirect("appmanage.aspx");
         }
         base.SaveRightURL();
     }
 }
コード例 #3
0
ファイル: appsortmanage.cs プロジェクト: Run2948/FangPageExam
        // Token: 0x06000070 RID: 112 RVA: 0x0000A4AC File Offset: 0x000086AC
        protected override void View()
        {
            if (this.id > 0)
            {
                this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.id);
            }
            SqlParam sqlParam = DbHelper.MakeAndWhere("appid", this.id);

            if (this.ispost)
            {
                if (this.action == "appupdate")
                {
                    SortAppInfo sortAppInfo = DbHelper.ExecuteModel <SortAppInfo>(this.sortappid);
                    sortAppInfo = FPRequest.GetModel <SortAppInfo>(sortAppInfo, "sort_");
                    if (sortAppInfo.name == "")
                    {
                        this.ShowErr("栏目应用名称不能为空。");
                        return;
                    }
                    DbHelper.ExecuteUpdate <SortAppInfo>(sortAppInfo);
                }
                else if (this.action == "appadd")
                {
                    SortAppInfo sortAppInfo = FPRequest.GetModel <SortAppInfo>(new SortAppInfo(), "sortadd_");
                    sortAppInfo.appid       = this.id;
                    sortAppInfo.installpath = this.appinfo.installpath;
                    if (sortAppInfo.name == "")
                    {
                        this.ShowErr("栏目应用名称不能为空。");
                        return;
                    }
                    DbHelper.ExecuteInsert <SortAppInfo>(sortAppInfo);
                }
                else if (this.action == "appdelete")
                {
                    DbHelper.ExecuteDelete <SortAppInfo>(FPRequest.GetInt("appid"));
                }
                this.sortapplist = DbHelper.ExecuteList <SortAppInfo>(OrderBy.ASC, new SqlParam[]
                {
                    sqlParam
                });
                string text = "";
                foreach (SortAppInfo sortAppInfo2 in this.sortapplist)
                {
                    if (text != "")
                    {
                        text += "|";
                    }
                    string text2 = text;
                    text = string.Concat(new string[]
                    {
                        text2,
                        sortAppInfo2.name,
                        ",",
                        sortAppInfo2.markup,
                        ",",
                        sortAppInfo2.indexpage,
                        ",",
                        sortAppInfo2.viewpage
                    });
                }
                this.appinfo.sortapps = text;
                FPSerializer.Save <AppInfo>(this.appinfo, FPUtils.GetMapPath(this.webpath + this.appinfo.installpath + "/app.config"));
                CacheBll.RemoveSortCache();
                base.Response.Redirect("appsortmanage.aspx?id=" + this.id);
            }
            this.sortapplist = DbHelper.ExecuteList <SortAppInfo>(OrderBy.ASC, new SqlParam[]
            {
                sqlParam
            });
            base.SaveRightURL();
        }