Exemplo n.º 1
0
    private void GetCateParentNewsGroup(int cId, int gId)
    {
        _page = new PagingInfo(15, Convert.ToInt32(hdnPage.Value), true);
        string strCate = this.GetCateParentIDArrayByID(cId, gId);

        NewsGroupBSO newsGroupBSO    = new NewsGroupBSO();
        DataTable    newsGroupPaging = newsGroupBSO.GetNewsGroupPagingApproved(Language.language, Convert.ToInt32(hddGroupCate.Value), strCate, _page, 1, 1, 0, 1);

        if (newsGroupPaging.Rows.Count > 0)
        {
            TotalRecord = Convert.ToInt32(newsGroupPaging.Rows[0]["Total"].ToString());
            SetAttributeGvArticle(Convert.ToInt32(newsGroupPaging.Rows[0]["Total"].ToString()));
            rptListNewsGroup.DataSource = newsGroupPaging;
            rptListNewsGroup.DataBind();
            Paging.DataLoad();
            if (TotalPage(Convert.ToInt32(newsGroupPaging.Rows[0]["Total"].ToString())) <= 1L)
            {
                Paging.Visible = false;
            }
            else
            {
                Paging.Visible = true;
            }
        }
        else
        {
            SetAttributeGvArticle(0);
            Paging.Visible    = false;
            panelDate.Visible = false;
        }


        CateNewsBSO cateNewsBSO     = new CateNewsBSO();
        DataTable   cateClientGroup = cateNewsBSO.getCateClientGroup(cId, Language.language, gId, 5);

        if (cateClientGroup.Rows.Count > 0)
        {
            tintuc_col1.Attributes.Add("class", "tintuc-col1");
            ViewListCate(cId, gId);
        }
        else
        {
            tintuc_col1.Attributes.Add("class", "tintuc-col-main");
            listNewsCatePanel.Visible = false;
        }


        PagingInfo paging           = new PagingInfo(15, (Convert.ToInt32(hdnPage.Value) + 1), true);
        DataTable  newsGroupPaging2 = newsGroupBSO.GetNewsGroupPagingApproved(Language.language, Convert.ToInt32(hddGroupCate.Value), strCate, paging, 1, 1, 0, 1);

        if (newsGroupPaging2.Rows.Count > 0)
        {
            newsOther.Visible           = true;
            rptListNewsOther.DataSource = newsGroupPaging2;
            rptListNewsOther.DataBind();
            return;
        }
        newsOther.Visible = false;
    }
    void GetNewsGroup(int groupcate)
    {
        int nRecord = 0;

        if (!String.IsNullOrEmpty(hddRecord.Value))
        {
            if (int.TryParse(hddRecord.Value, out nRecord))
            {
                _page = new PagingInfo(nRecord, 1, true);
            }
            else
            {
                _page = new PagingInfo(nRecord, 1, true);
            }
        }


        DataTable table = new DataTable();

        if (AspNetCache.CheckCache("Client_NewsbyGroup_Thumb" + groupcate + "_" + Language.language.Replace("-", "_")) == false)
        {
            string strCate = GetCateParentIDArrayByID(0, groupcate);

            NewsGroupBSO newsgroupBSO = new NewsGroupBSO();
            table = newsgroupBSO.GetNewsGroupPaging(Language.language, groupcate, -1, strCate, 1, 1, -1, 1, 0, _page);

            AspNetCache.SetCacheWithTime("Client_NewsbyGroup_Thumb" + groupcate + "_" + Language.language.Replace("-", "_"), table, 150);
        }
        else
        {
            table = (DataTable)AspNetCache.GetCache("Client_NewsbyGroup_Thumb" + groupcate + "_" + Language.language.Replace("-", "_"));
        }


        string strHotNewsCate = "";
        string text1          = "";

        if (table.Rows.Count > 0)
        {
            DateTime dtNow = DateTime.Now;

            for (int j = 0; j < table.Rows.Count; j++)
            {
                DataRow dataRow = table.Rows[j];

                //if (j < 4)
                //{
                strHotNewsCate += "<div class='col-md-3 col-lg-3 col-sm-6 col-xs-6 mb10'>";
                strHotNewsCate += "<div class='thumbnail no-thumbnail thumbnail-style thumbnail-kenburn height-250-fix'>";


                strHotNewsCate += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow["Title"]) + "-" + dataRow["GroupCate"] + "-" + dataRow["NewsGroupID"].ToString() + ".aspx' title='" + dataRow["Title"] + "'>";
                strHotNewsCate += "<div class='embed-image ratio-16-9'>";
                if (dataRow["ImageThumb"].ToString() != "")
                {
                    strHotNewsCate += "<img class='img-responsive' src='" + Utils.getURLThumbImage(dataRow["ImageThumb"].ToString(), 330) + "' alt='" + dataRow["Title"] + "'>";
                }
                else
                {
                    strHotNewsCate += "<img class='img-responsive' src='" + Utils.getURLThumbImage(ResolveUrl("~/") + "images/img_logo.jpg", 330) + "'  alt='" + dataRow["Title"] + "'>";
                }
                strHotNewsCate += "</div>";
                strHotNewsCate += "</a>";

                strHotNewsCate += "<div class='caption'>";
                strHotNewsCate += "<h3 class='title-news13'>";
                strHotNewsCate += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow["Title"]) + "-" + dataRow["GroupCate"] + "-" + dataRow["NewsGroupID"].ToString() + ".aspx' title='" + dataRow["Title"] + "'>";

                strHotNewsCate += dataRow["Title"].ToString();
                strHotNewsCate += "</a>";


                //strHotNewsCate += "<span style='color: #6D6D6D; font-size: 12px;'> (" + Convert.ToDateTime(dataRow["PostDate"]).ToString("dd/MM/yyyy") + ")</span>";
                strHotNewsCate += "</h3>";
                //strHotNewsCate += "<ul class='list-unstyled list-inline title-date'>";
                //strHotNewsCate += "<li><i class='fa fa-calendar'></i> " + Convert.ToDateTime(dataRow["PostDate"]).ToString("dd/MM/yyyy") + "</li>";
                //strHotNewsCate += "</ul>";
                strHotNewsCate += "</div>";

                strHotNewsCate += "</div>";


                strHotNewsCate += "</div>";
                //}
                //else
                //{
                //    strHotNewsCate += "<div class='linkother'>";
                //    strHotNewsCate += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow["Title"]) + "-" + dataRow["GroupCate"] + "-" + dataRow["NewsGroupID"].ToString() + ".aspx' title='" + dataRow["Title"] + "'>";
                //    strHotNewsCate += dataRow["Title"].ToString();
                //    //strHotNewsCate += " <span style='color:#6D6D6D; font-size: 12px;font-style:italic;'>(" + Convert.ToDateTime(dataRow["PostDate"]).ToString("dd/MM/yyyy") + ")</span>";
                //    strHotNewsCate += "</a>";

                //    strHotNewsCate += "</div>";
                //}
            }
            //strHotNewsCate += "</ul></div>";
            //strHotNewsCate += "</div>";
        }


        ltlNewsCateMainHome.Text = strHotNewsCate;

        DataTable   table1      = new DataTable();
        CateNewsBSO cateNewsBSO = new CateNewsBSO();

        if (AspNetCache.CheckCache("HTML_ltlCateSubMainHome_by_group_list_" + hddValue.Value + "_" + Language.language.Replace("-", "_")) == false)
        {
            table1 = cateNewsBSO.getCateClientGroup(0, Language.language, groupcate, 5);
            AspNetCache.SetCacheWithTime("HTML_ltlCateSubMainHome_by_group_list_" + hddValue.Value + "_" + Language.language.Replace("-", "_"), table1, 150);
        }
        else
        {
            table1 = (DataTable)AspNetCache.GetCache("HTML_ltlCateSubMainHome_by_group_list_" + hddValue.Value + "_" + Language.language.Replace("-", "_"));
        }


        string strCateSub = "";

        if (table1.Rows.Count > 0)
        {
            for (int i = 0; i < table1.Rows.Count; i++)
            {
                DataRow dataRow = table1.Rows[i];
                strCateSub += "<li><a href='" + ResolveUrl("~/") + "c3/" + cateNewsBSO.GetSlugByCateId(Convert.ToInt32(dataRow["CateNewsID"])) + "/" + GetString(dataRow["CateNewsName"]) + "-" + dataRow["GroupCate"] + "-" + dataRow["CateNewsID"].ToString() + ".aspx' title='" + dataRow["CateNewsName"] + "'>" + dataRow["CateNewsName"] + "</a></li>";
            }
        }


        ltlCateSub.Text = strCateSub;
    }
