Exemple #1
0
 // Token: 0x06000301 RID: 769 RVA: 0x0000BDE4 File Offset: 0x00009FE4
 protected override void View()
 {
     this.iuser = DbHelper.ExecuteModel <UserInfo>(this.userid);
     if (this.iuser.id == 0)
     {
         this.ShowErr("用户不存在。");
     }
     else if (this.ispost)
     {
         if (this.isfile)
         {
             HttpPostedFile postedFile = FPRequest.Files["uploadimg"];
             UpLoad         upLoad     = new UpLoad();
             string         json       = upLoad.FileSaveAs(postedFile, "image", this.user, false, false, 100, 100);
             JsonData       jsonData   = JsonMapper.ToObject(json);
             if (jsonData["error"].ToString() == "")
             {
                 if (this.iuser.avatar != "")
                 {
                     if (File.Exists(FPUtils.GetMapPath(this.iuser.avatar)))
                     {
                         File.Delete(FPUtils.GetMapPath(this.iuser.avatar));
                     }
                 }
                 this.iuser.avatar = jsonData["filename"].ToString();
                 DbHelper.ExecuteUpdate <UserInfo>(this.iuser);
                 base.ResetUser();
                 base.AddMsg("更新头像成功。");
             }
             else
             {
                 this.ShowErr(jsonData["error"].ToString());
             }
         }
         else
         {
             this.ShowErr("请选择要上传的头像文件");
         }
     }
 }
Exemple #2
0
        // Token: 0x0600002F RID: 47 RVA: 0x00004F2C File Offset: 0x0000312C
        protected override void View()
        {
            this.m_path   = Path.GetDirectoryName(this.filepath).Replace("\\", "/");
            this.filename = Path.GetFileName(this.filepath);
            string mapPath = FPUtils.GetMapPath(this.webpath + this.filepath);

            if (!File.Exists(mapPath))
            {
                this.ShowErr("文件已被删除或不存在。");
            }
            else if (this.ispost)
            {
                if (!this.isperm)
                {
                    this.ShowErr("对不起,您没有权限操作。");
                }
                else
                {
                    this.content = HttpUtility.HtmlDecode(FPRequest.GetString("content"));
                    using (FileStream fileStream = new FileStream(mapPath, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
                    {
                        byte[] bytes = Encoding.UTF8.GetBytes(this.content);
                        fileStream.Write(bytes, 0, bytes.Length);
                        fileStream.Close();
                    }
                    base.Response.Redirect("sysfileedit.aspx?path=" + this.filepath);
                }
            }
            else
            {
                using (StreamReader streamReader = new StreamReader(mapPath, Encoding.UTF8))
                {
                    this.content = streamReader.ReadToEnd();
                    streamReader.Close();
                }
                this.content = HttpUtility.HtmlEncode(this.content);
                base.SaveRightURL();
            }
        }
Exemple #3
0
        // Token: 0x0600001F RID: 31 RVA: 0x00003A68 File Offset: 0x00001C68
        public static void CopyDirectory(string sourcePath, string targetPath)
        {
            DirectoryInfo directoryInfo = new DirectoryInfo(sourcePath);

            if (!Directory.Exists(targetPath))
            {
                Directory.CreateDirectory(targetPath);
            }
            foreach (FileInfo fileInfo in directoryInfo.GetFiles())
            {
                if (fileInfo.Extension == ".dll")
                {
                    fileInfo.CopyTo(FPUtils.GetMapPath(WebConfig.WebPath + "bin/" + fileInfo.Name), true);
                    fileInfo.CopyTo(targetPath + "\\" + fileInfo.Name, true);
                }
                else if (fileInfo.Extension == ".sql")
                {
                    fileInfo.CopyTo(targetPath + "\\" + fileInfo.Name, true);
                    if (fileInfo.Name.ToLower().EndsWith("access.sql") && DbConfigs.DbType == DbType.Access)
                    {
                        string sqlstring = FPFile.ReadFile(fileInfo.FullName);
                        DbHelper.ExecuteSql(sqlstring);
                    }
                    else if (fileInfo.Name.ToLower().EndsWith("sqlserver.sql") && DbConfigs.DbType == DbType.SqlServer)
                    {
                        string sqlstring = FPFile.ReadFile(fileInfo.FullName);
                        DbHelper.ExecuteSql(sqlstring);
                    }
                }
                else
                {
                    fileInfo.CopyTo(targetPath + "\\" + fileInfo.Name, true);
                }
            }
            foreach (DirectoryInfo directoryInfo2 in directoryInfo.GetDirectories())
            {
                pluginupdate.CopyDirectory(directoryInfo2.FullName, targetPath + "\\" + directoryInfo2.Name);
            }
        }
Exemple #4
0
 // Token: 0x0600002C RID: 44 RVA: 0x000034FC File Offset: 0x000016FC
 private void CreateTemplate(SiteConfig siteconfig, string viewpath, string aspxpath)
 {
     if (File.Exists(FPUtils.GetMapPath(this.webpath + viewpath)))
     {
         if (!this.CheckView(viewpath, aspxpath))
         {
             string text  = "";
             string text2 = "";
             FPViews.CreateView(siteconfig, this.webpath, viewpath, aspxpath, 1, "", out text, out text2);
             if (this.includedata[viewpath] == null)
             {
                 this.includedata.Add(viewpath, text);
                 FPViews.AddViewInclude(viewpath, text);
             }
             else if (text != this.includedata[viewpath].ToString())
             {
                 this.includedata[viewpath] = text;
                 FPViews.UpdateViewInclude(viewpath, text);
             }
         }
     }
 }
Exemple #5
0
        // Token: 0x06000280 RID: 640 RVA: 0x0000950C File Offset: 0x0000770C
        public static long GetDbSize()
        {
            DbConfigInfo dbConfig = DbConfigs.GetDbConfig();
            long         num      = 0L;

            if (dbConfig.dbtype == FangPage.Data.DbType.SqlServer)
            {
                string    commandText = "SELECT OBJECT_NAME(ID) AS TableName,SIZE = sum(reserved) * CONVERT(FLOAT, (SELECT LOW FROM MASTER.DBO.SPT_VALUES WHERE NUMBER = 1 AND TYPE = 'E')) FROM [sysindexes] WHERE [indid] IN (0,1,255) GROUP BY ID ORDER BY SIZE DESC";
                DataTable dataTable   = DbHelper.ExecuteDataset(CommandType.Text, commandText).Tables[0];
                foreach (object obj in dataTable.Rows)
                {
                    DataRow dataRow = (DataRow)obj;
                    num += long.Parse(dataRow["size"].ToString());
                }
            }
            else
            {
                FileInfo fileInfo = new FileInfo(FPUtils.GetMapPath(WebConfig.WebPath + dbConfig.dbpath));
                num = fileInfo.Length;
            }
            return(num);
        }
        // Token: 0x06000032 RID: 50 RVA: 0x00005278 File Offset: 0x00003478
        private void Delete(string filename, string type)
        {
            string mapPath = FPUtils.GetMapPath(this.webpath + ((this.m_path == "/") ? "" : this.m_path) + filename);

            if (type == "文件夹")
            {
                if (Directory.Exists(mapPath))
                {
                    Directory.Delete(mapPath, true);
                }
            }
            else
            {
                if (File.GetAttributes(mapPath).ToString().IndexOf("ReadOnly") != -1)
                {
                    File.SetAttributes(mapPath, FileAttributes.Normal);
                }
                if (File.Exists(mapPath))
                {
                    File.Delete(mapPath);
                }
            }
        }
Exemple #7
0
        // Token: 0x06000093 RID: 147 RVA: 0x0000E540 File Offset: 0x0000C740
        protected string GetTxtImg(string txt, int qid)
        {
            string text = string.Concat(new object[]
            {
                this.webpath,
                "cache/qtxt_",
                qid,
                ".jpg"
            });

            if (!File.Exists(FPUtils.GetMapPath(text)))
            {
                Bitmap   bitmap   = new Bitmap(710, 100);
                Graphics graphics = Graphics.FromImage(bitmap);
                Font     font     = new Font("宋体", 11f);
                SizeF    sizeF    = graphics.MeasureString(txt, font, 710);
                bitmap   = new Bitmap(710, Convert.ToInt32(sizeF.Height));
                graphics = Graphics.FromImage(bitmap);
                graphics.Clear(Color.White);
                graphics.DrawString(txt, font, Brushes.Black, new Rectangle(0, 0, Convert.ToInt32(sizeF.Width), Convert.ToInt32(sizeF.Height)));
                bitmap.Save(FPUtils.GetMapPath(text), ImageFormat.Jpeg);
            }
            return(text);
        }
Exemple #8
0
 // Token: 0x06000068 RID: 104 RVA: 0x000093E8 File Offset: 0x000075E8
 protected override void View()
 {
     if (this.ispost)
     {
         string mapPath = FPUtils.GetMapPath(this.webpath + "cache");
         if (this.step == "step1")
         {
             this.filename = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a = Path.GetExtension(this.filename).ToLower();
             if (a != ".zip" && a != ".fpsite")
             {
                 this.ShowErr("该文件不是方配站点安装文件类型");
                 return;
             }
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + this.filename))
             {
                 File.Delete(mapPath + "\\" + this.filename);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + this.filename);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + this.filename, "");
             File.Delete(mapPath + "\\" + this.filename);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\site.config"))
             {
                 string mapPath2   = FPUtils.GetMapPath(this.webpath + "sites");
                 string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename);
                 siteinstall.CopyDirectory(sourcePath, mapPath2);
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
                 base.Response.Redirect("sitemanage.aspx");
             }
             else
             {
                 this.siteinfo = SiteConfigs.LoadConfig(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\site.config");
             }
         }
         else if (this.step == "step2")
         {
             string text = FPRequest.GetString("installpath").ToLower();
             if (text == "")
             {
                 this.ShowErr("安装目录不能为空。");
                 return;
             }
             this.filename          = FPRequest.GetString("filename");
             this.siteinfo          = SiteConfigs.LoadConfig(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\site.config");
             this.siteinfo.sitepath = text;
             string mapPath2    = FPUtils.GetMapPath(this.webpath + "sites/" + this.siteinfo.sitepath);
             string sourcePath2 = mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename);
             siteinstall.CopyDirectory(sourcePath2, mapPath2);
             Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             base.Response.Redirect("sitemanage.aspx");
         }
     }
     base.SaveRightURL();
 }
