Пример #1
0
        protected void btnThanhToan_Click(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies["TenTK"];

            if (cookie != null)
            {
                string    tenTK = cookie.Value;
                HoaDonDTO hd    = new HoaDonDTO();
                hd.TenTaiKhoan    = tenTK;
                hd.NgayMua        = DateTime.Now;
                hd.DiaChiGiaoHang = "Tp.HCM";
                hd.SDTGiaoHang    = "0905939947";
                hd.TongTien       = GioHangBUS.TinhTongTienGH(tenTK);
                hd.MaHD           = HoaDonBUS.ThemHD(hd);

                DataTable dtbKetQua = GioHangBUS.LayGH(tenTK);
                foreach (DataRow dr in dtbKetQua.Rows)
                {
                    CTHoaDonDTO cthd = new CTHoaDonDTO();
                    cthd.MaHD    = hd.MaHD;
                    cthd.MaSP    = dr["MaSP"].ToString();
                    cthd.SoLuong = Convert.ToInt32(dr["SoLuong"]);
                    cthd.DonGia  = Convert.ToInt32(dr["GiaTien"]);
                    CTHoaDonBUS.ThemCTHD(cthd);
                }
            }
        }
Пример #2
0
        protected void btnThanhToan_Click(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies["TenTK"];

            if (cookie != null)
            {
                string      tentk = cookie.Value;
                TaiKhoanDTO tk    = TaiKhoanBUS.LayThongTinTK(tentk);
                HoaDonDTO   hd    = new HoaDonDTO();
                hd.TenTaiKhoan    = tentk;
                hd.NgayMua        = DateTime.Now;
                hd.DiaChiGiaoHang = tk.DiaChi;
                hd.SdtGiaoHang    = tk.SoDienThoai;
                hd.TongTien       = GioHangBUS.TinhTongTienGH(tentk);
                hd.MaHD           = HoaDonBUS.ThemHD(hd);

                DataTable dtbKQ = GioHangBUS.LayGH(tentk);
                foreach (DataRow dr in dtbKQ.Rows)
                {
                    CTHoaDonDTO cthd = new CTHoaDonDTO();
                    cthd.MaHD    = hd.MaHD;
                    cthd.MaHoa   = dr["MaHoa"].ToString();
                    cthd.SoLuong = Convert.ToInt32(dr["SoLuong"]);
                    cthd.DonGia  = Convert.ToInt32(dr["GiaTien"]);
                    CTHoaDonBUS.ThemCTHD(cthd);
                }
            }
        }
Пример #3
0
        protected void btnThanhToan_Click(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies["TenTK"];

            if (cookie != null)
            {
                string    tenTK = cookie.Value;
                HoaDonDTO hd    = new HoaDonDTO();
                //GioHangDTO gh = new GioHangDTO();
                hd.TenTaiKhoan    = tenTK;
                hd.NgayMua        = DateTime.Now;
                hd.DiaChiGiaoHang = "Tp.HCM";
                hd.SDTGiaoHang    = "0905939947";
                hd.TongTien       = GioHangBUS.TinhTongTienGH(tenTK);
                hd.MaHD           = HoaDonBUS.ThemHD(hd);
                DataTable dtbKetQua = GioHangBUS.LayDSGioHang(tenTK);

                foreach (DataRow dr in dtbKetQua.Rows)
                {
                    CTHoaDonDTO cthd = new CTHoaDonDTO();
                    cthd.MaHD    = hd.MaHD;
                    cthd.MaSP    = dr["MaSP"].ToString();
                    cthd.SoLuong = Convert.ToInt32(dr["SoLuong"]);
                    cthd.DonGia  = Convert.ToInt32(dr["GiaTien"]);
                    CTHoaDonBUS.ThemCTHD(cthd);



                    GioHangDTO gh = new GioHangDTO();
                    gh.TenTaiKhoan = tenTK;
                    gh.MaSP        = dr["MaSP"].ToString();
                    gh.SoLuong     = Convert.ToInt32(dr["SoLuong"]);
                    gh.SizeGiay    = dr["sizenumber"].ToString();
                    GioHangBUS.XoaGH(gh);

                    SanPhamBUS.CapNhatSoLuongTonKho(gh.MaSP, gh.SizeGiay, gh.SoLuong);
                }

                Response.Redirect("GioHang.aspx");
            }
        }