private void btnConfirm_Click(object sender, EventArgs e) { int count = 0; BUS_Order bus = new BUS_Order(); BUS_Orderdetail busOderDetail = new BUS_Orderdetail(); BUS_Customer busCus = new BUS_Customer(); string valid = checkConfirm(); if (valid.Equals("")) { if (cus != null) { string cusphone = cus.cusPhonenumber; string idEmp = employee.Username; long totalPrice = int.Parse(lblTotalPrice.Text); int totalQuantity = int.Parse(lblQuantity.Text); DTO_Order order = new DTO_Order(cusphone, idEmp, totalPrice, totalQuantity); int IDOrder = bus.createOrder(order); foreach (DTO_Product pro in listCart) { DTO_OrderDetail detail = new DTO_OrderDetail(IDOrder, pro.proID, pro.proPrice, pro.discount, pro.proQuantity); int counts = busOderDetail.createOrderDetail(detail); count += counts; } showBill(); MessageBox.Show(count.ToString()); } else { string newCus = txtCusName.Text; string newPhone = txtCusPhone1.Text; string newAdd = txtCusAdress.Text; cus = new DTO_Customer(newPhone, newCus, newAdd); busCus.creatCustomer(cus); string idEmp = employee.Username; int totalQuantity = int.Parse(lblQuantity.Text); long totalPrice = int.Parse(lblTotalPrice.Text); DTO_Order order = new DTO_Order(cus.cusPhonenumber, idEmp, totalPrice, totalQuantity); int IDOrder = bus.createOrder(order); foreach (DTO_Product pro in listCart) { DTO_OrderDetail detail = new DTO_OrderDetail(IDOrder, pro.proID, pro.proPrice, pro.discount, pro.proQuantity); int counts = busOderDetail.createOrderDetail(detail); count += counts; } MessageBox.Show(count.ToString()); showBill(); } clear1(); loadProduct(); } else { MessageBox.Show(valid); } }