private void Window_Loaded(object sender, RoutedEventArgs e) { PracticApp.RealtorsDataSet realtorsDataSet = ((PracticApp.RealtorsDataSet)(this.FindResource("realtorsDataSet"))); // Загрузить данные в таблицу Deal. Можно изменить этот код как требуется. PracticApp.RealtorsDataSetTableAdapters.DealTableAdapter realtorsDataSetDealTableAdapter = new PracticApp.RealtorsDataSetTableAdapters.DealTableAdapter(); realtorsDataSetDealTableAdapter.Fill(realtorsDataSet.Deal); System.Windows.Data.CollectionViewSource dealViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("dealViewSource"))); dealViewSource.View.MoveCurrentToFirst(); // Загрузить данные в таблицу Clients. Можно изменить этот код как требуется. PracticApp.RealtorsDataSetTableAdapters.ClientsTableAdapter realtorsDataSetClientsTableAdapter = new PracticApp.RealtorsDataSetTableAdapters.ClientsTableAdapter(); realtorsDataSetClientsTableAdapter.Fill(realtorsDataSet.Clients); System.Windows.Data.CollectionViewSource clientsViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("clientsViewSource"))); clientsViewSource.View.MoveCurrentToFirst(); // Загрузить данные в таблицу Offer. Можно изменить этот код как требуется. PracticApp.RealtorsDataSetTableAdapters.OfferTableAdapter realtorsDataSetOfferTableAdapter = new PracticApp.RealtorsDataSetTableAdapters.OfferTableAdapter(); realtorsDataSetOfferTableAdapter.Fill(realtorsDataSet.Offer); System.Windows.Data.CollectionViewSource offerViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("offerViewSource"))); offerViewSource.View.MoveCurrentToFirst(); // Загрузить данные в таблицу Demand. Можно изменить этот код как требуется. PracticApp.RealtorsDataSetTableAdapters.DemandTableAdapter realtorsDataSetDemandTableAdapter = new PracticApp.RealtorsDataSetTableAdapters.DemandTableAdapter(); realtorsDataSetDemandTableAdapter.Fill(realtorsDataSet.Demand); System.Windows.Data.CollectionViewSource demandViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("demandViewSource"))); demandViewSource.View.MoveCurrentToFirst(); dealDataGrid.ItemsSource = new Deal().GetData(); }
public DatabaseRouter(string type) { this.type = type; switch (type) { case "Clients": this.ClientsTableAdapter = new RealtorsDataSetTableAdapters.ClientsTableAdapter(); break; case "Realty": this.RealtyTableAdapter = new RealtorsDataSetTableAdapters.RealtyTableAdapter(); this.RealtyAddressesTableAdapter = new RealtorsDataSetTableAdapters.RealtyAddressesTableAdapter(); this.ApartmentTableAdapter = new RealtorsDataSetTableAdapters.ApartmentTableAdapter(); this.HouseTableAdapter = new RealtorsDataSetTableAdapters.HouseTableAdapter(); this.LandTableAdapter = new RealtorsDataSetTableAdapters.LandTableAdapter(); this.RealtyTypesTableAdapter = new RealtorsDataSetTableAdapters.RealtyTypesTableAdapter(); break; case "Offer": this.OfferTableAdapter = new RealtorsDataSetTableAdapters.OfferTableAdapter(); break; case "Demand": this.ApartmentFilterTableAdapter = new RealtorsDataSetTableAdapters.ApartmentFilterTableAdapter(); this.HouseFilterTableAdapter = new RealtorsDataSetTableAdapters.HouseFilterTableAdapter(); this.LandFilterTableAdapter = new RealtorsDataSetTableAdapters.LandFilterTableAdapter(); this.DemandTableAdapter = new RealtorsDataSetTableAdapters.DemandTableAdapter(); break; case "Deal": this.RealtyTableAdapter = new RealtorsDataSetTableAdapters.RealtyTableAdapter(); this.RealtyAddressesTableAdapter = new RealtorsDataSetTableAdapters.RealtyAddressesTableAdapter(); this.ApartmentTableAdapter = new RealtorsDataSetTableAdapters.ApartmentTableAdapter(); this.HouseTableAdapter = new RealtorsDataSetTableAdapters.HouseTableAdapter(); this.LandTableAdapter = new RealtorsDataSetTableAdapters.LandTableAdapter(); this.RealtyTypesTableAdapter = new RealtorsDataSetTableAdapters.RealtyTypesTableAdapter(); this.DealTableAdapter = new RealtorsDataSetTableAdapters.DealTableAdapter(); this.DemandTableAdapter = new RealtorsDataSetTableAdapters.DemandTableAdapter(); this.OfferTableAdapter = new RealtorsDataSetTableAdapters.OfferTableAdapter(); break; } }