private void loadsp(int danhmuc, string noidung, int view) { int row = 10; int hide = 0; if (Request.QueryString["p"] != null) { hide = Convert.ToInt32(Request.QueryString["p"]); } sanphamBLL bs = new sanphamBLL(); List <sanphamDAL> ds = bs.getSanPhamP(row, hide, danhmuc, noidung, view); rpSanpham.DataSource = ds; rpSanpham.DataBind(); for (int i = 0; i <= ds.Count - 1; i++) { Label lbSTT = rpSanpham.Items[i].FindControl("lbSTT") as Label; DropDownList ddKuyenMai = rpSanpham.Items[i].FindControl("ddKuyenMai") as DropDownList; lbSTT.Text += (i + 1 + hide).ToString(); if (ds[i].khuyenmai == true) { ddKuyenMai.SelectedValue = "1"; } else { ddKuyenMai.SelectedValue = "0"; } } string pa = ""; if (view != -1) { pa = "&v=" + view + "&val=" + Request.QueryString["val"].ToString(); } else if (danhmuc != -1 && noidung != "") { pa = "&t=" + danhmuc + "&n=" + noidung + "&val=" + Request.QueryString["val"].ToString(); } // phan trang: int current = Convert.ToInt32(Request.QueryString["p"]); phantrang pt = new phantrang(); lbPage.Text = pt.paging(bs.countP(danhmuc, noidung, view), row, pa, current); }
// load san pham moi: private void loadspMoi() { lbtitle.Text = "Sản phẩm mới"; lbDanhMuc.Text = "Sản phẩm mới"; int hide = 0; int row = 10; if (Request.QueryString["p"] != null) { hide = Convert.ToInt32(Request.QueryString["p"]); } phantrang pt = new phantrang(); khuyenmaiBLL km = new khuyenmaiBLL(); sanphamBLL bs = new sanphamBLL(); List <sanphamDAL> ds = bs.getSanPhamP(row, hide, -1, "", -1); rpsanpham.DataSource = ds; rpsanpham.DataBind(); for (int i = 0; i <= ds.Count - 1; i++) { Label lbGia = rpsanpham.Items[i].FindControl("lbGia") as Label; if (ds[i].khuyenmai == true) { decimal khm = ds[i].gia - (ds[i].gia * km.getKhuyenMaibyId(1) / 100); lbGia.Text = "<span class='price'><span style='color:Red;'><del>" + String.Format("{0:0,0 vnđ}", ds[i].gia) + "</del> </span>" + String.Format("{0:0,0 vnđ}", khm) + "</span>"; } else { lbGia.Text = "<span class='price'>" + String.Format("{0:0,0 vnđ}", ds[i].gia) + "</span>"; } } int r = bs.countP(-1, "", -1); lbPhanTrang.Text = pt.pagingpublic(r, row, "&v=new", hide); }