Example #1
0
 /// <summary>
 /// 静态生成频道封面
 /// </summary>
 /// <param name="IndexModels"></param>
 /// <returns></returns>
 public static bool StaticChannel(int Type)
 {
     try
     {
         string ChannelUrl = new ROYcms.Templet.GetMyUrl().GetStaticChannel(Type, 0);
         if (ChannelUrl == null)
         {
             return(false);
         }
         //2013-08-07修复BUG
         Thread.Sleep(200);//暂停0.5秒
         string ChannelD = new IndexDate().GetChannelDate(Type);
         if (ChannelD == null)
         {
             return(false);
         }
         GRoot(ChannelUrl);//创建目录
         return(ROYcms.Common.SystemCms.Create(HttpContext.Current.Server.MapPath(ChannelUrl), ChannelD, IndexDate.EncodIng));
     }
     catch
     {
         new ROYcms.Sys.BLL.ROYcms_Log().InsertSystemLog("5", "静态生成频道失败", "静态生成频道失败");//写入日志
         return(false);
     }
 }
Example #2
0
 /// <summary>
 /// 静态生成文章
 /// </summary>
 /// <param name="IndexModels"></param>
 /// <returns></returns>
 public static bool StaticArticle(int Id)
 {
     try
     {
         string ArticleUrl = new ROYcms.Templet.GetMyUrl().GetStaticArticle(Id);
         if (ArticleUrl == null)
         {
             return(false);
         }
         //2013-08-07修复BUG
         Thread.Sleep(200);//暂停0.5秒
         string ArticleD = new IndexDate().GetArticleDate(Id);
         if (ArticleD == null)
         {
             return(false);
         }
         GRoot(ArticleUrl);//创建目录
         return(ROYcms.Common.SystemCms.Create(HttpContext.Current.Server.MapPath(ArticleUrl), ArticleD, IndexDate.EncodIng));
     }
     catch
     {
         new ROYcms.Sys.BLL.ROYcms_Log().InsertSystemLog("5", "静态生成文章失败", "静态生成文章失败");//写入日志
         return(false);
     }
 }
Example #3
0
        /// <summary>
        /// 静态生成频道的列表
        /// </summary>
        /// <param name="IndexModels"></param>
        /// <returns></returns>
        public static bool StaticChannelList(int Type, int page)
        {
            try
            {
                bool e = false;
                if (page > 0)
                {
                    //2013-07-27修复BUG   i = 1
                    for (int i = 1; i < page; i++)
                    {
                        //2013-08-07修复BUG
                        Thread.Sleep(200);//暂停0.5秒

                        string ChannelListUrl = new ROYcms.Templet.GetMyUrl().GetStaticChannel(Type, 1);
                        //2013-07-27修复BUG
                        if (ChannelListUrl == null)
                        {
                            return(false);
                        }
                        ChannelListUrl = ChannelListUrl.ToLower().Replace("{page}", i.ToString());//替换参数

                        string ChannelListD = new IndexDate().GetChannelListDate(Type, i);
                        //2013-07-27修复BUG
                        if (ChannelListD == null)
                        {
                            return(false);
                        }
                        GRoot(ChannelListUrl);//创建目录
                        e = ROYcms.Common.SystemCms.Create(HttpContext.Current.Server.MapPath(ChannelListUrl), ChannelListD, IndexDate.EncodIng);
                    }
                }
                return(e);
            }
            catch
            {
                new ROYcms.Sys.BLL.ROYcms_Log().InsertSystemLog("5", "静态生成频道的列表失败", "静态生成频道的列表失败");//写入日志
                return(false);
            }
        }
Example #4
0
 /// <summary>
 ///  静态生成首页
 /// </summary>
 /// <returns></returns>
 public static bool StaticI()
 {
     try
     {
         string IndexUrl = new ROYcms.Templet.GetMyUrl().GetStaticIndex();
         if (IndexUrl == null)
         {
             return(false);
         }
         //2013-08-07修复BUG
         Thread.Sleep(200);//暂停0.5秒
         string IndexD = new IndexDate().IDate();
         if (IndexD == null)
         {
             return(false);
         }
         return(ROYcms.Common.SystemCms.Create(HttpContext.Current.Server.MapPath(IndexUrl), IndexD, IndexDate.EncodIng));
     }
     catch {
         new ROYcms.Sys.BLL.ROYcms_Log().InsertSystemLog("5", "静态生成首页失败", "静态生成首页失败");//写入日志
         return(false);
     }
 }
