Ejemplo n.º 1
0
        // thanh toán
        protected void btnThanhToan_Click(object sender, EventArgs e)
        {
            CustomerBLL b1 = new CustomerBLL();

            b1.Insert(txtNameCus.Text, txtAddressCus.Text, txtPhoneCus.Text);
            string id_cus = b1.getByIdJustCreated()[0].Id;

            BillBLL b2 = new BillBLL();

            b2.Insert(id_cus, DateTime.Parse(txtDateDelivery.Text), Int32.Parse("1"));
            string id_bill = b2.getByIdJustCreated()[0].Id;


            BillDetailsBLL b3   = new BillDetailsBLL();
            DataTable      cart = (DataTable)Session["cart"];

            foreach (DataRow r in cart.Rows)
            {
                string     id_pro   = r[0].ToString();
                int        price    = Int32.Parse(r[2].ToString());
                int        qty      = Int32.Parse(r[3].ToString());
                int        discount = Int32.Parse(txtDiscount.Text);
                int        amount   = price * qty - price * discount / 100;
                ProductBLL b4       = new ProductBLL();
                int        qty_pro  = b4.getById(id_pro)[0].Qty; // lấy giá trị số lượng tồn
                b3.Insert(id_bill, id_pro, qty_pro, qty, price, discount, amount);
            }
            for (int i = 0; i < gv_Cart.Rows.Count; i++)
            {
                gv_Cart.DeleteRow(i);
            }
            Session.Contents.Remove("cart");
        }
Ejemplo n.º 2
0
 private void dgvDSHD_Click(object sender, EventArgs e)
 {
     try
     {
         int       idx  = dgvDSHD.CurrentRow.Index;
         string    maHD = dgvDSHD.Rows[idx].Cells[0].Value.ToString();
         DataTable _ds  = BillDetailsBLL.LayDSCTHDTuMaHD(maHD);
         dgvCTHD.DataSource = _ds;
     }
     catch { }
 }