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); }
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"); } } }