public UpdateHomes(PeopleCollection people, HomeCollection homes, HomeSalesCollection homeSales, RealEstateCompanyCollection realEstateCompanies) { InitializeComponent(); peopleUd = people; HomeUd = homes; homeSalesCollection = homeSales; IsVisibleChanged += UpdateHomes_IsVisibleChanged; Closing += UpdateHomes_Closing; }
private void Button_Click_3(object sender, RoutedEventArgs e)//refresh db { using (HomeTrackerModel1 db = new HomeTrackerModel1()) { //retrieve data: homeCollection = new HomeCollection(db.Homes.ToList()); homeSalesCollection = new HomeSalesCollection(db.HomeSales.ToList()); peopleCollection = new PeopleCollection(db.People.ToList()); realEstateCompaniesCollection = new RealEstateCompanyCollection(db.RealEstateCompanies.ToList()); } HomeDataGrid.DataContext = homeCollection; }
private void LoadHomesList() { using (var db = new HomeTrackerModel1()) { homeCollection = new HomeCollection(db.Homes.ToList()); this.HomeListBox.DisplayMemberPath = "Address"; this.HomeListBox.SelectedValuePath = "HomeID"; this.HomeListBox.ItemsSource = homeCollection; realEstateCompaniesCollection = new RealEstateCompanyCollection(db.RealEstateCompanies.ToList()); this.CompanyListBox.DisplayMemberPath = "CompanyName"; this.CompanyListBox.SelectedValuePath = "CompanyID"; this.CompanyListBox.ItemsSource = realEstateCompaniesCollection; } }
public MainWindow() { homeCollection = new HomeCollection(); homeSalesCollection = new HomeSalesCollection(); peopleCollection = new PeopleCollection(); realEstateCompaniesCollection = new RealEstateCompanyCollection(); InitializeComponent(); DataContext = this; using (HomeTrackerModel1 db = new HomeTrackerModel1()) { //retrieve data: homeCollection = new HomeCollection(db.Homes.ToList()); homeSalesCollection = new HomeSalesCollection(db.HomeSales.ToList()); peopleCollection = new PeopleCollection(db.People.ToList()); realEstateCompaniesCollection = new RealEstateCompanyCollection(db.RealEstateCompanies.ToList()); addHomeWindow = new AddHome(peopleCollection, homeCollection); updateHomesWindow = new UpdateHomes(peopleCollection, homeCollection, homeSalesCollection, realEstateCompaniesCollection); removeAHomeWindow = new removeAHome(peopleCollection, homeCollection); } }