Beispiel #1
0
 /// <summary>
 /// 从模板说明文件中获得模板说明信息
 /// </summary>
 /// <param name="xmlPath">模板路径(不包含文件名)</param>
 /// <returns>模板说明信息</returns>
 private Model.template GetInfo(string xmlPath)
 {
     Model.template model = new Model.template();
     ///存放关于信息的文件 about.xml是否存在,不存在返回空串
     if (!File.Exists(xmlPath + @"\about.xml"))
     {
         return(null);
     }
     try
     {
         XmlNodeList xnList = XmlHelper.ReadNodes(xmlPath + @"\about.xml", "about");
         foreach (XmlNode n in xnList)
         {
             if (n.NodeType != XmlNodeType.Comment && n.Name.ToLower() == "template")
             {
                 model.name       = n.Attributes["name"] != null ? n.Attributes["name"].Value.ToString() : "";
                 model.author     = n.Attributes["author"] != null ? n.Attributes["author"].Value.ToString() : "";
                 model.createdate = n.Attributes["createdate"] != null ? n.Attributes["createdate"].Value.ToString() : "";
                 model.version    = n.Attributes["version"] != null ? n.Attributes["version"].Value.ToString() : "";
                 model.fordntver  = n.Attributes["fordntver"] != null ? n.Attributes["fordntver"].Value.ToString() : "";
             }
         }
     }
     catch
     {
         return(null);
     }
     return(model);
 }
 /// <summary>
 /// 从模板说明文件中获得模板说明信息
 /// </summary>
 /// <param name="xmlPath">模板路径(不包含文件名)</param>
 /// <returns>模板说明信息</returns>
 private Model.template GetInfo(string xmlPath)
 {
     Model.template model = new Model.template();
     ///存放关于信息的文件 about.xml是否存在,不存在返回空串
     if (!File.Exists(xmlPath + @"\about.xml"))
     {
         return null;
     }
     try
     {
         XmlNodeList xnList = XmlHelper.ReadNodes(xmlPath + @"\about.xml", "about");
         foreach (XmlNode n in xnList)
         {
             if (n.NodeType != XmlNodeType.Comment && n.Name.ToLower() == "template")
             {
                 model.name = n.Attributes["name"] != null ? n.Attributes["name"].Value.ToString() : "";
                 model.author = n.Attributes["author"] != null ? n.Attributes["author"].Value.ToString() : "";
                 model.createdate = n.Attributes["createdate"] != null ? n.Attributes["createdate"].Value.ToString() : "";
                 model.version = n.Attributes["version"] != null ? n.Attributes["version"].Value.ToString() : "";
                 model.fordntver = n.Attributes["fordntver"] != null ? n.Attributes["fordntver"].Value.ToString() : "";
             }
         }
     }
     catch
     {
         return null;
     }
     return model;
 }
Beispiel #3
0
        private void RptBind()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("skinname", Type.GetType("System.String"));
            dt.Columns.Add("name", Type.GetType("System.String"));
            dt.Columns.Add("img", Type.GetType("System.String"));
            dt.Columns.Add("author", Type.GetType("System.String"));
            dt.Columns.Add("createdate", Type.GetType("System.String"));
            dt.Columns.Add("version", Type.GetType("System.String"));
            dt.Columns.Add("fordntver", Type.GetType("System.String"));

            DirectoryInfo dirInfo = new DirectoryInfo(Utils.GetMapPath("../../templates/"));

            foreach (DirectoryInfo dir in dirInfo.GetDirectories())
            {
                DataRow        dr    = dt.NewRow();
                Model.template model = GetInfo(dir.FullName);
                if (model != null)
                {
                    dr["skinname"]   = dir.Name;                                     //文件夹名称
                    dr["name"]       = model.name;                                   // 模板名称
                    dr["img"]        = "../../templates/" + dir.Name + "/about.png"; // 模板图片
                    dr["author"]     = model.author;                                 //作者
                    dr["createdate"] = model.createdate;                             //创建日期
                    dr["version"]    = model.version;                                //模板版本
                    dr["fordntver"]  = model.fordntver;                              //适用的版本
                    dt.Rows.Add(dr);
                }
            }
            this.rptList.DataSource = dt;
            this.rptList.DataBind();
        }
Beispiel #4
0
        private void RptBind(int _site_id)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("skinname", Type.GetType("System.String"));
            dt.Columns.Add("version", Type.GetType("System.String"));
            dt.Columns.Add("preview", Type.GetType("System.String"));
            dt.Columns.Add("name", Type.GetType("System.String"));
            dt.Columns.Add("demo", Type.GetType("System.String"));
            dt.Columns.Add("img", Type.GetType("System.String"));
            dt.Columns.Add("author", Type.GetType("System.String"));
            dt.Columns.Add("description", Type.GetType("System.String"));
            dt.Columns.Add("website", Type.GetType("System.String"));
            dt.Columns.Add("createdate", Type.GetType("System.String"));

            DirectoryInfo dirInfo = new DirectoryInfo(Utils.GetMapPath("../../templates/"));

            foreach (DirectoryInfo dir in dirInfo.GetDirectories())
            {
                DataRow        dr    = dt.NewRow();
                Model.template model = GetInfo(dir.FullName);
                if (model != null)
                {
                    dr["skinname"]    = dir.Name;                                     //文件夹名称
                    dr["version"]     = model.version;                                //模板版本
                    dr["preview"]     = model.preview;                                //缩略图
                    dr["name"]        = model.name;                                   // 模板名称
                    dr["demo"]        = model.demo;                                   // 演示地址
                    dr["img"]         = "../../templates/" + dir.Name + "/about.png"; // 模板图片
                    dr["author"]      = model.author;                                 //作者
                    dr["description"] = model.description;                            //版本描述
                    dr["website"]     = model.website;                                //网站域名
                    dr["createdate"]  = model.createdate;                             //创建日期
                    dt.Rows.Add(dr);
                }
            }

            //获取站点信息
            Model.channel_site modelt = new BLL.channel_site().GetModel(this.site_id);
            if (modelt != null)
            {
                //复制新表
                DataTable dtNew = dt.Clone();
                //重新筛选
                DataRow[] drArr = dt.Select(string.Format("skinname='{0}'", modelt.templet_path));
                for (int i = 0; i < drArr.Length; i++)
                {
                    dtNew.ImportRow(drArr[i]);
                }
                this.rptCurrent.DataSource = dtNew;
                this.rptCurrent.DataBind();

                //复制新表
                DataTable dtNew2 = dt.Clone();
                DataRow[] oldArr = dt.Select(string.Format("skinname<>'{0}'", modelt.templet_path));
                //重新写入表
                for (int i = 0; i < oldArr.Length; i++)
                {
                    dtNew2.ImportRow(oldArr[i]);
                }
                this.rptList.DataSource = dtNew2;
                this.rptList.DataBind();
            }
            else
            {
                this.rptList.DataSource = dt;
                this.rptList.DataBind();
            }
        }