public void showBoatLengthMenu(Boat.BoatType boatType) { Console.WriteLine(); Console.WriteLine("Vald Båttyp: {0}", boatType); Console.WriteLine(); Console.WriteLine("Ange en båt längd"); }
public void AddBoat(MemberList members) { Console.WriteLine("Skriv in det medlemsnumer som du ska registrera en ny båt på:"); var boat = new Boat(); boat.AddBoat(members); Console.WriteLine("\nDu har lagt till en båt."); ContinueOnKeyPressed(); }
public Boat GetBoat() { var boat = new Boat(); Console.Write("Enter boat length: "); boat.Length = GetIntInputFromString(); Console.WriteLine("Please choose boat type"); boat.Type = (BoatType)GetMenuChoice("1. Sailboat\n2. Kayak\n3. Motorsailer\n4. Other", 4); return boat; }
public void CompactList(MemberList members) { var boat = new Boat(); foreach (Member mObject in members.Members) { int boatCount = boat.CountBoats(mObject); Console.WriteLine("\nName: {0} MedlemsNr: {1} Antal båtar: {2}" , mObject.Name, mObject.MemberId, boatCount); } ContinueOnKeyPressed(); }
public void RemoveBoat(MemberList members) { Boat currentBoat = new Boat(); Console.WriteLine("Skriv in det medlemsnummer som du ska radera en båt på:"); currentBoat.RemoveBoat(members); Console.WriteLine("\nDu har readerat en båt."); ContinueOnKeyPressed(); }
public void UpDateBoat(MemberList members) { Boat currentBoat = new Boat(); Member currentMember = new Member(); Console.WriteLine("Skriv in det medlemsnummer som du vill redigera en båt på."); currentMember = currentMember.ObjectFinder1(members); Console.WriteLine("Skriv in nummret på den båt du vill ändra på:"); currentBoat.UpDateBoat(currentMember, currentBoat); Console.WriteLine("\nDu har redigerat en båt."); ContinueOnKeyPressed(); }
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 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); }
//Change's the boat type public void updateBoatType(Boat boat) { Console.Clear(); listOfBoatTypes(); Boat.BoatType boatType = Boat.BoatType.Other; ConsoleKeyInfo input = Console.ReadKey(); switch (input.Key) { case ConsoleKey.D1: case ConsoleKey.NumPad1: boatType = Boat.BoatType.Salilboat; break; case ConsoleKey.D2: case ConsoleKey.NumPad2: boatType = Boat.BoatType.Motorsailer; break; case ConsoleKey.D3: case ConsoleKey.NumPad3: boatType = Boat.BoatType.Kayak_Canoe; break; case ConsoleKey.D4: case ConsoleKey.NumPad4: boatType = Boat.BoatType.Other; break; default: run(); break; } boat.BoatTypeProp = (Boat.BoatType)boatType; member_dal.saveMember(); listOfMembers.Clear(); run(); }
//Shows a menu of what to update on the selected boat public void updateBoatMenu(Boat boat) { main_menu.showChangeBoatMenu(); ConsoleKeyInfo input = Console.ReadKey(); switch (input.Key) { case ConsoleKey.D1: case ConsoleKey.NumPad1: updateBoatType(boat); break; case ConsoleKey.D2: case ConsoleKey.NumPad2: updateBoatLength(boat); break; default: run(); break; } }
public void updateBoatLength(Boat boat) { main_menu.changeBoatLength(); try { boat.BoatLenght = float.Parse(Console.ReadLine()); member_dal.saveMember(); listOfMembers.Clear(); run(); } catch (Exception) { run(); } }
public void addBoat(Boat boat) { _boats.Add(boat); }
public void Add(Boat obj) { _boats.Add(obj); }
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); }
public void AddBoatTypeAndLength(Boat boatObject) { while (true) { try { int TypeNr = Convert.ToInt16(Console.ReadLine()); if (TypeNr >= 1 && TypeNr <= 5) { string BoatType = Convert.ToString(TypeNr); boatObject.BoatType = BoatType; break; } else { Console.WriteLine("Fel nummer i inmatningen, välj 1-5."); } } catch (Exception) { Console.WriteLine("Fel i inmatning, försök igen."); } } while (true) { try { Console.WriteLine("Ange längden på båten i m."); double BoatLength = Convert.ToDouble(Console.ReadLine()); boatObject.BoatLength = BoatLength; break; } catch (Exception) { Console.WriteLine("Ange rätt inmatning i meter, försök igen."); } } }
public void showMemberBoats(int id, Boat.BoatType boatType, float boatLength) { Console.WriteLine("{0}: {1}\t{2}", id, boatType, boatLength); }