Beispiel #1
0
        private void AddCustomer(string orgnr, string name, string address, string zipcode, string city, string region,
                                 string country, string phonenr)
        {
            var customerId    = Customer.GenerateCustomerId(_customers);
            var accountNumber = Account.GenerateAccountNumber(_customers);
            var customer      = new Customer(customerId, orgnr, name, address, city, region, zipcode, country, phonenr);

            customer.AddBankAccount(new Account(accountNumber, customerId), accountNumber);
            _customers.Add(customer);
            Console.WriteLine($"Kund {name} med kundnummer {customerId} har skapats.");
            Console.WriteLine($"Kunden har fått ett konto med nummer #{accountNumber}.");
        }
Beispiel #2
0
        public void CreateNewAccount()
        {
            Console.Clear();
            Console.WriteLine("* Skapa konto *");
            var input    = Validation.InputInt("Kundnummer? ");
            var customer = BankSearch.GetCustomerById(_customers, input);

            if (customer == null)
            {
                return;
            }
            customer.CustomerShortDetails();
            var accountId = Account.GenerateAccountNumber(_customers);

            Console.WriteLine();
            Console.WriteLine("Vill du lägga till ett nytt konto för denna kund? j/n");
            var newAccount = true;

            do
            {
                var select = Console.ReadKey();
                switch (select.Key)
                {
                case ConsoleKey.J:
                    customer.AddBankAccount(new Account(accountId, customer.CustomerId), accountId);
                    Console.WriteLine();
                    Console.WriteLine("Ett nytt konto har skapats till kund " +
                                      $"{customer.CustomerId} med kontonummer #{accountId}");
                    newAccount = false;
                    break;

                case ConsoleKey.N:
                    newAccount = false;
                    break;
                }
            } while (newAccount);
            Console.ReadLine();
        }