Exemplo n.º 1
0
    protected void btnThemGioHang_Click(object sender, EventArgs e)
    {
        string madouong = Request.QueryString.Get("madouong");
        Cart   cart;

        if (Session["cart"] == null)
        {
            cart = new Cart();
        }
        else
        {
            cart = (Cart)Session["cart"];
        }
        string sql = "select * from douong ";

        if (madouong != null)
        {
            sql += "where madouong = " + madouong;
        }
        DataTable tbDoUong = ketnoi.getBang(sql);
        DataRow   row      = tbDoUong.Rows[0];

        cart.addCard(Convert.ToInt16(row[0]), row[1] + "", Convert.ToDouble(row[2]));
        Session["cart"] = cart;
        Response.Redirect("GioHang.aspx");
    }
    private void loadDrlMaDoUong()
    {
        string    sql       = "select * from danhmuc";
        DataTable tbDanhMuc = ketnoi.getBang(sql);

        drl_MaDoUong.DataSource     = tbDanhMuc;
        drl_MaDoUong.DataValueField = "madanhmuc";
        drl_MaDoUong.DataTextField  = "tendanhmuc";
        drl_MaDoUong.DataBind();
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string path = Server.MapPath("App_Data\\");

        ketnoi = new KetNoiDuLieu(path);
        if (!IsPostBack)
        {
            string    sql       = "select * from danhmuc";
            DataTable tbDanhMuc = ketnoi.getBang(sql);
            this.Repeater1.DataSource = tbDanhMuc;
            this.Repeater1.DataBind();
        }
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string path = Server.MapPath("App_Data\\");

        ketnoi = new KetNoiDuLieu(path);
        string madouong = Request.QueryString.Get("madouong");
        string sql      = "select * from douong ";

        if (madouong != null)
        {
            sql += "where madouong = " + madouong;
        }
        DataTable tbDoUong = ketnoi.getBang(sql);

        Repeater2.DataSource = tbDoUong;
        Repeater2.DataBind();
    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string path = Server.MapPath("App_Data\\");

        ketnoi = new KetNoiDuLieu(path);
        string sql       = "select * from douong ";
        string condition = Request.QueryString.Get("madanhmuc");

        if (condition != null)
        {
            sql += "where madanhmuc = " + condition;
        }
        DataTable tbDoUong = ketnoi.getBang(sql);

        DataList1.DataSource = tbDoUong;
        DataList1.DataBind();
    }