void CreateClassHtml() { //文件夹名称 string dir = string.Empty; string listid = string.Empty; bool ischanel = false; string pagename = string.Empty; int allpages = 1; int pagesize = 15; string chid = string.Empty; string strFileName = Loneu.Common.File.CommFile.ReadFile(Server.MapPath("bar.htm")); int pagecount = 0; if (!int.TryParse(Web9long.Web.Util.Query("page"), out pagecount)) pagecount = 0; //获取生成参数 string strclass = Web9long.Web.Util.Query("newslist"); string[] a = strclass.Split('|'); if (a.Length == 2) { dir = a[0]; listid = a[1]; ischanel = true; } else { dir = a[0]; chid = a[1]; listid = a[2]; } //生成文件夹 string contentpath = Server.MapPath("../../" + dir + "/"); if (!System.IO.Directory.Exists(contentpath)) System.IO.Directory.CreateDirectory(contentpath); string weburls = ""; string pagenames = ""; int allcount; pagename = "List_" + listid + "_{0}.html"; string weburl = string.Empty; if (ischanel) { using (SiteBLL bll = new SiteBLL()) { //生成频道列表 allcount = bll.GetCount("select count(1) from SYS_Article where Islock=0 and ChannelID=" + listid); weburl = websiteurl + "NewsList.aspx?channelid=" + listid + "&AsPage={0}&AsCount=" + allcount; if (allcount % pagesize == 0) { allpages = allcount / pagesize; } else { allpages = (allcount / pagesize) + 1; } Response.Write(strFileName); //添加最大页数限制 if (pagecount != 0 && pagecount < allpages) allpages = pagecount; for (int i = 1; i <= allpages; i++) { Response.Write("<script>loadBar(" + i + "," + allpages + ");</script>"); weburls = string.Format(weburl, i); pagenames = string.Format(pagename, i); if (i == 1) { Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(weburls, contentpath, pagenames); Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(weburls, contentpath, "index.html"); } else { Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(weburls, contentpath, pagenames); } Thread.Sleep(100); } } } else { using (SiteBLL bll = new SiteBLL()) { //生成类别列表 allcount = bll.GetCount("select count(1) from SYS_Article where Islock=0 and CategoryID=" + listid); if (allcount % pagesize == 0) allpages = allcount / pagesize; else allpages = (allcount / pagesize) + 1; //添加最大页数限制 if (pagecount != 0 && pagecount < allpages) allpages = pagecount; weburl = websiteurl + "NewsList.aspx?channelid=" + chid + "&classid=" + listid + "&AsPage={0}&AsCount=" + allcount; Response.Write(strFileName); for (int i = 1; i <= allpages; i++) { Response.Write("<script>loadBar(" + i + "," + allpages + ");</script>"); weburls = string.Format(weburl, i); pagenames = string.Format(pagename, i); if (i == 1) { Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(weburls, contentpath, pagenames); Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(weburls, contentpath, "index.html"); } else { Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(weburls, contentpath, pagenames); } Thread.Sleep(100); } } } }
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(); } }
public void CreateSiteHtml() { string strFileName = Loneu.Common.File.CommFile.ReadFile(Server.MapPath("newbar.html")); Response.Write(strFileName); string pagePath = string.Empty; string webUrl = string.Empty; string newPageName = string.Empty; bool rs; //文件夹 string contentpath = string.Empty; List<EmptyTable> lsety = null; int allcount, pagesize=15,allpages=1, pagecount=5; //生成内容页 string sql = "select ArticleID,CateCallIndex from SYS_Article as a inner join SYS_Category as b on a.CategoryID=b.CateID where a.Islock=0 {0} order by Addtime desc "; string spandate = ContentSpan(); sql = string.Format(sql,spandate); using (SiteBLL bll = new SiteBLL()) { lsety = bll.GetList<EmptyTable>(sql); if (lsety != null && lsety.Count > 0) { int count = lsety.Count; for (int i = 1; i <= lsety.Count; i++) { if (i == 1) { Response.Write("<script>SetTitle('开始生成内容页');</script>"); } Response.Write("<script>loadBar(" + i + "," + lsety.Count + ");</script>"); contentpath = Server.MapPath("../../" + lsety[i - 1].Get<string>("CateCallIndex") + "/"); if (!System.IO.Directory.Exists(contentpath)) System.IO.Directory.CreateDirectory(contentpath); webUrl = websiteurl + "NewsShow.aspx?id=" + lsety[i - 1].Get<int>("ArticleID"); Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(webUrl, contentpath, lsety[i - 1].Get<int>("ArticleID") + ".html"); Thread.Sleep(100); } } else { Response.Write("<b>恭喜,一键生成完成!</b>"); Response.End(); } } string weburls = string.Empty; string pagename = "List_{0}_{1}.html"; string pagenames = string.Empty; //生成列表页 // sql = "select a.CateCallIndex,a.CateID,b.CL_ID,b.CL_Name from SYS_Category as a inner join SYS_Channel as b on a.ChannelID=b.CL_ID"; #region 生成频道列表页 sql = "select CL_ID,CL_Name from SYS_Channel order by CL_ID desc"; using (SiteBLL bll = new SiteBLL()) { lsety = bll.GetList<EmptyTable>(sql); if (lsety != null && lsety.Count > 0) { //生成列表 foreach (EmptyTable et in lsety) { contentpath = Server.MapPath("../../" + et.Get<string>("CL_Name") + "/"); if (!System.IO.Directory.Exists(contentpath)) System.IO.Directory.CreateDirectory(contentpath); //生成频道列表 allcount = bll.GetCount("select count(1) from SYS_Article where Islock=0 and ChannelID=" + et.Get<int>("CL_ID")); webUrl = websiteurl + "NewsList.aspx?channelid=" + et.Get<int>("CL_ID") + "&AsPage={0}&AsCount=" + allcount; if (allcount % pagesize == 0) { allpages = allcount / pagesize; } else { allpages = (allcount / pagesize) + 1; } //添加最大页数限制 if (pagecount != 0 && pagecount < allpages) allpages = pagecount; for (int i = 1; i <= allpages; i++) { weburls = string.Format(webUrl, i); pagenames = string.Format(pagename, et.Get<int>("CL_ID"),i); if (i == 1) { //Response.Write(System.DateTime.Now.ToString("g") + ":开始生成频道列表页..."); //Response.Write(strFileName); Response.Write("<script>SetTitle('开始生成频道列表页');</script>"); Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(weburls, contentpath, pagenames); Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(weburls, contentpath, "index.html"); } else { Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(weburls, contentpath, pagenames); } Response.Write("<script>loadBar(" + i + "," + allpages + ");</script>"); Thread.Sleep(100); } } } //生成首页 pagePath = Server.MapPath("../../"); webUrl = websiteurl + "Index.aspx"; newPageName = "index.html"; rs = Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(webUrl, pagePath, newPageName); Response.Write("<script>SetTitle('开始生成首页');</script>"); Response.Write("<script>loadBar(1,1);</script>"); } #endregion #region 生成类别列表 sql = "select a.CateCallIndex,a.CateID,b.CL_ID,b.CL_Name from SYS_Category as a inner join SYS_Channel as b on a.ChannelID=b.CL_ID"; using (SiteBLL bll = new SiteBLL()) { lsety = bll.GetList<EmptyTable>(sql); if (lsety != null && lsety.Count > 0) { //生成列表 foreach (EmptyTable et in lsety) { contentpath = Server.MapPath("../../" + et.Get<string>("CateCallIndex") + "/"); if (!System.IO.Directory.Exists(contentpath)) System.IO.Directory.CreateDirectory(contentpath); //生类别列表 allcount = bll.GetCount("select count(1) from SYS_Article where Islock=0 and CategoryID=" + et.Get<int>("CateID")); webUrl = websiteurl + "NewsList.aspx?channelid=" + et.Get<int>("CL_ID") + "&classid=" + et.Get<int>("CateID") + "&AsPage={0}&AsCount=" + allcount; if (allcount % pagesize == 0) { allpages = allcount / pagesize; } else { allpages = (allcount / pagesize) + 1; } //添加最大页数限制 if (pagecount != 0 && pagecount < allpages) allpages = pagecount; for (int i = 1; i <= allpages; i++) { weburls = string.Format(webUrl, i); pagenames = string.Format(pagename, et.Get<int>("CL_ID"), i); if (i == 1) { //Response.Write(System.DateTime.Now.ToString("g") + ":开始生成栏目列表页..."); //Response.Write(strFileName); Response.Write("<script>SetTitle('开始生成栏目列表页');</script>"); Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(weburls, contentpath, pagenames); Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(weburls, contentpath, "index.html"); } else { Loneu.Web.UI.ComPage.CreatePage.CreateOnePage(weburls, contentpath, pagenames); } Response.Write("<script>loadBar(" + i + "," + allpages + ");</script>"); Thread.Sleep(100); } } } } #endregion Response.Write("<b>恭喜,一键生成完成!</b>"); }