Пример #1
0
    private string getSliderfoot(DataTable data)
    {
        string  title = "", desc = "", url = "", img = "", html = "";
        int     i   = 0;
        DBClass _db = new DBClass();

        foreach (DataRow row in data.Rows)
        {
            i++;
            title = BaseView.GetStringFieldValue(row, "tieude");
            desc  = BaseView.GetStringFieldValue(row, "tomtat");
            url   = BaseView.GetStringFieldValue(row, "url");
            img   = BaseView.GetStringFieldValue(row, "hinhanh");
            DateTime ngaydang = BaseView.GetDateTimeFieldValue(row, "ngaydang");
            if (i == 1)
            {
                html += "<li class='slider-item'>";
            }
            string  tendanhmuc = "", urlloai = "";
            DataRow rowLoai = _db.get_info_loai(BaseView.GetIntFieldValue(row, "maloai"));
            if (rowLoai != null)
            {
                tendanhmuc = BaseView.GetStringFieldValue(rowLoai, "name");
                urlloai    = BaseView.GetStringFieldValue(rowLoai, "code") + ".hxml";
            }
            html += "<article class='slide-item col-xs-6 col-md-4'>";
            html += "<div class='slide-content'>";
            html += "<div class='slide-data'>";
            html += "<div class='slide-data-outer'>";
            html += "<div class='slide-data-inner'>";
            html += "<a class='slide-link' href='" + url + "' title='" + title + "' rel='bookmark'></a>";
            html += "<span class='slide-category'>";
            html += "<a href='" + urlloai + "' title=''>" + tendanhmuc + "</a> </span>";
            html += "<span class='slide-date'>" + BaseView.getThang(ngaydang) + " " + ngaydang.Day + ", " + ngaydang.Year + "</span>";
            html += "<h4 class='slide-title'><a href='" + url + "' title='" + title + "' rel='bookmark'>" + title + "</a></h4>";
            html += "</div>";
            html += "</div>";
            html += " </div>";
            html += "<div class='slide-hover'></div>";
            html += "<div class='slide-image'>";
            html += "<span>";
            html += "<img alt='" + title + "' width='263' height='187' src='" + img + "'></span>";
            html += "</div>";
            html += "</div>";
            html += "</article>";

            if (i == 3)
            {
                html += "</li>";
                html += "<li class='slider-item'>";
            }

            if (i != 3 && i == data.Rows.Count)
            {
                html += "</li>";
            }
        }
        return(html);
    }
Пример #2
0
    private string getSliderNews(DataTable data)
    {
        string title = "", desc = "", url = "", img = "", html = "";
        int    i = 0;

        foreach (DataRow row in data.Rows)
        {
            i++;
            title = BaseView.GetStringFieldValue(row, "tieude");
            desc  = BaseView.GetStringFieldValue(row, "tomtat");
            url   = BaseView.GetStringFieldValue(row, "url");
            img   = BaseView.GetStringFieldValue(row, "hinhanh");
            if (img.IndexOf("http") == -1)
            {
                img = "../uploadFile/postImages/" + img;
            }
            DateTime ngaydang = BaseView.GetDateTimeFieldValue(row, "ngaydang");
            string   tendanhmuc = "", urlloai = "";
            DBClass  _db     = new DBClass();
            DataRow  rowLoai = _db.get_info_loai(BaseView.GetIntFieldValue(row, "maloai"));
            if (rowLoai != null)
            {
                tendanhmuc = BaseView.GetStringFieldValue(rowLoai, "name");
                urlloai    = BaseView.GetStringFieldValue(rowLoai, "code") + ".hxml";
            }
            if (i == 1)
            {
                html += "<li class='col-md-12 slider-item'>";
                html += "<div class='box-slideshow-main box-slideshow-small'>";
                html += "<div class='box-slideshow-img'>";
                html += "<a href='" + url + "' title='" + title + "' rel='bookmark'>";
                html += "<img alt='" + title + "' width='360' height='229' src='" + img + "' />";
                html += "</a>";
                html += "<div class='slideshow-overlay'><a href='/' title='" + title + "' rel='bookmark'></a></div>";
                html += " </div>";
                html += "<div class='box-slideshow-content'>";
                html += "<div class='box-slideshow-outer'>";
                html += " <div class='box-slideshow-inner'>";
                html += "<span class='slide-category'>";
                html += " <a href='" + urlloai + "' title=''>" + tendanhmuc + "</a> </span>";
                html += "<span class='slide-date'><i class='fa fa-calendar'></i>" + BaseView.getThang(ngaydang) + " " + ngaydang.Day + ", " + ngaydang.Year + "</span>";
                html += "<div class='clearfix'></div>";
                html += "<a href='" + url + "' title='" + title + "' rel='bookmark'>" + title + " </a>";
                html += " </div>";
                html += " </div>";
                html += "</div>";
                html += "</div>";
                html += " </li>";
            }
        }
        return(html);
    }
