//create order with orderlines private void orderButton_Click(object sender, EventArgs e) { Order.Order newOrder = new Order.Order(); Order.User customer = new Order.User(); customer.ID = this.loggedUser.ID; newOrder.date = DateTime.Now; newOrder.total = double.Parse(totalPlaceHolder.Text); newOrder.customer = customer; OrderLine[] orderLines = new OrderLine[cartListView.Items.Count]; for (int i = 0; i < cartListView.Items.Count; i++) { Order.OrderLine line = new Order.OrderLine(); Order.Product cartPoduct = new Order.Product(); cartPoduct.ID = int.Parse(cartListView.Items[i].SubItems[0].Text); line.product = cartPoduct; line.qty = int.Parse(cartListView.Items[i].SubItems[3].Text); line.priceUnit = double.Parse(cartListView.Items[i].SubItems[2].Text); orderLines[i] = line; } if (orderManager.createOrder(loggedUser.email, loggedUser.password, newOrder, orderLines)) { cartListView.Clear(); totalPlaceHolder.Text = "0"; this.loadOrders(); } }