Ejemplo n.º 1
0
        public static void KundeMenu() //Kundemenu valg som fører videre til andre metoder
        {
            Checkfilter menuChoices = pressedKey => pressedKey != 'A' && pressedKey != 'S' && pressedKey != 'D' && pressedKey != 'F' && pressedKey != 'Q';

            bool inMenu = true;

            while (inMenu)
            {
                listeAfKunder = Kunde.GetKunderList();
                listeAfKonti  = Konto.GetKontiList();
                DrawKunde();
                switch (EvaluateInput(menuChoices))
                {
                case 'A':
                    CreateKunde();
                    break;

                case 'S':
                    DeleteKunde();
                    break;

                case 'D':
                    SearchKunde();
                    break;

                case 'F':
                    Kontooversigt();
                    break;

                case 'Q':
                    inMenu = false;
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        public static char Start() //Menu input for hovedmenu
        {
            Checkfilter menuChoices = pressedKey => pressedKey != 'A' && pressedKey != 'S' && pressedKey != 'Q';

            DrawStart();
            return(EvaluateInput(menuChoices));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Tager en bool delegate af typen Checkfilter(char c);. Det er et filter for at bestemme tilladte taster for Console.Readkey input.
        /// <para></para>
        /// Eksempel: Checkfilter menuChoices = pressedKey => pressedKey != 'A' &amp;&amp; pressedKey != 'S' &amp;&amp; pressedKey != 'Q';
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        //Checkfilter menuChoices = pressedKey => pressedKey != 'A' && pressedKey != 'S' && pressedKey != 'Q';
        private static char EvaluateInput(Checkfilter filter)
        {
            char button;
            int  inputLeft = Console.CursorLeft, inputTop = Console.CursorTop;

            do
            {
                Console.SetCursorPosition(inputLeft, inputTop);
                button = Console.ReadKey().KeyChar;
                button = char.ToUpper(button);
            } while (filter(button));
            return(button);
        }
Ejemplo n.º 4
0
        private static void SletKonto()
        {
            Checkfilter yesNo = pressedKey => pressedKey != 'Y' && pressedKey != 'N';
            int         kontoNr;

            Console.Clear();
            Console.WriteLine();
            Console.Write("\t\tIndtast kontonummer: ");
            kontoNr = Convert.ToInt32(Console.ReadLine());
            Konto denneKonto = listeAfKonti.Find(k => k.Kontonummer == kontoNr);

            Console.WriteLine("Er du sikker du vil slette denne konto? (Y/N): ");
            if (EvaluateInput(yesNo) == 'Y')
            {
                denneKonto.RemoveKonto();
            }
        }
Ejemplo n.º 5
0
        private static void DeleteKunde() //UI for slet en kunde
        {
            Checkfilter yesNo = pressedKey => pressedKey != 'Y' && pressedKey != 'N';
            int         kundeNr;

            Console.Clear();
            Console.WriteLine();
            Console.Write("\t\tIndtast kundeummer: ");
            kundeNr = Convert.ToInt32(Console.ReadLine());
            Kunde denneKunde = listeAfKunder.Find(k => k.Kundenummer == kundeNr);

            Console.WriteLine("Er du sikker du vil slette denne kunde? (Y/N): ");
            if (EvaluateInput(yesNo) == 'Y')
            {
                denneKunde.RemoveKunde();
            }
        }
Ejemplo n.º 6
0
        public static void KontoMenu() //Menuen for Konto
        {
            Checkfilter menuChoices = pressedKey => pressedKey != 'A' && pressedKey != 'S' && pressedKey != 'D' && pressedKey != 'F' && pressedKey != 'G' && pressedKey != 'Q';
            bool        inMenu      = true;

            while (inMenu)
            {
                listeAfKonti         = Konto.GetKontiList(); //Loading af lister
                listeAfTransaktioner = Transaktion.GetTransaktionerList();
                DrawKonto();
                switch (EvaluateInput(menuChoices)) //Switch til Metoder
                {
                case 'A':
                    OpretKonto();
                    break;

                case 'S':
                    SletKonto();
                    break;

                case 'D':
                    VisSaldo();
                    break;

                case 'F':
                    IndsætHæv();
                    break;

                case 'G':
                    VisTransaktioner();
                    break;

                case 'Q':
                    inMenu = false;
                    break;
                }
            }
        }