Пример #3
0
    private string gethomeLastPost(DataTable data)
    {
        string title = "", desc = "", url = "", img = "", html = "";
        int    i = 0;

        foreach (DataRow row in data.Rows)
        {
            i++;
            title = BaseView.GetStringFieldValue(row, "tieude");
            desc  = BaseView.RemoveHtmlTagsUsingCompiledRegex(BaseView.GetStringFieldValue(row, "noidung"));
            url   = BaseView.GetStringFieldValue(row, "url");
            img   = BaseView.GetStringFieldValue(row, "hinhanh");

            if (img.IndexOf("http") == -1)
            {
                img = "../uploadFile/postImages/" + img;
            }
            DateTime ngaydang = BaseView.GetDateTimeFieldValue(row, "ngaydang");
            html += "<article class='v-post clearfix article-title-meta-image post-style-6 animation post--content image_post post-no-border post-349 post type-post status-publish format-standard has-post-thumbnail hentry category-apple' data-animate='fadeInUp' itemscope='' itemtype='http://schema.org/Article'>";
            html += "<div class='post-img post-img-9'>";
            html += "<div class='post-type'><i class='fa fa-image'></i></div>";
            html += "<a href='" + url + "' title='" + title + "' rel='bookmark' class='post-img-link'>";
            html += "<img alt='" + title + "' width='280px' height='230px' style='width: 250px;' src='" + img + "' />";
            html += "</a>";
            html += "</div>";
            html += "<div class='post-inner-6'>";
            html += "<h3 class='post-head-title'>";
            html += "<a itemprop='url' href='" + url + "' title='" + title + "' rel='bookmark'>" + title + "</a>";
            html += " </h3>";
            html += "<div class='post-meta'>";
            html += "<div class='post-meta-author'>";
            html += "<img alt='Ahmed Hassan' src='content/images/up/dell-2-27x27.jpg'><a href='author/' title='Posts by Ahmed Hassan' rel='author'>Ahmed Hassan</a>";
            html += "</div>";
            html += "<div class='post-meta-date'><i class='fa fa-calendar'></i>" + BaseView.getThang(ngaydang) + " " + ngaydang.Day + ", " + ngaydang.Year + "</div>";
            html += "<div class='post-meta-category'><i class='fa fa-folder-o'></i><a href='/' rel='category tag'>Apple</a></div>";
            html += "<div class='post-meta-comment'><i class='fa fa-comments-o'></i><a href='" + url + "#respond'>0 Comments</a></div>";
            html += "</div>";
            html += "<div class='clearfix'></div>";
            html += "<div class='post-inner'>";
            if (desc.Length > 80)
            {
                desc = desc.Substring(0, 80) + " ...";
            }
            html += "<p>" + desc + "</p>";
            html += "<div class='post-more'><a class='button-default medium' href='/' title='" + title + "' rel='bookmark'><i class='fa fa-long-arrow-right'></i>Đọc tiếp</a></div>";
            html += "<div class='clearfix'></div>";
            html += "</div>";
            html += "</div>";
            html += "</article>";
        }
        return(html);
    }
