protected void btnorder_Click1(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["tenTK"]; string tentk = cookie.Value; if (cookie != null && string.IsNullOrEmpty(txb_hoten.Text) && string.IsNullOrEmpty(txb_diachi.Text) && string.IsNullOrEmpty(txb_sdt.Text)) { string tenTK = cookie.Value; DTO_hoadon hd = new DTO_hoadon(); DTO_cthoadon cthd = new DTO_cthoadon(); TaiKhoanDTO tk = TaiKhoanBUS.LayThongTinTaiKhoan(tenTK); hd.Tentaikhoan = tk.TenTaiKhoan; hd.Diachi = tk.DiaChi; hd.Ngaymua = DateTime.Now; int tong = BUS_giohang.tinhtien(tentk) + 3; hd.Tongtien = tong; hd.Sdt = tk.SDT; BUS_hoadon.themhoadon(hd); cthd.Mahd = hd.Mahd; cthd.Dongia = hd.Tongtien; BUS_giohang.xoagh(tentk); Response.Redirect("index.aspx"); } else { Response.Write("<script>alert('dat hang that bai')</script>") } }
protected void btn_qldh_Click(object sender, EventArgs e) { tttk.Visible = false; gv_donhang.Visible = true; HttpCookie cookie = Request.Cookies["tentk"]; string tenTK = cookie.Value; gv_donhang.DataSource = BUS_hoadon.loadhoadon(tenTK); gv_donhang.DataBind(); }