public void AssignBoat(int indexOfSelectedCustomer, int indexOfSelectedBoat, ListBox listBox_ownedBoats) { // Selected customer. Customer selectedCustomer = myDataStorerForCustomers.ArrayOfCustomers[indexOfSelectedCustomer]; // Selected boat. Boat selectedBoat = myDataStorerForBoats.ArrayOfBoats[indexOfSelectedBoat]; // Make sure the boat doesn't have an owner yet. if (selectedBoat.Owner == null) { // Add the ownership to data storer. string customerPhoneNum = selectedCustomer.TelephoneNumber; string boatRegNum = selectedBoat.RegistrationNumber.ToString(); myDataStorerForOwnedBoats.AssignBoatToOwner(customerPhoneNum, boatRegNum); // Update ownership for: // customer and.. selectedCustomer.UpdateBoatsArr(selectedBoat); // boat. selectedBoat.Owner = selectedCustomer; // Update the ListBox for boats owned. MyListPopulatorForOwnedBoats.List(listBox_ownedBoats, selectedCustomer); } else { MyDebugger.ShowComment("already has an owner"); } }
public void DisplayCustomerInfo(Label[] arrayOfCustomerLabelsInfo, int indexOfSelectedCustomer, ListBox listBox_ownedBoats) { Customer selectedCustomer = null; if (indexOfSelectedCustomer != -1) { selectedCustomer = myDataStorerForCustomers.ArrayOfCustomers[indexOfSelectedCustomer]; } MyInfoDisplayerForCustomer.DisplayInfo(arrayOfCustomerLabelsInfo, selectedCustomer); // Update the groupBox->listBox to show the boats owned. MyListPopulatorForOwnedBoats.List(listBox_ownedBoats, selectedCustomer); }