Пример #4
0
    private string itemSlideFootHome(DataTable dt)
    {
        DBClass _db = new DBClass();
        string  title = "", desc = "", url = "", img = "", html = "";
        int     i = 0;

        foreach (DataRow row in dt.Rows)
        {
            i++;
            title = BaseView.GetStringFieldValue(row, "tieude");
            desc  = BaseView.GetStringFieldValue(row, "tomtat");
            url   = BaseView.GetStringFieldValue(row, "url");
            img   = BaseView.GetStringFieldValue(row, "hinhanh");
            if (img.IndexOf("http") == -1)
            {
                img = "../uploadFile/postImages/" + img;
            }
            string  tendanhmuc = "", urlloai = "";
            DataRow rowLoai = _db.get_info_loai(BaseView.GetIntFieldValue(row, "maloai"));
            if (rowLoai != null)
            {
                tendanhmuc = BaseView.GetStringFieldValue(rowLoai, "name");
                urlloai    = "../" + BaseView.GetStringFieldValue(rowLoai, "code") + ".hxml";
            }
            DateTime ngaydang = BaseView.GetDateTimeFieldValue(row, "ngaydang");
            html += "<article class='slide-item col-xs-6 col-md-2'>";
            html += "<div class='slide-content'>";
            html += "<div class='slide-data'>";
            html += "<div class='slide-data-outer'>";
            html += "<div class='slide-data-inner'>";
            html += "<a class='slide-link' href='" + url + "' title='" + title + "' rel='bookmark'></a>";
            html += "<span class='slide-category'>";
            html += "<a href='" + urlloai + "' title='" + tendanhmuc + "'> " + tendanhmuc + "</a> </span>";
            html += "<span class='slide-date'><i class='fa fa-calendar'></i>" + BaseView.getThang(ngaydang) + " " + ngaydang.Day + ", " + ngaydang.Year + "</span>";
            html += "<span class='slide-review'></span>";
            html += "</div>";
            html += "</div>";
            html += "</div>";
            html += "<div class='slide-hover'></div>";
            html += "<div class='slide-image'>";
            html += "<span><img alt='" + title + "' width='263' height='187' src='" + img + "'></span>";
            html += "</div>";
            html += " </div>";
            html += "<h4 class='slide-title'><a href='" + url + "' title='" + title + "' rel='bookmark'>" + title + "</a></h4>";
            html += "</article>";
        }
        return(html);
    }
