private void FoodOrderListBox_SelectedIndexChanged(object sender, EventArgs e) { FoodOrder selectedFoodOrder = (FoodOrder)this.foodOrderListBox.SelectedItem; this.orderTracker1.UpdateOrderedFoodBlocks(selectedFoodOrder.foodBlockList); this.nameLabel.Text = selectedFoodOrder.customerDetails.customerName; this.addressLabel.Text = selectedFoodOrder.customerDetails.customerAddress; this.phoneLabel.Text = selectedFoodOrder.customerDetails.customerPhone; }
public void AddFoodOrder(FoodOrder foodOrder) { int index = 0; while (FoodOrderArray[index] != null) { index++; } if (FoodOrderArray[index] == null) { FoodOrderArray[index] = foodOrder; } else { Array.Resize(ref FoodOrderArray, FoodOrderArray.Length + 10); index++; FoodOrderArray[index] = foodOrder; } }
private void Button1_Click(object sender, EventArgs e) { FoodOrder foodOrder = new FoodOrder(); Random randomNumberGenerator = new Random(); CustomerDetails customerDetails = new CustomerDetails(); customerDetails.customerName = this.customerNameTextBox.Text; customerDetails.customerAddress = this.customerAddressTextBox.Text; customerDetails.customerPhone = this.customerPhoneNumberTextBox.Text; customerDetails.restaurantName = this.cowFilALabel.Text; foodOrder.customerDetails = customerDetails; foodOrder.orderNumber = randomNumberGenerator.Next(1, 100); foodOrder.foodBlockList = foodOrderList; this.Hide(); var formCompletionPage = new FormCompletionPage(pParentPage); formCompletionPage.FoodOrder = foodOrder; formCompletionPage.Show(); }