//loai cua hang = 1 -> VIP //loai cua hang = 2 -> Chuyên nghiệp //loai cua hang = 0 -> Binh Thuong private void LoadGianHang(int LoaiCuaHang, int CurrentPage) { tblGianHang.Rows.Clear(); int RowStart = (CurrentPage - 1)*PageSize + 1; CuaHang ch = new CuaHang(); DataSet ds = new DataSet(); int NhomSanPhamID = 0; if (Request.QueryString["cid"] != null) NhomSanPhamID = int.Parse(Request.QueryString["cid"]); if (LoaiCuaHang != 0) { ds = ch.SelectCuaHangInLoaiCuaHangNhomSanPhamIDPaging(txtKeySearch.Text, LoaiCuaHang, NhomSanPhamID, RowStart, PageSize); } else { if (NhomSanPhamID == 0) ds = ch.SelectAllCuaHangPaging(txtKeySearch.Text, RowStart, PageSize); else ds = ch.SelectAllCuaHangByNhomSanPhamIDPaging(NhomSanPhamID, txtKeySearch.Text, RowStart, PageSize); } int n = ds.Tables[0].Rows.Count; for (int j = 0; j < 10; j++) { TableRow tr = new TableRow(); for (int i = 0; i < 2; i++) { TableCell td = new TableCell(); string content = ""; if (j*2 + i < n) { DataRow dr = ds.Tables[0].Rows[j * 2 + i]; content += "<table width=\"100%\" border=\"0\" cellspacing=\"4\" cellpadding=\"0\">"; if (dr["LoaiCuaHangID"].ToString() == "26") { content += "<tr><td style=\"widht:110px\"><a href=\"Newestore.aspx?sid=" + dr["CuaHangID"] + "\"><img src=\"" + dr["Anh"] + "\" width=\"110\" height=\"73\" style=\"border:#ece2a4 1px solid\" /></a></td>"; content += "<td style=\"width:80%\"><a href=\"Newestore.aspx?sid=" + dr["CuaHangID"] + "\"><b>" + dr["TenCuaHang"] + "</b><br> Đánh giá: "; } else { content += "<tr><td style=\"widht:110px\"><a href=\"estore.aspx?sid=" + dr["CuaHangID"] + "\"><img src=\"" + dr["Anh"] + "\" width=\"110\" height=\"73\" style=\"border:#ece2a4 1px solid\" /></a></td>"; content += "<td style=\"width:80%\"><a href=\"estore.aspx?sid=" + dr["CuaHangID"] + "\"><b>" + dr["TenCuaHang"] + "</b><br> Đánh giá: "; } int sodiem = (int) decimal.Parse("0" + dr["diem"]); for (int m = 0; m < sodiem; m++) { content += "<img align=\"absmiddle\" border=\"0\" src=\"./images/star1.gif\">"; } for (int m = 10; m > sodiem; m--) { content += "<img align=\"absmiddle\" border=\"0\" src=\"./images/star0.gif\">"; } content += string.Format("{0:0.0}", decimal.Parse("0" + dr["diem"])); if (dr["LoaiCuaHang"].ToString() == "1") { content += "<br><img border=0 src=\"./images/store2.jpg\" /><img src=\"./images/vip.jpg\" border=0 />"; } else { content += "<br><img border=0 src=\"./images/store1.jpg\" />"; } content += "</a></td></tr></table>"; } td.Text = content; td.HorizontalAlign = HorizontalAlign.Left; if (j == 0) td.Width = Unit.Percentage(50); tr.Cells.Add(td); } tblGianHang.Rows.Add(tr); } int NumberOfRow = int.Parse(ds.Tables[1].Rows[0]["Total"].ToString()); int NumberOfPage = NumberOfRow/PageSize; if (NumberOfPage*PageSize < NumberOfRow) NumberOfPage += 1; string strPage = "Trang"; for (int i = 1; i <= NumberOfPage; i++) { if (i == CurrentPage) { strPage += " [" + i + "]"; } else { strPage += " <a href=\"javascript:GoToPage(" + i + ")\">" + i + "</a>"; } } lblPage.Text = strPage; ddlPage.Items.Clear(); for (int i = 1; i <= NumberOfPage; i++) { ListItem li = new ListItem(i.ToString(), i.ToString()); if (i == CurrentPage) li.Selected = true; ddlPage.Items.Add(li); } }