Пример #5
0
    private string getHomeNewsF(DataTable dt)
    {
        string title = "", desc = "", url = "", img = "", html = "";
        int    i = 0;

        foreach (DataRow row in dt.Rows)
        {
            i++;
            title = BaseView.GetStringFieldValue(row, "tieude");
            desc  = BaseView.GetStringFieldValue(row, "tomtat");
            url   = BaseView.GetStringFieldValue(row, "url");
            img   = BaseView.GetStringFieldValue(row, "hinhanh");
            if (img.IndexOf("http") == -1)
            {
                img = "../uploadFile/postImages/" + img;
            }
            DateTime ngaydang = BaseView.GetDateTimeFieldValue(row, "ngaydang");
            if (i == 1)
            {
                html += "<li class='col-md-6 col-sm-6 col-xs-6 col-mo-100'>";
                html += "<div class='box-news-big'>";
                html += "<div class='box-news-img'>";
                html += "<img alt='" + title + "' width='409' height='260' src='" + img + "'>";
                html += "<div class='box-news-overlay'><a href='" + url + "' title='" + title + "' rel='bookmark'></a></div>";
                html += "</div>";
                html += "<div class='box-news-content'>";
                html += "<div class='box-news-title'><a href='" + url + "' title='" + title + "' rel='bookmark'>" + title + " </a></div>";
                html += "<div class='box-news-meta box-meta-author'>";
                html += "<div class='box-news-meta-author'>";
                html += "<div class='post-meta-author'>";
                html += "<img alt='Phong Lê' src='content/images/up/dell-2-27x27.jpg'><a href='" + url + "' title='Làm đẹp' rel='author'>Phong Lê</a>";
                html += "</div>";
                html += "</div>";
                html += "<time class='box-news-meta-date' datetime='" + ngaydang + "'><i class='fa fa-calendar'></i>" + BaseView.getThang(ngaydang) + " " + ngaydang.Day + ", " + ngaydang.Year + "</time>";
                html += "<a class='box-news-meta-comment' href='" + url + "#respond'><i class='fa fa-comments-o'></i>0</a>";
                html += "<div class='box-news-meta-view'><i class='fa fa-eye'></i>377</div>";
                html += "</div>";
                html += "<div class='box-news-desc'>";
                html += "<p>" + desc + "</p>";
                html += "</div>";
                html += "<div class='box-news-more'><a href='" + url + "' title='" + title + "' rel='bookmark'>Đọc tiếp</a></div>";
                html += "</div>";
                html += "<div class='clearfix'></div>";
                html += "</div>";
                html += "</li>";
            }
            else
            {
                html += "<li class='col-md-6 col-sm-6 col-xs-6 col-mo-100'>";
                html += "<div class='box-news-small'>";
                html += "<div class='box-news-img'>";
                html += "<img alt='" + title + "' width='94' height='73' src='" + img + "'>";
                html += "<div class='box-news-overlay'><a href='" + url + "' title='" + title + "' rel='bookmark'></a></div>";
                html += " </div>";
                html += "<div class='box-news-content'>";
                html += "<div class='box-news-title'><a href='" + url + "' title='" + title + "' rel='bookmark'>" + title + "</a></div>";
                html += "<div class='box-news-meta'>";
                html += "<time class='box-news-meta-date' datetime=''" + ngaydang + "'><i class='fa fa-calendar'></i>" + BaseView.getThang(ngaydang) + " " + ngaydang.Day + ", " + ngaydang.Year + "</time>";
                html += "<a class='box-news-meta-comment' href='" + url + "#respond'><i class='fa fa-comments-o'></i>0</a>";
                html += "<div class='box-news-meta-view'><i class='fa fa-eye'></i>216</div>";
                html += "</div>";
                html += "</div>";
                html += "<div class='clearfix'></div>";
                html += "</div>";
                html += "</li>";
            }
        }
        return(html);
    }
