public void RemoveTransactionUserInput()
        {
            quit = false;
            int userInput2 = 0;

            RemoveTransactionDisplay();
            UIMenus UI = new UIMenus();

            foreach (var transaction in categorySelector)
            {
                if (!int.TryParse(Console.ReadLine(), out userInput2))
                {
                    Console.Clear();
                    UI.NonValidNum();
                    Console.ReadLine();
                    Console.Clear();
                    RemoveTransactionDisplay();
                }
                else if (userInput2 == transaction)
                {
                    ML.RemoveTransaction(categorySelector, userInput2);
                    break;
                }
                else
                {
                    //Do nothing...
                }
            }
        }
        public void AddTransactionUserInput()
        {
            AddTransactionDisplay();
            quit = false;
            UIMenus UI = new UIMenus();
            decimal transaction;

            while (!quit)
            {
                if (!decimal.TryParse(Console.ReadLine(), out userInput))
                {
                    Console.Clear();
                    UI.NonValidNum();
                    Console.ReadLine();
                    Console.Clear();
                    AddTransactionDisplay();
                }
                else
                {
                    transaction = userInput;
                    ML.AddTransaction(categorySelector, transaction);
                    quit = true;
                    break;
                }
                if (quit)
                {
                    break;
                }
            }
            quit = false;
        }
示例#3
0
        static void Main(string[] args)
        {
            //Console.Clear();
            SpendingTracker.UIMenus MM = new UIMenus();
            MM.mainMenu();



            //Console.WriteLine($"The lowest transaction is ${stats.Low:N2}");
            //Console.WriteLine($"The highest transaction is ${stats.High:N2}");
            //Console.WriteLine($"The average transaction is ${stats.Average:N2}");
            //Console.WriteLine($"The Total of the transactions is ${stats.Total:N2}");
            //M.ForEach(Console.WriteLine);
        }
        public void CategoryUserInput()
        {
            quit = false;
            UIMenus UI = new UIMenus();

            while (!quit)
            {
                if (!decimal.TryParse(Console.ReadLine(), out userInput)) //returns false if the user doesn't enter a number
                {
                    Console.Clear();
                    UI.NonValidNum();
                }
                else if (userInput == mN[0])
                {
                    Console.Clear();
                    AddTransactionUserInput();
                    quit = true;
                    break;
                }
                else if (userInput == mN[1])
                {
                    Console.Clear();
                    RemoveTransactionUserInput();
                    quit = true;
                    break;
                }
                else if (userInput == mN[2])
                {
                    Exit = true;
                    quit = true;
                    break;
                }
                else
                {
                    //Do nothing or wait...
                }
                if (quit)
                {
                    break;
                }
            }
            quit = false;
        }
示例#5
0
 static void Main(string[] args)
 {
     //Console.Clear();
     SpendingTracker.UIMenus MM = new UIMenus();
     MM.mainMenu();
 }
        public void categorySelectorUserInput()
        {
            UIMenus UI = new UIMenus();

            while (!quit)
            {
                if (!decimal.TryParse(Console.ReadLine(), out userInput))
                {
                    Console.Clear();
                    UI.NonValidNum();
                }
                else if (userInput == mN[0])
                {
                    Console.Clear();
                    UI.mainMenu();
                    quit = true;
                    break;
                }
                else if (userInput == mN[1])
                {
                    category         = categoryList[0];
                    categorySelector = ML.Bills;
                    quit             = true;
                    break;
                }
                else if (userInput == mN[2])
                {
                    category         = categoryList[1];
                    categorySelector = ML.Food;
                    quit             = true;
                    break;
                }
                else if (userInput == mN[3])
                {
                    category         = categoryList[2];
                    categorySelector = ML.Wants;
                    quit             = true;
                    break;
                }
                else if (userInput == mN[4])
                {
                    category         = categoryList[3];
                    categorySelector = ML.GasStationSnacks;
                    quit             = true;
                    break;
                }
                else if (userInput == mN[5])
                {
                    category         = categoryList[4];
                    categorySelector = ML.WorkAVI;
                    quit             = true;
                    break;
                }
                else if (userInput == mN[6])
                {
                    category         = categoryList[5];
                    categorySelector = ML.Gas;
                    quit             = true;
                    break;
                }
                else if (userInput == mN[7])
                {
                    category         = categoryList[6];
                    categorySelector = ML.Other;
                    quit             = true;
                    break;
                }
                else
                {
                    UI.mainMenu();
                    quit = true;
                    break;
                }
                if (quit)
                {
                    break;
                }
                quit = false;
            }
        }
        public void MonthSelectorListUserInput()
        {
            UIMenus UI = new UIMenus();

            //Variables
            while (!quit)
            {
                if (!decimal.TryParse(Console.ReadLine(), out userInput))
                {
                    Console.Clear();
                    UI.NonValidNum();
                }
                else if (userInput == mN[0])
                {
                    month = Months[0];
                    quit  = true;
                    break;
                }
                else if (userInput == mN[1])
                {
                    month = Months[1];
                    quit  = true;
                    break;
                }
                else if (userInput == mN[2])
                {
                    month = Months[2];
                    quit  = true;
                    break;
                }
                else if (userInput == mN[3])
                {
                    month = Months[3];
                    quit  = true;
                    break;
                }
                else if (userInput == mN[4])
                {
                    month = Months[4];
                    quit  = true;
                    break;
                }
                else if (userInput == mN[5])
                {
                    month = Months[5];
                    quit  = true;
                    break;
                }
                else if (userInput == mN[6])
                {
                    month = Months[6];
                    quit  = true;
                    break;
                }
                else if (userInput == mN[7])
                {
                    month = Months[7];
                    quit  = true;
                    break;
                }
                else if (userInput == mN[8])
                {
                    month = Months[8];
                    quit  = true;
                    break;
                }
                else if (userInput == mN[9])
                {
                    month = Months[9];
                    quit  = true;
                    break;
                }
                else if (userInput == mN[10])
                {
                    month = Months[10];
                    quit  = true;
                    break;
                }
                else if (userInput == mN[11])
                {
                    month = Months[11];
                    quit  = true;
                    break;
                }
                else
                {
                    Console.Clear();
                    UI.NonValidNum();
                }
                if (quit)
                {
                    break;
                }
            }
            quit = false;
        }