public TableMappingViewModel(DBTable table, MappingPageViewModel mappingPageViewModel) { this.viewModel = mappingPageViewModel; ColumnMapping[] mappings = new ColumnMapping[table.Columns.Count]; ObservableCollection<ColumnMappingViewModel> viewModels = new ObservableCollection<ColumnMappingViewModel>(); for (int i = 0; i < table.Columns.Count; i++) { mappings[i] = new NullColumnMapping(table.Columns[i], ColumnUse.Insert); viewModels.Add(new NullColumnMappingViewModel((NullColumnMapping)mappings[i], this)); } this.tableMapping = new TableMapping(table, TableMappingImportType.Insert, mappings); this.columnsMappingViewModels = viewModels.ToList(); }
public TableMappingViewModel(DBTable table, MappingPageViewModel mappingPageViewModel) { this.viewModel = mappingPageViewModel; ColumnMapping[] mappings = new ColumnMapping[table.Columns.Count]; ObservableCollection <ColumnMappingViewModel> viewModels = new ObservableCollection <ColumnMappingViewModel>(); for (int i = 0; i < table.Columns.Count; i++) { mappings[i] = new NullColumnMapping(table.Columns[i], ColumnUse.Insert); viewModels.Add(new NullColumnMappingViewModel((NullColumnMapping)mappings[i], this)); } this.tableMapping = new TableMapping(table, TableMappingImportType.Insert, mappings); this.columnsMappingViewModels = viewModels.ToList(); }
public TableMappingViewModel(TableMapping tableMapping, MappingPageViewModel mappingPageViewModel) { this.viewModel = mappingPageViewModel; ObservableCollection<ColumnMappingViewModel> viewModels = new ObservableCollection<ColumnMappingViewModel>(); foreach (DBColumn column in tableMapping.DestinationTable.Columns) { ColumnMapping columnMapping = tableMapping.ColumnMappings.Where(c => c.DestinationColumn == column).FirstOrDefault(); if (columnMapping == null) columnMapping = new NullColumnMapping(column, tableMapping.AllowedColumnUses()[0]); viewModels.Add(ColumnMappingViewModelCreator.CreateFromColumnMapping(columnMapping, this)); } ColumnMapping[] columnMappings = viewModels.Select(v => v.ColumnMapping).ToArray(); tableMapping.ColumnMappings = columnMappings; this.tableMapping = tableMapping; this.columnsMappingViewModels = viewModels.ToList(); }
public TableMappingViewModel(TableMapping tableMapping, MappingPageViewModel mappingPageViewModel) { this.viewModel = mappingPageViewModel; ObservableCollection <ColumnMappingViewModel> viewModels = new ObservableCollection <ColumnMappingViewModel>(); foreach (DBColumn column in tableMapping.DestinationTable.Columns) { ColumnMapping columnMapping = tableMapping.ColumnMappings.Where(c => c.DestinationColumn == column).FirstOrDefault(); if (columnMapping == null) { columnMapping = new NullColumnMapping(column, tableMapping.AllowedColumnUses()[0]); } viewModels.Add(ColumnMappingViewModelCreator.CreateFromColumnMapping(columnMapping, this)); } ColumnMapping[] columnMappings = viewModels.Select(v => v.ColumnMapping).ToArray(); tableMapping.ColumnMappings = columnMappings; this.tableMapping = tableMapping; this.columnsMappingViewModels = viewModels.ToList(); }
void TableMappingControl_Loaded(object sender, RoutedEventArgs e) { tableMappingViewModel = (TableMappingViewModel)DataContext; mappingPageViewModel = ((WizardViewModel)Window.GetWindow(this).DataContext).MappingPageViewModel; }
public WizardViewModel() { connectionPageViewModel = new ConnectionPageViewModel(this); mappingPageViewModel = new MappingPageViewModel(this); importPageViewModel = new ImportPageViewModel(this); }