/// <summary>
        /// 获得数据列表
        /// </summary>
        public List <ROYcms.Sys.Model.ROYcms_template> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            List <ROYcms.Sys.Model.ROYcms_template> modelList = new List <ROYcms.Sys.Model.ROYcms_template>();
            int rowsCount = ds.Tables[0].Rows.Count;

            if (rowsCount > 0)
            {
                ROYcms.Sys.Model.ROYcms_template model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ROYcms.Sys.Model.ROYcms_template();
                    if (ds.Tables[0].Rows[n]["bh"].ToString() != "")
                    {
                        model.bh = int.Parse(ds.Tables[0].Rows[n]["bh"].ToString());
                    }
                    model.name        = ds.Tables[0].Rows[n]["name"].ToString();
                    model.tag         = ds.Tables[0].Rows[n]["tag"].ToString();
                    model.htmlcontent = ds.Tables[0].Rows[n]["htmlcontent"].ToString();
                    if (ds.Tables[0].Rows[n]["htmltimes"].ToString() != "")
                    {
                        model.htmltimes = DateTime.Parse(ds.Tables[0].Rows[n]["htmltimes"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #2
0
        /// <summary>
        /// GEs the t_ DATE.
        /// </summary>
        /// <param name="Con">The con.</param>
        /// <returns></returns>
        public string ArticlsHtml(HttpContext Con)
        {
            //初始化一些参数
            this.Context  = Con;
            this.type     = Context.Request["type"];
            this.bh       = Context.Request["id"];
            this.templet  = Context.Request["templet"];
            this.pageNum  = Context.Request["page_Num"]; //分页  page 参数
            this.classs   = Context.Request["class"];    //list页的分类编号参数
            this.pageHost = Context.Request["host"];
            //模板URL
            string templet_url = "~/" + config.templet_root + "/" + TemplateZone.TemplateZpath(this.pageHost) + "/" + type + templet + ".html";
            //读取 模板
            StringBuilder HTM = new StringBuilder();

            if (DataCache.GetCache(templet_url) == null)
            {
                try
                {
                    if (SystemCms.Read_File(Context.Server.MapPath(templet_url), config.templet_language) == null)
                    {
                        //目录不存在创建
                        if (!Directory.Exists(Con.Server.MapPath("~/" + config.templet_root + "/" + TemplateZone.TemplateZpath(this.pageHost) + "/")))
                        {
                            Directory.CreateDirectory(Con.Server.MapPath("~/" + config.templet_root + "/" + TemplateZone.TemplateZpath(this.pageHost) + "/"));
                        }

                        if (this.templet != null)
                        {
                            ROYcms.Sys.Model.ROYcms_template model = _BLL.GetModel(Convert.ToInt32(this.templet));
                            HTM.Append(model.htmlcontent);
                            SystemCms.CreateFile(Con.Server.MapPath(templet_url), model.htmlcontent, config.templet_language);
                        }
                        else
                        {
                            HTM.Append("模板不存在!");
                            SystemCms.CreateFile(Con.Server.MapPath(templet_url), "ROYcms!NT  空模板,请编辑", config.templet_language);
                        }
                    }
                    else
                    {
                        HTM.Append(SystemCms.Read_File(Context.Server.MapPath(templet_url), config.templet_language));
                    }
                    DataCache.SetCache(templet_url, (object)SystemCms.Read_File(Context.Server.MapPath(templet_url), config.templet_language));
                }
                catch { HTM.Append("读取模板异常!确定是否有创建文件的权限"); }
            }
            else
            {
                HTM.Append(DataCache.GetCache(templet_url).ToString());
            }
            if (config.HTML_zip == "true")
            {
                return(SystemCms.ZipHtml(LoopClass(loopPage(ShowTag(LoopTag(PublicTag(HTM.ToString())))))));
            }
            else
            {
                return(LoopClass(loopPage(ShowTag(LoopTag(PublicTag(HTM.ToString()))))));
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(ROYcms.Sys.Model.ROYcms_template model)
 {
     dal.Update(model);
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ROYcms.Sys.Model.ROYcms_template model)
 {
     return(dal.Add(model));
 }