public void DisplayOrderDetails() { Customer orderCustomer = null; Staff orderStaff = null; ExternalBusiness orderContractor = null; string customerDetails = ""; string bakerDetails = ""; foreach (Customer customer in DB.GetListOfCustomers()) { if (customer.getPersonID() == customOrder.getCustomerID()) { orderCustomer = customer; } } if (customOrder.getOrderOutsourced()) { foreach (ExternalBusiness contractor in DB.GetListOfContractors()) { if (contractor.getPersonID() == customOrder.getBakerID()) { orderContractor = contractor; } } } else { foreach (Staff baker in DB.GetListOfStaffMembers()) { if (baker.getPersonID() == customOrder.getBakerID()) { orderStaff = baker; } } } if (customOrder.getActiveOrder()) { ActiveOrderTextBlock.Text = "Active"; } else { ActiveOrderTextBlock.Text = "Inactive"; } IDTextBlock.Text = customOrder.getOrderID().ToString(); CustIDTextBlock.Text = customOrder.getCustomerID().ToString(); if (orderCustomer != null) { customerDetails = orderCustomer.getFirstName() + " " + orderCustomer.getSurname(); if (orderCustomer.getPhone() != "") { customerDetails = customerDetails + ", " + orderCustomer.getPhone(); } if (orderCustomer.getEmail() != "") { customerDetails = customerDetails + ", " + orderCustomer.getEmail(); } } CustDetailsTextBlock.Text = customerDetails; BakerIDTextBlock.Text = customOrder.getBakerID().ToString(); if (orderStaff != null) { BakerContractorTextBlock.Text = "In-shop baker"; bakerDetails = orderStaff.getFirstName() + " " + orderStaff.getSurname(); } else { try { BakerContractorTextBlock.Text = "Contractor"; if (orderContractor.GetBusinessName() != "") { bakerDetails = orderContractor.GetBusinessName() + ", "; } bakerDetails = bakerDetails + orderContractor.getFirstName() + " " + orderContractor.getSurname(); } catch { } } BakerDetailsTextBlock.Text = bakerDetails; SizeTextBlock.Text = customOrder.getOrderSize(); DescriptionTextBlock.Text = customOrder.getOrderDescription(); PriceTextBlock.Text = "£" + customOrder.getOrderPrice().ToString(); if (customOrder.getIsPaid()) { PaidTextBlock.Text = "Paid"; } else { PaidTextBlock.Text = "Not paid"; } if (customOrder.getReadyToCollect()) { ReadyToCollectTextBlock.Text = "Ready for collection"; } else { ReadyToCollectTextBlock.Text = "Not ready"; } if (customOrder.getCollected()) { CollectedBlock.Text = "Collected"; } else { CollectedBlock.Text = "Not collected"; } }