Exemplo n.º 3
0
    private void ViewListCate(int cId, int gId)
    {
        if (!AspNetCache.CheckCache("HTML_ltlListNewsCatebyCate_" + gId + "_" + cId))
        {
            CateNewsBSO  cateNewsBSO     = new CateNewsBSO();
            DataTable    cateClientGroup = cateNewsBSO.getCateClientGroup(cId, Language.language, gId, 6);
            string       text            = "";
            NewsGroupBSO newsGroupBSO    = new NewsGroupBSO();
            DataTable    dataTable       = new DataTable();
            if (cateClientGroup.Rows.Count > 0 && cateClientGroup != null)
            {
                listNewsCatePanel.Visible = true;
                for (int i = 0; i < cateClientGroup.Rows.Count; i++)
                {
                    DataRow dataRow = cateClientGroup.Rows[i];
                    string  cateParentIDArrayByID = GetCateParentIDArrayByID(Convert.ToInt32(dataRow["CateNewsID"]), gId);
                    dataTable = newsGroupBSO.GetNewsGroupByCateHomeList(cateParentIDArrayByID, gId, "1", 5, "1");

                    if (dataTable.Rows.Count > 0)
                    {
                        text += "<div class='r-ro'>";
                        text += "<div class='box-list-content-cate'>";
                        text += "<h2 class='h2'>";

                        text += "<a class='h2-cate' href='" + ResolveUrl("~/") + "c3/" + cateNewsBSO.GetSlugByCateId(Convert.ToInt32(dataRow["CateNewsID"])) + "/" + GetString(dataRow["CateNewsName"].ToString().Trim()) + "-" + dataRow["GroupCate"] + "-" + dataRow["CateNewsID"].ToString() + ".aspx' title='" + dataRow["CateNewsName"].ToString().Trim() + "'>";
                        text += "<span>" + Tool.SubString(Tool.StripTagsCharArray(dataRow["CateNewsName"].ToString().Trim()), 20) + "</span></a>";

                        text += "</h2>";
                        text += "<div class='box-content-main-col-a'>";


                        DataRow dataRow2 = dataTable.Rows[0];
                        text += "<div class='box-tintuc-first'>";
                        text += "<div class='box-tintuc-image'>";

                        text += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow2["Title"]) + "-" + dataRow2["GroupCate"] + "-" + dataRow2["NewsGroupID"].ToString() + ".aspx' title='" + dataRow2["Title"] + "'>";
                        if (dataRow2["ImageLarge"].ToString() != "")
                        {
                            text += "<img class='box-tintuc-landscape' src='" + Utils.getURLThumbImage(dataRow2["ImageLarge"].ToString(), 175) + "' width='175px' height='110px' alt='" + dataRow2["Title"] + "'>";
                        }
                        else if (dataRow2["ImageThumb"].ToString() != "")
                        {
                            text += "<img class='box-tintuc-landscape' src='" + Utils.getURLThumbImage(dataRow2["ImageThumb"].ToString(), 175) + "' width='175px' height='110px' alt='" + dataRow2["Title"] + "'>";
                        }
                        //else
                        //{

                        //    text += "<img class='box-tintuc-landscape' src='" + ResolveUrl("~/") + "images/img_logo.jpg' width='205px' height='120px' alt='" + dataRow2["Title"] + "'>";

                        //}
                        text += "</a>";
                        text += "</div>";
                        text += "<div class='clear'></div>";
                        text += "<div class='box-tintuc-linkabs'>";

                        text += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow2["Title"]) + "-" + dataRow2["GroupCate"] + "-" + dataRow2["NewsGroupID"].ToString() + ".aspx' title='" + dataRow2["Title"] + "'>";

                        text += dataRow2["Title"].ToString();
                        text += "</a>";
                        text += "</div>";
                        text += "</div>";
                        text += "<div class='box-tintuc-linkother'>";
                        text += "<ul>";
                        for (int j = 1; j < dataTable.Rows.Count; j++)
                        {
                            DataRow dataRow3 = dataTable.Rows[j];
                            text += "<li class='ter'>";

                            text += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow3["Title"]) + "-" + dataRow3["GroupCate"] + "-" + dataRow3["NewsGroupID"].ToString() + ".aspx' title='" + dataRow3["Title"] + "'>";

                            text += dataRow3["Title"].ToString();
                            text += "</a>";
                            text += "</li>";
                        }
                        text += "</ul></div>";

                        text += "</div>";
                        text += "</div>";
                        text += "</div>";
                    }
                }
            }
            else
            {
                listNewsCatePanel.Visible = false;
            }
            AspNetCache.SetCacheWithTime("HTML_ltlListNewsCatebyGroup_" + gId, text, 150.0);
            ltlListNewsCate.Text = text;
        }
        else
        {
            ltlListNewsCate.Text = (string)AspNetCache.GetCache("HTML_ltlListNewsCatebyGroup_" + gId);
        }

        if (ltlListNewsCate.Text != "")
        {
            tintuc_col1.Attributes.Add("class", "tintuc-col1");
            //   ViewListCate(cId, gId);
        }
        else
        {
            tintuc_col1.Attributes.Add("class", "tintuc-col-main");
            listNewsCatePanel.Visible = false;
        }
    }
