Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable tbl = BOCategory.GetCategoryByParent(0, false);

            if (tbl.Rows.Count > 0)
            {
                rptCategory.DataSource = tbl;
                rptCategory.DataBind();
            }
        }
Exemplo n.º 2
0
 // Methods
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         DataTable categoryByParentId = new DataTable();
         categoryByParentId          = BOCategory.GetCategoryByParent(0, false);
         this.rptCategory.DataSource = categoryByParentId;
         this.rptCategory.DataBind();
     }
 }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var tbl = BOCategory.GetCategoryByParent(CatID);

            if (tbl != null && tbl.Rows.Count > 0)
            {
                foreach (System.Data.DataRow row in tbl.Rows)
                {
                    Literal1.Text += String.Format(childCat, (String.Format("/{0}.html", row["Cat_DisplayUrl"].ToString())), row["Cat_Name"].ToString(), row["Cat_ID"]);
                }
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var tbl = BOCategory.GetCategoryByParent(0, false);

            if (tbl != null && tbl.Rows.Count > 0)
            {
                foreach (System.Data.DataRow row in tbl.Rows)
                {
                    //Literal1.Text += String.Format(childCat, row["Cat_DisplayUrl"].ToString().Trim().ToLower(), row["Cat_Name"].ToString(), row["Cat_ID"].ToString(), row["Cat_ID"].ToString().Equals("78") ? "http://clip.netlife.com.vn" : "http://netlife.com.vn");
                    Literal1.Text += String.Format(childCat, row["Cat_DisplayUrl"].ToString().Trim().ToLower(), row["Cat_Name"].ToString(), row["Cat_ID"].ToString(), "");
                }
            }
        }