Example #5
0
        protected override void OnDataBinding(EventArgs e)
        {
            string Strs = null;

            if (this.Tag != null)//Tag标签
            {
                Strs += "tag like '%" + this.Tag + "%' AND ";
            }
            if (this.Switchs != null)//审核状态
            {
                Strs += "Switchs = " + this.Switchs + " AND ";
            }
            if (this.Ding != null)//置顶状态
            {
                Strs += "Ding = " + this.Ding + " AND ";
            }
            if (this.Tuijian != null)//推荐状态
            {
                Strs += "Tuijian = " + this.Tuijian + " AND ";
            }
            if (this.Type != null)    //Class分类ID标识
            {
                if (this.Son != null) //是否包含子类内容
                {
                    Strs += " classname in (" + new SQLSplitJoint().ClassWheres(this.Type) + ") AND ";
                }
                else if (this.Type.Contains("|"))
                {
                    Strs += new SQLSplitJoint().Wheres(this.Type, "classname") + " AND ";
                }
                else
                {
                    Strs += "classname='" + this.Type + "' AND ";
                }
            }
            if (this.ClassKind != null)//ClassKind标识
            {
                Strs += "type='" + this.ClassKind + "' AND ";
            }
            Strs += "bh>-1 ";

            if (this.StrWhere != null) //自定义SQL查询条件
            {
                Strs = this.StrWhere;
            }
            if (this.SQL != null) //自定义SQL语句
            {
                Strs = this.SQL;
            }

            DataSet DS = this.NewBll.GetList(Top, Strs, this.FiledOrder);

            if ((!this.Type.Contains("|")) && this.Type != null)
            {
                //获取智能表单的数据
                string[] TableLists = null;
                TableLists = this.CustomBll.GetTableList(Convert.ToInt32(this.Type));
                //增加几列   文章链接、栏目名称、栏目链接
                if (DS.Tables[0].Rows.Count > 0)
                {
                    DS.Tables[0].Columns.Add("ShowLink", typeof(System.String));        //添加一列数据 文章链接
                    DS.Tables[0].Columns.Add("ChannelName", typeof(System.String));     //添加一列数据 栏目名称
                    DS.Tables[0].Columns.Add("ChannelLink", typeof(System.String));     //添加一列数据 栏目链接
                    DS.Tables[0].Columns.Add("ChannelListLink", typeof(System.String)); //添加一列数据 栏目链接2
                    if (TableLists != null)
                    {
                        for (int i = 0; i < TableLists.Length; i++)
                        {
                            DS.Tables[0].Columns.Add(TableLists[i], typeof(System.String));//添加一列数据
                        }
                    }
                    foreach (DataRow Dr in DS.Tables[0].Rows)
                    {
                        Dr["ShowLink"]        = new ROYcms.Templet.GetMyUrl().GetArticle(Convert.ToInt32(Dr["bh"]));
                        Dr["ChannelName"]     = this.ClassBll.GetClassField(Convert.ToInt32(Dr["classname"]), "ClassName");
                        Dr["ChannelLink"]     = new ROYcms.Templet.GetMyUrl().GetChannel(Convert.ToInt32(Dr["classname"]), 0);
                        Dr["ChannelListLink"] = new ROYcms.Templet.GetMyUrl().GetChannel(Convert.ToInt32(Dr["classname"]), 1);
                        if (TableLists != null)
                        {
                            for (int i = 0; i < TableLists.Length; i++)
                            {
                                Dr[TableLists[i]] = this.CustomBll.GetVal(Convert.ToInt32(Dr["bh"]), Convert.ToInt32(Dr["classname"]), TableLists[i]); //赋值 Dr["bh"] Dr["classname"]
                            }
                        }
                    }
                }
            }
            dataSource      = (IList)(new DataView(((DataSet)(DS)).Tables[0]));
            base.DataSource = dataSource;
            intItemCount    = dataSource.Count;
            base.OnDataBinding(e);
        }
