Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int _pageIndex = Lib.QueryString.PageIndex;
                _pageIndex = _pageIndex == 0 ? 1 : _pageIndex;
                _catID     = Lib.QueryString.CategoryID;
                //_catID = Lib.QueryString.ParentCategory==0 ? Lib.QueryString.ParentCategory : Lib.QueryString.CategoryID;
                DataTable objCat = XpcHelper.SelectCategory(_catID);


                if (objCat != null && objCat.Rows.Count > 0)
                {
                    CatName = string.Format("<a title=\"{1}\" href=\"{0}\">{1}</a>", objCat.Rows[0]["Cat_URL"], objCat.Rows[0]["Cat_Name"]);
                    CatRSS  = string.Format("<a title=\"{1}\" target=\"_blank\" class=\"rss\" href=\"{0}\"><img src=\"/images/IconRSS.gif\"/></a>", objCat.Rows[0]["RSS_URL"], objCat.Rows[0]["Cat_Name"]);
                    Utility.SetPageHeader(this.Page, objCat.Rows[0]["Cat_Name"].ToString(), objCat.Rows[0]["Cat_Name"] + "-" + ", " + objCat.Rows[0]["Cat_displayURL"], objCat.Rows[0]["Cat_Name"] + ", " + objCat.Rows[0]["Cat_displayURL"], Lib.QueryString.PageIndex > 1);
                    //Đặt SEO cho Facebook
                    Utility.SetFaceBookSEO(this.Page, objCat.Rows[0]["Cat_Name"].ToString(), objCat.Rows[0]["Cat_Name"] + "-" + ", " + objCat.Rows[0]["Cat_displayURL"], System.Configuration.ConfigurationManager.AppSettings["WebDomain"] + "/images/BannerHome.png", System.Configuration.ConfigurationManager.AppSettings["WebDomain"] + "/" + objCat.Rows[0]["Cat_URL"]);
                }


                DataTable objTintuc = XpcHelper.displayGetDanhSachTin(_catID, _pageIndex, _pageSize, 240);

                if (objTintuc != null && objTintuc.Rows.Count > 0)
                {
                    DataRow dtRow = objTintuc.Rows[0];
                    ltrBigPic.Text = Utility.GetThumbNail(dtRow["News_Title"].ToString(), dtRow["URL"].ToString(), dtRow["News_Image"].ToString(), 600);

                    ltrBigTitle.Text       = "<a href=\"" + dtRow["URL"] + "\">" + dtRow["News_Title"] + "</a>";
                    ltrDateTime.Text       = dtRow["PublishDate"].ToString();
                    ltrBigInitContent.Text = dtRow["News_InitContent"].ToString();

                    DataTable dtData = objTintuc.Clone();
                    for (int i = 1; i < objTintuc.Rows.Count; i++)
                    {
                        dtData.ImportRow(objTintuc.Rows[i]);
                    }

                    rptData.DataSource = dtData;
                    rptData.DataBind();
                }

                Pagging1.TotalPage = XpcHelper.GetDanhSachTin_Count(_catID, _pageSize);
                Pagging1.DoPagging(_pageIndex);
                //Paging1.TotalPage = GVietNamHelper.GetDanhSachTin_Count(_catID, _pageSize);
                //Paging1.DoPagging(_pageIndex);
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!IsPostBack)
                {
                    int _pageIndex = Lib.QueryString.PageIndex;
                    _pageIndex = _pageIndex == 0 ? 1 : _pageIndex;
                    _catID     = Lib.QueryString.CategoryID;

                    long news_ID = Lib.QueryString.NewsID;



                    //_catID = Lib.QueryString.ParentCategory==0 ? Lib.QueryString.ParentCategory : Lib.QueryString.CategoryID;
                    DataTable objCat = XpcHelper.SelectCategory(_catID);


                    if (objCat != null && objCat.Rows.Count > 0)
                    {
                        CatName = string.Format("<a title=\"{1}\" href=\"{0}\">{1}</a>", objCat.Rows[0]["Cat_URL"], objCat.Rows[0]["Cat_Name"]);
                        CatRSS  = string.Format("<a title=\"{1}\" target=\"_blank\" class=\"rss\" href=\"{0}\"><img src=\"/images/IconRSS.gif\"/></a>", objCat.Rows[0]["RSS_URL"], objCat.Rows[0]["Cat_Name"]);
                        Utility.SetPageHeader(this.Page, objCat.Rows[0]["Cat_Name"].ToString(), objCat.Rows[0]["Cat_Name"] + "-" + ", " + objCat.Rows[0]["Cat_displayURL"], objCat.Rows[0]["Cat_Name"] + ", " + objCat.Rows[0]["Cat_displayURL"], Lib.QueryString.PageIndex > 1);
                        //Đặt SEO cho Facebook
                        Utility.SetFaceBookSEO(this.Page, objCat.Rows[0]["Cat_Name"].ToString(), objCat.Rows[0]["Cat_Name"] + "-" + ", " + objCat.Rows[0]["Cat_displayURL"], System.Configuration.ConfigurationManager.AppSettings["WebDomain"] + "/images/BannerHome.png", System.Configuration.ConfigurationManager.AppSettings["WebDomain"] + "/" + objCat.Rows[0]["Cat_URL"]);
                    }

                    if (news_ID != 0)
                    {
                        DataTable detail = XpcHelper.displayMicrof_Detail(news_ID);
                        if (detail != null && detail.Rows.Count > 0)
                        {
                            DataRow dtRow  = detail.Rows[0];
                            string  noHTML = Regex.Replace(dtRow["News_Content"].ToString(), @"<[^>]+>|&nbsp;", "").Trim();
                            ltrBigVideo.Text       = "<iframe width=\"595\" height=\"351\" src=\"" + noHTML + "\" frameborder=\"0\" allowfullscreen=\"\"></iframe>";
                            ltrBigTitle.Text       = dtRow["News_Title"].ToString();
                            ltrDateTime.Text       = dtRow["PublishDate"].ToString();
                            ltrBigInitContent.Text = dtRow["News_InitContent"].ToString();

                            string Seo_Title   = dtRow["News_Title"].ToString();
                            string Seo_Des     = dtRow["News_InitContent"].ToString();
                            string Seo_KeyWord = !String.IsNullOrEmpty(dtRow["Extension3"].ToString()) ? dtRow["Extension3"].ToString() : "";

                            Utility.SetPageHeaderDetail(this.Page, Seo_Title, objCat.Rows[0]["Cat_Name"].ToString(), Seo_Des, Seo_KeyWord);
                        }
                    }
                    DataTable objTintuc = XpcHelper.displayGetDanhSachTin(_catID, 1, 5, 70);
                    if (objTintuc != null && objTintuc.Rows.Count > 0)
                    {
                        if (news_ID == 0)
                        {
                            DataRow dtRow  = objTintuc.Rows[0];
                            string  noHTML = Regex.Replace(dtRow["News_Content"].ToString(), @"<[^>]+>|&nbsp;", "").Trim();
                            ltrBigVideo.Text       = "<iframe width=\"595\" height=\"351\" src=\"" + noHTML + "\" frameborder=\"0\" allowfullscreen=\"\"></iframe>";
                            ltrBigTitle.Text       = dtRow["News_Title"].ToString();
                            ltrDateTime.Text       = dtRow["PublishDate"].ToString();
                            ltrBigInitContent.Text = dtRow["News_InitContent"].ToString();
                        }


                        rptData.DataSource = objTintuc;
                        rptData.DataBind();
                    }

                    DataTable objVideoTongHop = XpcHelper.displayGetDanhSachTin(_catID, _pageIndex, _pageSize, 120);
                    if (objVideoTongHop != null && objVideoTongHop.Rows.Count > 0)
                    {
                        rptListVideo.DataSource = objVideoTongHop;
                        rptListVideo.DataBind();
                    }
                    Pagging.TotalPage = XpcHelper.GetDanhSachTinCount(_catID);
                    Pagging.DoPagging(_pageIndex);
                }
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int       _catID = Lib.QueryString.ParentCategory != 0 ? Lib.QueryString.ParentCategory : Lib.QueryString.CategoryID;
                long      newsID = Lib.QueryString.NewsID;
                DataTable objCat = XpcHelper.SelectCategory(_catID);
                if (objCat != null && objCat.Rows.Count > 0)
                {
                    // CatName = string.Format("<a title=\"{1}\" href=\"{0}\">{1} </a>", objCat.Rows[0]["Cat_URL"], objCat.Rows[0]["Cat_Name"]);
                    Utility.SetPageHeader(this.Page, objCat.Rows[0]["Cat_Name"].ToString(), objCat.Rows[0]["Cat_Name"] + "-" + ", " + objCat.Rows[0]["Cat_displayURL"], objCat.Rows[0]["Cat_Name"] + ", " + objCat.Rows[0]["Cat_displayURL"], Lib.QueryString.PageIndex > 1);
                    //ltrCatName.Text = CatName;
                }
                DataTable detail = XpcHelper.displayMicrof_Detail(newsID);
                string    imgTo;
                if (detail != null && detail.Rows.Count > 0)
                {
                    DataRow row = detail.Rows[0];
                    ltrSapo.Text        = row["News_InitContent"].ToString().Replace("[xevaphongcach.net]", "");
                    ltrTitle.Text       = row["News_Title"].ToString();
                    ltrContent.Text     = row["News_Content"] != null ? row["News_Content"].ToString() : string.Empty;
                    imgTo               = row["News_Image"] != null ? row["News_Image"].ToString().StartsWith("http:") ? row["News_Image"].ToString() : Utility.ImagesStorageUrl + "/" + row["News_Image"].ToString() : "";
                    ltrPublishDate.Text = row["PublishDate"].ToString();
                    //imgBigImage.ImageUrl = imgTo;
                    //imgBigImage.Visible = row["News_Image"].ToString().Length > 0;
                    ltrRelatedNews.Text = row["NewsRelated"] != null && !string.IsNullOrEmpty(row["NewsRelated"].ToString())
                        ? "<div class=\"news-relate\">" + row["NewsRelated"] + "</div>"
                        : string.Empty;

                    if (!string.IsNullOrEmpty(row["Icon"].ToString()))
                    {
                        string   txtTags  = string.Empty;
                        string[] arrayTag = row["Icon"].ToString().Split(',');
                        if (arrayTag.Length > 0)
                        {
                            foreach (string s in arrayTag)
                            {
                                txtTags +=
                                    //"<a title=\"" + s + "\" href=\"/tag/" + Utility.UnicodeToKoDauAndGach(s) + ".htm\"><strong>" + s + "</strong></a>, ";
                                    "<a title=\"" + s + "\" href=\"/tag/" + s.Trim() + ".htm\"><strong>" + s + "</strong></a>, ";
                            }
                            ltrTags.Text = txtTags.TrimEnd(' ').TrimEnd(',');
                        }
                        else
                        {
                            divTags.Visible = false;
                        }
                    }
                    else
                    {
                        divTags.Visible = false;
                    }


                    string Seo_Title   = row["News_Title"].ToString();
                    string Seo_Des     = row["News_InitContent"].ToString();
                    string Seo_KeyWord = !String.IsNullOrEmpty(row["Extension3"].ToString()) ? row["Extension3"].ToString() : "";

                    Utility.SetPageHeaderDetail(this.Page, Seo_Title, objCat.Rows[0]["Cat_Name"].ToString(), Seo_Des, Seo_KeyWord);

                    // Truong hop Title bi thay doi, URL se thay doi theo. Khi đó ta chuyển Link về theo URL mới.
                    Utility.SetCanonicalLink(this.Page, row["NewsURL"].ToString());



                    // Bao cho Google biet la Link đa bi xoa
                    if (String.IsNullOrEmpty(row["News_Title"].ToString()))
                    {
                        Utility.DeletedLinkNotify();
                    }

                    //Đặt SEO cho Facebook
                    Utility.SetFaceBookSEO(this.Page, Seo_Title, Seo_Des, imgTo, System.Configuration.ConfigurationManager.AppSettings["WebDomain"] + row["NewsURL"].ToString());


                    DataTable dtTinKhac = XpcHelper.displayGetTinKhac(10, _catID, newsID, 100);
                    if (dtTinKhac != null && dtTinKhac.Rows.Count > 0)
                    {
                        DataTable dt1 = dtTinKhac.Clone(), dt2 = dtTinKhac.Clone();
                        for (int i = 0; i < dtTinKhac.Rows.Count; i++)
                        {
                            if (i <= 2)
                            {
                                dt1.ImportRow(dtTinKhac.Rows[i]);
                            }
                            else
                            {
                                dt2.ImportRow(dtTinKhac.Rows[i]);
                            }
                        }
                        dt1.AcceptChanges(); dt2.AcceptChanges();


                        rpt3TinKhac.DataSource = dt1;
                        rpt3TinKhac.DataBind();
                        rptTinKhac.DataSource = dt2;
                        rptTinKhac.DataBind();
                    }


                    //DataTable dtTinMoiCapNhat = XpcHelper.displayGetTinMoiCapNhat(10, _catID, newsID);
                    //if (dtTinMoiCapNhat != null && dtTinMoiCapNhat.Rows.Count > 0)
                    //{
                    //    rptTinMoiCapNhat.DataSource = dtTinMoiCapNhat;
                    //    rptTinMoiCapNhat.DataBind();
                    //}
                    //else
                    //{
                    //    divTinMoiCapNhat.Visible = false;
                    //}
                }
            }
        }