Example #1
0
        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>")
            }
        }
Example #2
0
        public static bool themctHD(DTO_cthoadon cthoadon)
        {
            string query = "insert into CTHoaDon(MaHD, MaSP, SoLuong, DonGia) values (@mahd, @masp, @soluong, @dongia)";

            SqlParameter[] param = new SqlParameter[4];
            param[0] = new SqlParameter("@mahd", cthoadon.Mahd);
            param[1] = new SqlParameter("@masp", cthoadon.Masp);
            param[2] = new SqlParameter("@soluong", cthoadon.Soluong);
            param[3] = new SqlParameter("@dongia", cthoadon.Dongia);

            return(DataProvider.ExecuteInsertQuery(query, param) == 1);
        }
Example #3
0
 public static bool themcthd(DTO_cthoadon cthd)
 {
     return(DAO_cthoadon.themctHD(cthd));
 }