Ejemplo n.º 1
0
        private void BtnThanhToanDonHang_Click(object sender, EventArgs e)
        {
            OrderBUS orderBUS = new OrderBUS();
            Order    order    = new Order();

            order.CustomerID = customer.CustomerID;
            order.EmployeeID = Session.EmployeeSession.employee.EmployeeID;
            order.CreatedAt  = DateTime.Now;
            order.TotalPrice = int.Parse(txtTongThanhTien.Text);

            int orerID = orderBUS.Insert(order);

            OrderDetailBUS orderDetailBUS = new OrderDetailBUS();

            for (int i = 0; i < lstOrderProduct.Count; i++)
            {
                OrderDetail orderDetail = new OrderDetail();
                orderDetail.OrderID        = orerID;
                orderDetail.ProductID      = lstOrderProduct[i].ProductID;
                orderDetail.SalingPrice    = lstOrderProduct[i].Price;
                orderDetail.SalingQuantity = lstOrderQuantity[i];

                orderDetailBUS.Insert(orderDetail);
            }

            ResetForm();
        }