private void GetList() { DiamondProcessCode _dm = new DiamondProcessCode(); rpLastestPost.DataSource = _dm.GetTopPost(10, "", true); rpLastestPost.DataBind(); }
private DataTable dataSource() { DiamondProcessCode _db = new DiamondProcessCode(); try { string[] ids = Request.QueryString["code"].Split(','); string idString = Request.QueryString["code"]; if (ids.Length > 1) { idString = ids[0]; } string[] sKey = idString.Split('-'); if (sKey.Length > 0) { idString = ""; for (int i = 1; i < sKey.Length; i++) { idString += sKey[i] + "-"; } } return(_db.GetTopPost(10, idString, true)); } catch { return(_db.GetListPost("", null, null, true)); } }
private string getPostForMenu(string linkURL) { string htmlNews = ""; DiamondProcessCode _diamond = new DiamondProcessCode(); DataRow infoCategory = _diamond.GetSingleCategory(null, linkURL.Replace(".hxml", ""), true); if (infoCategory != null) { int idCategory = BaseView.GetIntFieldValue(infoCategory, "isPatient"); if (idCategory == 0) { idCategory = BaseView.GetIntFieldValue(infoCategory, "id"); } DataTable dataNews = _diamond.GetListPost("", idCategory, null, true); int rowsCount = 0; rowsCount = dataNews.Rows.Count < 8 ? dataNews.Rows.Count : 8; for (int i = 0; i < rowsCount; i++) { DataRow infoNews = dataNews.Rows[i]; htmlNews += "<div class='col-md-3' style='padding: 5px;'>"; string hinh = BaseView.GetStringFieldValue(infoNews, "HinhAnh"); if (hinh.IndexOf("http") == -1 && hinh.Trim() != "") { hinh = BaseView.pathImagesPost() + hinh; } htmlNews += "<div class='practise-area'>"; htmlNews += "<div class='thumb-top'>"; htmlNews += "<a href='" + BaseView.GetStringFieldValue(infoNews, "id_tt") + "'>"; htmlNews += "<img src='" + hinh + "' alt='" + BaseView.GetStringFieldValue(infoNews, "TieuDe") + "' /></a>"; htmlNews += "</div>"; htmlNews += "<div class=''>"; htmlNews += "<p class='details'>" + BaseView.GetStringFieldValue(infoNews, "TieuDe") + "</p>"; //htmlNews += "<a href='" + BaseView.UrlServer() + "/" + BaseView.GetStringFieldValue(infoNews, "id_tt") + "'>Xem thêm <i class='fa fa-arrow-circle-right'></i></a>"; htmlNews += "</div>"; htmlNews += "</div>"; htmlNews += "</div>"; } } return(htmlNews); }
private void getDetails() { if (!String.IsNullOrEmpty(Request.QueryString["id"])) { DBClass _db = new DBClass(); string url = Request.QueryString["id"] + ".html"; DiamondProcessCode _dm = new DiamondProcessCode(); DataRow info = _dm.GetSinglePost(null, url, null, true); //int countKey = 0; if (info == null) { info = _db.Get_URL_Pages(url); } if (info != null) { ltTitle.Text = BaseView.GetStringFieldValue(info, "tieude"); ltDesc.Text = BaseView.GetStringFieldValue(info, "tomtat"); string noidung = BaseView.GetStringFieldValue(info, "noidung"); ltContent.Text = noidung; Page.Title = BaseView.GetStringFieldValue(info, "title"); Page.MetaDescription = BaseView.GetStringFieldValue(info, "description"); Page.MetaKeywords = BaseView.GetStringFieldValue(info, "keywords"); string[] keywords = BaseView.GetStringFieldValue(info, "keywords").Split(','); string tags = ""; for (int i = 0; i < keywords.Length - 1; i++) { string[] ids = keywords[i].Split('-'); int idKey = ToSQL.SQLToInt(ids[ids.Length - 1]); DataRow row = _db.get_info_words(idKey); if (row != null) { tags += "<a class='f-tag b-tag' itemprop='keywords' href='../tags/" + BaseView.GetStringFieldValue(row, "id") + "-" + BaseView.convertStringLinks(BaseView.GetStringFieldValue(row, "keywords")) + "'>" + BaseView.GetStringFieldValue(row, "keywords") + "</a>"; } } //btnSua.PostBackUrl = "~/admin-us/sua-bai/default.aspx?id=" + BaseView.GetStringFieldValue(r, "id"); lbTags.Text = tags; } } }
void BindItemsList() { //Process data here string code = ""; if (!String.IsNullOrEmpty(Request.QueryString["code"])) { code = Request.QueryString["code"]; } DataTable data = new DataTable(); DiamondProcessCode _dm = new DiamondProcessCode(); DataRow infoCategory = _dm.GetSingleCategory(null, code, true); if (infoCategory != null) { int idCategory = BaseView.GetIntFieldValue(infoCategory, "id"); data = _dm.GetListPost("", idCategory, null, true); } //fill dataTable from Database _PageDataSource.DataSource = data.DefaultView; _PageDataSource.AllowPaging = true; _PageDataSource.PageSize = 8; _PageDataSource.CurrentPageIndex = CurrentPage; ViewState["TotalPages"] = _PageDataSource.PageCount; this.dataPost.DataSource = _PageDataSource; this.dataPost.DataBind(); if (dataPost.Items.Count > 0) { this.doPaging(); } else { //Message.Visible = true; //ShowMessage.Visible = true; //Message.Text = "Sorry,There is No Products yet !."; } }
private void getDetails() { if (!String.IsNullOrEmpty(Request.QueryString["code"])) { DiamondProcessCode _dm = new DiamondProcessCode(); DBClass _db = new DBClass(); string url = Request.QueryString["code"]; DataRow info = _dm.GetSingleCategory(null, url, true); if (info != null) { ltTitle.Text = BaseView.GetStringFieldValue(info, "name"); ltDesc.Text = BaseView.GetStringFieldValue(info, "description"); string noidung = BaseView.GetStringFieldValue(info, "noidung"); ltContent.Text = noidung; Page.Title = BaseView.GetStringFieldValue(info, "name"); Page.MetaDescription = BaseView.GetStringFieldValue(info, "description"); Page.MetaKeywords = BaseView.GetStringFieldValue(info, "description"); } } }
//private void getComments() //{ // DBClass _db = new DBClass(); // RpComment.DataSource = _db.get_all_comments_width_post(getPostID(), true); // RpComment.DataBind(); //} private int getPostID() { 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"; } DiamondProcessCode _dm = new DiamondProcessCode(); DataRow rowPost = _dm.GetSinglePost(null, url, null, true); if (rowPost == null) { rowPost = _db.Get_URL_Pages(url); } if (rowPost != null) { return(BaseView.GetIntFieldValue(rowPost, "id")); } } return(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"; } DiamondProcessCode _dm = new DiamondProcessCode(); DataRow rowPost = _dm.GetSinglePost(null, url, null, true); //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"); content = content.Replace("http://ykhoadiamond.vn/admin-tk/ckeditor/upload/", "http://ykhoadiamond.com/UploadFile/PostImages/"); string keywords = BaseView.GetStringFieldValue(rowPost, "keywords"); int maloai = BaseView.GetIntFieldValue(rowPost, "maloai"); Page.Title = title == "" ? BaseView.GetStringFieldValue(rowPost, "name") : title; Page.MetaDescription = desc; Page.MetaKeywords = keywords; ltImg.Text = "<meta property='og:image' content='" + BaseView.UrlServer() + "/UploadFile/postImages/" + BaseView.GetStringFieldValue(rowPost, "hinhanh") + "'>"; LbTieuDeChinh.Text = name; ltDescPost.Text = "<div class=''>" + tomtat + "</div>"; ltContent.Text = content; getDataLQ(BaseView.GetStringFieldValue(rowPost, "id")); 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>"; 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."; } }