Exemplo n.º 4
0
    void GetNewsGroup(int cateID, int groupcate)
    {
        DataTable table = new DataTable();

        if (AspNetCache.CheckCache("HTML_ltlNews_MainHome_by_cate_list_" + hddValue.Value + "_" + Language.language.Replace("-", "_")) == false)
        {
            string strCate = GetCateParentIDArrayByID(cateID, groupcate);

            NewsGroupBSO newsgroupBSO = new NewsGroupBSO();
            table = newsgroupBSO.GetNewsGroupByCateHomeList(strCate, groupcate, "1", Convert.ToInt32(hddRecord.Value), "1");

            AspNetCache.SetCacheWithTime("HTML_ltlNews_MainHome_by_cate_list_" + hddValue.Value + "_" + Language.language.Replace("-", "_"), table, 150);
        }
        else
        {
            table = (DataTable)AspNetCache.GetCache("HTML_ltlNews_MainHome_by_cate_list_" + hddValue.Value + "_" + Language.language.Replace("-", "_"));
        }

        string strNewsCateSlider = "";
        string text1             = "";

        if (table.Rows.Count > 0)
        {
            DateTime dtNow    = DateTime.Now;
            DataRow  dataRow0 = table.Rows[0];
            text1 += "<div class='col-lg-3 col-md-4 col-sm-6 col-xs-12'>";
            text1 += "<div class='box-news-thumb'>";
            text1 += "<div class='thumbnail no-thumbnail thumbnail-style thumbnail-kenburn'>";
            text1 += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow0["Title"]) + "-" + dataRow0["GroupCate"] + "-" + dataRow0["NewsGroupID"].ToString() + ".aspx' title='" + dataRow0["Title"] + "'>";
            text1 += "<div class='embed-image ratio-16-9'>";
            if (dataRow0["ImageThumb"].ToString() != "")
            {
                text1 += "<img class='img-responsive' src='" + Utils.getURLThumbImage(dataRow0["ImageThumb"].ToString(), 330) + "' alt='" + dataRow0["Title"] + "'>";
            }
            else
            {
                text1 += "<img class='img-responsive' src='" + Utils.getURLThumbImage(ResolveUrl("~/") + "images/img_logo.jpg", 330) + "'  alt='" + dataRow0["Title"] + "'>";
            }
            text1 += "</div>";
            text1 += "</a>";


            text1 += "<div class='caption'>";
            text1 += "<h3 class='title-news'>";
            text1 += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow0["Title"]) + "-" + dataRow0["GroupCate"] + "-" + dataRow0["NewsGroupID"].ToString() + ".aspx' title='" + dataRow0["Title"] + "'>";

            text1 += dataRow0["Title"].ToString();
            if (Convert.ToDateTime(dataRow0["PostDate"].ToString()).Date >= dtNow.Date)
            {
                text1 += "<span class='fs12 fa fa-star text-danger pl5'></span>";
            }
            text1 += "</a> <br/>";
            text1 += "<span style='color: #6D6D6D; font-size: 12px;'> (" + Convert.ToDateTime(dataRow0["PostDate"]).ToString("dd/MM/yyyy") + ")</span>";
            text1 += "</h3>";
            text1 += "</div>";
            text1 += "</div>";
            text1 += "</div>";
            text1 += "</div>";

            int col = 0;
            int dem = 0;
            for (int i = 1; i < table.Rows.Count; i++)
            {
                DataRow dataRow = table.Rows[i];

                if (dem == 0)
                {
                    col++;
                    text1 += "<div class='col-lg-3 col-md-4 col-sm-6 col-xs-12 " + ((col == 3) ? "hidden-md" : "") + "'>";
                    text1 += "<ul class='news-thumb-list'>";
                }
                text1 += "<li>";

                text1 += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow["Title"]) + "-" + dataRow["GroupCate"] + "-" + dataRow["NewsGroupID"].ToString() + ".aspx' title='" + dataRow["Title"] + "'>";

                if (dataRow["ImageThumb"].ToString() != "")
                {
                    text1 += "<img src='" + Utils.getURLThumbImage(dataRow["ImageThumb"].ToString(), 100) + "' alt='" + dataRow["Title"] + "' width='100px' class='image loaded'>";
                }
                else
                {
                    text1 += "<img src='" + Utils.getURLThumbImage(ResolveUrl("~/") + "images/img_logo.jpg", 100) + "'  alt='" + dataRow["Title"] + "' width='100px' class='image loaded'>";
                }

                text1 += "<div class='caption'>";
                text1 += "<span class='title'>";
                text1 += dataRow["Title"].ToString();
                text1 += "</span>";
                text1 += "<span class='sourcename'> (" + Convert.ToDateTime(dataRow["PostDate"]).ToString("dd/MM/yyyy") + ")</span>";
                text1 += "</div>";
                text1 += "</a>";
                text1 += "</li>";

                dem++;

                if (dem == 3)
                {
                    text1 += "</ul>";
                    text1 += "</div>";
                    dem    = 0;
                }
            }

            if (dem > 0)
            {
                text1 += "</ul>";
                text1 += "</div>";
                dem    = 0;
            }

            strNewsCateSlider += text1;
        }


        ltlNewsCateMainHome.Text = strNewsCateSlider;

        DataTable   table1      = new DataTable();
        CateNewsBSO cateNewsBSO = new CateNewsBSO();

        if (AspNetCache.CheckCache("HTML_ltlCateSubMainHome_by_cate_list_" + hddValue.Value + "_" + Language.language.Replace("-", "_")) == false)
        {
            table1 = cateNewsBSO.getCateClientGroup(cateID, Language.language, groupcate, 5);
            AspNetCache.SetCacheWithTime("HTML_ltlCateSubMainHome_by_cate_list_" + hddValue.Value + "_" + Language.language.Replace("-", "_"), table1, 150);
        }
        else
        {
            table1 = (DataTable)AspNetCache.GetCache("HTML_ltlCateSubMainHome_by_cate_list_" + hddValue.Value + "_" + Language.language.Replace("-", "_"));
        }


        string strCateSub = "";

        if (table1.Rows.Count > 0)
        {
            for (int i = 0; i < table1.Rows.Count; i++)
            {
                DataRow dataRow = table1.Rows[i];
                strCateSub += "<li><a href='" + ResolveUrl("~/") + "c3/" + cateNewsBSO.GetSlugByCateId(Convert.ToInt32(dataRow["CateNewsID"])) + "/" + GetString(dataRow["CateNewsName"]) + "-" + dataRow["GroupCate"] + "-" + dataRow["CateNewsID"].ToString() + ".aspx' title='" + dataRow["CateNewsName"] + "'>" + dataRow["CateNewsName"] + "</a></li>";
            }
        }


        ltlCateSub.Text = strCateSub;
    }