Exemple #1
0
 public static void RemoveCategory(string idName)
 {
     if (categoriesList.RemoveWhere(Match(idName)) > 0)
     {
         Save();
     }
     else
     {
         Console.WriteLine(Literals.getLiterals("Category does not exist"));
         Console.ReadKey(true);
     }
 }
Exemple #2
0
 public static void AddCategory(string idName)
 {
     if (!CategoryExists(idName))
     {
         categoriesList.Add(new Category(idName, 0));
     }
     else
     {
         Console.WriteLine(Literals.getLiterals("Category name or it's identity describer is not unique"));
         Console.ReadKey(true);
     }
 }
 public static void RemoveAccount(string accountNameId)
 {
     if (accountsList.RemoveWhere(Match(accountNameId)) > 0)
     {
         Save();
     }
     else
     {
         Console.WriteLine(Literals.getLiterals("Account does not exist"));
         Console.ReadKey(true);
     }
 }
 public static void AddAccount(string accountNameId, int accountBalance)
 {
     if (!AccountExists(accountNameId))
     {
         accountsList.Add(new Account(accountNameId, accountBalance));
         Save();
     }
     else
     {
         Console.WriteLine(Literals.getLiterals("Account name or it's identity describer is not unique"));
         Console.ReadKey(true);
     }
 }
 public static void Show()
 {
     if (accountsList == null || accountsList.Count == 0)
     {
         return;
     }
     Console.ForegroundColor = ConsoleColor.Cyan;
     Console.WriteLine(Literals.getLiterals("List of accounts and their balances"));
     foreach (Account ac in accountsList)
     {
         Console.WriteLine(ac.NameId + ":" + ac.Balance.ToString("#.##"));
     }
     Console.ForegroundColor = ConsoleColor.Green;
 }
Exemple #6
0
        public void Show()
        {
            if (categoriesList == null || categoriesList.Count == 0)
            {
                return;
            }

            Console.WriteLine();
            Console.WriteLine(Literals.getLiterals("List of categories and their expences"));
            Console.WriteLine("----------------------------------------------------------------------");
            Console.WriteLine();
            foreach (Category c in categoriesList)
            {
                Console.Write(c.NameId);
                for (int i = 0; i < 21 - c.NameId.Length; i++)
                {
                    Console.Write(" ");
                }
                Console.ForegroundColor = ConsoleColor.Red;
                Console.BackgroundColor = ConsoleColor.Red;


                double customerPercentage = 0;
                if (totalExpense != 0)
                {
                    customerPercentage = c.Expense * 100 / totalExpense;
                }
                for (int i = 0; i < customerPercentage / 2 + 1; i++)
                {
                    Console.Write(" ");
                }
                Console.ResetColor();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Write(" ");
                if (customerPercentage == 0)
                {
                    Console.WriteLine(c.Expense.ToString("#.##") + " " + customerPercentage + " %");
                }
                else
                {
                    Console.WriteLine(c.Expense.ToString("#.##") + " " + customerPercentage.ToString("#.##") + " %");
                }
                Console.WriteLine();
            }
            Console.WriteLine("----------------------------------------------------------------------");
        }
Exemple #7
0
 public static Literals getInstance()
 {
     return(literals == null ? literals = new Literals() : literals);
 }