Exemple #1
0
 public void TickEvent(Object source, ElapsedEventArgs e)
 {
     Dt = Dt.AddDays(1);
     if (Dt.Month != Dt.AddDays(-1).Month)//pokaždé, když se změní měsíc >>> do this
     {
         foreach (Account acc in Ac)
         {
             if (acc.Typ != "Uverovy")
             {
                 acc.Zustatek *= 1.02;
             }
             else
             {
                 Uverovy uv = acc as Uverovy;
                 uv.Jistina *= 1.02;
             }
         }
     }
 }
Exemple #2
0
        public void AccAdd(List <Account> AccountList, List <string> HistoryList)
        {
            Console.Write("Zadejte příjmení vlastníka: ");
            string surname = Console.ReadLine();

            Console.Write("Zadejte typ účtu (Spořící/Úvěrový/Studentský): ");
            string type = Console.ReadLine();

            if (type == "Spořící" || type == "Sporici")
            {
                Sporici spAcc = new Sporici(500.0, surname); AccountList.Add(spAcc); HistoryList.Add($"Added {type} account owned by {surname}");
            }
            if (type == "Úvěrový" || type == "Uverovy")
            {
                Uverovy uvAcc = new Uverovy(surname, 2000, 50000); AccountList.Add(uvAcc); HistoryList.Add($"Added {type} account owned by {surname}");
            }
            if (type == "Studentský" || type == "Studentsky")
            {
                Studentsky stAcc = new Studentsky(500.0, surname); AccountList.Add(stAcc); HistoryList.Add($"Added {type} account owned by {surname}");
            }
        }
Exemple #3
0
        public void AccManage(List <Account> AccountList, List <string> HistoryList)
        {
            Console.Clear();
            Console.Write(@"Zadejte, co chcete dělat?
Deposit ~ vybere peníze z účtu
Add ~ Přidá penize na účet
History ~ Vypíše historii pohybů účtu
Příkaz: ");
            string decision = Console.ReadLine();

            switch (decision)
            {
            case "Add":
                Console.Write("Zadejte vlastníka účtu: ");
                string surname = Console.ReadLine();
                Console.Write("Kolik se připočte: ");
                string s    = Console.ReadLine();
                double Plus = Convert.ToDouble(s);
                foreach (Account acc in AccountList)
                {
                    if (acc.Owner == surname)
                    {
                        if (acc.Typ == "Uverove")
                        {
                            HistoryList.Add($"Paid {Plus}czk from you {uv.Jistina}czk debt on account owned by {surname}.");
                            Uverovy uv = acc as Uverovy;
                            uv.Jistina -= Plus;
                        }
                        else
                        {
                            acc.Zustatek += Plus;
                            HistoryList.Add($"Added {Plus}czk to account owned by {surname}.");
                        }
                    }
                }

                break;

            case "Deposit":
                Console.Write("Zadejte vlastníka účtu: ");
                string sur = Console.ReadLine();
                Console.Write("Kolik se odečte: ");
                string t     = Console.ReadLine();
                double minus = Convert.ToDouble(t);
                foreach (Account acc in AccountList)
                {
                    if (acc.Owner == sur || acc.Typ == "Sporici")
                    {
                        if (acc.Zustatek - minus > 0)
                        {
                            acc.Zustatek -= minus;
                        }
                    }
                    if (acc.Owner == sur || acc.Typ == "Studentsky")
                    {
                        if (acc.Zustatek - minus > 0 && minus <= 500)
                        {
                            acc.Zustatek -= minus;
                        }
                    }
                    if (acc.Owner == sur || acc.Typ == "Uverovy")
                    {
                        Uverovy sp = acc as Uverovy;
                        if (minus < sp.UverovyRamec)
                        {
                            sp.Zustatek -= minus;
                        }
                    }
                }
                HistoryList.Add($"Deposited {minus}czk from account owned by {sur}.");
                break;

            case "History":
                FileStream   fs = new FileStream("history.txt", FileMode.Open);
                StreamReader sr = new StreamReader(fs);
                Console.WriteLine(sr.ReadToEnd());
                sr.Close();
                fs.Close();
                break;
            }
        }