Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            url = "http://" + Request.Url.Authority + Request.ApplicationPath + "/";
            string ChannelAlias = Request.QueryString["alias"].ToString();
            string ChannelTitle = DataQuery.GetNameByCategoryAlias(ChannelAlias);
            // 推荐
            String    CommendAlias   = DataQuery.GetChannelAliasByName(ChannelAlias, "推荐");
            string    CommendGuid    = DataQuery.CategoryAliasToID(CommendAlias);
            DataTable CommendCourses = new DAL.Article().GetArticleList(CommendGuid, false, 12);

            CommendList.DataSource = CommendCourses;
            CommendList.DataBind();
            //排行
            //DataTable HotListDataSrc = DataQuery.GetHotList();
            //HotList.DataSource = HotListDataSrc;
            //HotList.DataBind();

            // 主列表
            String    CategoryLv2Alias = DataQuery.GetChannelAliasByName(ChannelAlias, "栏目");
            string    Version          = ConfigurationManager.AppSettings["Version_Mark"];
            DataTable GetSubCategories = DataQuery.GetSubCategoriesApart(CategoryLv2Alias, Version);

            Level2MainRight.DataSource = GetSubCategories;
            Level2MainRight.DataBind();
            Image Level2MainBanner = (Image)FindControl <Image>("Level2MainBanner");

            Level2MainBanner.ImageUrl = "images/AD" + ChannelAlias + ".gif";

            //LeftPic
            LeftPicAliasText          = ConfigurationManager.AppSettings["ChannelPicCategory"];
            LeftPicLv2AliasText       = DataQuery.GetChannelAliasByName(LeftPicAliasText, ChannelTitle);
            Level2LeftPicBot.ImageUrl = "ShowBytePic.aspx?Title=底部图片&Alias=" + LeftPicLv2AliasText;
            int       LeftPicCount            = (GetSubCategories.Rows.Count - 6) / 2;
            String    LeftPicAlias            = DataQuery.GetChannelAliasByName(ChannelAlias, "图片专题");
            DataTable LeftPicGetSubCategories = DataQuery.GetSubCategories(LeftPicAlias, LeftPicCount.ToString());

            LeftPicList.DataSource = LeftPicGetSubCategories;
            LeftPicList.DataBind();
            //Level2LeftPic1.ImageUrl = "images/" + ChannelAlias + "_1.jpg";
            //int SubCategoriesCount = GetSubCategories.Rows.Count;
            //if (SubCategoriesCount >= 10)
            //{
            //    Level2LeftPic2.Visible = true;
            //    Level2LeftPic2.ImageUrl = "images/" + ChannelAlias + "_2.jpg";
            //}
            //if (SubCategoriesCount >= 12)
            //{
            //    Level2LeftPic3.Visible = true;
            //    Level2LeftPic3.ImageUrl = "images/" + ChannelAlias + "_3.jpg";
            //}
            //if (SubCategoriesCount >= 14)
            //{
            //    Level2LeftPic4.Visible = true;
            //    Level2LeftPic4.ImageUrl = "images/" + ChannelAlias + "_4.jpg";
            //}
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            url = "http://" + Request.Url.Authority + Request.ApplicationPath + "/";
            string ChannelAlias = "";
            string ChannelTitle = "";

            try
            {
                ChannelAlias = Request.QueryString["alias"].ToString();
            }
            catch
            {
                ChannelAlias = "gxchannel1";
            }
            ChannelTitle = DataQuery.GetNameByCategoryAlias(ChannelAlias);
            // 推荐
            String    CommendAlias   = DataQuery.GetChannelAliasByName(ChannelAlias, "推荐");
            string    CommendGuid    = DataQuery.CategoryAliasToID(CommendAlias);
            DataTable CommendCourses = new DAL.Article().GetArticleList(CommendGuid, false, 12);

            CommendList.DataSource = CommendCourses;
            CommendList.DataBind();
            //排行
            //DataTable HotListDataSrc = DataQuery.GetHotList();
            //HotList.DataSource = HotListDataSrc;
            //HotList.DataBind();

            // 主列表
            String    CategoryLv2Alias = DataQuery.GetChannelAliasByName(ChannelAlias, "栏目");
            string    Version          = ConfigurationManager.AppSettings["Version_Mark"];
            DataTable GetSubCategories = DataQuery.GetSubCategoriesApart(CategoryLv2Alias, Version);

            // Level2MainRight.DataSource = GetSubCategories;
            // Level2MainRight.DataBind();
            // Image Level2MainBanner = (Image)FindControl<Image>("Level2MainBanner");
            //Level2MainBanner.ImageUrl = "images/AD" + ChannelAlias + ".gif";

            //LeftPic
            LeftPicAliasText    = ConfigurationManager.AppSettings["ChannelPicCategory"];
            LeftPicLv2AliasText = DataQuery.GetChannelAliasByName(LeftPicAliasText, ChannelTitle);
            //Level2LeftPicBot.ImageUrl = "ShowBytePic.aspx?Title=底部图片&Alias=" + LeftPicLv2AliasText;
            //int LeftPicCount = (GetSubCategories.Rows.Count - 6) / 2;
            int       LeftPicCount            = 1;
            String    LeftPicAlias            = DataQuery.GetChannelAliasByName(ChannelAlias, "图片专题");
            DataTable LeftPicGetSubCategories = DataQuery.GetSubCategories(LeftPicAlias, LeftPicCount.ToString());

            LeftPicList.DataSource = LeftPicGetSubCategories;
            LeftPicList.DataBind();
            //Level2LeftPic1.ImageUrl = "images/" + ChannelAlias + "_1.jpg";
            //int SubCategoriesCount = GetSubCategories.Rows.Count;
            //if (SubCategoriesCount >= 10)
            //{
            //    Level2LeftPic2.Visible = true;
            //    Level2LeftPic2.ImageUrl = "images/" + ChannelAlias + "_2.jpg";
            //}
            //if (SubCategoriesCount >= 12)
            //{
            //    Level2LeftPic3.Visible = true;
            //    Level2LeftPic3.ImageUrl = "images/" + ChannelAlias + "_3.jpg";
            //}
            //if (SubCategoriesCount >= 14)
            //{
            //    Level2LeftPic4.Visible = true;
            //    Level2LeftPic4.ImageUrl = "images/" + ChannelAlias + "_4.jpg";
            //}
            String CategoryGUID = "";
            string TraceText    = "";

            if (Request.QueryString["id"] == null)
            {
                CategoryGUID = "1c68f666dc914382b95456acf6be87a5";
            }
            else
            {
                CategoryGUID = Request.QueryString["id"].ToString();
            }
            char[] PathSeparator = { '/' };
            string CategoryPath  = DataQuery.CategoryPath(CategoryGUID);

            string[] CategoryPaths = CategoryPath.Split(PathSeparator);
            for (int i = 4; i < CategoryPaths.Length; i++)
            {
                string title = DataQuery.GetNameByCategoryID(CategoryPaths[i]);
                TraceText += title + " / ";
            }
            Trace.Text = TraceText;
        }