Пример #6
0
    private void getInfo()
    {
        if (!String.IsNullOrEmpty(Request.QueryString["urlcode"]))
        {
            DataRow rowPost = GetPOST(Request.QueryString["urlcode"] + ".html");
            if (rowPost != null)
            {
                string   name     = BaseView.GetStringFieldValue(rowPost, "tieude");
                string   title    = BaseView.GetStringFieldValue(rowPost, "title");
                string   desc     = BaseView.GetStringFieldValue(rowPost, "desc");
                string   tomtat   = BaseView.GetStringFieldValue(rowPost, "tomtat");
                string   content  = BaseView.GetStringFieldValue(rowPost, "noidung");
                string   keywords = BaseView.GetStringFieldValue(rowPost, "keywords");
                string   url      = BaseView.GetStringFieldValue(rowPost, "url");
                int      maloai   = BaseView.GetIntFieldValue(rowPost, "maloai");
                DateTime ngaydang = BaseView.GetDateTimeFieldValue(rowPost, "ngaydang");
                string   hinh     = BaseView.GetStringFieldValue(rowPost, "hinhanh");
                hinh = hinh.IndexOf("http") == -1 ? BaseView.UrlServer() + "/UploadFile/postImages/" + BaseView.GetStringFieldValue(rowPost, "hinhanh") : hinh;

                //Write Info html----------------------------------------------------

                WritePost(name, tomtat, keywords, hinh, content, url, title, desc, keywords);
                DataRow row = _db.get_info_loai(maloai);
                if (row != null)
                {
                    string urlCat  = BaseView.GetStringFieldValue(row, "code") + ".html";
                    string nameCat = BaseView.GetStringFieldValue(row, "name");
                    ltLinkStrema.Text = "<a itemprop='url' href='" + urlCat + "'>" + nameCat + "</a> <i class='fa fa-angle-right'></i><a itemprop='url' href='" + url + "'>" + title + "</a>";
                    ltDM.Text         = "<a href='" + urlCat + "'>" + nameCat + "</a>";
                    //ltChuyenMuc.Text = nameCat;
                }
                //Get Category -----------------------------------------------------------------
                BindRepeater(_db.Get_All_News_Loai_SEO(maloai, 0));
                getPostisSEO(maloai, 10, 1, rpBaiSEO);
            }
            else if (_db.get_info_loai_code(Request.QueryString["urlcode"]) != null)
            {
                DataRow infoDM   = _db.get_info_loai_code(Request.QueryString["urlcode"]);
                int     id       = BaseView.GetIntFieldValue(infoDM, "id");
                string  name     = BaseView.GetStringFieldValue(infoDM, "name");
                string  title    = BaseView.GetStringFieldValue(infoDM, "title");
                string  desc     = BaseView.GetStringFieldValue(infoDM, "description");
                string  content  = BaseView.GetStringFieldValue(infoDM, "noidung");
                string  keywords = BaseView.GetStringFieldValue(infoDM, "keywords");
                string  url      = BaseView.GetStringFieldValue(infoDM, "code");

                //Write Info html----------------------------------------------------

                WritePost(name, name, keywords, desc, content, url, title, desc, keywords);

                //Get Category ------------------------------------------------------

                BindRepeater(_db.Get_All_News_Loai_SEO(id, 0));
                getPostisSEO(id, 10, 1, rpBaiSEO);
                //ltChuyenMuc.Text = name;
            }
            else
            {
                if (dataTags() != null)
                {
                    BindRepeater(dataTags());
                }
                else
                {
                    Response.Redirect("~/404/");
                }
            }
        }
    }
