示例#1
0
        public void Deposit(int id, int balance)
        {
            Account_Info ob    = new Account_Info();
            int          b_val = bankingEntities.Account_Info.Find(id).Balance;

            bankingEntities.Account_Info.Find(id).Balance = b_val + balance;
        }
示例#2
0
        public void Withdrawl(int id, int amount)
        {
            Account_Info ob    = new Account_Info();
            int          b_val = bankingEntities.Account_Info.Find(id).Balance;
            string       type  = bankingEntities.Account_Info.Find(id).AccountType;

            if (type.Equals("Savings") && b_val - amount < 1000)
            {
                Console.Write("You can only withdraw " + (b_val - amount));
                Console.WriteLine("INSUFFICIENT BALANCE ");
            }
            else if (type.Equals("Current") && b_val - amount < 0)
            {
                Console.Write("You can only withdraw " + (b_val - amount));
                Console.WriteLine("INSUFFICIENT BALANCE ");
            }

            else if (type.Equals("DMAT") && b_val - amount < -1000)
            {
                Console.Write("You can only withdraw " + (b_val - amount));
                Console.WriteLine("INSUFFICIENT BALANCE ");
            }

            else
            {
                bankingEntities.Account_Info.Find(id).Balance = b_val - amount;
            }
        }
示例#3
0
        public void AddEntity(string name, int id, string AccountType, int balance)
        {
            var          bankE = new BankingEntities();
            Account_Info ob    = new Account_Info();

            ob.Id          = id;
            ob.Name        = name;
            ob.AccountType = AccountType;
            ob.Balance     = balance;
            bankE.Account_Info.Add(ob);
            bankE.SaveChanges();
        }
示例#4
0
        public void Simple(int id)
        {
            Account_Info ob    = new Account_Info();
            int          b_val = bankingEntities.Account_Info.Find(id).Balance;
            string       type  = bankingEntities.Account_Info.Find(id).AccountType;

            if (type.Equals("Savings"))
            {
                Console.WriteLine(.01 * b_val);
            }
            else if (type.Equals("Current"))
            {
                Console.WriteLine(.01 * b_val);
            }
        }
示例#5
0
        public void Display()
        {
            Account_Info ob = new Account_Info();

            try
            {
                List <Account_Info> lis = bankingEntities.Account_Info.ToList();
                for (int itr = 0; itr < lis.Count; itr++)
                {
                    Console.WriteLine("Account-id {0}", lis[itr].Id);
                    Console.WriteLine("Name {0}", lis[itr].Name);
                    Console.WriteLine("Account Type {0}", lis[itr].AccountType);
                    Console.WriteLine("Balance {0}", lis[itr].Balance);
                }
            }
            catch (Exception ae)
            {
            }
        }