private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { if (SystemClass.CheckConnection()) { ImusCityHallEntities db = new ImusCityHallEntities(); ImusCityGovernmentSystem.Model.Customer customer = db.Customers.Find(id); this.Title = string.Join(" ", customer.FirstName, customer.LastName, "Transactions"); List <CustomerTransactionsEntity> transactionlist = new List <CustomerTransactionsEntity>(); var result = db.GetCustomerTransactions(id); foreach (var item in result) { var transaction = new CustomerTransactionsEntity { Activity = item.Activity, TransactionDate = item.TransactionDate.Value.ToShortDateString() }; transactionlist.Add(transaction); } customernamelbl.Content = string.Join(" ", customer.FirstName, customer.LastName); customerTransactiondg.ItemsSource = transactionlist; } else { MessageBox.Show(SystemClass.DBConnectionErrorMessage); } }