private void RemoveTemplateInDB(string templateidlist, string tempstr)
        {
            #region 移除模板
            GeneralConfigInfo __configinfo = GeneralConfigs.GetConfig();
            if (tempstr.IndexOf("," + __configinfo.Templateid + ",") >= 0) //当要删除的模板是系统的默认模板时
            {
                __configinfo.Templateid = 1;
            }

            GeneralConfigs.Serialiaze(__configinfo, AppDomain.CurrentDomain.BaseDirectory + "config/general.config");

            DatabaseProvider.GetInstance().UpdateForumAndUserTemplateId(templateidlist);
            AdminTemplates.DeleteTemplateItem(templateidlist);

            Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/TemplateList");
            Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/TemplateIDList");
            Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/TemplateListBoxOptions");
            AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "从数据库中删除模板文件", "ID为:" + DNTRequest.GetString("templateid").Replace("0 ", "").Trim());
            #endregion
        }
        public void LoadTemplateData()
        {
            #region 加载模板数据

            path = AppDomain.CurrentDomain.BaseDirectory + "templates/";

            string templatepath   = "由于目录 : ";
            string templateidlist = "0";
            foreach (DataRow dr in buildGridData().Select("valid =1"))
            {
                DirectoryInfo dirinfo = new DirectoryInfo(path + dr["directory"].ToString() + "/");
                if (dr["directory"].ToString().ToLower() == "default")
                {
                    continue;
                }
                if (!dirinfo.Exists)
                {
                    templatepath   += dr["directory"].ToString() + " ,";
                    templateidlist += "," + dr["templateid"].ToString();
                }
            }

            if ((templateidlist != "") && (templateidlist != "0"))
            {
                base.RegisterStartupScript("", "<script>alert('" + templatepath.Substring(0, templatepath.Length - 1) + "已被删除, 因此系统将自动更新模板列表!')</script>");
                AdminTemplates.DeleteTemplateItem(templateidlist);
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "从数据库中删除模板文件", "ID为:" + templateidlist);
                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/TemplateIDList");
                Templates.GetValidTemplateIDList();
            }

            DataGrid1.AllowCustomPaging = false;
            DataGrid1.DataSource        = buildGridData();
            DataGrid1.DataBind();

            #endregion
        }