private void CreateOrder() { //create order id string idOrder = Guid.NewGuid().ToString(); TblOrderDTO order = new TblOrderDTO() { idOrder = idOrder, idEmployee = form.getEmployee().idEmployee, idCustomer = form.getCustomerId().Text, priceSum = float.Parse(form.getAmount().Text), discount = float.Parse(form.getDiscount().Text), total = float.Parse(form.getCurrentAmount().Text), orderDate = DateTime.Now, }; bool isSuccess = orderModel.AddOrder(order); if (isSuccess) { //create order detail dto for insert to database List <TblOrderDetailDTO> itemList = new List <TblOrderDetailDTO>(); foreach (var item in listProductOrder) { TblOrderDetailDTO dto = new TblOrderDetailDTO() { idOrder = idOrder, idProduct = item.idProduct, quantity = item.quantity, price = item.price, }; itemList.Add(dto); } CartDTO cart = new CartDTO(idOrder, itemList); isSuccess = orderModel.AddOrderDetail(cart); if (isSuccess) { updateCustomerPoint(); MessageBox.Show(MessageUtil.CHECKOUT_SUCCESS); } else { MessageBox.Show(MessageUtil.ERROR); } } else { MessageBox.Show(MessageUtil.ERROR); } }