protected static string loadProductList(string cmdText, bool testDiscount) { DataTable tb = DataProvider.Instance.ExecuteQr(cmdText); string html = ""; string availiable = ""; foreach (DataRow row in tb.Rows) { IndexPageProduct product = new IndexPageProduct(row); if (product.Availiable) { availiable = "Còn hàng"; } else { availiable = "Liên hệ"; } html += "<a href=\"chi_tiet_san_pham.aspx?id=" + product.Id + "\" class=\"product\">"; html += "<div class=\"image\">"; html += "<img src=\"img/" + product.Image + ".jpg\">"; html += "</div>"; html += "<div class=\"product-content\">"; html += "<div class=\"title\">"; html += "<span class=\"name\">" + product.Name + "</span>"; html += "</div>"; html += "<div class=\"price\">"; html += "<span>" + string.Format("{0:0,0 đ}", product.Price) + "</span>"; html += "</div>"; html += "<div class=\"shop-name\">"; html += "<span>Tình trạng: " + availiable + "</span>"; html += "</div>"; html += "</div>"; html += "</a>"; i++; } return(html); }
protected void Page_Load(object sender, EventArgs e) { string search = Request.QueryString.Get("search"); string seeMore = Request.QueryString.Get("seeMore"); string kieudang = Request.QueryString.Get("loaihang"); DataTable tb = null; object[] parameter = new object[1]; object[] listPr = new object[1]; if (search != null) { parameter[0] = "@text"; listPr[0] = search; tb = DataProvider.Instance.ExecuteQr("SearchBtn", parameter, listPr); } else if (kieudang != null) { parameter[0] = "@loaihang"; listPr[0] = kieudang; tb = DataProvider.Instance.ExecuteQr("selectKieuDang", parameter, listPr); } else if (seeMore != null && String.Compare(seeMore, "new", true) == 0) { tb = DataProvider.Instance.ExecuteQr("seeMoreNew"); } else if (seeMore != null && String.Compare(seeMore, "sell", true) == 0) { tb = DataProvider.Instance.ExecuteQr("seeMoreSell"); } else if (seeMore != null && String.Compare(seeMore, "dis", true) == 0) { tb = DataProvider.Instance.ExecuteQr("seeMoreDis"); } string availiable = "", html = ""; foreach (DataRow row in tb.Rows) { IndexPageProduct product = new IndexPageProduct(row); if (product.Availiable) { availiable = "Còn hàng"; } else { availiable = "Liên hệ"; } html += "<a href=\"chi_tiet_san_pham.aspx?id=" + product.Id + "\" class=\"product\">"; html += "<div class=\"image\">"; html += "<img src=\"img/" + product.Image + ".jpg\">"; html += "</div>"; html += "<div class=\"product-content\">"; html += "<div class=\"title\">"; html += "<span class=\"name\">" + product.Name + "</span>"; html += "</div>"; html += "<div class=\"price\">"; html += "<span>" + string.Format("{0:0,0 đ}", product.Price) + "</span>"; html += "</div>"; html += "<div class=\"shop-name\">"; html += "<span>Tình trạng: " + availiable + "</span>"; html += "</div>"; html += "</div>"; html += "</a>"; } productList.InnerHtml = html; }