Exemple #9
0
 // Token: 0x060000BE RID: 190 RVA: 0x0000E7B0 File Offset: 0x0000C9B0
 protected override void View()
 {
     this.regconfig = RegConfigs.GetRegConfig();
     if (this.ispost)
     {
         if (!this.isfile)
         {
             this.ShowErr("请选择要导入的本地Excel表文件");
         }
         else
         {
             string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
             string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a        = Path.GetExtension(fileName).ToLower();
             if (a != ".xls")
             {
                 this.ShowErr("该文件不是Excel表文件类型");
             }
             else
             {
                 if (!Directory.Exists(mapPath))
                 {
                     Directory.CreateDirectory(mapPath);
                 }
                 if (File.Exists(mapPath + "\\" + fileName))
                 {
                     File.Delete(mapPath + "\\" + fileName);
                 }
                 FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
                 DataTable excelTable = FPExcel.GetExcelTable(mapPath + "\\" + fileName);
                 if (excelTable.Rows.Count > 0)
                 {
                     int num = excelTable.Rows.Count - 1;
                     for (int i = 0; i < excelTable.Rows.Count; i++)
                     {
                         DataRow dataRow = excelTable.Rows[num - i];
                         string  text    = dataRow.ItemArray[0].ToString().Trim();
                         if (!(text == ""))
                         {
                             if (!this.InRestrictArray(text, this.regconfig.restrict))
                             {
                                 if (!UserBll.CheckUserName(text))
                                 {
                                     DbHelper.ExecuteInsert <UserInfo>(new UserInfo
                                     {
                                         username = text,
                                         password = FPUtils.MD5(dataRow.ItemArray[1].ToString().Trim()),
                                         realname = dataRow.ItemArray[2].ToString().Trim(),
                                         mobile   = dataRow.ItemArray[3].ToString().Trim(),
                                         email    = dataRow.ItemArray[4].ToString().Trim(),
                                         roleid   = this.GetRoleId(dataRow.ItemArray[5].ToString().Trim()),
                                         departid = this.GetDepartId(dataRow.ItemArray[6].ToString().Trim())
                                     });
                                 }
                             }
                         }
                     }
                 }
                 if (File.Exists(mapPath + "\\" + fileName))
                 {
                     File.Delete(mapPath + "\\" + fileName);
                 }
                 base.Response.Redirect("usermanage.aspx");
             }
         }
     }
 }
Exemple #10
0
        // 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();
        }
Exemple #11
0
        // Token: 0x0600005E RID: 94 RVA: 0x000084C4 File Offset: 0x000066C4
        protected override void View()
        {
            if (this.m_sitepath != "")
            {
                this.siteinfo = SiteBll.GetSiteConfig(this.m_sitepath);
            }
            if (this.siteinfo.version == "")
            {
                this.siteinfo.version = "V1.0";
            }
            if (this.ispost)
            {
                string text = FPRequest.GetString("dirpath").ToLower();
                if (text.Trim() == "")
                {
                    base.AddErr("站点路径名称不能为空。");
                }
                string pattern = "^[a-zA-Z0-9_\\w]+$";
                if (this.err == 0 && !Regex.IsMatch(text.Trim(), pattern, RegexOptions.IgnoreCase))
                {
                    base.AddErr("站点路径名称只能由数字、字母或下划线组成。");
                }
                if (this.err > 0)
                {
                    if (!this.iscuserr)
                    {
                        MessageBox.Show(this.msg);
                    }
                    return;
                }
                this.siteinfo.roles = "";
                this.siteinfo       = FPRequest.GetModel <SiteConfig>(this.siteinfo);
                if (this.siteinfo.sitepath != text)
                {
                    if (Directory.Exists(FPUtils.GetMapPath(this.webpath + "sites/" + text)))
                    {
                        this.ShowErr("该站点路径已存在,请使用其他的名称");
                        return;
                    }
                }
                if (this.m_sitepath == "")
                {
                    this.siteinfo.sitepath = text;
                }
                if (this.siteinfo.sitetitle == "")
                {
                    this.siteinfo.sitetitle = this.siteinfo.name;
                }
                SiteBll.SaveSiteConfig(this.siteinfo);
                if (this.siteinfo.sitepath != text)
                {
                    Directory.Move(FPUtils.GetMapPath(this.webpath + "sites/" + this.siteinfo.sitepath), FPUtils.GetMapPath(this.webpath + "sites/" + text));
                }
                if (this.tab == 0)
                {
                    base.Response.Redirect("sitemanage.aspx");
                }
                else
                {
                    base.Response.Redirect(string.Concat(new object[]
                    {
                        "siteadd.aspx?sitepath=",
                        this.siteinfo.sitepath,
                        "&tab=",
                        this.tab
                    }));
                }
            }
            SqlParam sqlParam = DbHelper.MakeAndWhere("id", WhereType.NotIn, "2,3,4");

            this.rolelist = DbHelper.ExecuteList <RoleInfo>(new SqlParam[]
            {
                sqlParam
            });
            base.SaveRightURL();
        }
Exemple #12
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();
        }
