Exemplo n.º 1
0
        private void GetNewsGroupByCate(int cId)
        {
            CateNewsGroupBSO cateNewsgroupBSO = new CateNewsGroupBSO();

            NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
            DataTable table = newsGroupBSO.GetNewsGroupByCate(cId, Language.language, "1");

            DataView view = new DataView(table);
            view.Sort = "PostDate Desc";
            table = view.ToTable();

            DataTable tableClone = table.Clone();
            DataTable tblClone = table.Clone();

            for (int j = 0; j < table.Rows.Count; j++)
            {
                if (j < 10)
                    tableClone.ImportRow(table.Rows[j]);
                else if (j < 20)
                {
                    tblClone.ImportRow(table.Rows[j]);
                    Label1.Text = "<div class='gt_title'> <div class='title_article_top'>Các tin khác</div></div>";
                }
                else
                    break;

            }
            if (table.Rows.Count > 0)
            {
                DataListCateNews.Visible = true;
                DataListCateNews.DataSource = tableClone;
                DataListCateNews.DataBind();
                CateNewsPanel.Visible = true;
                Repeater1.DataSource = tblClone;
                Repeater1.DataBind();
            }
            else
            {
                DataListCateNews.Visible = false;
                CateNewsPanel.Visible = false;
            }


            CateNewsBSO catenewsBSO = new CateNewsBSO();
            CateNews catenews = catenewsBSO.GetCateNewsById(cId);
            //HyperLinkCate.NavigateUrl = "~/Default.aspx?go=cate&Id=" + catenews.CateNewsID;


            title_name.Text = catenews.CateNewsName;

            //    Label1.Text = "<div class='gt_title'> <div class='title_article_top'>" + Literal1.Text + "</div><div class='title_article_bg'></div></div>";

            string cate = "<a href='" + ResolveUrl("~/") + "FullNews/" + catenews.GroupCate + "/" + GetString(cateNewsgroupBSO.GetCateNewsGroupByGroupCate(catenews.GroupCate).CateNewsGroupName) + "/default.aspx' class='content_Text_Cat'>";
            string s1 = "";
            while (catenews.ParentNewsID != 0)
            {
                int pId = catenews.ParentNewsID;
                catenews = catenewsBSO.GetCateNewsById(pId);
                s1 = "<a href='" + ResolveUrl("~/") + "Category/" + catenews.GroupCate + "/" + catenews.CateNewsID + "/" + GetString(catenews.CateNewsName) + "/default.aspx' class='content_Text_Cat'>" + catenews.CateNewsName + "</a> &nbsp;<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'>&nbsp;" + s1;
            }

            cate += cateNewsgroupBSO.GetCateNewsGroupByGroupCate(catenews.GroupCate).CateNewsGroupName.ToUpper(); //Sửa lại
            cate += "</a> &nbsp;<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'>";
            cate += s1;
            title_cate.Text = "<a href='" + ResolveUrl("~/") + "Default.aspx' class='content_Text_Cat'>" + Resources.resource.Home + "</a> &nbsp;<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'>&nbsp;";
            title_cate.Text += cate;

            Page.Title = GetString(cateNewsgroupBSO.GetCateNewsGroupByGroupCate(catenews.GroupCate).CateNewsGroupName);

        }