public void RemoveBoatFromList(model.Member member, int i)
 {
     member.DeleteBoat(GetBoat(member, i - 1));
     c_dc.UpdateDataStorage();
 }
        /**
         * Checks boat menu option and delegates control to specialized functions
         */
        private void DoDelegateBoatOperation(model.Member member)
        {
            m_memberView.ShowMembersBoats();
            if (!member.HasNoBoatsRegistered())
            {
                model.Boat boatToHandle = m_memberView.GetMembersBoatToDisplay();
                m_boatView.ShowVerboseBoat(boatToHandle);
                view.BoatOperation operation = m_boatView.GetWhatToDoWithBoat();

                switch (operation)
                {
                    case view.BoatOperation.Edit:
                        m_boatController.DoEditBoat(boatToHandle);
                        break;
                    case view.BoatOperation.Delete:
                        member.DeleteBoat(boatToHandle);
                        m_baseView.PrintMessage("Boat deleted");
                        break;
                    case view.BoatOperation.Back:
                        break;
                    default:
                        break;
                }
            }
            else
            {
                m_baseView.GetKeyPress();
            }
            m_list.SaveMemberList();
        }
Exemplo n.º 3
0
        // Display view to delete a boat (pick boat, confirmation window), delete the boat from the member
        private void DeleteBoat(model.Member member)
        {
            if (member.Boats.Count() == 0)
            {
                DoMemberView(member);
            }
            else
            {
                try
                {
                    model.Boat boatToDelete = _boatView.GetBoatToEditOrDelete(member, "delete");
                    if (_boatView.ConfirmDelete() == true)
                    {
                        member.DeleteBoat(boatToDelete);
                        _list.SaveMemberList();
                    }

                    DoMemberView(member);
                }
                catch (Exception ex)
                {
                    _boatView.DisplayErrorMessage(ex.Message);
                    _boatView.PressKeyToContinue();
                    DoMemberView(member);
                }
            }
        }