Exemple #13
0
        // Token: 0x06000058 RID: 88 RVA: 0x00007EC8 File Offset: 0x000060C8
        public static string CopyDirectory(string sourcePath, string targetPath, string vpath, string appfiles)
        {
            string        text          = "";
            DirectoryInfo directoryInfo = new DirectoryInfo(sourcePath);

            if (!Directory.Exists(targetPath))
            {
                Directory.CreateDirectory(targetPath);
            }
            foreach (FileInfo fileInfo in directoryInfo.GetFiles())
            {
                if (fileInfo.Extension == ".dll")
                {
                    fileInfo.CopyTo(FPUtils.GetMapPath(WebConfig.WebPath + "bin/" + fileInfo.Name), true);
                    if (!FPUtils.InArray("bin/" + fileInfo.Name, appfiles))
                    {
                        if (text != "")
                        {
                            text += ",";
                        }
                        text = text + "bin/" + fileInfo.Name;
                    }
                }
                else if (fileInfo.Extension == ".sql")
                {
                    fileInfo.CopyTo(targetPath + "\\" + fileInfo.Name, true);
                    if (fileInfo.Name.ToLower().EndsWith("access.sql") && DbConfigs.DbType == DbType.Access)
                    {
                        string sqlstring = FPFile.ReadFile(fileInfo.FullName);
                        DbHelper.ExecuteSql(sqlstring);
                    }
                    else if (fileInfo.Name.ToLower().EndsWith("sqlserver.sql") && DbConfigs.DbType == DbType.SqlServer)
                    {
                        string sqlstring = FPFile.ReadFile(fileInfo.FullName);
                        DbHelper.ExecuteSql(sqlstring);
                    }
                    if (!FPUtils.InArray("bin/" + fileInfo.Name, appfiles))
                    {
                        if (text != "")
                        {
                            text += ",";
                        }
                        text = text + "bin/" + fileInfo.Name;
                    }
                }
                else
                {
                    if (!FPUtils.InArray("bin/" + fileInfo.Name, appfiles))
                    {
                        if (text != "")
                        {
                            text += ",";
                        }
                        text = text + "bin/" + fileInfo.Name;
                    }
                    fileInfo.CopyTo(targetPath + "\\" + fileInfo.Name, true);
                }
            }
            foreach (DirectoryInfo directoryInfo2 in directoryInfo.GetDirectories())
            {
                string text2 = appupdate.CopyDirectory(directoryInfo2.FullName, targetPath + "\\" + directoryInfo2.Name, vpath + directoryInfo2.Name + "/", appfiles);
                if (text2 != "")
                {
                    if (text != "")
                    {
                        text += ",";
                    }
                    text += text2;
                }
            }
            return(text);
        }
Exemple #14
0
 // Token: 0x06000055 RID: 85 RVA: 0x0000760C File Offset: 0x0000580C
 protected override void View()
 {
     if (this.id > 0)
     {
         this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.id);
     }
     if (this.ispost)
     {
         this.appinfo.target = "";
         this.appinfo        = FPRequest.GetModel <AppInfo>(this.appinfo);
         if (this.appinfo.name == "")
         {
             this.ShowErr("应用名称不能为空");
             return;
         }
         if (this.appinfo.installpath == "")
         {
             this.ShowErr("安装目录不能为空");
             return;
         }
         string pattern = "^[a-zA-Z0-9_\\w]+$";
         if (this.err == 0 && !Regex.IsMatch(this.appinfo.installpath.Trim(), pattern, RegexOptions.IgnoreCase))
         {
             base.AddErr("应用安装目录名称只能由数字、字母或下划线组成。");
         }
         if (this.appinfo.guid == "")
         {
             this.appinfo.guid = Guid.NewGuid().ToString();
         }
         if (this.appinfo.target == "")
         {
             this.appinfo.target = "_self";
         }
         if (this.appinfo.setpath == "")
         {
             this.appinfo.setpath = this.appinfo.installpath;
         }
         this.appinfo.version = FPUtils.StrToDecimal(this.appinfo.version).ToString("0.0");
         SqlParam           sqlParam = DbHelper.MakeAndWhere("appid", this.id);
         List <SortAppInfo> list     = DbHelper.ExecuteList <SortAppInfo>(OrderBy.ASC, new SqlParam[]
         {
             sqlParam
         });
         string text = "";
         foreach (SortAppInfo sortAppInfo in list)
         {
             if (text != "")
             {
                 text += "|";
             }
             string text2 = text;
             text = string.Concat(new string[]
             {
                 text2,
                 sortAppInfo.name,
                 ",",
                 sortAppInfo.markup,
                 ",",
                 sortAppInfo.indexpage,
                 ",",
                 sortAppInfo.viewpage
             });
         }
         this.appinfo.sortapps = text;
         if (this.appinfo.id > 0)
         {
             DbHelper.ExecuteUpdate <AppInfo>(this.appinfo);
         }
         else
         {
             this.id = DbHelper.ExecuteInsert <AppInfo>(this.appinfo);
         }
         FPSerializer.Save <AppInfo>(this.appinfo, FPUtils.GetMapPath(this.webpath + this.appinfo.installpath + "/app.config"));
         base.Response.Redirect("appmanage.aspx");
     }
     base.SaveRightURL();
 }
 // Token: 0x06000071 RID: 113 RVA: 0x0000B6F8 File Offset: 0x000098F8
 protected override void View()
 {
     this.sortinfo = SortBll.GetSortInfo(this.sortid);
     if (this.ispost)
     {
         if (!this.isfile)
         {
             this.ShowErr("请选择要导入的本地Excel表文件");
             return;
         }
         string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
         string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
         string a        = Path.GetExtension(fileName).ToLower();
         if (a != ".xls")
         {
             this.ShowErr("该文件不是Excel表文件类型");
             return;
         }
         if (!Directory.Exists(mapPath))
         {
             Directory.CreateDirectory(mapPath);
         }
         if (File.Exists(mapPath + "\\" + fileName))
         {
             File.Delete(mapPath + "\\" + fileName);
         }
         FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
         DataTable excelTable = FPExcel.GetExcelTable(mapPath + "\\" + fileName);
         if (excelTable.Columns.Count < 14)
         {
             this.ShowErr("对不起,Excel表格列不得少于14。");
             return;
         }
         if (excelTable.Rows.Count > 0)
         {
             int num = excelTable.Rows.Count - 1;
             for (int i = 0; i < excelTable.Rows.Count; i++)
             {
                 DataRow      dataRow      = excelTable.Rows[num - i];
                 ExamQuestion examQuestion = new ExamQuestion();
                 examQuestion.uid       = this.userid;
                 examQuestion.channelid = this.sortinfo.channelid;
                 examQuestion.type      = this.TypeInt(dataRow.ItemArray[0].ToString());
                 examQuestion.title     = dataRow.ItemArray[1].ToString();
                 if (examQuestion.type != 0 && !(examQuestion.title == ""))
                 {
                     for (int j = 0; j < 6; j++)
                     {
                         if (dataRow.ItemArray[2 + j].ToString() != "")
                         {
                             ExamQuestion examQuestion2 = examQuestion;
                             examQuestion2.content += ((examQuestion.content == "") ? dataRow.ItemArray[2 + j].ToString() : ("§" + dataRow.ItemArray[2 + j].ToString()));
                         }
                     }
                     if (examQuestion.type == 1 || examQuestion.type == 2)
                     {
                         examQuestion.answer  = dataRow.ItemArray[8].ToString().Trim().ToUpper();
                         examQuestion.ascount = FPUtils.SplitString(examQuestion.content, "§").Length;
                     }
                     else if (examQuestion.type == 3)
                     {
                         if (FPUtils.InArray(dataRow.ItemArray[8].ToString().Trim(), "y,Y,正确,对"))
                         {
                             examQuestion.answer = "Y";
                         }
                         else
                         {
                             examQuestion.answer = "N";
                         }
                         examQuestion.ascount = 2;
                     }
                     else if (examQuestion.type == 4)
                     {
                         foreach (string a2 in FPUtils.SplitString(examQuestion.content, "§"))
                         {
                             if (a2 == "区分大小写")
                             {
                                 examQuestion.upperflg = 1;
                             }
                             else if (a2 == "区分顺序")
                             {
                                 examQuestion.orderflg = 1;
                             }
                         }
                         examQuestion.answer  = dataRow.ItemArray[8].ToString().Trim();
                         examQuestion.ascount = FPUtils.SplitString(examQuestion.answer).Length;
                     }
                     else
                     {
                         examQuestion.answer  = dataRow.ItemArray[8].ToString().Trim();
                         examQuestion.ascount = 1;
                     }
                     examQuestion.answerkey  = dataRow.ItemArray[9].ToString();
                     examQuestion.explain    = dataRow.ItemArray[10].ToString();
                     examQuestion.difficulty = this.DifficultyInt(dataRow.ItemArray[11].ToString().Trim());
                     examQuestion.status     = ((dataRow.ItemArray[12].ToString().Trim() == "否") ? 0 : 1);
                     examQuestion.sortid     = this.GetSortId(dataRow.ItemArray[13].ToString());
                     if (examQuestion.sortid == 0)
                     {
                         examQuestion.sortid = this.sortid;
                     }
                     DbHelper.ExecuteInsert <ExamQuestion>(examQuestion);
                     SortBll.UpdateSortPosts(examQuestion.sortid, 1);
                 }
             }
         }
         if (File.Exists(mapPath + "\\" + fileName))
         {
             File.Delete(mapPath + "\\" + fileName);
         }
         base.Response.Redirect("questionmanage.aspx?sortid=" + this.sortid);
     }
     base.SaveRightURL();
 }