Exemplo n.º 5
0
 protected void rptCategory_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         var       row   = ((DataRowView)e.Item.DataItem);
         int       catId = Convert.ToInt32(row["Cat_ID"]);
         DataTable categoryByParentId = BOCategory.GetCategoryByParent(catId, false);
         var       rpt = (Repeater)e.Item.FindControl("rptSubCategory");
         if (rpt != null && categoryByParentId != null)
         {
             rpt.DataSource = categoryByParentId;
             rpt.DataBind();
         }
     }
 }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //


            DataTable tbl = BOCategory.GetCategoryByParent(0, false);

            if (tbl.Rows.Count > 0)
            {
                for (int i = 0; i < tbl.Rows.Count; i++)
                {
                    var ctr = (Categorys)LoadControl("~/Controls/Home/Categorys.ascx");
                    if (ctr != null)
                    {
                        ctr.Cat_ID = Convert.ToInt32(tbl.Rows[i]["Cat_ID"]);
                        this.pnControl.Controls.Add(ctr);
                    }
                }
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var tbl = BOCategory.GetCategoryByParent(CatID);

            if (tbl != null && tbl.Rows.Count > 0)
            {
                foreach (System.Data.DataRow row in tbl.Rows)
                {
                    Literal1.Text += String.Format(childCat, (String.Format("/{0}.html", row["Cat_DisplayUrl"].ToString())), row["Cat_Name"].ToString(), row["Cat_ID"]);
                }
            }


            NewsPublishEntity ne = NewsPublished.NP_TinChiTiet(Lib.QueryString.NewsID, false);

            if (ne != null)
            {
                if (Request.QueryString["move301"] != null)
                {
                    Utils.Move301(ne.URL);
                    return;
                }
                string htmlMobile2 = BOAdv.GetAdvItemById(Lib.Object2Integer(48), Lib.QueryString.CategoryID);
                string adsContent  = "";

                if (!String.IsNullOrWhiteSpace(htmlMobile2))
                {
                    adsContent = Environment.NewLine + "<script>" + String.Format("var zone{0}_{2} = new RunBanner({1}, \"zone{0}_{2}_Adv\"); zone{0}_{2}.Show();", Lib.QueryString.CategoryID, htmlMobile2.Replace("\\n", " ").Replace("\\t", " "), 48).Replace("INSERT_RANDOM_NUMBER_HERE", DateTime.Now.ToFileTime().ToString()) + "</script>" + Environment.NewLine;
                }

                ltrTitle.Text = ne.NEWS_TITLE;

                var    content   = ne.NEWS_CONTENT;
                string pattern   = @"(?<start><a[^>]*)(?<end>>)";
                string repl      = @"${start} target=""_blank"" ${end}";
                string newString = Regex.Replace(content, pattern, repl);
                ltrContent.Text = newString.Replace("src=\"/Uploaded/", "src=\"http://static.netlife.vn/Uploaded/").Replace("<div id=\"vmcbackground\"></div>", string.Format("<div id=\"vmcbackground\"><center>{0}</center></div>", adsContent));
                ltrContent.Text = ltrContent.Text.Replace("jpg\"", "jpg?maxwidth=480\"" + " alt=\"" + ne.NEWS_TITLE + "\"");

                //jwplayer
                ltrContent.Text += "";



                string html = BOAdv.GetAdvEmbedScriptItemById(Lib.Object2Integer(37), Lib.Object2Integer(Lib.QueryString.CategoryID));
                if (html.Length > 2) //add ad video 7
                {
                    //if (html.Contains("ambient")) //ambient
                    //{
                    ltrContent.Text += Environment.NewLine;
                    ltrContent.Text += html;
                    //}
                    //else if (html.Contains("ebound")) //ebound
                    //{
                    //    String[] part = html.Split('@');
                    //    ltrContent.Text += Environment.NewLine;
                    //    ltrContent.Text = ltrContent.Text.Replace("<video", part[0] + "<video").Replace("video>", "video>" + part[1]);
                    //}
                }
                if (!ltrContent.Text.Contains("people_write"))
                {
                    ltrContent.Text += "\n<table class=\"tplCaption\"><div class=\"people_write hide\" itemprop=\"author\" itemscope=\"\" itemtype=\"https://schema.org/Person\"> <b><span itemprop=\"name\" class=\"icon_author\">Tổng hợp</span>/ Theo google</b><br></div> </div> </div></table>";
                }



                ltrDate.Text  = ne.NEWS_PUBLISHDATE.ToString("dd/MM/yyyy");
                ltrTime.Text  = ne.NEWS_PUBLISHDATE.ToString("hh:mm");
                ltrDes.Text   = ne.NEWS_INITCONTENT;
                ltrAthor.Text = ne.NEWS_ATHOR;

                if (!String.IsNullOrEmpty(ne.Keywrods))
                {
                    ltrKeyword.Text = ne.Keywrods;
                }
                else
                {
                    tags.Visible = false;
                }
                var catId = 0;

                if (Lib.QueryString.ParentCategoryID == 0)
                {
                    catId = Lib.QueryString.CategoryID;
                }
                else
                {
                    catId = Lib.QueryString.ParentCategoryID;
                }
                CategoryEntity cat = BOCategory.GetCategory(catId);
                if (cat != null)
                {
                    ltrCatName.Text = cat.Cat_Name;

                    ltrCattxt.Text = string.Format(txtCat, cat.Cat_DisplayURL.ToLower(), cat.Cat_Name);
                }
                if (Lib.QueryString.ParentCategoryID > 0)
                {
                    catId = Lib.QueryString.CategoryID;
                    CategoryEntity cat1 = BOCategory.GetCategory(catId);
                    ltrCatParent.Text = string.Format(txtCatPr, cat1.Cat_Description, cat1.Cat_Name);
                }



                Utils.SetPageHeader(this.Page, ne.NEWS_TITLE, ne.NEWS_INITCONTENT, Utils.RemoveHTMLTag(ne.Keywrods));
                Utils.SetFaceBookSEO(this.Page, ne.NEWS_TITLE, ne.NEWS_INITCONTENT, ne.Imgage.StorageUrl, Request.RawUrl);

                string GOOGLE =
                    @"  <meta itemprop=""datePublished"" content=""{4}"" />
                                        <meta itemprop=""sourceOrganization"" content=""NetLife"" />
                                        <meta itemprop=""url"" property=""og:url"" content=""{0}"" />
                                        <meta itemprop=""articleSection"" content=""{1}"" />
                                        <meta itemprop=""image"" content=""{3}"" />
                                        <div style=""display: none !important"" itemscope itemtype=""http://schema.org/Recipe"">
                                            <span itemprop=""name"">{2}</span>
                                            <img itemprop=""image"" src=""{3}"" />                                             
                                        </div>";

                ltrTitle.Text += string.Format(GOOGLE, ne.URL.StartsWith("http") ? ne.URL : "http://netlife.vn" + ne.URL, cat.Cat_Name, ne.NEWS_TITLE, !String.IsNullOrEmpty(ne.Imgage.StorageUrl) && ne.Imgage.StorageUrl.StartsWith("http") ? ne.Imgage.StorageUrl : Utils.ImagesThumbUrl + "/" + ne.Imgage.StorageUrl, ne.NEWS_PUBLISHDATE);
            }
            //if (ne != null && ne.NEWS_RELATION.Count > 0)
            {
                var abc = ne.NEWS_RELATION.Count > 2 ? ne.NEWS_RELATION.Skip(2).Take(6).ToList() : ne.NEWS_RELATION; // Edit Take(8) -> Take(6)  edit 20160525
                dataEntity = abc;
                NewsPublishEntity nep;
                int iCount = dataEntity != null ? dataEntity.Count : 0;
                for (int i = 0; i < (iCount > 6 ? 6 : iCount); i++) //(int i = 0; i < iCount; i++)
                {
                    nep        = dataEntity[i];
                    nep.Imgage = new ImageEntity(300, nep.Imgage.ImageUrl);
                    if (i < 3) //Gia tri cu la 4, thay doi vi ly do giam muc xuong con 6 bai, thay vi 8 bai nhu cu
                    {
                        ltrListRelate.Text += String.Format(itemRelateNews, nep.URL, nep.NEWS_TITLE, nep.URL_IMG);
                    }
                    else
                    {
                        ltrListRelate2.Text += String.Format(itemRelateNews, nep.URL, nep.NEWS_TITLE, nep.URL_IMG);
                        relatenews.Visible   = true;
                    }
                    // "Tin Cung Chuyen Muc"
                    if (relatedNewsId == null || relatedNewsId == "")
                    {
                        relatedNewsId = nep.NEWS_ID.ToString();
                    }
                    else
                    {
                        relatedNewsId = relatedNewsId + "," + nep.NEWS_ID.ToString();
                    }
                }

                for (int i = 0; i < (iCount > 3 ? 3 : iCount); i++) //Gia tri cu la 4, thay doi vi ly do giam muc xuong con 6 bai, thay vi 8 bai nhu cu
                {
                    nep             = dataEntity[i];
                    ltrRelate.Text += String.Format(itemOtherNews, nep.URL, nep.NEWS_TITLE, nep.URL_IMG);
                }
            }
            //else
            //{
            //    lienquan.Visible = false;

            //}

            //ltrVideo

            var video = NewsPublished.NP_Danh_Sach_Tin(0, 134, 4, 1, 300);

            if (video != null)
            {
                NewsPublishEntity nep;
                int iCount = video != null ? video.Count : 0;
                for (int i = 0; i < iCount; i++)
                {
                    nep = video[i];

                    ltrVideo.Text += String.Format(itemRelate, nep.URL, nep.NEWS_TITLE, nep.URL_IMG);
                }
            }

            {
                if (relatedNewsId.Length == 0)
                {
                    relatedNewsId = "20170427093838540";
                }
                var otherNews = NewsPublished.NP_Select_Tin_Cung_Chuyen_Muc(Lib.QueryString.ParentCategoryID, Lib.QueryString.CategoryID, Lib.QueryString.NewsID, 6, relatedNewsId);
                if (otherNews != null)
                {
                    NewsPublishEntity nep;
                    int iCount = otherNews != null ? otherNews.Count : 0;

                    for (int i = 0; i < (iCount > 6 ? 6 : iCount); i++) //(int i = 0; i < iCount; i++)
                    {
                        nep        = otherNews[i];
                        nep.Imgage = new ImageEntity(300, nep.Imgage.ImageUrl);
                        /*Chinh muc tin cung chuyen muc hien thi tuong tu Muc tin lien quan*/
                        if (i < 3) //Gia tri cu la 4, thay doi vi ly do giam muc xuong con 6 bai, thay vi 8 bai nhu cu
                        {
                            LiteralOther1.Text += String.Format(itemOther, nep.URL, nep.NEWS_TITLE, nep.URL_IMG);
                        }
                        else
                        {
                            LiteralOther2.Text += String.Format(itemOther, nep.URL, nep.NEWS_TITLE, nep.URL_IMG);
                            othernews.Visible   = true;
                        }
                    }
                }
                else
                {
                    cungchuyenmuc.Visible = false;
                }
            }
            {
                var listNews = NewsPublished.NP_Tin_Moi_Trong_Ngay(10, 60);
                if (listNews != null)
                {
                    NewsPublishEntity nep;
                    int iCount = listNews != null ? listNews.Count : 0;
                    //for (int i = 0; i < iCount; i++)
                    //{
                    //    nep = otherNews[i];
                    //    nep.Imgage = new ImageEntity(40, nep.Imgage.ImageUrl);
                    //    ltrOther.Text += String.Format(itemOther, nep.URL, nep.NEWS_TITLE, nep.URL_IMG);
                    //}
                    for (int i = 0; i < (iCount > 6 ? 6 : iCount); i++) //(int i = 0; i < iCount; i++)
                    {
                        nep        = listNews[i];
                        nep.Imgage = new ImageEntity(300, nep.Imgage.ImageUrl);
                        /* EDIT: Chinh muc tin cung chuyen muc hien thi tuong tu Muc tin lien quan*/
                        if (i < 3) //Gia tri cu la 4, thay doi vi ly do giam muc xuong con 6 bai, thay vi 8 bai nhu cu
                        {
                            LiteralNews1.Text += String.Format(itemNews, nep.URL, nep.NEWS_TITLE, nep.URL_IMG);
                        }
                        else
                        {
                            LiteralNews2.Text += String.Format(itemNews, nep.URL, nep.NEWS_TITLE, nep.URL_IMG);
                            listnews.Visible   = true;
                        }
                    }
                }
            }
        }