Ejemplo n.º 1
0
        public static SavingsAcount AddSavingsAccount(Customer cust, string accountNumber)
        {
            List <Transaction> tempList = new List <Transaction>();
            //skapa ett objekt av savingsAccount
            SavingsAcount newAcc = new SavingsAcount(accountNumber, 0, 1, "saving", tempList, true);



            cust.CustomerAccounts.Add(newAcc);


            return(newAcc);
        }
Ejemplo n.º 2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            if (Search_Field.Text != "" || comboBox.Text != "")
            {
                try
                {
                    accounts.Clear();
                    foreach (Account ac in accounts)
                    {
                        accounts.Remove(ac);
                    }
                }
                catch (InvalidOperationException)
                {
                }

                try
                {
                    ChoosenCustomer = BankLogic.GetCustomers().Find(cust => cust.SSN == Search_Field.Text);
                }
                catch (NullReferenceException) { }
                try
                {
                    Fnamn.Text           = ChoosenCustomer.Name;
                    PersonNummer.Text    = ChoosenCustomer.SSN;
                    ChoosenCustomer.Name = Fnamn.Text;
                }
                catch (Exception)
                {
                    var _Frame = Window.Current.Content as Frame;
                    _Frame.Navigate(typeof(MainPage));
                }

                button.IsEnabled = false;
                try
                {
                    if (ChoosenCustomer.CustomerAccounts.Count != 0)
                    {
                        foreach (Account ac in ChoosenCustomer.CustomerAccounts)
                        {
                            accounts.Add(ac);
                        }
                    }
                    else
                    {
                        try { List <Transaction> emptytrans = new List <Transaction>(); Account empty = new SavingsAcount("Inget konto", 0, 0, "saving", emptytrans, false); AcList.Add(empty); } catch (Exception) { }
                    }
                }
                catch (System.NullReferenceException) { }
            }
            else
            {
                button.IsEnabled = false;
            }
        }