Exemplo n.º 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>")
            }
        }
Exemplo n.º 2
0
        protected void rpt_slider_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "ThemGH")
            {
                HttpCookie cookie = Request.Cookies["tenTK"];
                if (cookie != null)
                {
                    string      tenTK = cookie.Value;
                    DTO_giohang gh    = new DTO_giohang();
                    gh.Tentaikhoan = tenTK;
                    gh.Masp        = e.CommandArgument.ToString();
                    gh.Soluong     = 1;

                    if (BUS_giohang.themvaogiohang(gh))
                    {
                        Response.Write("<script>alert('thanh cong')</script>");
                        Response.Redirect("cart.aspx");
                    }
                    else
                    {
                        Response.Redirect("cart.aspx");
                    }
                }
                else
                {
                    Response.Write("<script>warning('ban can phai dang nhap truoc')</script>");
                    Response.Redirect("../DangNhap.aspx");
                }
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                rpt_slider.DataSource = BUS_Sanpham.LayDSsp();
                rpt_slider.DataBind();


                HttpCookie cookie = Request.Cookies["tenTK"];
                if (cookie != null)
                {
                    string tenTK = cookie.Value;
                    if (!Page.IsPostBack)
                    {
                        DataTable   dtb_giohang = BUS_giohang.loadgiohang(tenTK);
                        TaiKhoanDTO tk          = TaiKhoanBUS.LayThongTinTaiKhoan(tenTK);

                        grvGioHang.DataSource = dtb_giohang;
                        grvGioHang.DataBind();
                        lblTongTien.Text = BUS_giohang.tinhtien(tenTK) + " USD";

                        //lb_tongtien.Text = BUS_giohang.tinhtien(tenTK) + " USD";
                        //txb_tenTK.Text = tk.TenTaiKhoan;
                        //txb_sdt.Text = tk.SDT;
                        //txb_diachi.Text = tk.DiaChi;
                        //txb_ngaymua.Text = DateTime.Now.ToString();
                    }
                }
                else
                {
                    Response.Redirect("../DangNhap.aspx");
                }
            }
        }
Exemplo n.º 4
0
        protected void ship2_CheckedChanged(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies["tenTK"];
            string     tentk  = cookie.Value;

            lbfee.Text = "+ $3.00";

            int tong = BUS_giohang.tinhtien(tentk) + 3;

            lbltong.Text = tong.ToString();
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies["tenTK"];

            if (cookie == null)
            {
                panel_logout.Visible = false;
            }
            else
            {
                string tenTK = cookie.Value;
                lb_username.Text     = tenTK;
                lb_amount.Text       = BUS_giohang.soluongSp(tenTK).ToString();
                panel_logout.Visible = true;
            }
        }
Exemplo n.º 6
0
        //protected void btn_cnthanhtoan_Click1(object sender, EventArgs e)
        //{
        //    HttpCookie cookie = Request.Cookies["tenTK"];
        //    if (cookie != null)
        //    {
        //        string tentk = cookie.Value;
        //        TaiKhoanDTO tk = TaiKhoanBUS.LayThongTinTaiKhoan(tentk);
        //        DTO_hoadon hd = new DTO_hoadon();
        //        hd.Tentaikhoan = tentk;
        //        hd.Ngaymua = DateTime.Now;
        //        hd.Diachi = tk.DiaChi;
        //        hd.Sdt = tk.SDT;
        //        hd.Tongtien = BUS_giohang.tinhtien(tentk);
        //        hd.Mahd = BUS_hoadon.themhoadon(hd);

        //        DataTable dtbketqua = BUS_giohang.loadgiohang(tentk);
        //        foreach (DataRow dr in dtbketqua.Rows)
        //        {
        //            DTO_cthoadon cthd = new DTO_cthoadon();
        //            cthd.Mahd = hd.Mahd;
        //            cthd.Masp = dr["masp"].ToString();
        //            cthd.Soluong = Convert.ToInt32(dr["soluong"]);
        //            cthd.Dongia = Convert.ToInt32(dr["giatien"]);
        //            BUS_cthoadon.themcthd(cthd);
        //        }


        //        Response.Write("<script>alert('Đơn hàng xử ý thành công!')</script>");
        //        BUS_giohang.xoagh(tentk);
        //    }


        //    //response.redirect("");
        //}


        protected void grvGioHang_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "xoasp")
            {
                HttpCookie cookie = Request.Cookies["TenTk"];
                string     tentk  = cookie.Value;

                string masp = e.CommandArgument.ToString();

                if (BUS_giohang.xoaSP(tentk, masp))
                {
                    Response.Write("<script>alert('tc')</script>");
                    Response.Redirect("cart.aspx");
                }
            }
            else
            {
                Response.Write("<script>alert('failed')</script>");
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                HttpCookie cookie = Request.Cookies["tenTK"];
                string     tentk  = cookie.Value;

                rpt_prdlist.DataSource = BUS_giohang.loadgiohang(tentk);
                rpt_prdlist.DataBind();
                lblTongTien.Text = BUS_giohang.tinhtien(tentk) + " USD";
                lbltong.Text     = BUS_giohang.tinhtien(tentk) + " USD";
                if (rd_dc1.Checked == true)
                {
                    TaiKhoanDTO tk = TaiKhoanBUS.LayThongTinTaiKhoan(tentk);
                    txb_hoten.Text   = tk.HoTen;
                    txb_diachi.Text  = tk.DiaChi;
                    txb_sdt.Text     = tk.SDT;
                    txb_zopcode.Text = "700000";
                    lbfee.Text       = "Free";
                }
            }
        }