void GetNewsGroup(int cateID, int groupcate)
    {
        string strCate = GetCateParentIDArrayByID(cateID, groupcate);

        if (AspNetCache.CheckCache("HTML_ltlBlockNewsbyCateID_" + hddValue.Value) == false)
        {
            NewsGroupBSO newsgroupBSO = new NewsGroupBSO();
            DataTable    table        = newsgroupBSO.GetNewsGroupByCateHot(strCate, groupcate, "1", Convert.ToInt32(hddRecord.Value), "1", "1");


            string text1 = "";

            if (table.Rows.Count > 0)
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    DataRow dataRow = table.Rows[i];
                    text1 += "<div class='news-list'>";
                    text1 += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow["Title"]) + "-" + dataRow["GroupCate"] + "-" + dataRow["NewsGroupID"].ToString() + ".aspx' title='" + dataRow["Title"] + "'>";
                    text1 += "<span>";

                    if (dataRow["ImageThumb"].ToString() != "")
                    {
                        text1 += "<img class='is_img' src='" + Utils.getURLThumbImage(dataRow["ImageThumb"].ToString(), 65) + "' style='border-width: 0px;' alt='" + dataRow["Title"] + "'>";
                    }
                    else
                    {
                        text1 += "<img class='is_img' src='" + ResolveUrl("~/") + "images/img_logo.jpg' style='border-width: 0px;' alt='" + dataRow["Title"] + "'>";
                    }
                    text1 += dataRow["Title"];
                    text1 += "</span>" + "</a>";
                    text1 += "<div class='clear'></div>" + "</div>";
                }
            }


            AspNetCache.SetCacheWithTime("HTML_ltlBlockNewsbyCateID_" + hddValue.Value, text1, 150);
            ltlHotNewsSlider.Text = text1;
        }
        else
        {
            ltlHotNewsSlider.Text = (string)AspNetCache.GetCache("HTML_ltlBlockNewsbyCateID_" + hddValue.Value);
        }
    }