Exemple #16
0
 // Token: 0x06000084 RID: 132 RVA: 0x0000D2E8 File Offset: 0x0000B4E8
 protected override void View()
 {
     if (this.ispost)
     {
         if (!this.isfile)
         {
             this.ShowErr("请选择要导入的本地Excel表文件");
         }
         else
         {
             string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
             string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a        = Path.GetExtension(fileName).ToLower();
             if (a != ".xls")
             {
                 this.ShowErr("该文件不是Excel表文件类型");
             }
             else
             {
                 if (!Directory.Exists(mapPath))
                 {
                     Directory.CreateDirectory(mapPath);
                 }
                 if (File.Exists(mapPath + "\\" + fileName))
                 {
                     File.Delete(mapPath + "\\" + fileName);
                 }
                 FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
                 DataTable excelTable = FPExcel.GetExcelTable(mapPath + "\\" + fileName);
                 string    text       = "";
                 string    text2      = "";
                 string    text3      = "";
                 if (excelTable.Rows.Count > 0)
                 {
                     int num = excelTable.Rows.Count - 1;
                     for (int i = 0; i < num; i++)
                     {
                         DataRow dataRow = excelTable.Rows[num - i];
                         string  text4   = dataRow.ItemArray[0].ToString().Trim();
                         if (!(text4 == ""))
                         {
                             SqlParam sqlParam = DbHelper.MakeAndWhere("username", text4);
                             UserInfo userInfo = DbHelper.ExecuteModel <UserInfo>(new SqlParam[]
                             {
                                 sqlParam
                             });
                             if (userInfo.id == 0)
                             {
                                 userInfo.username = text4;
                                 userInfo.realname = dataRow.ItemArray[1].ToString().Trim();
                                 userInfo.password = FPUtils.MD5(dataRow.ItemArray[2].ToString().Trim());
                                 userInfo.roleid   = this.GetRoleId(dataRow.ItemArray[3].ToString().Trim());
                                 userInfo.departid = this.GetDepartId(dataRow.ItemArray[4].ToString().Trim());
                                 userInfo.nickname = dataRow.ItemArray[5].ToString().Trim();
                                 userInfo.id       = DbHelper.ExecuteInsert <UserInfo>(userInfo);
                             }
                             else
                             {
                                 if (!string.IsNullOrEmpty(dataRow.ItemArray[1].ToString().Trim()))
                                 {
                                     userInfo.realname = dataRow.ItemArray[1].ToString().Trim();
                                 }
                                 if (!string.IsNullOrEmpty(dataRow.ItemArray[2].ToString().Trim()))
                                 {
                                     userInfo.password = FPUtils.MD5(dataRow.ItemArray[2].ToString().Trim());
                                 }
                                 if (!string.IsNullOrEmpty(dataRow.ItemArray[3].ToString().Trim()))
                                 {
                                     userInfo.roleid = this.GetRoleId(dataRow.ItemArray[3].ToString().Trim());
                                 }
                                 if (!string.IsNullOrEmpty(dataRow.ItemArray[4].ToString().Trim()))
                                 {
                                     userInfo.departid = this.GetDepartId(dataRow.ItemArray[4].ToString().Trim());
                                 }
                                 if (!string.IsNullOrEmpty(dataRow.ItemArray[5].ToString().Trim()))
                                 {
                                     userInfo.nickname = dataRow.ItemArray[5].ToString().Trim();
                                 }
                                 DbHelper.ExecuteUpdate <UserInfo>(userInfo);
                             }
                             if (text != "")
                             {
                                 text += ",";
                             }
                             text += userInfo.id;
                         }
                     }
                     if (File.Exists(mapPath + "\\" + fileName))
                     {
                         File.Delete(mapPath + "\\" + fileName);
                     }
                     if (text != "")
                     {
                         if (this.examuser != "")
                         {
                             this.examuser += ",";
                         }
                         this.examuser += text;
                     }
                     SqlParam        sqlParam2 = DbHelper.MakeAndWhere("id", WhereType.In, this.examuser);
                     List <UserInfo> list      = DbHelper.ExecuteList <UserInfo>(new SqlParam[]
                     {
                         sqlParam2
                     });
                     foreach (int num2 in FPUtils.SplitInt(this.examuser))
                     {
                         foreach (UserInfo userInfo2 in list)
                         {
                             if (num2 == userInfo2.id && !FPUtils.InArray(num2, text3))
                             {
                                 if (text2 != "")
                                 {
                                     text2 += ",";
                                 }
                                 if (userInfo2.realname != "")
                                 {
                                     text2 += userInfo2.realname;
                                 }
                                 else
                                 {
                                     text2 += userInfo2.username;
                                 }
                                 if (text3 != "")
                                 {
                                     text3 += ",";
                                 }
                                 text3 += num2;
                             }
                         }
                     }
                 }
                 Hashtable hashtable = new Hashtable();
                 hashtable["uname"]    = text2;
                 hashtable["examuser"] = text3;
                 base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                 base.Response.Write(JsonMapper.ToJson(hashtable));
                 base.Response.End();
             }
         }
     }
 }
        // Token: 0x060002CD RID: 717 RVA: 0x0000A804 File Offset: 0x00008A04
        protected override void View()
        {
            string strPath = this.webpath + "upload/";
            string text    = this.webpath + "upload/";
            string text2   = "gif,jpg,jpeg,png,bmp";
            string mapPath = FPUtils.GetMapPath(strPath);
            string @string = FPRequest.GetString("dir");
            string text3   = FPRequest.GetString("path");

            text3 = (string.IsNullOrEmpty(text3) ? "" : text3);
            string path;
            string value;
            string text4;
            string value2;

            if (text3 == "")
            {
                path   = mapPath;
                value  = text;
                text4  = "";
                value2 = "";
            }
            else
            {
                path   = mapPath + text3;
                value  = text + text3;
                text4  = text3;
                value2 = Regex.Replace(text4, "(.*?)[^\\/]+\\/$", "$1");
            }
            string text5 = FPRequest.GetString("order");

            text5 = (string.IsNullOrEmpty(text5) ? "" : text5.ToLower());
            if (Regex.IsMatch(text3, "\\.\\."))
            {
                base.Response.Write("不允许使用上一级目录。");
                base.Response.End();
            }
            if (text3 != "" && !text3.EndsWith("/"))
            {
                base.Response.Write("目录格式错误。");
                base.Response.End();
            }
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string[] directories = Directory.GetDirectories(path);
            string[] files       = Directory.GetFiles(path);
            string   text6       = text5;

            if (text6 != null)
            {
                if (text6 == "size")
                {
                    Array.Sort(directories, new filemanagerajax.NameSorter());
                    Array.Sort(files, new filemanagerajax.SizeSorter());
                    goto IL_21D;
                }
                if (text6 == "type")
                {
                    Array.Sort(directories, new filemanagerajax.NameSorter());
                    Array.Sort(files, new filemanagerajax.TypeSorter());
                    goto IL_21D;
                }
                if (!(text6 == "name"))
                {
                }
            }
            Array.Sort(directories, new filemanagerajax.NameSorter());
            Array.Sort(files, new filemanagerajax.NameSorter());
IL_21D:
            Hashtable hashtable = new Hashtable();

            hashtable["moveup_dir_path"]  = value2;
            hashtable["current_dir_path"] = text4;
            hashtable["current_url"]      = value;
            hashtable["total_count"]      = directories.Length + files.Length;
            List <Hashtable> list = new List <Hashtable>();

            hashtable["file_list"] = list;
            for (int i = 0; i < directories.Length; i++)
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(directories[i]);
                Hashtable     hashtable2    = new Hashtable();
                hashtable2["is_dir"]   = true;
                hashtable2["has_file"] = (directoryInfo.GetFileSystemInfos().Length > 0);
                hashtable2["filesize"] = 0;
                hashtable2["is_photo"] = false;
                hashtable2["filetype"] = "";
                hashtable2["filename"] = directoryInfo.Name;
                hashtable2["datetime"] = directoryInfo.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
                list.Add(hashtable2);
            }
            for (int i = 0; i < files.Length; i++)
            {
                FileInfo  fileInfo   = new FileInfo(files[i]);
                Hashtable hashtable2 = new Hashtable();
                hashtable2["is_dir"]   = false;
                hashtable2["has_file"] = false;
                hashtable2["filesize"] = fileInfo.Length;
                hashtable2["is_photo"] = (Array.IndexOf <string>(text2.Split(new char[]
                {
                    ','
                }), fileInfo.Extension.Substring(1).ToLower()) >= 0);
                hashtable2["filetype"] = fileInfo.Extension.Substring(1);
                hashtable2["filename"] = fileInfo.Name;
                hashtable2["datetime"] = fileInfo.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
                list.Add(hashtable2);
            }
            base.Response.AddHeader("Content-Type", "application/json; charset=UTF-8");
            base.Response.Write(JsonMapper.ToJson(hashtable));
            base.Response.End();
        }
