public void HandleEventShowMemberInfoMenu(Model.Member member, View.ConsoleView view, Model.MemberRegistry registry) { while (true) { view.ShowMenu(View.MenuEvent.MemberInfoMenu, member); switch (view.GetMenuSelection()) { case View.MenuEvent.EditMemberName: view.ShowInputInfo(View.MenuEvent.EditMemberName, member); try { member.Name = view.InputMemberName(); registry.Save(); } catch (ArgumentException) { view.ShowErrorMessage(View.Error.InvalidMemberName, null); view.Wait(); } break; case View.MenuEvent.EditMemberPersonalNumber: view.ShowInputInfo(View.MenuEvent.EditMemberPersonalNumber, member); try { member.PersonalNumber = view.InputMemberPersonalNumber(); registry.Save(); } catch (ArgumentException) { view.ShowErrorMessage(View.Error.InvalidPersonalNumber, null); view.Wait(); } break; case View.MenuEvent.ManageBoatsMenu: HandleEventShowManageBoatsMenu(member, view, registry); registry.Save(); break; case View.MenuEvent.Back: return; } } }
public void HandleEventNewMember(View.ConsoleView view, Model.MemberRegistry registry) { view.ShowInputInfo(View.MenuEvent.AddNewMember, null); Model.Member m = new Model.Member(registry.GetNextMemberId()); try { m.Name = view.InputMemberName(); } catch (ArgumentException) { view.ShowErrorMessage(View.Error.InvalidMemberName, null); view.Wait(); return; } try { m.PersonalNumber = view.InputMemberPersonalNumber(); } catch (ArgumentException) { view.ShowErrorMessage(View.Error.InvalidPersonalNumber, null); view.Wait(); return; } registry.AddMember(m); registry.Save(); }