Example #1
0
        public void EditMenu(ConsoleView view)
        {
            do{
                try
               {
            int choice = view.ListEditChoices();

                    IReadOnlyCollection<Member> m_list = MemberDAL.getMemberList();
                    switch(choice){

                        case 0:
                            return;

                        case 1:
                            view.VerboseList(m_list);
                            view.ChooseID();
                            selectMember(m_list);

                            break;

                        default: break;

                    }
                }
                catch (FormatException e)
                {
                    Console.WriteLine("nåt gick fel");
                }
            }
            while (Console.ReadKey(true).Key != ConsoleKey.Escape);
        }
 static void Main(string[] args)
 {
     View.ConsoleView           v          = new View.ConsoleView();
     Model.MemberRegistry       registry   = new Model.MemberRegistry();
     Controller.ControllerClass controller = new Controller.ControllerClass();
     controller.Start(v, registry);
 }
Example #3
0
        // argument Listan
        public void selectMember(IReadOnlyCollection<Member> list)
        {
            ConsoleView test = new ConsoleView();
                         // show menyn

            int choice = int.Parse(Console.ReadLine());
            if(choice == 0)
            {
                return;
            }
            choice--;
            Member member = list.ElementAt(choice);
            test.ShowMembers(member);                        // skickar till show member visning av medlemmar
               int menuChoicce = int.Parse(Console.ReadLine());

                switch (menuChoicce)                    // menualternativ för Medlemmen
                {
                    case 0:
                        return;

                    case 1:
                       member.GetName = test.Rename();        // change name
                        break;

                    case 2:

                        MemberDAL.removeMember(choice);           // tas bort medlemmen
                        break;

                    case 3:
                        member.GetSecurityNumber = test.ChangeNumber();   // ändra personlighets nummer
                        break;

                    case 4:
                        test.ViewBoattype();
                        int Boatchoice = int.Parse(test.Boattypeinfo());            // användning av inmatning av boatchoice

                        double BoatLength = double.Parse(test.BoattypeLength());      //inmatning båtlängd // kan inte använda console write line eftersom det är void
                        Boat FullBoat = new Boat(Boatchoice,BoatLength);      // instans av ny objekt( med intagen längd av båtlängd och båtkategorier
                        member.sendToBoatList(FullBoat);
                        break;
                    case 5:
                        test.ShowBoat(member);
                        selectBoat(member);
                          break;

                    default: break;

                }
        }
Example #4
0
        public void selectBoat(Member member)
        {
            Boat boaten;
            IReadOnlyCollection<Member> newlist = MemberDAL.getMemberList(); ;
            ConsoleView test2 = new ConsoleView();
            //test2.bild();
            int choices = int.Parse(Console.ReadLine());
            if (choices == 0)
            {
                return;
            }
            choices--;

            test2.boatChoices();
            int boatchoice = int.Parse(Console.ReadLine());
            boaten = member.BoatList.ElementAt(choices);
            switch(boatchoice)
            {
                case 1:
                    member.RemoveBoatList(choices);
                    break;

                case 2:
                    test2.ViewBoattype();
                    choices = int.Parse(Console.ReadLine());
                test2.Boatchanges();
                    double newLength = double.Parse(Console.ReadLine());
                    //Boat FullBoat = new Boat(choices, newLength);
                    boaten.GetLength = newLength;                                  // egenskap == nya värdet
                    boaten.GetCategory = (Model.Boat.BoatCategory)choices;    // kan inte skicka in i egenskaper eftersom de inte har parameteer
                                                                          // hämtade objektet från båten
                                                                              // ändra värden via parse
                    break;

            }
        }
        public void selectBoat(Member member)
        {
            Boat boaten;
            IReadOnlyCollection<Member> newlist = MemberDAL.getMemberList(); ;
            ConsoleView newview = new ConsoleView();
            //test2.bild();
            int choices = int.Parse(Console.ReadLine());
            if (choices == 0)
            {
                return;
            }
            choices--;

            newview.boatChoices();
            int boatchoice = int.Parse(Console.ReadLine());
            boaten = member.BoatList.ElementAt(choices);
            switch (boatchoice)
            {
                case 1:
                    member.RemoveBoatList(choices);
                    break;

                case 2:
                    newview.ViewBoattype();
                    choices = int.Parse(Console.ReadLine());
                    newview.Boatchanges();
                    double newLength = double.Parse(Console.ReadLine());

                    boaten.GetLength = newLength;
                    boaten.GetCategory = (Model.Boat.BoatCategory)choices;

                    break;

            }
        }