Exemple #18
0
 // Token: 0x06000053 RID: 83 RVA: 0x00007374 File Offset: 0x00005574
 protected override void View()
 {
     if (this.ispost)
     {
         if (!this.isperm)
         {
             this.ShowErr("对不起,您没有权限操作。");
             return;
         }
         int     @int    = FPRequest.GetInt("appid");
         AppInfo appInfo = DbHelper.ExecuteModel <AppInfo>(@int);
         string  mapPath = FPUtils.GetMapPath(this.webpath + appInfo.installpath);
         if (this.action == "delete")
         {
             if (DbHelper.ExecuteDelete <AppInfo>(@int) > 0)
             {
                 foreach (string text in FPUtils.SplitString(appInfo.files))
                 {
                     if (text.StartsWith("bin/"))
                     {
                         if (File.Exists(FPUtils.GetMapPath(WebConfig.WebPath + text)))
                         {
                             File.Delete(FPUtils.GetMapPath(WebConfig.WebPath + text));
                         }
                     }
                     if (File.Exists(mapPath + "/" + text))
                     {
                         if (text.EndsWith(".sql"))
                         {
                             if (text.ToLower().EndsWith("access_un.sql") && DbConfigs.DbType == DbType.Access)
                             {
                                 string sqlstring = FPFile.ReadFile(mapPath + "/" + text);
                                 DbHelper.ExecuteSql(sqlstring);
                             }
                             else if (text.ToLower().EndsWith("sqlserver_un.sql") && DbConfigs.DbType == DbType.SqlServer)
                             {
                                 string sqlstring = FPFile.ReadFile(mapPath + "/" + text);
                                 DbHelper.ExecuteSql(sqlstring);
                             }
                         }
                         File.Delete(mapPath + "/" + text);
                     }
                 }
                 if (Directory.Exists(mapPath))
                 {
                     DirectoryInfo directoryInfo = new DirectoryInfo(mapPath);
                     if (directoryInfo.GetFiles().Length == 0)
                     {
                         directoryInfo.Delete(true);
                     }
                 }
                 SqlParam sqlParam = DbHelper.MakeAndWhere("appid", @int);
                 DbHelper.ExecuteDelete <SortAppInfo>(new SqlParam[]
                 {
                     sqlParam
                 });
             }
             FPCache.Remove("FP_SORTTREE");
             base.Response.Redirect("appmanage.aspx");
         }
     }
     this.applist = DbHelper.ExecuteList <AppInfo>(OrderBy.ASC);
     base.SaveRightURL();
 }
Exemple #19
0
        // Token: 0x0600027B RID: 635 RVA: 0x00008AA4 File Offset: 0x00006CA4
        public static string BackUpDatabase()
        {
            string mapPath = FPUtils.GetMapPath(WebConfig.WebPath + "backup/datas");

            if (!Directory.Exists(mapPath))
            {
                Directory.CreateDirectory(mapPath);
            }
            DbConfigInfo dbConfig = DbConfigs.GetDbConfig();
            string       str      = dbConfig.dbname + "_" + DateTime.Now.ToString("yyyyMMddHHmmss");

            if (dbConfig.dbtype == FangPage.Data.DbType.SqlServer)
            {
                SQLServer sqlserver = new SQLServerClass();
                sqlserver.Connect(dbConfig.dbpath, dbConfig.userid, dbConfig.password);
                try
                {
                    if (File.Exists(mapPath + "\\" + dbConfig.dbname + ".bak"))
                    {
                        File.Delete(mapPath + "\\" + dbConfig.dbname + ".bak");
                    }
                    ((_Backup) new BackupClass
                    {
                        Action = SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database,
                        Initialize = true,
                        Files = mapPath + "\\" + dbConfig.dbname + ".bak",
                        Database = dbConfig.dbname
                    }).SQLBackup(sqlserver);
                    if (File.Exists(mapPath + "\\" + str + ".config"))
                    {
                        using (FPZip fpzip = new FPZip())
                        {
                            fpzip.AddFile(mapPath + "\\" + dbConfig.dbname + ".bak", dbConfig.dbname + ".bak");
                            fpzip.ZipSave(mapPath + "\\" + str + ".config");
                        }
                        File.Delete(mapPath + "\\" + dbConfig.dbname + ".bak");
                    }
                    return(string.Empty);
                }
                catch (Exception ex)
                {
                    string text = ex.Message.Replace("'", " ");
                    text = text.Replace("\n", " ");
                    return(text.Replace("\\", "/"));
                }
                finally
                {
                    sqlserver.DisConnect();
                }
            }
            string result;

            try
            {
                if (File.Exists(mapPath + "\\" + str + ".config"))
                {
                    File.Delete(mapPath + "\\" + str + ".zip");
                    using (FPZip fpzip = new FPZip())
                    {
                        fpzip.AddFile(WebConfig.WebPath + dbConfig.dbpath, dbConfig.dbpath);
                        fpzip.ZipSave(mapPath + "\\" + str + ".config");
                    }
                }
                result = string.Empty;
            }
            catch (Exception ex)
            {
                string text = ex.Message.Replace("'", " ");
                text   = text.Replace("\n", " ");
                text   = text.Replace("\\", "/");
                result = text;
            }
            return(result);
        }
Exemple #20
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();
     }
 }
