public void LoadDSSP(bool TrangThai) { BUS_HoaDon bus = new BUS_HoaDon(); DataTable dt = new DataTable(); dt = bus.LoadDSHD(TrangThai); gvHoaDon.DataSource = dt.DefaultView; gvHoaDon.DataBind(); }
protected void gvHoaDon_PageIndexChanging(object sender, GridViewPageEventArgs e) { bool trangthai = bool.Parse(ddlHoaDon.SelectedValue); Session["hdPage"] = e.NewPageIndex; BUS_HoaDon bus = new BUS_HoaDon(); DataTable dt = new DataTable(); dt = bus.LoadDSHD(trangthai); gvHoaDon.DataSource = dt.DefaultView; gvHoaDon.PageIndex = e.NewPageIndex; gvHoaDon.DataBind(); }
protected void btnCapNhat_Click(object sender, EventArgs e) { if (Session["MaHoaDon"] != null) { BUS_HoaDon bus = new BUS_HoaDon(); int mahd = int.Parse(Session["MaHoaDon"].ToString()); HoaDon hd = new HoaDon(); hd.MAHD = mahd; hd.DIACHIGIAOHANG = txtDiaChi.Text; hd.TRANGTHAI = bool.Parse(ddlTrangThai.SelectedValue); bus.CapNhatHD(hd); if (hd.TRANGTHAI.Equals(true)) { foreach (GridViewRow row in gvCTHD.Rows) { int masp = int.Parse(row.Cells[1].Text); bus.CapNhatSoLuong(masp); } } lblThongBao.Text = ""; bool trangthai = bool.Parse(ddlHoaDon.SelectedValue); int page = int.Parse(Session["hdPage"].ToString()); DataTable dt = new DataTable(); dt = bus.LoadDSHD(trangthai); gvHoaDon.DataSource = dt.DefaultView; gvHoaDon.PageIndex = page; gvHoaDon.DataBind(); Session["MaHoaDon"] = null; } else { lblThongBao.Text = "Chưa chọn hóa đơn cần cập nhật."; } }