public AddHost(Grid HostGrid, Grid RulerGrid) { InitializeComponent(); host.HostBankAccount = new BankAccount(); this.HostGrid = HostGrid; this.RulerGrid = RulerGrid; this.DataContext = host; List <string> temp = new List <string>(); banks = new List <BankAccount>(); foreach (var item1 in bl.GetBankAccounts()) { bool flag = true; foreach (var item2 in banks) { if (item1.BankNumber == item2.BankNumber) { flag = false; } } if (flag) { temp.Add(item1.BankName); banks.Add(item1); } } bankNameCombo.ItemsSource = temp; bankNameCombo.DataContext = host.HostBankAccount; branchNameCombo.DataContext = host.HostBankAccount; bankAccountText.DataContext = host.HostBankAccount; host.HostBankAccount.BankName = ""; }
public UpdateHostWindow(Host host) { InitializeComponent(); this.host = host; this.DataContext = host; List <string> temp = new List <string>(); banks = new List <BankAccount>(); foreach (var item1 in bl.GetBankAccounts()) { bool flag = true; foreach (var item2 in banks) { if (item1.BankNumber == item2.BankNumber) { flag = false; } } if (flag) { temp.Add(item1.BankName); banks.Add(item1); } } bankNameCombo.ItemsSource = temp; bankNameCombo.DataContext = host.HostBankAccount; branchNameCombo.DataContext = host.HostBankAccount; bankAccountText.DataContext = host.HostBankAccount; passwordBox.Password = host.Password; }