Exemple #21
0
 // Token: 0x0600000D RID: 13 RVA: 0x000029C8 File Offset: 0x00000BC8
 protected override void View()
 {
     this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.id);
     if (this.appinfo.id == 0)
     {
         this.ShowErr("对不起,该应用已被删除或不存在。");
     }
     else
     {
         string mapPath = FPUtils.GetMapPath(this.webpath + this.appinfo.installpath);
         if (this.ispost)
         {
             string @string = FPRequest.GetString("setpath");
             if (@string == "")
             {
                 this.ShowErr("对不起,应用默认安装目录名称不能为空。");
             }
             else
             {
                 string pattern = "^[a-zA-Z0-9_\\w]+$";
                 if (this.err == 0 && !Regex.IsMatch(@string.Trim(), pattern, RegexOptions.IgnoreCase))
                 {
                     base.AddErr("默认安装目录名称只能由数字、字母或下划线组成。");
                 }
                 this.appinfo.setpath = @string;
                 DbHelper.ExecuteUpdate <AppInfo>(this.appinfo);
                 FPSerializer.Save <AppInfo>(this.appinfo, FPUtils.GetMapPath(this.webpath + this.appinfo.installpath + "/app.config"));
                 string str = this.appinfo.name + ".fpk";
                 if (this.appinfo.files != "")
                 {
                     using (FPZip fpzip = new FPZip())
                     {
                         foreach (string text in FPUtils.SplitString(this.appinfo.files))
                         {
                             if (text.StartsWith("bin/"))
                             {
                                 fpzip.AddFile(FPUtils.GetMapPath(WebConfig.WebPath + text), text);
                             }
                             else
                             {
                                 fpzip.AddFile(mapPath + "/" + text, text);
                             }
                         }
                         fpzip.ZipDown(FPUtils.UrlEncode(str));
                     }
                 }
                 else
                 {
                     using (FPZip fpzip = new FPZip())
                     {
                         DirectoryInfo directoryInfo = new DirectoryInfo(mapPath);
                         foreach (DirectoryInfo directoryInfo2 in directoryInfo.GetDirectories())
                         {
                             fpzip.AddDirectory(directoryInfo2.FullName);
                         }
                         foreach (FileInfo fileInfo in directoryInfo.GetFiles())
                         {
                             if (fileInfo.Name != "site.config")
                             {
                                 fpzip.AddFile(fileInfo.FullName, "");
                             }
                         }
                         string mapPath2 = FPUtils.GetMapPath(this.webpath + "sites/" + this.appinfo.installpath + "/site.config");
                         if (File.Exists(mapPath2))
                         {
                             SiteConfig siteConfig = SiteConfigs.LoadConfig(mapPath2);
                             if (siteConfig.inherits != "")
                             {
                                 if (siteConfig.inherits.EndsWith(".Controller"))
                                 {
                                     fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + siteConfig.inherits.Replace(".Controller", "") + ".dll"), "bin/" + siteConfig.inherits.Replace(".Controller", "") + ".dll");
                                 }
                                 else
                                 {
                                     fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + siteConfig.inherits + ".dll"), "bin/" + siteConfig.inherits + ".dll");
                                 }
                             }
                             if (siteConfig.import != "")
                             {
                                 foreach (string text in siteConfig.import.Split(new string[]
                                 {
                                     "\r\n",
                                     ";",
                                     ",",
                                     "|"
                                 }, StringSplitOptions.RemoveEmptyEntries))
                                 {
                                     fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + text + ".dll"), "bin/" + text + ".dll");
                                 }
                             }
                         }
                         fpzip.ZipDown(FPUtils.UrlEncode(str));
                     }
                 }
             }
         }
     }
 }
Exemple #22
0
 // Token: 0x06000050 RID: 80 RVA: 0x00006B80 File Offset: 0x00004D80
 protected override void View()
 {
     if (this.ispost)
     {
         string mapPath = FPUtils.GetMapPath(this.webpath + "cache");
         if (this.step == "step1")
         {
             this.filename = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a = Path.GetExtension(this.filename).ToLower();
             if (a != ".fpk" && a != ".zip")
             {
                 this.ShowErr("该文件不是方配站点应用安装文件类型");
                 return;
             }
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + this.filename))
             {
                 File.Delete(mapPath + "\\" + this.filename);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + this.filename);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + this.filename, "");
             File.Delete(mapPath + "\\" + this.filename);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\app.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
                 this.ShowErr("应用安装配置文件不存在。");
                 return;
             }
             this.appinfo = FPSerializer.Load <AppInfo>(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\app.config");
             if (this.appinfo.guid == "")
             {
                 this.ShowErr("对不起,该应用安装标识码不能为空。");
                 return;
             }
             SqlParam sqlParam = DbHelper.MakeAndWhere("guid", this.appinfo.guid);
             if (DbHelper.ExecuteCount <AppInfo>(new SqlParam[]
             {
                 sqlParam
             }) > 0)
             {
                 this.ShowErr("对不起,该应用已安装,不能重复安装。");
                 return;
             }
         }
         else if (this.step == "step2")
         {
             this.filename = FPRequest.GetString("filename");
             this.appinfo  = FPSerializer.Load <AppInfo>(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\app.config");
             if (this.appinfo.name == "")
             {
                 this.appinfo.name = "无应用名称";
             }
             if (FPRequest.GetString("installpath") == "")
             {
                 this.ShowErr("对不起,安装目录不能为空");
                 return;
             }
             this.appinfo.installpath = FPRequest.GetString("installpath");
             if (!Directory.Exists(FPUtils.GetMapPath(this.webpath + this.appinfo.installpath)))
             {
                 Directory.CreateDirectory(FPUtils.GetMapPath(this.webpath + this.appinfo.installpath));
             }
             string mapPath2   = FPUtils.GetMapPath(this.webpath + this.appinfo.installpath);
             string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename);
             this.appinfo.files = this.CopyDirectory(sourcePath, mapPath2, "");
             this.appinfo.id    = DbHelper.ExecuteInsert <AppInfo>(this.appinfo);
             if (this.appinfo.id > 0)
             {
                 foreach (string strContent in this.appinfo.sortapps.Split(new char[]
                 {
                     '|'
                 }))
                 {
                     string[] array2 = FPUtils.SplitString(strContent, ",", 4);
                     if (!(array2[0] == ""))
                     {
                         DbHelper.ExecuteInsert <SortAppInfo>(new SortAppInfo
                         {
                             appid       = this.appinfo.id,
                             name        = array2[0],
                             markup      = array2[1],
                             indexpage   = array2[2],
                             viewpage    = array2[3],
                             installpath = this.appinfo.installpath
                         });
                     }
                 }
             }
             Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             CacheBll.RemoveSortCache();
             base.Response.Redirect("appmanage.aspx");
         }
     }
     base.SaveRightURL();
 }
Exemple #23
0
 // Token: 0x0600001E RID: 30 RVA: 0x00003758 File Offset: 0x00001958
 protected override void View()
 {
     if (this.pluname != "")
     {
         this.pluginconfig             = FPSerializer.Load <PluginConfig>(FPUtils.GetMapPath(this.webpath + "plugins/" + this.pluname + "/plugin.config"));
         this.pluginconfig.installpath = this.pluname;
     }
     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 != ".plu" && a != ".zip")
         {
             this.ShowErr("对不起,该文件不是方配系统插件更新文件类型。");
         }
         else
         {
             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) + "\\plugin.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                 this.ShowErr("插件配置文件不存在或有错误。");
             }
             else
             {
                 PluginConfig pluginConfig = FPSerializer.Load <PluginConfig>(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\plugin.config");
                 if (pluginConfig.guid == "")
                 {
                     this.ShowErr("对不起,该插件标识码错误,更新失败。");
                 }
                 else
                 {
                     Version v  = new Version(FPUtils.StrToDecimal(pluginConfig.version).ToString("0.0"));
                     Version v2 = new Version(FPUtils.StrToDecimal(this.pluginconfig.version).ToString("0.0"));
                     if (v < v2)
                     {
                         this.ShowErr("对不起,您更新的版本比安装版本还低,不能更新");
                     }
                     else
                     {
                         string mapPath2   = FPUtils.GetMapPath(this.webpath + "plugins/" + pluginConfig.installpath);
                         string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName);
                         pluginupdate.CopyDirectory(sourcePath, mapPath2);
                         Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                         base.Response.Redirect("pluginmanage.aspx");
                     }
                 }
             }
         }
     }
 }
Exemple #24
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();
 }
