Example #1
0
        public void openAcc(int id)
        {
            //foreach (Customer cust in CustomerDAL.customerList)
            //{
            try
            {
                Customer cust = DAL.GetCustomer(id);

                if (cust.Id == id)
                {
                    Console.WriteLine("1:Businness Acoount\n2:Checking Account");
                    int i = Convert.ToInt32(Console.ReadLine());
                    if (i == 1)
                    {
                        Acc a = new BusAcc();
                        a.id = cust.Id;
                        //Console.WriteLine("1");
                        a.Accountnum = "B12345" + cust.Id + cust.AccList.Count;
                        a.Amount     = 0;
                        DAL.CreateAccount(cust, a);
                        //cust.customerList.Add(a);
                        Console.WriteLine("Your new account number is:  " + a.Accountnum);
                    }

                    else if (i == 2)
                    {
                        Acc a = new CheckAcc();
                        a.id         = cust.Id;
                        a.Accountnum = "C12345" + cust.Id + cust.AccList.Count;
                        a.Amount     = 0;
                        DAL.CreateAccount(cust, a);
                        Console.WriteLine("Your new account number is:  " + a.Accountnum);
                    }

                    else
                    {
                        throw new Exception();
                    }


                    getallacc(cust.Id);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }