// load thoong tin nguoi dung: private void loadNguoiDung(int id) { nguoidungBLL bs = new nguoidungBLL(); List <nguoidungDAL> ds = bs.getNguoiDungbyId(id); if (ds.Count == 1) { txtDiaChi.Text = ds[0].diachi; txtEmail.Text = ds[0].email; txtHoTen.Text = ds[0].hoten; txtSDT.Text = ds[0].sdt; ddlRole.SelectedValue = ds[0].role.ToString(); lbTK.Text = ds[0].username; } else { Response.Redirect("error.aspx"); } }
// 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); }