Esempio n. 1
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;
            }
        }
Esempio n. 2
0
        public MainPage()
        {
            this.InitializeComponent();

            //test kund

            while (BankLogic.runOnce <= 1)
            {
                BankLogic.AddCustomer("Berit Nillson", "192304237494");
                BankLogic.AddSavingsAccount(BankLogic.GetCustomers().Find(customer => customer.SSN == "192304237494"), "12345");
                BankLogic.AddCreditAccount("1234", BankLogic.GetCustomers().Find(customer => customer.SSN == "192304237494"));

                BankLogic.runOnce++;
            }
            //

            MainFrame.Navigate(typeof(NotSelected_Page));

            foreach (Customer cust in BankLogic.GetCustomers())
            {
                comboBox.Items.Add(cust.SSN);
            }
            try
            {
                Search_Field.Text = ChoosenCustomer.SSN;
            }
            catch (Exception) { }

            if (Search_Field != null)
            {
                try
                {
                    button_Click(null, null);
                }
                catch (Exception) { }
            }
        }
Esempio n. 3
0
 private void Ssn_Selected(object sender, SelectionChangedEventArgs e)
 {
     Search_Field.Text = comboBox.Text;
     ChoosenCustomer   = BankLogic.GetCustomers().Find(cust => cust.SSN == comboBox.Text);
     button.IsEnabled  = true;
 }