예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        using (SiteBLL bll = new SiteBLL())
        {
            int newid;
            if (!int.TryParse(Web9long.Web.Util.Query("id"), out newid))
                Web9long.Web.Clew.AlertBack("参数错误");

            etyInfo = bll.GetOnlyRow<EmptyTable>("select * from SYS_Article where ArticleID=" + newid);
            etyInfo.Set("content",GetInnerlink(etyInfo.Get<string>("content")));

            if (etyInfo == null) Web9long.Web.Clew.AlertBack("查找的信息不存在");

            etyChannel = bll.GetOnlyRow<EmptyTable>("select * from SYS_channel where CL_ID=" + etyInfo.Get<string>("ChannelID"));

            etyClass = bll.GetOnlyRow<EmptyTable>("select * from SYS_Category where CateID=" + etyInfo.Get<string>("CategoryID"));

            string sql = @" select top 11 CategoryID,title, ArticleID,CateCallIndex,CL_Name,Addtime,Zhaiyao,Catetitle from SYS_Article,SYS_Category,SYS_channel
                where SYS_Article.CategoryID=SYS_Category.CateID and sys_article.ChannelID=SYS_channel.CL_ID
                and Islock<>1 and Isred=1
                order by Addtime desc,Sortid desc,ArticleID desc
            ";
            List<EmptyTable> ls = bll.GetList<EmptyTable>(sql);
            if (ls != null && ls.Count > 0)
            {
                topety = ls[0];
                ls.Remove(topety);
            }
            this.rpt_list_tuijian.DataSource = ls;


            //频道精华
            sql = @" select top 11 CategoryID,title, ArticleID,CateCallIndex,CL_Name,Addtime,Zhaiyao from SYS_Article,SYS_Category,SYS_channel
                where SYS_Article.CategoryID=SYS_Category.CateID and sys_article.ChannelID=SYS_channel.CL_ID
                and Islock<>1 and Isred=1 {0}
                order by Sortid desc,Addtime desc,ArticleID desc
            ";

            sql = string.Format(sql, " and sys_article.ChannelID=" + etyInfo.Get<string>("ChannelID"));

            this.rpt_topNew.DataSource = bll.GetList<EmptyTable>(sql);

            //相关文章
            sql = @" select top 6 CategoryID,title, ArticleID,CateCallIndex,CL_Name,Addtime,Zhaiyao,Imgurl,Seokeywords from SYS_Article,SYS_Category,SYS_channel
                where SYS_Article.CategoryID=SYS_Category.CateID and sys_article.ChannelID=SYS_channel.CL_ID
                and Islock<>1  and Imgurl<>''  {0}
                order by Sortid desc,Addtime desc,ArticleID desc
            ";

            StringBuilder sb = new StringBuilder();
            string keywwords=etyInfo.Get<string>("Seokeywords");
            if(string.IsNullOrEmpty(keywwords))
            {
                string[] a = keywwords.Split(',');
                if (a.Length > 0)
                {
                    sb.Append(" and (");
                    int i = 0;
                    foreach (string s in a)
                    {
                        if(i==0)
                        sb.Append(" Seokeywords like '%" + s + ",'");
                        else
                            sb.Append(" or Seokeywords like '%" + s + ",'");
                    }
                    sb.Append(")");
                }
              
            }
            sql = string.Format(sql,sb.ToString());
            ls = bll.GetList<EmptyTable>(sql);
            rpt_list_6More.DataSource = ls;
            this.Page.DataBind();
        }

    }
