public BoatController(string selectedMember, MemberView memberView) { this.selectedMember = selectedMember; this.boatView = new BoatView(this.selectedMember); this.memberDAL = new MemberDALModel(); this.memberView = memberView; showSelectedMenu(); }
public void run() { MemberList members = new MemberList(); var serializer = new SerializerXML(); var listViews = new ListViews(); var consoleView = new ConsoleView(); var memberview = new MemberView(); var boatview = new BoatView(); members = serializer.SerializerXMLIsNullOrNot(members); do { int choise = consoleView.GetMenuChoice(); switch (choise) { case 0: Environment.Exit(0); break; case 1: memberview.CreateMember(members); break; case 2: memberview.ShowMember(members); break; case 3: memberview.UpDateMember(members); break; case 4: memberview.RemoveMember(members); break; case 5: boatview.AddBoat(members); break; case 6: boatview.UpDateBoat(members); break; case 7: boatview.RemoveBoat(members); break; case 8: listViews.CompactList(members); break; case 9: listViews.CompleteList(members); break; } serializer.SerializeToXML(members); Console.Clear(); } while (true); }
static void Main(string[] args) { var appView = new AppView(); var memberView = new MemberView(); var boatView = new BoatView(); var memberController = new MemberController(memberView); var boatController = new BoatController(boatView); var appController = new AppController(appView, boatController, memberController); appController.Start(); }
public void CompleteList(MemberList members) { var boat = new Boat(); foreach (Member mObject in members.Members) { int boatCount = boat.CountBoats(mObject); Console.WriteLine("\nName: {0} PersonNr: {1} Medlemsnummer: {2} Antal båtar: {3}" , mObject.Name, mObject.SocialNr, mObject.MemberId, boatCount); if (boatCount != 0) { var boatview = new BoatView(); boatview.ShowBoats(mObject); } } ContinueOnKeyPressed(); }
public void ShowMember(MemberList members) { Console.WriteLine("Skriv in det medlemsnummer som du vill titta på:"); var member = new Member(); Member currentMember = member.ShowMember(members); Console.WriteLine("\nNamn: {0}", currentMember.Name); Console.WriteLine("MedlemsNr: {0}", currentMember.MemberId); Console.WriteLine("PersonNr: {0}", currentMember.SocialNr); var boatView = new BoatView(); boatView.ShowBoats(currentMember); ContinueOnKeyPressed(); }
public void AddBoat(MemberList members) { Boat myBoat = new Boat(); Member currentMember = new Member(); var boatview = new BoatView(); currentMember = currentMember.ObjectFinder1(members); if (currentMember.BoatList == null) { currentMember.BoatList = new BoatList(); } int index = members.Members.IndexOf(currentMember); boatview.ShowBoatTypeAndLength(); AddBoatTypeAndLength(myBoat); currentMember.BoatList.Add(myBoat); members.Members.RemoveAt(index); members.Members.Insert(index, currentMember); }
public void UpDateBoat(Member currentMember, Boat currentBoat) { var boatview = new BoatView(); boatview.ShowBoats(currentMember); int choise = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Du har valt att ändra på båt nr {0}", choise); int boatIndex = choise - 1; boatview.ShowBoatTypeAndLength(); AddBoatTypeAndLength(currentBoat); currentMember.BoatList.Add(currentBoat); currentMember.BoatList.Boats.RemoveAt(boatIndex); }