Exemple #25
0
 // Token: 0x06000025 RID: 37 RVA: 0x00004088 File Offset: 0x00002288
 protected override void View()
 {
     if (this.ispost)
     {
         string mapPath = FPUtils.GetMapPath(this.webpath + "cache");
         if (this.step == "step1")
         {
             this.filename = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a = Path.GetExtension(this.filename).ToLower();
             if (a != ".zip" && a != ".plu")
             {
                 this.ShowErr("该文件不是方配WMS系统插件安装文件类型");
                 return;
             }
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + this.filename))
             {
                 File.Delete(mapPath + "\\" + this.filename);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + this.filename);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + this.filename, "");
             File.Delete(mapPath + "\\" + this.filename);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\plugin.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
                 this.ShowErr("插件安装配置文件不存在。");
                 return;
             }
             this.plugininfo = FPSerializer.Load <PluginConfig>(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\plugin.config");
             if (this.plugininfo.guid == "")
             {
                 this.ShowErr("对不起,该插件安装标识码不能为空。");
                 return;
             }
         }
         else if (this.step == "step2")
         {
             string @string = FPRequest.GetString("installpath");
             if (@string == "")
             {
                 this.ShowErr("安装目录不能为空。");
                 return;
             }
             this.filename               = FPRequest.GetString("filename");
             this.plugininfo             = FPSerializer.Load <PluginConfig>(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\plugin.config");
             this.plugininfo.installpath = @string;
             string mapPath2   = FPUtils.GetMapPath(this.webpath + "plugins/" + this.plugininfo.installpath);
             string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename);
             plugininstall.CopyDirectory(sourcePath, mapPath2);
             Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             base.Response.Redirect("pluginmanage.aspx");
         }
     }
     base.SaveRightURL();
 }
Exemple #26
0
 // Token: 0x06000021 RID: 33 RVA: 0x00003C60 File Offset: 0x00001E60
 protected override void View()
 {
     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 != ".task")
         {
             this.ShowErr("对不起,该文件不是方配系统任务安装文件类型。");
         }
         else
         {
             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) + "\\task.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                 this.ShowErr("应用配置文件不存在或有错误。");
             }
             else
             {
                 TaskInfo taskInfo = FPSerializer.Load <TaskInfo>(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\task.config");
                 if (taskInfo.key == "")
                 {
                     taskInfo.key = Guid.NewGuid().ToString();
                 }
                 SqlParam sqlParam  = DbHelper.MakeAndWhere("key", taskInfo.key);
                 TaskInfo taskInfo2 = DbHelper.ExecuteModel <TaskInfo>(new SqlParam[]
                 {
                     sqlParam
                 });
                 if (taskInfo2.id > 0)
                 {
                     taskInfo2.type = taskInfo.type;
                     taskInfo2.name = taskInfo.name;
                     DbHelper.ExecuteUpdate <TaskInfo>(taskInfo2);
                 }
                 else
                 {
                     DbHelper.ExecuteInsert <TaskInfo>(taskInfo);
                 }
                 DirectoryInfo directoryInfo = new DirectoryInfo(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName));
                 foreach (FileInfo fileInfo in directoryInfo.GetFiles())
                 {
                     if (fileInfo.Extension == ".dll")
                     {
                         fileInfo.CopyTo(FPUtils.GetMapPath(WebConfig.WebPath + "bin/" + fileInfo.Name), true);
                     }
                 }
                 base.Response.Redirect("taskmanage.aspx");
             }
         }
     }
 }
Exemple #27
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();
     }
 }