Пример #7
0
    private void UpdateXml()
    {
        //Response.Clear();
        //Response.ContentType = "text/xml";
        using (XmlTextWriter writer = new XmlTextWriter(Server.MapPath("~/sitemap.xml"), Encoding.UTF8))
        {
            writer.WriteStartDocument();
            writer.WriteStartElement("urlset");
            writer.WriteAttributeString("xmlns", "http://www.google.com/schemas/sitemap/0.84");
            writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
            writer.WriteAttributeString("xsi:schemaLocation", "http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd");


            DBClass   _db  = new DBClass();
            DataTable dtDM = _db.get_all_DanhMuc();
            BaseView  _bv  = new BaseView();
            foreach (DataRow row in dtDM.Rows)
            {
                int    idDanhMuc         = BaseView.GetIntFieldValue(row, "maDanhMuc");
                string convertTitleToUrl = BaseView.repalce_UrlFriendly(BaseView.convertToUnSign2(BaseView.GetStringFieldValue(row, "tenDanhMuc")).ToLower());
                string linkURL           = BaseView.repalce_UrlFriendly(convertTitleToUrl + "-" + idDanhMuc) + ".html";


                writer.WriteStartElement("url");
                writer.WriteElementString("loc", _bv.serverUrl() + "/" + linkURL + "");
                writer.WriteElementString("lastmod", String.Format("{0:yyyy-MM-dd}", DateTime.Now));
                writer.WriteElementString("changefreq", "daily");
                writer.WriteElementString("priority", "1.00");
                writer.WriteEndElement();
            }

            DataTable dtLT = _db.Get_All_LoaiTin();
            foreach (DataRow row in dtLT.Rows)
            {
                //tableSiteMap.Rows.Add(new object[] { "http://thammydiamond.com/"+ BaseView.GetStringFieldValue(row, "code").ToLower() + ".html", DateTime.Now.Year+"-"+DateTime.Now.Month+"-"+DateTime.Now.Day, "weekly" });
                writer.WriteStartElement("url");
                writer.WriteElementString("loc", _bv.serverUrl() + "/" + BaseView.GetStringFieldValue(row, "code").ToLower() + ".html");
                writer.WriteElementString("lastmod", String.Format("{0:yyyy-MM-dd}", DateTime.Now));
                writer.WriteElementString("changefreq", "daily");
                writer.WriteElementString("priority", "1.00");
                writer.WriteEndElement();
            }
            //DataTable dtTag = _db.get_top_words(10000);
            //foreach (DataRow row in dtTag.Rows)
            //{
            //    //tableSiteMap.Rows.Add(new object[] { "http://thammydiamond.com/" + "tags/" + BaseView.GetStringFieldValue(row, "id") + "-" + convertStringLinks(BaseView.GetStringFieldValue(row, "keywords")), DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day, "weekly" });

            //    writer.WriteStartElement("url");
            //    writer.WriteElementString("loc", _bv.serverUrl() + "/" + "tags/" + BaseView.GetStringFieldValue(row, "id") + "-" + convertStringLinks(BaseView.GetStringFieldValue(row, "keywords")));
            //    writer.WriteElementString("lastmod", String.Format("{0:yyyy-MM-dd}", DateTime.Now));
            //    writer.WriteElementString("changefreq", "daily");
            //    writer.WriteElementString("priority", "1.00");
            //    writer.WriteEndElement();
            //}
            DataTable dt = _db.get_all_news_actived(true);
            foreach (DataRow r in dt.Rows)
            {
                DateTime datePost = BaseView.GetDateTimeFieldValue(r, "ngaydang");

                //tableSiteMap.Rows.Add(new object[] { "http://thammydiamond.com/" + r["url"].ToString(), dateT.Year + "-" + dateT.Month + "-" + dateT.Day, "weekly" });

                writer.WriteStartElement("url");
                writer.WriteElementString("loc", _bv.serverUrl() + "/" + r["url"].ToString());
                writer.WriteElementString("lastmod", String.Format("{0:yyyy-MM-dd}", datePost));
                writer.WriteElementString("changefreq", "daily");
                writer.WriteElementString("priority", "1.00");
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.Flush();
        }
    }
Пример #8
0
    private string getItemForMenu(int idLoai, string urlLoai, string tieudeLoai)
    {
        string  htnl = "";
        DBClass _db  = new DBClass();
        string  html = "";

        html += "<li id='menu-item-375' class='menu-item menu-item-type-taxonomy menu-item-object-category menu-item-375 has-a-sub mega-menu-posts mega-menu-posts-2 mega-menu menu-no-title two-columns'><a href='" + urlLoai + "' class=''>" + tieudeLoai + "</a><div class='mega-menu-content menu-sub-content'>";
        DataTable dataNews = _db.sqlGetData("select top(7) * from News where maloai =" + idLoai + " order by id desc");

        if (dataNews.Rows.Count > 0)
        {
            html += "<div class='mega-menu-block'>";
            html += "<div class='row'>";
            html += "<div class='box-news box-news-1'>";
            html += "<ul>";
            string title = "", desc = "", url = "", img = "";
            int    i = 0;
            foreach (DataRow rowNews in dataNews.Rows)
            {
                i++;
                title = BaseView.GetStringFieldValue(rowNews, "tieude");
                desc  = BaseView.GetStringFieldValue(rowNews, "tomtat");
                url   = "../" + BaseView.GetStringFieldValue(rowNews, "url");
                img   = BaseView.GetStringFieldValue(rowNews, "hinhanh");
                if (img.IndexOf("http") == -1)
                {
                    img = "../uploadFile/postImages/" + img;
                }
                DateTime ngaydang = BaseView.GetDateTimeFieldValue(rowNews, "ngaydang");
                if (i == 1)
                {
                    html += "<li class='col-md-4'>";
                    html += "<div class='box-news-big'>";
                    html += "<div class='box-news-img'>";
                    html += "<img alt='" + title + "' width='550' height='350' src='" + img + "'><div class='box-news-overlay'><a href='" + url + "' title='" + title + "' rel='bookmark'></a></div>";
                    html += "</div>";
                    html += "<div class='box-news-content'>";
                    html += "<div class='box-news-title'><a href='" + url + "' title='" + title + "' rel='bookmark'>" + title + "</a></div>";
                    html += "<div class='box-news-meta'>";
                    html += "<time class='box-news-meta-date' datetime='" + ngaydang + "'><i class='fa fa-calendar'></i>" + BaseView.getThang(ngaydang) + " " + ngaydang.Day + ", " + ngaydang.Year + "</time>";
                    html += "<a class='box-news-meta-comment' href='" + url + "#respond'><i class='fa fa-comments-o'></i>0</a><div class='box-news-meta-view'><i class='fa fa-eye'></i>232</div>";
                    html += "</div>";
                    html += "</div>";
                    html += "<div class='clearfix'></div>";
                    html += "</div>";
                    html += "</li>";
                }
                else
                {
                    html += "<li class='col-md-4'>";
                    html += "<div class='box-news-small'>";
                    html += "<div class='box-news-img'>";
                    html += "<img alt='" + title + "' width='188' height='144' src='" + img + "'><div class='box-news-overlay'><a href='" + url + "' title='" + title + "' rel='bookmark'></a></div>";
                    html += "</div>";
                    html += "<div class='box-news-content'>";
                    html += "<div class='box-news-title'><a href='" + url + "' title='" + title + "' rel='bookmark'>" + title + "</a></div>";
                    html += "<div class='box-news-meta'>";
                    html += "<time class='box-news-meta-date' datetime='" + ngaydang + "'><i class='fa fa-calendar'></i>" + BaseView.getThang(ngaydang) + " " + ngaydang.Day + ", " + ngaydang.Year + "</time>";
                    html += "<a class='box-news-meta-comment' href='" + url + "#respond'><i class='fa fa-comments-o'></i>0</a><div class='box-news-meta-view'><i class='fa fa-eye'></i>57</div>";
                    html += " </div>";
                    html += "</div>";
                    html += "<div class='clearfix'></div>";
                    html += "</div>";
                    html += "</li>";
                }
            }

            html += "</ul>";
            html += "</div>";
            html += "<div class='clear'></div>";
            html += "</div>";
            html += " </div>";
            html += "</div>";
        }

        return(html);
    }
Пример #9
0
    private void getInfo()
    {
        if (!String.IsNullOrEmpty(Request.QueryString["id"]))
        {
            DBClass  _db      = new DBClass();
            string   url      = Request.QueryString["id"] + ".html";
            string[] urlShort = Request.QueryString["id"].Split('/');
            if (urlShort.Length > 0)
            {
                url = urlShort[urlShort.Length - 1] + ".html";
            }
            DataRow rowPost = _db.sqlGetDataRow("select * from News where url = '" + url + "'");
            //int countKey = 0;
            if (rowPost == null)
            {
                rowPost = _db.Get_URL_Pages(url);
            }
            if (rowPost != null)
            {
                string name     = BaseView.GetStringFieldValue(rowPost, "tieude");
                string title    = BaseView.GetStringFieldValue(rowPost, "title");
                string desc     = BaseView.GetStringFieldValue(rowPost, "desc");
                string tomtat   = BaseView.GetStringFieldValue(rowPost, "tomtat");
                string content  = BaseView.GetStringFieldValue(rowPost, "noidung");
                string keywords = BaseView.GetStringFieldValue(rowPost, "keywords");
                int    maloai   = BaseView.GetIntFieldValue(rowPost, "maloai");

                Page.Title           = title == "" ? BaseView.GetStringFieldValue(rowPost, "title") : title;
                Page.MetaDescription = desc;
                Page.MetaKeywords    = keywords;
                string hinh = BaseView.GetStringFieldValue(rowPost, "hinhanh");
                hinh            = hinh.IndexOf("http") == -1 ? BaseView.UrlServer() + "/UploadFile/postImages/" + BaseView.GetStringFieldValue(rowPost, "hinhanh") : hinh;
                ltImg.Text      = "<meta property='og:image' content='" + hinh + "'>";
                ltTitle.Text    = name;
                ltTitle2.Text   = name;
                ltDescPost.Text = "<div class=''>" + tomtat + "</div>";
                ltContent.Text  = content;
                getDataLQ(BaseView.GetStringFieldValue(rowPost, "id"));
                DateTime ngaydang = BaseView.GetDateTimeFieldValue(rowPost, "ngaydang");
                ltngaydang.Text = BaseView.getThang(ngaydang) + " " + ngaydang.Day + ", " + ngaydang.Year;
                DataRow infoLoai = _db.get_info_loai(maloai);


                if (infoLoai != null)
                {
                    ltCat.Text    = "<a itemprop='url' href='" + BaseView.GetStringFieldValue(infoLoai, "code").ToLower() + ".hxml'>" + BaseView.GetStringFieldValue(infoLoai, "name") + "</a>";
                    ltCattag.Text = "<a  href='" + BaseView.GetStringFieldValue(infoLoai, "code").ToLower() + ".hxml' rel='category tag'>" + BaseView.GetStringFieldValue(infoLoai, "name") + "</a>";

                    string hinhanh = BaseView.GetStringFieldValue(infoLoai, "Images").ToLower();
                    //if (hinhanh == "")
                    //    imgDanhMuc.Visible = false;
                    //else
                    //    imgDanhMuc.Visible = true;
                    //imgDanhMuc.ImageUrl = BaseView.UrlServer() + "/uploadFile/DanhMuc/" + hinhanh;
                    //imgDanhMuc.AlternateText = name;
                }
                //ltCat.Text = "<a itemprop='url' href='" + BaseView.GetStringFieldValue(rowPost, "code").ToLower() + ".hxml'>" + name + "</a>";

                BindRepeater(maloai);

                //btnSua.PostBackUrl = "~/EditPost/default.aspx?id=" + BaseView.GetStringFieldValue(rowPost, "id");
                //try
                //{
                string[] keywordArr = BaseView.GetStringFieldValue(rowPost, "keywords").Split(',');
                string   tags       = "";
                if (keywordArr.Length > 0)
                {
                    for (int i = 0; i < keywordArr.Length - 1; i++)
                    {
                        //lbTags.Text += i.ToString() + " ";
                        string[] ids   = keywordArr[i].Split('-');
                        int      idKey = ToSQL.SQLToInt(ids[ids.Length - 1]);
                        DataRow  row   = _db.get_info_words(idKey);
                        if (row != null)
                        {
                            tags += "<h6><a class='button small' itemprop='keywords' href='../tags/" + BaseView.GetStringFieldValue(row, "id") + "-" + convertStringLinks(BaseView.GetStringFieldValue(row, "keywords")) + "'>" + BaseView.GetStringFieldValue(row, "keywords") + "</a></h6>";
                        }
                    }
                }
                //lbTags.Text = tags;
                //}
                //catch { }


                //getLienQuan(BaseView.GetIntFieldValue(r, "maloai"));
                //getCamNangLienQuan(BaseView.GetIntFieldValue(r, "maloai"));
            }
            else
            {
                Response.Redirect("~/404/");
            }
        }
        if (Page.Title == "")
        {
            Page.Title = "Trang không tồn tại.";
        }
    }