Exemple #2
0
    void GetNewsGroup(int cateID, int groupcate)
    {
        //string _value = hddValue.Value.Replace(",", "_").Substring(0, 25);
        string _value = hddValue.Value;
        //  string _value = truongID.ToString();

        String csname1 = "PanelScript_byCateID_" + _value;
        Type   cstype  = this.GetType();

        ClientScriptManager cs = Page.ClientScript;

        if (!cs.IsClientScriptBlockRegistered(cstype, csname1))
        {
            StringBuilder cstext1 = new StringBuilder();
            cstext1.Append("<script type=\"text/javascript\">");
            //cstext1.Append("$(document).ready(function(){");
            cstext1.Append("$(function() {");
            cstext1.Append("$(\"#carousel_newsID_" + _value + "\").carouFredSel({");
            cstext1.Append("items: 5,");
            cstext1.Append("scroll:1,");
            cstext1.Append("circular: true,");
            cstext1.Append("infinite: false,");
            cstext1.Append("direction: \"up\",");
            cstext1.Append("auto: {");
            cstext1.Append("play: true,");
            cstext1.Append("duration: 1000");
            cstext1.Append("},");
            cstext1.Append("height: 355,");
            cstext1.Append("width:295,");
            cstext1.Append("prev: {");
            cstext1.Append("button: \"#prev_" + _value + "\",");
            cstext1.Append("key: \"up\"");
            cstext1.Append("},");
            cstext1.Append("next: {");
            cstext1.Append("button: \"#next_" + _value + "\",");
            cstext1.Append("key: \"down\"");
            cstext1.Append("}");
            cstext1.Append("});");

            cstext1.Append("});");
            cstext1.Append("</script>");

            cs.RegisterClientScriptBlock(cstype, csname1, cstext1.ToString());
        }


        string strCate = GetCateParentIDArrayByID(cateID, groupcate);

        if (AspNetCache.CheckCache("HTML_blockNewsSlidebyCateID_All_" + _value) == false)
        {
            string strHotNewsSlider = "";

            if (strCate != String.Empty && strCate != "")
            {
                NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
                DataTable    table        = newsGroupBSO.GetNewsGroupByCateHot(strCate, groupcate, "1", Convert.ToInt32(hddRecord.Value), "1", "1");


                if (table.Rows.Count > 0)
                {
                    strHotNewsSlider += "<div id='carousel_newsID_" + _value + "'>";
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        DataRow dataRow = table.Rows[i];


                        strHotNewsSlider += "<div class='box-carousel-newsStrID'>";
                        strHotNewsSlider += "<div class='news-list'>";
                        strHotNewsSlider += "<a href='" + ResolveUrl("~/") + "d4/news/" + GetString(dataRow["Title"]) + "-" + dataRow["GroupCate"] + "-" + dataRow["NewsGroupID"].ToString() + ".aspx' title='" + dataRow["Title"] + "'>";
                        strHotNewsSlider += "<span>";
                        if (dataRow["ImageThumb"].ToString() != "")
                        {
                            strHotNewsSlider += "<img class='is_img' src='" + Utils.getURLThumbImage(dataRow["ImageThumb"].ToString(), 65) + "' style='border-width: 0px;' alt='" + dataRow["Title"] + "'>";
                        }
                        else
                        {
                            strHotNewsSlider += "<img class='is_img' src='" + ResolveUrl("~/") + "images/img_logo.jpg' style='border-width: 0px;' alt='" + dataRow["Title"] + "'>";
                        }
                        strHotNewsSlider += dataRow["Title"];
                        strHotNewsSlider += "</span>";
                        strHotNewsSlider += "</a>";
                        strHotNewsSlider += "<div class='clr'></div>";
                        strHotNewsSlider += "</div>";
                        strHotNewsSlider += "</div>";
                    }
                    strHotNewsSlider += "</div>";
                    strHotNewsSlider += "<div class='clearfix'>";
                    strHotNewsSlider += "</div>";
                    strHotNewsSlider += "<a class='prev-newsStrID' id='prev_" + _value + "' href='#'><span>up</span></a>";
                    strHotNewsSlider += "<a class='next-newsStrID' id='next_" + _value + "' href='#'><span>down</span></a>";
                }
            }
            // + hddValue.Value.Replace(",", "_").Substring(0, 10)
            AspNetCache.SetCacheWithTime("HTML_blockNewsSlidebyCateID_All_" + _value, strHotNewsSlider, 150);
            ltlHotNewsSlider.Text = strHotNewsSlider;
        }
        else
        {
            ltlHotNewsSlider.Text = (string)AspNetCache.GetCache("HTML_blockNewsSlidebyCateID_All_" + _value);
        }
    }
    private void GetHotNewsGroup(int cId, int gId)
    {
        NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
        DataTable    dataTable    = new DataTable();

        if (!AspNetCache.CheckCache("HTML_ltlHotNewsCateGroup_Group1_" + gId + "_" + cId))
        {
            string strCate = this.GetCateParentIDArrayByID(cId, gId);
            dataTable = newsGroupBSO.GetNewsGroupByCateHot(strCate, gId, "1", 4, "1", "1");

            AspNetCache.SetCacheWithTime("HTML_ltlHotNewsCateGroup_Group1_" + gId + "_" + cId, dataTable, 150);
        }
        else
        {
            dataTable = (DataTable)AspNetCache.GetCache("HTML_ltlHotNewsCateGroup_Group1_" + gId + "_" + cId);
        }

        string text = "";

        if (dataTable.Rows.Count > 0)
        {
            DataRow dataRow = dataTable.Rows[0];
            text += "<div class='box-content-main' style='padding:10px 0 0 0;'>";
            text += "<div class='box-hotnews'>";

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

            if (dataRow["ImageLarge"].ToString() != "")
            {
                text += "<img src='" + Utils.getURLThumbImage(dataRow["ImageLarge"].ToString(), 310) + "' width='300px' height='170px' alt='" + dataRow["Title"] + "'>";
            }
            else if (dataRow["ImageThumb"].ToString() != "")
            {
                text += "<img src='" + Utils.getURLThumbImage(dataRow["ImageThumb"].ToString(), 310) + "' width='300px' height='170px' alt='" + dataRow["Title"] + "'>";
            }

            text += "</a>";
            text += "</div>";
            text += "<div class='hotnews1-slider' style='margin-left: 320px;'>";
            text += "<div class='text-first'>";
            text += "<span>";

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

            text += dataRow["Title"].ToString();
            text += "</a></span> &nbsp;";
            text += "<span style='color:#6D6D6D; font-size: 12px;'>(" + Convert.ToDateTime(dataRow["PostDate"]).ToString("dd/MM/yyyy") + ")</span>";
            text += "<div class='richtext'>";
            text += "<p>";
            text += Tool.SubString(Tool.StripTagsCharArray(dataRow["ShortDescribe"].ToString()), 350);
            text += "</p>";
            text += "</div>";
            text += "</div>";
            for (int i = 1; i < dataTable.Rows.Count; i++)
            {
                DataRow dataRow2 = dataTable.Rows[i];
                text += "<div class='text-next'>";

                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='clear'></div>";
            text += "</div>";
            text += "</div>";
        }

        ltlHotNewsGroup.Text = text;
    }