Exemple #28
0
 // Token: 0x06000006 RID: 6 RVA: 0x000023A8 File Offset: 0x000005A8
 protected override void View()
 {
     this.link = "dbreset.aspx";
     if (this.ispost)
     {
         if (DbConfigs.DbType == FangPage.Data.DbType.Access)
         {
             this.ShowErr("对不起,本操作不支持Access数据库版本,请安装SqlServer版本。");
             return;
         }
         if (this.action == "table")
         {
             string @string = FPRequest.GetString("tablename");
             if (string.IsNullOrEmpty(@string))
             {
                 this.ShowErr("没有选择要重置的表。");
                 return;
             }
             string   text  = "";
             string[] array = FPUtils.SplitString(FPFile.ReadFile(FPUtils.GetMapPath("sqlreset.sql")), "GO\r\n", 8);
             string   text2 = "";
             foreach (string text3 in FPUtils.SplitString(@string))
             {
                 if (text != "")
                 {
                     text += "GO\r\n";
                 }
                 text = text + "TRUNCATE TABLE " + text3;
                 if (text3.EndsWith("WMS_UserInfo"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[0];
                 }
                 else if (text3.EndsWith("WMS_UserGrade"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[1];
                 }
                 else if (text3.EndsWith("WMS_RoleInfo"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[2];
                 }
                 else if (text3.EndsWith("WMS_Permission"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[3];
                 }
                 else if (text3.EndsWith("WMS_MenuInfo"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[4];
                 }
                 else if (text3.EndsWith("WMS_DesktopInfo"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[5];
                 }
                 else if (text3.EndsWith("WMS_ChannelInfo"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[6];
                 }
                 else if (text3.EndsWith("WMS_AttachType"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[7];
                 }
             }
             if (text2 != "")
             {
                 if (text != "")
                 {
                     text += "GO\r\n";
                 }
                 text += text2;
             }
             DbHelper.ExecuteSql(text);
         }
         else if (this.action == "system")
         {
             this.dbtablelist = DbHelper.GetDbTableList();
             string text = "";
             foreach (object obj in this.dbtablelist.Rows)
             {
                 DataRow dataRow = (DataRow)obj;
                 if (dataRow["TABLE_NAME"].ToString().StartsWith(DbConfigs.Prefix))
                 {
                     if (text != "")
                     {
                         text += "|";
                     }
                     text = text + "TRUNCATE TABLE " + dataRow["TABLE_NAME"].ToString();
                 }
             }
             DbHelper.ExecuteSql(text);
             text = FPFile.ReadFile(FPUtils.GetMapPath("sqlreset.sql")).Replace("|", "");
             DbHelper.ExecuteSql(text);
             this.link = this.adminpath + "logout.aspx";
         }
     }
     this.dbtablelist = DbHelper.GetDbTableList();
     base.SaveRightURL();
 }
Exemple #29
0
 // Token: 0x06000061 RID: 97 RVA: 0x00009A40 File Offset: 0x00007C40
 protected override void View()
 {
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
     else if (this.ispost)
     {
         this.examinfo          = DbHelper.ExecuteModel <ExamInfo>(this.examid);
         this.examinfo.passmark = this.examinfo.passmark * this.examinfo.total / 100.0;
         this.examtopiclist     = ExamBll.GetExamTopicList(this.examid, this.paper);
         int num = 0;
         for (int i = 0; i < this.examtopiclist.Count; i++)
         {
             this.examtopiclist[i].questionlist = QuestionBll.GetTopicQuestion(this.channelinfo.id, this.examtopiclist[i]);
             string[] array = FPUtils.SplitString(this.examtopiclist[i].questionlist);
             if (this.examinfo.display == 0)
             {
                 this.examtopiclist[i].questionlist = QuestionBll.GetRandom(array, array.Length);
             }
             num += array.Length;
             this.examtopiclist[i].questions = array.Length;
         }
         this.examinfo.questions = num;
         AsposeWordApp asposeWordApp = new AsposeWordApp();
         if (this.papersize == "a4")
         {
             asposeWordApp.Open(FPUtils.GetMapPath("images\\exampaper_a4.doc"));
         }
         else
         {
             asposeWordApp.Open(FPUtils.GetMapPath("images\\exampaper_a3.doc"));
         }
         asposeWordApp.InsertText("examtitle", this.examinfo.name);
         asposeWordApp.InsertText("subtitle", this.GetPaper(this.paper));
         asposeWordApp.MoveToBookmark("content");
         DataTable  dataTable = new DataTable();
         DataColumn column    = new DataColumn("s0", Type.GetType("System.String"));
         dataTable.Columns.Add(column);
         int num2 = 1;
         foreach (ExamTopic examTopic in this.examtopiclist)
         {
             column = new DataColumn("s" + num2, Type.GetType("System.String"));
             dataTable.Columns.Add(column);
             num2++;
         }
         column = new DataColumn("s" + num2, Type.GetType("System.String"));
         dataTable.Columns.Add(column);
         DataRow dataRow = dataTable.NewRow();
         dataRow["s0"] = "题  号";
         num2          = 1;
         foreach (ExamTopic examTopic in this.examtopiclist)
         {
             dataRow["s" + num2] = this.GetNum(num2);
             num2++;
         }
         dataRow["s" + num2] = "总  分";
         dataTable.Rows.Add(dataRow);
         dataRow       = dataTable.NewRow();
         dataRow["s0"] = "得  分";
         num2          = 1;
         foreach (ExamTopic examTopic in this.examtopiclist)
         {
             dataRow["s" + num2] = "";
             num2++;
         }
         dataRow["s" + num2] = "";
         dataTable.Rows.Add(dataRow);
         asposeWordApp.InsertTable(dataTable, true);
         asposeWordApp.InsertLineBreak();
         num2 = 1;
         foreach (ExamTopic examTopic in this.examtopiclist)
         {
             asposeWordApp.InsertScoreTable(true, true, string.Concat(new object[]
             {
                 examTopic.title,
                 "  (共",
                 examTopic.questions,
                 "题,每题",
                 examTopic.perscore,
                 "分,共",
                 (double)examTopic.questions * examTopic.perscore,
                 "分)"
             }));
             foreach (ExamQuestion examQuestion in this.GetQuestionList(examTopic.questionlist))
             {
                 if (examQuestion.type == 1 || examQuestion.type == 2)
                 {
                     if (this.papertype == 1)
                     {
                         asposeWordApp.Writeln(string.Concat(new object[]
                         {
                             num2,
                             "、",
                             examQuestion.title,
                             "  ",
                             examQuestion.answer
                         }), 12.0, false, "left");
                         asposeWordApp.Writeln(this.Option(asposeWordApp, examQuestion.option, examQuestion.ascount, examQuestion.optionlist), 12.0, false, "left");
                         if (examQuestion.explain != "")
                         {
                             asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left");
                         }
                     }
                     else
                     {
                         asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left");
                         asposeWordApp.Writeln(this.Option(asposeWordApp, examQuestion.option, examQuestion.ascount, examQuestion.optionlist), 12.0, false, "left");
                     }
                 }
                 else if (examQuestion.type == 3)
                 {
                     if (this.papertype == 1)
                     {
                         asposeWordApp.Writeln((string.Concat(new object[]
                         {
                             num2,
                             "、",
                             examQuestion.title,
                             "  (",
                             examQuestion.answer
                         }) == "Y") ? "正确" : "错误)", 12.0, false, "left");
                         if (examQuestion.explain != "")
                         {
                             asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left");
                         }
                     }
                     else
                     {
                         asposeWordApp.Writeln(string.Concat(new object[]
                         {
                             num2,
                             "、",
                             examQuestion.title,
                             "  (    )"
                         }), 12.0, false, "left");
                     }
                 }
                 else if (examQuestion.type == 4)
                 {
                     if (this.papertype == 1)
                     {
                         asposeWordApp.Writeln(num2 + "、" + this.FmAnswer(examQuestion.title), 12.0, false, "left");
                         asposeWordApp.Writeln("答案:" + examQuestion.answer, 12.0, false, "left");
                         if (examQuestion.explain != "")
                         {
                             asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left");
                         }
                     }
                     else
                     {
                         asposeWordApp.Writeln(num2 + "、" + this.FmAnswer(examQuestion.title), 12.0, false, "left");
                     }
                 }
                 else if (examQuestion.type == 5)
                 {
                     if (this.papertype == 1)
                     {
                         asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left");
                         asposeWordApp.Writeln("答:" + examQuestion.answer, 12.0, false, "left");
                         if (examQuestion.explain != "")
                         {
                             asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left");
                         }
                     }
                     else
                     {
                         asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left");
                         asposeWordApp.InsertLineBreak(6);
                     }
                 }
                 else if (examQuestion.type == 6)
                 {
                     asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left");
                 }
                 num2++;
             }
         }
         if (this.papertype == 0)
         {
             asposeWordApp.InsertPagebreak();
             asposeWordApp.Writeln("参考答案", 12.0, true, "center");
             num2 = 1;
             foreach (ExamTopic examTopic in this.examtopiclist)
             {
                 asposeWordApp.InsertLineBreak();
                 asposeWordApp.Writeln(examTopic.title, 12.0, true, "left");
                 foreach (ExamQuestion examQuestion in this.GetQuestionList(examTopic.questionlist))
                 {
                     if (examQuestion.type == 3)
                     {
                         asposeWordApp.Write((num2 + "、" + examQuestion.answer == "Y") ? "正确" : "错误  ", 12.0, false, "left");
                     }
                     else if (examQuestion.type == 6)
                     {
                         asposeWordApp.Write(num2 + "、请按题目打字  ", 12.0, false, "left");
                     }
                     else
                     {
                         asposeWordApp.Write(string.Concat(new object[]
                         {
                             num2,
                             "、",
                             examQuestion.answer,
                             "  "
                         }), 12.0, false, "left");
                     }
                     num2++;
                 }
             }
         }
         asposeWordApp.Save(base.Response, this.examinfo.name + this.GetPaper(this.paper) + ".doc");
     }
 }
Exemple #30
0
        // Token: 0x0600027C RID: 636 RVA: 0x00008E34 File Offset: 0x00007034
        public static string RestoreDatabase(string backupfile)
        {
            string result;

            if (!File.Exists(backupfile))
            {
                result = "备份文件已不存在。";
            }
            else
            {
                DbConfigInfo dbConfig = DbConfigs.GetDbConfig();
                if (dbConfig.dbtype == FangPage.Data.DbType.SqlServer)
                {
                    SQLServer sqlserver = new SQLServerClass();
                    if (Path.GetExtension(backupfile) == ".zip" || Path.GetExtension(backupfile) == ".config")
                    {
                        FPZip.UnZipFile(backupfile, "");
                    }
                    backupfile = string.Concat(new string[]
                    {
                        Path.GetDirectoryName(backupfile),
                        "\\",
                        Path.GetFileName(backupfile),
                        "\\",
                        dbConfig.dbname,
                        ".bak"
                    });
                    if (!File.Exists(backupfile))
                    {
                        return("备份文件已不存在。");
                    }
                    try
                    {
                        sqlserver.Connect(dbConfig.dbpath, dbConfig.userid, dbConfig.password);
                        QueryResults queryResults = sqlserver.EnumProcesses(-1);
                        int          num          = -1;
                        int          num2         = -1;
                        for (int i = 1; i <= queryResults.Columns; i++)
                        {
                            string text = queryResults.get_ColumnName(i);
                            if (text.ToUpper().Trim() == "SPID")
                            {
                                num = i;
                            }
                            else if (text.ToUpper().Trim() == "DBNAME")
                            {
                                num2 = i;
                            }
                            if (num != -1 && num2 != -1)
                            {
                                break;
                            }
                        }
                        for (int i = 1; i <= queryResults.Rows; i++)
                        {
                            int    columnLong   = queryResults.GetColumnLong(i, num);
                            string columnString = queryResults.GetColumnString(i, num2);
                            if (columnString.ToUpper() == dbConfig.dbname.ToUpper())
                            {
                                sqlserver.KillProcess(columnLong);
                            }
                        }
                        ((_Restore) new RestoreClass
                        {
                            Action = SQLDMO_RESTORE_TYPE.SQLDMORestore_Database,
                            Files = backupfile,
                            Database = dbConfig.dbname,
                            ReplaceDatabase = true
                        }).SQLRestore(sqlserver);
                        File.Delete(backupfile);
                        return(string.Empty);
                    }
                    catch (Exception ex)
                    {
                        return(ex.Message);
                    }
                    finally
                    {
                        sqlserver.DisConnect();
                    }
                }
                string mapPath = FPUtils.GetMapPath(WebConfig.WebPath + Path.GetDirectoryName(dbConfig.dbpath));
                try
                {
                    if (!Directory.Exists(mapPath))
                    {
                        Directory.CreateDirectory(mapPath);
                    }
                    if (Path.GetExtension(backupfile) == ".zip" || Path.GetExtension(backupfile) == ".config")
                    {
                        FPZip.UnZipFile(backupfile, mapPath);
                    }
                    else
                    {
                        File.Copy(backupfile, mapPath + "\\" + dbConfig.dbname);
                    }
                    result = string.Empty;
                }
                catch (Exception ex)
                {
                    result = ex.Message;
                }
            }
            return(result);
        }