private void AddItem_Click(object sender, RoutedEventArgs e) { try { // Insert item. BLAccount.InsertItem(accountId, txtIname.Text); // Update items. lstItem.DataContext = BLAccount.GetItems(accountId); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void DelItem_Click(object sender, RoutedEventArgs e) { try { // Get selected item. Item selectedItem = (Item)spItem.DataContext; // Delete item. BLAccount.DeleteItem(Convert.ToInt32(txtId.Text)); // Update items. lstItem.DataContext = BLAccount.GetItems(accountId); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
public void InitializeAccountData(int accountId) { try { this.accountId = accountId; // 1. Get account from BL. spAccount.DataContext = BLAccount.GetAccount(accountId); // 2. Get items from BL. lstItem.DataContext = BLAccount.GetItems(accountId); } catch (Exception exception) { MessageBox.Show(exception.Message); } }