Example #6
0
        protected override void OnDataBinding(EventArgs e)
        {
            string Strs = null;
            // int Count;
            DataSet DS = null;

            //Tag标签
            if (this.Tag != null)
            {
                Strs += "tag like '%" + this.Tag + "%' and ";
            }
            //审核状态
            if (this.Switchs != null)
            {
                Strs += "Switchs = " + this.Switchs + " and ";
            }
            //置顶状态
            if (this.Ding != null)
            {
                Strs += "Ding = " + this.Ding + " and ";
            }
            //推荐状态
            if (this.Tuijian != null)
            {
                Strs += "Tuijian = " + this.Tuijian + " and ";
            }
            //Class分类ID标识
            if (this.Type != null)
            {
                //是否包含子类内容
                if (this.Son != null)
                {
                    Strs += " classname in (" + ClassWheres() + ") and ";
                }
                else
                {
                    Strs += "classname='" + this.Type + "' and ";
                }
            }

            //ClassKind标识
            if (this.ClassKind != null)
            {
                Strs += "type='" + this.ClassKind + "' and ";
            }
            if (Strs.EndsWith("and "))
            {
                Strs = Strs.Remove(Strs.LastIndexOf("and"), 4);
            }
            //自定义SQL查询条件
            if (this.StrWhere != null)
            {
                Strs = this.StrWhere;
            }
            //自定义SQL语句
            if (this.SQL != null)
            {
                Strs = this.SQL;
            }

            DS = new ROYcms.Sys.BLL.ROYcms_news().GetList(this.PageSize, Convert.ToInt32(this.CurrentPageIndex), Strs, 1, "TIME");


            //增加几列   文章链接、栏目名称、栏目链接
            if (DS.Tables[0].Rows.Count > 0)
            {
                DS.Tables[0].Columns.Add("ShowLink", typeof(System.String));        //添加一列数据 文章链接
                DS.Tables[0].Columns.Add("ChannelName", typeof(System.String));     //添加一列数据 栏目名称
                DS.Tables[0].Columns.Add("ChannelLink", typeof(System.String));     //添加一列数据 栏目链接
                DS.Tables[0].Columns.Add("ChannelListLink", typeof(System.String)); //添加一列数据 栏目链接2

                foreach (DataRow Dr in DS.Tables[0].Rows)
                {
                    Dr["ShowLink"]        = new ROYcms.Templet.GetMyUrl().GetArticle(Convert.ToInt32(Dr["bh"]));
                    Dr["ChannelName"]     = this.ClassBll.GetClassField(Convert.ToInt32(Dr["classname"]), "ClassName");
                    Dr["ChannelLink"]     = new ROYcms.Templet.GetMyUrl().GetChannel(Convert.ToInt32(Dr["classname"]), 0);
                    Dr["ChannelListLink"] = new ROYcms.Templet.GetMyUrl().GetChannel(Convert.ToInt32(Dr["classname"]), 1);
                }
            }

            DataView dv = new DataView();

            dv.Table   = DS.Tables[0];
            dv.Sort    = this.FiledOrder;
            dataSource = (IList)dv;

            intItemCount = new ROYcms.Sys.BLL.ROYcms_news().GetCount(Strs);
            if (CurrentPageIndex != "1")
            {
                this.RealSource = true;
            }
            if (this.RealSource) //数据源已分页
            {
                base.DataSource = dataSource;
            }
            else//数据源未分页
            {
                int start = (Convert.ToInt32(intCurrentPage) - 1) * intPageSize;
                int size  = Math.Min(intPageSize, intItemCount - start);

                IList list = new ArrayList();

                for (int i = 0; i < size; i++)
                {
                    list.Add(dataSource[start + i]);
                }
                base.DataSource = list;
            }
            base.OnDataBinding(e);
        }