예제 #2
0
    /// <summary>
    /// 内容分页
    /// </summary>
    /// <param name="chid"></param>
    /// <param name="nowid"></param>
    /// <returns></returns>
    public  string ContentPageList(int catid, int nowid)
    {
        StringBuilder sb = new StringBuilder();

        EmptyTable ety = null;
        sb.AppendLine(" <div class=\"pianshu\">");


        string sql = @" select top 1 CategoryID,title, ArticleID,CateCallIndex,Addtime from SYS_Article,SYS_Category
                where SYS_Article.CategoryID=SYS_Category.CateID 
                and Islock<>1 and  ArticleID <{0} and CategoryID={1} order by ArticleID desc
            ";
        
        //上一页

        using (SiteBLL bll = new SiteBLL())
        {

            ety = bll.GetOnlyRow<EmptyTable>(string.Format(sql, nowid, catid));
            if (ety != null)
                sb.AppendLine("上一篇:<a href=\"http://" + Web9long.Web.Util.GetHttpUrl() + ety.Get<string>("CateCallIndex") + "/" + ety.Get<string>("ArticleID") + ".html\">" + ety.Get<string>("title") + "</a>");
            //下一页
            sql = @" select top 1 CategoryID,title, ArticleID,CateCallIndex,Addtime from SYS_Article,SYS_Category
                where SYS_Article.CategoryID=SYS_Category.CateID 
                and Islock<>1 and  ArticleID >{0} and CategoryID={1} order by ArticleID desc
            ";
            ety = bll.GetOnlyRow<EmptyTable>(string.Format(sql, nowid, catid));
            if (ety != null)
                sb.AppendLine("下一篇:<a href=\"http://" + Web9long.Web.Util.GetHttpUrl() + ety.Get<string>("CateCallIndex") + "/" + ety.Get<string>("ArticleID") + ".html\">" + ety.Get<string>("title") + "</a>");

            sb.AppendLine("</div> ");
            return sb.ToString();
        }

    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        using (SiteBLL bll = new SiteBLL())
        {
            if (!int.TryParse(Web9long.Web.Util.Query("channelid"), out channelid)) Web9long.Web.Clew.AlertBack("参数错误");
            if (!int.TryParse(Web9long.Web.Util.Query("classid"), out categoryid)) categoryid = 0;

            //绑定频道下的类别
            List<EmptyTable> ls = bll.GetList<EmptyTable>("select CateID,CateCallIndex,Catetitle,Cateseotitle,Cateseokeywords,Cateseodescription from SYS_Category where ChannelID=" + this.channelid + " order by CateSortID desc,CateID desc");

            if (ls != null && ls.Count > 0)
            {
                foreach (EmptyTable et in ls)
                {
                    if (et.Get<int>("CateID") == categoryid)
                        etyClass = et;
                    break;
                }
            }
            etyChannel = bll.GetOnlyRow<EmptyTable>("select * from SYS_channel where CL_ID=" + channelid);
            seotitle = etyChannel.Get<string>("CL_SeoTitle");
            seokeywords = etyChannel.Get<string>("CL_Keywords");
            seodes = etyChannel.Get<string>("CL_Description");

            if (categoryid > 0)
            {
                etyClass = bll.GetOnlyRow<EmptyTable>("select * from SYS_Category where CateID=" + categoryid);
                seotitle = etyClass.Get<string>("Cateseotitle");
                seokeywords = etyClass.Get<string>("Cateseokeywords");
                seodes = etyClass.Get<string>("Cateseodescription");
            }

            Com_Config webconfig = Loneu.BLL.Config.WebSiteConfig.Info();

            this.rpt_class.DataSource = ls;
            this.rpt_class.DataBind();

            //内容列表

            HtmlPageUrl1.Pagesize = 15;
            HtmlPageUrl1.Nowpage = int.Parse(Web9long.Web.Util.Query("AsPage"));
            HtmlPageUrl1.Allcount = int.Parse(Web9long.Web.Util.Query("AsCount"));
            if (categoryid > 0)
            {
                HtmlPageUrl1.Pagename = "List_" + categoryid.ToString();
            }
            else
            {
                HtmlPageUrl1.Pagename = "List_" + channelid.ToString();
            }

            Web9long.DB.SqlCreate strsql = new Web9long.DB.MSSQL().GetSqlCreate();
            strsql.Table = "(select ArticleID,SYS_Article.ChannelID,CategoryID,title,Sortid,Addtime,Ismsg,Istop,Isred,Ishot,Isslide,Catetitle,CateCallIndex,Zhaiyao from  SYS_Article,SYS_Category where  CategoryID=CateID ) t";
            strsql.Fild = "ArticleID,ChannelID,CategoryID,title,Sortid,Addtime,Ismsg,Istop,Isred,Ishot,Isslide,Catetitle,CateCallIndex,Zhaiyao";
            strsql.Order = "order by Istop desc,Sortid desc,ArticleID desc";
            strsql.AddAndWhere(" ChannelID=" + this.channelid);
            if (this.categoryid > 0)
                strsql.AddAndWhere("CategoryID=" + this.categoryid);

            if (AsGet2.Count == 0)
                AsGet2.Count = bll.GetCount(AsGet2.MakeCountSql(strsql.Table, strsql.Where));
            AsGet2.Compute();
            this.rpt_ContentList.DataSource = bll.GetList<EmptyTable>(AsGet2.MakeSql(strsql.Fild, strsql.Table, strsql.Where, "ArticleID", strsql.Order));
            this.rpt_ContentList.DataBind();


            string sql = @" select top 10 CategoryID,Catetitle, title, ArticleID,CateCallIndex,CL_Name,Addtime,Zhaiyao from SYS_Article,SYS_Category,SYS_channel
                where SYS_Article.CategoryID=SYS_Category.CateID and sys_article.ChannelID=SYS_channel.CL_ID
                and Islock<>1 {0} 
                order by ClickHits desc,Sortid desc,ArticleID desc
            ";
            if (this.categoryid > 0)
            {
                sql = string.Format(sql, " and sys_article.ChannelID=" + this.channelid + " and SYS_Article.CategoryID=" + this.categoryid);
            }
            else
            {
                sql = string.Format(sql, " and sys_article.ChannelID=" + this.channelid);
            }

            this.rpt_list_hot.DataSource = bll.GetList<EmptyTable>(sql);

            sql = @" select top 11 CategoryID,title, ArticleID,CateCallIndex,CL_Name,Addtime,Zhaiyao,Catetitle from SYS_Article,SYS_Category,SYS_channel
                where SYS_Article.CategoryID=SYS_Category.CateID and sys_article.ChannelID=SYS_channel.CL_ID
                and Islock<>1 and Isred=1
                order by Addtime desc,Sortid desc,ArticleID desc
            ";
            ls = bll.GetList<EmptyTable>(sql);
            if (ls != null && ls.Count > 0)
            {
                topety = ls[0];
                ls.Remove(topety);
            }
            this.rpt_list_tuijian.DataSource = ls;
            this.Page.DataBind();
        }
    }