// lay danh sach da dat hang: private void danhsach() { List <userpublicDAL> usp = (List <userpublicDAL>)Session["userPublic"]; int id = usp[0].id_user; dathangBLL bs = new dathangBLL(); List <dathangDAL> ds = bs.getDathangPublic(id); rpLichSuMua.DataSource = ds; rpLichSuMua.DataBind(); phuongthucthanhtoanBLL pt_bs = new phuongthucthanhtoanBLL(); for (int i = 0; i <= ds.Count - 1; i++) { List <phuongthucthanhtoanDAL> pt_ds = pt_bs.getPhuongThucById(ds[i].id_pt); Label lbPT = rpLichSuMua.Items[i].FindControl("lbPT") as Label; Label lbSTT = rpLichSuMua.Items[i].FindControl("lbSTT") as Label; lbSTT.Text = (i + 1).ToString(); lbPT.Text = pt_ds[0].ten_phuongthuc; Label lbTrangThai = rpLichSuMua.Items[i].FindControl("lbTrangThai") as Label; if (ds[i].trangthai == true) { lbTrangThai.Text = "Đã giao hàng"; } else { lbTrangThai.Text = "Đang chờ giao hàng"; } } }
// load thong tin cua thanh toan: private void loadthanhToanId(int id) { phuongthucthanhtoanBLL bs = new phuongthucthanhtoanBLL(); id = Convert.ToInt32(ddThanhToan.SelectedValue); List <phuongthucthanhtoanDAL> ds = bs.getPhuongThucById(id); lbThanhToan.Text = ds[0].chitiet; }
// hien thi du lieu private void loadphuongThuc() { int id = Convert.ToInt32(Request.QueryString["id"]); phuongthucthanhtoanBLL bs = new phuongthucthanhtoanBLL(); List <phuongthucthanhtoanDAL> ds = bs.getPhuongThucById(id); txtTen.Text = ds[0].ten_phuongthuc; txtTT.Text = ds[0].chitiet; }
// load dat hang private void loadDatHang(string v) { int row = 10; int hide = 0; if (Request.QueryString["p"] != null) { hide = Convert.ToInt32(Request.QueryString["p"]); } dathangBLL bs = new dathangBLL(); phuongthucthanhtoanBLL pt_bs = new phuongthucthanhtoanBLL(); dathangdetailBLL dhdt_bs = new dathangdetailBLL(); nguoidungBLL nd_bs = new nguoidungBLL(); khuyenmaiBLL km = new khuyenmaiBLL(); List <dathangDAL> ds = bs.getDathangP(row, hide, v); rpDatHang.DataSource = ds; rpDatHang.DataBind(); for (int i = 0; i <= ds.Count - 1; i++) { List <nguoidungDAL> nd_ds = nd_bs.getNguoiDungbyId(ds[i].id_user); List <phuongthucthanhtoanDAL> pt_ds = pt_bs.getPhuongThucById(ds[i].id_pt); List <dathangdetail> dhdt_ds = dhdt_bs.getdathangDetail(ds[i].id_dathang); Label lbNguoiDung = rpDatHang.Items[i].FindControl("lbNguoiDung") as Label; lbNguoiDung.Text = nd_ds[0].hoten; Label lbThanhToan = rpDatHang.Items[i].FindControl("lbThanhToan") as Label; lbThanhToan.Text = pt_ds[0].ten_phuongthuc; Label lbTongTien = rpDatHang.Items[i].FindControl("lbTongTien") as Label; decimal tongTien = 0; for (int j = 0; j <= dhdt_ds.Count - 1; j++) { if (dhdt_ds[j].khuyenmai == true) { tongTien += (dhdt_ds[j].gia - (dhdt_ds[j].gia * km.getKhuyenMaibyId(1) / 100)) * dhdt_ds[j].soluong; } else { tongTien += (dhdt_ds[j].gia * dhdt_ds[j].soluong); } } lbTongTien.Text = String.Format("{0:0,0 VNĐ}", tongTien); Label lbHinh = rpDatHang.Items[i].FindControl("lbHinh") as Label; if (ds[i].trangthai == true) { lbHinh.Text = "<img src=\"../images/admin/dathutien.jpg\" alt=\"Đã thu tiền\">"; } Label lbSTT = rpDatHang.Items[i].FindControl("lbSTT") as Label; lbSTT.Text += (i + 1 + hide).ToString(); } string view = ""; if (v != "") { view = "&v=" + Request.QueryString["v"]; } // phan trang: int current = Convert.ToInt32(Request.QueryString["p"]); phantrang pt = new phantrang(); lbPage.Text = pt.paging(bs.countP(v), row, view, current); }