Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void CustomerRegistration()
- {
- Console.Clear();
- bool registrationStatus = false;
- Customer newCustomer = null;
- while (!registrationStatus)
- {
- Console.Write("Write your name: ");
- string name = Console.ReadLine();
- Console.Write("Age: ");
- int age = int.Parse(Console.ReadLine());
- Console.Write("Password: ");
- string password = Console.ReadLine();
- if (age <= 17)
- {
- Console.Clear();
- Console.WriteLine("Sorry, we can't register you as a customer, because your age is under 18.\nOnly adults could register as a bank customer");
- Console.ReadKey(true);
- new BankMenu().ShowMainMenu();
- break;
- }
- else
- {
- newCustomer = new Customer { Id = Guid.NewGuid().ToString(), Name = name, Age = age, Password = password };
- registrationStatus = Context.CurrentBank.RegisterBankCustomer(newCustomer);
- if (registrationStatus == false)
- {
- Console.Clear();
- Console.WriteLine("There is already registered user with that name, please try again !");
- Console.Clear();
- Console.ReadKey(true);
- }
- }
- }
- Console.Clear();
- Console.WriteLine("Successful registration !");
- Console.ReadKey(true);
- if (newCustomer != null)
- {
- newCustomer.ShowCustomerMainMenu();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement