Пример #1
0
    // lay danh sach da dat hang:

    private void danhsach()
    {
        List <userpublicDAL> usp = (List <userpublicDAL>)Session["userPublic"];
        int               id     = usp[0].id_user;
        dathangBLL        bs     = new dathangBLL();
        List <dathangDAL> ds     = bs.getDathangPublic(id);

        rpLichSuMua.DataSource = ds;
        rpLichSuMua.DataBind();


        phuongthucthanhtoanBLL pt_bs = new phuongthucthanhtoanBLL();

        for (int i = 0; i <= ds.Count - 1; i++)
        {
            List <phuongthucthanhtoanDAL> pt_ds = pt_bs.getPhuongThucById(ds[i].id_pt);
            Label lbPT  = rpLichSuMua.Items[i].FindControl("lbPT") as Label;
            Label lbSTT = rpLichSuMua.Items[i].FindControl("lbSTT") as Label;
            lbSTT.Text = (i + 1).ToString();
            lbPT.Text  = pt_ds[0].ten_phuongthuc;
            Label lbTrangThai = rpLichSuMua.Items[i].FindControl("lbTrangThai") as Label;
            if (ds[i].trangthai == true)
            {
                lbTrangThai.Text = "Đã giao hàng";
            }
            else
            {
                lbTrangThai.Text = "Đang chờ giao hàng";
            }
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        dathangBLL        bs = new dathangBLL();
        List <dathangDAL> ds = bs.getDathangthanhtoan();

        rpDatHang.DataSource = ds;
        rpDatHang.DataBind();

        for (int i = 0; i <= ds.Count - 1; i++)
        {
            Label lbSTT = rpDatHang.Items[i].FindControl("lbSTT") as Label;
            lbSTT.Text += (i + 1).ToString();
        }
    }
Пример #3
0
    private void thanhtoan(int id, string tt)
    {
        string     key = txtXacNhan.Text;
        string     k   = lbHinh.ToolTip;
        dathangBLL bs  = new dathangBLL();

        if (key == k)
        {
            bool tf = bs.ttDonHang(id, tt);
            Response.Redirect("dathang.aspx");
        }
        else
        {
            lbError.Text = "Mã xác thực không chính xác !";
        }
    }
Пример #4
0
    protected void btnUpDate_Click(object sender, EventArgs e)
    {
        dathangBLL       bs  = new dathangBLL();
        dathangdetailBLL bss = new dathangdetailBLL();
        string           id  = "";
        int  lengh           = 0;
        bool tf    = false;
        bool tff   = false;
        bool check = false;

        for (int i = 0; i <= rpDatHang.Items.Count - 1; i++)
        {
            CheckBox cbDell = rpDatHang.Items[i].FindControl("cbDell") as CheckBox;

            if (cbDell.Checked)
            {
                id   += cbDell.ToolTip + ",";
                check = true;
            }
        }
        lengh = id.Length;

        if (check == true)
        {
            string hid = id.Remove(lengh - 1);
            tff = bss.del(hid);
            tf  = bs.del(hid);
            if (tff == true && tf == true)
            {
                Response.Redirect("dathang.aspx?up=t");
            }
            else
            {
                lbError.Text = "<div class='error'> " +
                               " <div class='tl'></div><div class='tr'></div>"
                               + "<div class='desc'>"
                               + "	<p>Cập nhật thất bại!</p>"
                               + "</div>"
                               + "<div class='bl'></div><div class='br'></div>"
                               + "</div>";
            }
        }
    }
Пример #5
0
    protected void btnThanhToan_Click(object sender, EventArgs e)
    {
        sanphamBLL           bss  = new sanphamBLL();
        List <giohangDAL>    cart = (List <giohangDAL>)Session["cart"];
        List <userpublicDAL> usp  = (List <userpublicDAL>)Session["userPublic"];
        dathangBLL           bs   = new dathangBLL();

        bs.add_dathang(usp[0].id_user, Convert.ToInt32(ddThanhToan.SelectedValue));
        int id = bs.id_dathang(usp[0].id_user);

        for (int i = 0; i <= cart.Count - 1; i++)
        {
            int y = Convert.ToInt32(cart[i].id_sanpham);
            List <sanphamDAL> liSoLuong = bss.getSPbyId(y);
            bs.add_dathang_detail(cart[i].id_sanpham, id, cart[i].soluong, cart[i].size);
            int pi = liSoLuong[0].soluong - cart[i].soluong;
            bs.soluong_sp(cart[i].id_sanpham, pi);
        }

        Session.Remove("cart");
        Response.Redirect("success.aspx");
    }
Пример #6
0
    private void loadDatHang()
    {
        decimal           tong    = 0;
        dathangBLL        bs      = new dathangBLL();
        dathangdetailBLL  dhdt_bs = new dathangdetailBLL();
        khuyenmaiBLL      km      = new khuyenmaiBLL();
        List <dathangDAL> ds      = bs.getDathangdoanhthu("false");

        rpDatHang.DataSource = ds;
        rpDatHang.DataBind();
        for (int i = 0; i <= ds.Count - 1; i++)
        {
            List <dathangdetail> dhdt_ds = dhdt_bs.getdathangDetail(ds[i].id_dathang);

            Label   lbTongTien = rpDatHang.Items[i].FindControl("lbTongTien") as Label;
            decimal tongTien   = 0;
            for (int j = 0; j <= dhdt_ds.Count - 1; j++)
            {
                if (dhdt_ds[j].khuyenmai == true)
                {
                    tongTien += (dhdt_ds[j].gia - (dhdt_ds[j].gia * km.getKhuyenMaibyId(1) / 100)) * dhdt_ds[j].soluong;
                }
                else
                {
                    tongTien += (dhdt_ds[j].gia * dhdt_ds[j].soluong);
                }
            }
            tong           += tongTien;
            lbTongTien.Text = String.Format("{0:0,0 VNĐ}", tongTien);



            Label lbSTT = rpDatHang.Items[i].FindControl("lbSTT") as Label;
            lbSTT.Text += (i + 1).ToString();
        }
        lbSum.Text = "Tổng doanh thu:" + String.Format("{0:0,0 VNĐ}", tong);
    }
Пример #7
0
    // dem so luong dat hang chua xu ly:
    private void chuaxuly()
    {
        dathangBLL bs = new dathangBLL();

        lbDatHang.Text = bs.dangXuLy().ToString();
    }
Пример #8
0
    // load dat hang
    private void loadDatHang(string v)
    {
        int row  = 10;
        int hide = 0;

        if (Request.QueryString["p"] != null)
        {
            hide = Convert.ToInt32(Request.QueryString["p"]);
        }
        dathangBLL             bs      = new dathangBLL();
        phuongthucthanhtoanBLL pt_bs   = new phuongthucthanhtoanBLL();
        dathangdetailBLL       dhdt_bs = new dathangdetailBLL();
        nguoidungBLL           nd_bs   = new nguoidungBLL();
        khuyenmaiBLL           km      = new khuyenmaiBLL();
        List <dathangDAL>      ds      = bs.getDathangP(row, hide, v);

        rpDatHang.DataSource = ds;
        rpDatHang.DataBind();
        for (int i = 0; i <= ds.Count - 1; i++)
        {
            List <nguoidungDAL>           nd_ds   = nd_bs.getNguoiDungbyId(ds[i].id_user);
            List <phuongthucthanhtoanDAL> pt_ds   = pt_bs.getPhuongThucById(ds[i].id_pt);
            List <dathangdetail>          dhdt_ds = dhdt_bs.getdathangDetail(ds[i].id_dathang);
            Label lbNguoiDung = rpDatHang.Items[i].FindControl("lbNguoiDung") as Label;
            lbNguoiDung.Text = nd_ds[0].hoten;
            Label lbThanhToan = rpDatHang.Items[i].FindControl("lbThanhToan") as Label;
            lbThanhToan.Text = pt_ds[0].ten_phuongthuc;
            Label   lbTongTien = rpDatHang.Items[i].FindControl("lbTongTien") as Label;
            decimal tongTien   = 0;
            for (int j = 0; j <= dhdt_ds.Count - 1; j++)
            {
                if (dhdt_ds[j].khuyenmai == true)
                {
                    tongTien += (dhdt_ds[j].gia - (dhdt_ds[j].gia * km.getKhuyenMaibyId(1) / 100)) * dhdt_ds[j].soluong;
                }
                else
                {
                    tongTien += (dhdt_ds[j].gia * dhdt_ds[j].soluong);
                }
            }
            lbTongTien.Text = String.Format("{0:0,0 VNĐ}", tongTien);
            Label lbHinh = rpDatHang.Items[i].FindControl("lbHinh") as Label;
            if (ds[i].trangthai == true)
            {
                lbHinh.Text = "<img src=\"../images/admin/dathutien.jpg\" alt=\"Đã thu tiền\">";
            }

            Label lbSTT = rpDatHang.Items[i].FindControl("lbSTT") as Label;
            lbSTT.Text += (i + 1 + hide).ToString();
        }
        string view = "";

        if (v != "")
        {
            view = "&v=" + Request.QueryString["v"];
        }

        // phan trang:
        int       current = Convert.ToInt32(Request.QueryString["p"]);
        phantrang pt      = new phantrang();

        lbPage.Text = pt.paging(bs.countP(v), row, view, current);
    }