Exemple #1
0
        public static void DepositIntoAcct()
        {
            Console.WriteLine("Enter the Account Number");
            string acct = Console.ReadLine();

            Console.WriteLine("Enter the Amount to be deposited:");
            string amt    = Console.ReadLine();
            var    item_S = s_Acct_List.Where(x => x.Acct_Number == Convert.ToInt64(acct)).FirstOrDefault();

            if (item_S != null)
            {
                Savings_Acct sc = new Savings_Acct();
                sc.Deposit(Convert.ToInt32(amt));

                s_Acct_List.Remove(item_S);
                item_S.Balance = Convert.ToInt32(amt);
                s_Acct_List.Add(item_S);
                Console.WriteLine("Amount deposited successfully!");
            }
            else
            {
                var item_C = c_Acct_List.Where(x => x.Acct_Number == Convert.ToInt64(acct)).FirstOrDefault();
                if (item_C != null)
                {
                    Current_Acct sc = new Current_Acct();
                    sc.Deposit(Convert.ToInt32(amt));

                    c_Acct_List.Remove(item_C);
                    item_S.Balance = Convert.ToInt32(amt);
                    c_Acct_List.Add(item_C);
                    Console.WriteLine("Amount deposited successfully!");
                }
            }
        }
Exemple #2
0
        public static void GetRateOfInterest()
        {
            Console.WriteLine("Press S for Savings Account");
            Console.WriteLine("Press C for Current Account");

            string inp = Console.ReadLine();

            if (string.Equals(inp, "S", StringComparison.OrdinalIgnoreCase))
            {
                var sv = new Savings_Acct();
                sv.GetRateofInterest();
            }
            else if (string.Equals(inp, "C", StringComparison.OrdinalIgnoreCase))
            {
                var sv = new Current_Acct();
                sv.GetRateofInterest();
            }
        }
Exemple #3
0
        public static void EditExistingAccount()
        {
            Console.WriteLine("Enter the Account Number");
            string acct = Console.ReadLine();

            Console.WriteLine("Enter the new Name");
            string name   = Console.ReadLine();
            var    item_S = s_Acct_List.Where(x => x.Acct_Number == Convert.ToInt64(acct)).FirstOrDefault();

            if (item_S != null)
            {
                Savings_Acct sc = new Savings_Acct();
                if (sc.EditAccount(name))
                {
                    s_Acct_List.Remove(item_S);
                    item_S.User_Name = name;
                    s_Acct_List.Add(item_S);
                    Console.WriteLine("Account edited successfully!");
                }
                else
                {
                    Console.WriteLine("Error processing account!!");
                }
            }
            else
            {
                var item_C = c_Acct_List.Where(x => x.Acct_Number == Convert.ToInt64(acct)).FirstOrDefault();
                if (item_C != null)
                {
                    Current_Acct sc = new Current_Acct();
                    if (sc.EditAccount(name))
                    {
                        c_Acct_List.Remove(item_C);
                        item_C.User_Name = name;
                        c_Acct_List.Add(item_C);
                        Console.WriteLine("Account edited successfully!");
                    }
                    else
                    {
                        Console.WriteLine("Error processing account!!");
                    }
                }
            }
        }
Exemple #4
0
        public static void TransferAmount()
        {
            Console.WriteLine("Enter the account number, from where the amount will be deducted:");
            string acctF = Console.ReadLine();

            Console.WriteLine("Enter the account number, from where the amount will be added:");
            string acctT = Console.ReadLine();

            Console.WriteLine("Enter the amount to be transferred to the account:");
            string amt    = Console.ReadLine();
            var    item_S = s_Acct_List.Where(x => x.Acct_Number == Convert.ToInt64(acctF)).FirstOrDefault();

            if (item_S != null)
            {
                Savings_Acct sc = new Savings_Acct();
                sc.FromAccount = Convert.ToInt32(acctF);
                sc.ToAccount   = Convert.ToInt32(acctT);
                if (sc.FromAccount > 0 && sc.ToAccount > 0)
                {
                    var tpl = new Dictionary <string, object>();
                    tpl.Add("SAVINGS", s_Acct_List);
                    var data = sc.TransferAmount(tpl, Convert.ToInt32(amt));
                    s_Acct_List = data.Where(x => x.Key == "SAVINGS") as List <Savings_Acct>;
                }
            }
            else
            {
                var item_C = c_Acct_List.Where(x => x.Acct_Number == Convert.ToInt64(acctF)).FirstOrDefault();
                if (item_C != null)
                {
                    Current_Acct sc = new Current_Acct();
                    sc.FromAccount = Convert.ToInt32(acctF);
                    sc.ToAccount   = Convert.ToInt32(acctT);
                    if (sc.FromAccount > 0 && sc.ToAccount > 0)
                    {
                        var tpl = new Dictionary <string, object>();
                        tpl.Add("CURRENT", s_Acct_List);
                        var data = sc.TransferAmount(tpl, Convert.ToInt32(amt));
                        c_Acct_List = data.Where(x => x.Key == "CURRENT") as List <Current_Acct>;
                    }
                    Console.WriteLine("Amount transferred successfully!");
                }
            }
        }
Exemple #5
0
        public static void ViewAccount()
        {
            Console.WriteLine("Enter the Account Number");
            string acct   = Console.ReadLine();
            var    item_S = s_Acct_List.Where(x => x.Acct_Number == Convert.ToInt64(acct)).FirstOrDefault();

            if (item_S != null)
            {
                var sv = new Savings_Acct(item_S.Balance, item_S.Acct_Number, item_S.User_Name);
                sv.GetAccountDetails();
            }
            var item_C = c_Acct_List.Where(x => x.Acct_Number == Convert.ToInt64(acct)).FirstOrDefault();

            if (item_C != null)
            {
                var sv = new Current_Acct(item_C.Balance, item_C.Acct_Number, item_C.User_Name);
                sv.GetAccountDetails();
            }
        }
Exemple #6
0
        public static void OpenNewAcct()
        {
            Console.WriteLine("Press S for Savings Account");
            Console.WriteLine("Press C for Current Account");

            string inp = Console.ReadLine();

            Console.WriteLine("-- Enter user name: --");

            string name = Console.ReadLine();

            Console.WriteLine("Enter balance to be deposited:");

            string bal = Console.ReadLine();

            if (string.Equals(inp, "S", StringComparison.OrdinalIgnoreCase))
            {
                Savings_Acct acct    = new Savings_Acct();
                bool         isVlaid = acct.OpenAccount(name, Convert.ToInt32(bal));
                if (isVlaid)
                {
                    s_Acct_List.Add(acct);
                }
                else
                {
                    Console.WriteLine("Error processing Account!!");
                }
            }
            else if (string.Equals(inp, "C", StringComparison.OrdinalIgnoreCase))
            {
                Current_Acct acct    = new Current_Acct();
                bool         isVlaid = acct.OpenAccount(name, Convert.ToInt32(bal));
                if (isVlaid)
                {
                    c_Acct_List.Add(acct);
                }
                else
                {
                    Console.WriteLine("Error processing account!!");
                }
            }
        }
Exemple #7
0
        public static void CloseAccount()
        {
            Console.WriteLine("Enter the Account Number");
            string acct   = Console.ReadLine();
            var    item_S = s_Acct_List.Where(x => x.Acct_Number == Convert.ToInt64(acct)).FirstOrDefault();

            if (item_S != null)
            {
                Savings_Acct sc = new Savings_Acct();
                if (sc.CloseAccount(item_S.Balance))
                {
                    s_Acct_List.Remove(item_S);
                    Console.WriteLine("Account closed successfully!");
                }
                else
                {
                    Console.WriteLine("Error processing account!!");
                }
            }
            else
            {
                var item_C = c_Acct_List.Where(x => x.Acct_Number == Convert.ToInt64(acct)).FirstOrDefault();
                if (item_C != null)
                {
                    Current_Acct sc = new Current_Acct();
                    if (sc.CloseAccount(item_C.Balance))
                    {
                        c_Acct_List.Remove(item_C);
                        Console.WriteLine("Account closed successfully!");
                    }
                    else
                    {
                        Console.WriteLine("Error processing account!!");
                    }
                }
            }
        }