public ColumnPicker(TableMappingViewModel tableMappingViewModel)
        {
            InitializeComponent();
            DataContext = this;

            this.viewModel = tableMappingViewModel;

            items = tableMappingViewModel.TableMapping.ColumnMappings.Select(c => new ColumnPickerItem(c)).ToArray();

            Closed += ColumnPicker_Closed;
        }
Beispiel #2
0
        public static ColumnMappingViewModel CreateFromColumnMapping(ColumnMapping columnMapping,
                                                                     TableMappingViewModel tableMappingViewModel)
        {
            string type = columnMapping.GetType().ToString();

            if (type == typeof(ExcelColumnMapping).ToString())
            {
                return(new ExcelColumnMappingViewModel((ExcelColumnMapping)columnMapping, tableMappingViewModel));
            }
            else if (type == typeof(TableColumnMapping).ToString())
            {
                return(new TableColumnMappingViewModel((TableColumnMapping)columnMapping, tableMappingViewModel));
            }
            else if (type == typeof(LiteralColumnMapping).ToString())
            {
                return(new LiteralColumnMappingViewModel((LiteralColumnMapping)columnMapping, tableMappingViewModel));
            }
            else
            {
                return(new NullColumnMappingViewModel((NullColumnMapping)columnMapping, tableMappingViewModel));
            }
        }
 public void RemoveMappingTable(TableMappingViewModel mappingTable)
 {
     tableMappingViewModels.Remove(mappingTable);
     NotifyPropertyChanged("TableMappings");
     NotifyPropertyChanged("MappingTableReferences");
 }
 void TableMappingControl_Loaded(object sender, RoutedEventArgs e)
 {
     tableMappingViewModel = (TableMappingViewModel)DataContext;
     mappingPageViewModel = ((WizardViewModel)Window.GetWindow(this).DataContext).MappingPageViewModel;
 }
 public void RemoveMappingTable(TableMappingViewModel mappingTable)
 {
     tableMappingViewModels.Remove(mappingTable);
     NotifyPropertyChanged("TableMappings");
     NotifyPropertyChanged("MappingTableReferences");
 }
Beispiel #6
0
 public NullColumnMappingViewModel(NullColumnMapping nullColumnMapping, TableMappingViewModel tableMappingViewModel) :
     base(nullColumnMapping, tableMappingViewModel)
 {
     this.importType = ColumnMappingImportType.Null;
 }
Beispiel #7
0
 public ColumnMappingViewModel(ColumnMapping columnMapping,
                               TableMappingViewModel tableMappingViewModel)
 {
     this.tableMappingViewModel = tableMappingViewModel;
     this.columnMapping         = columnMapping;
 }
Beispiel #8
0
        public static ColumnMappingViewModel CreateBlankSourceViewModel(ColumnMappingImportType importType, TableMappingViewModel tableMappingViewModel,
                                                                        DBColumn destinationColumn, ColumnUse columnUse)
        {
            switch (importType)
            {
            case (SQLImporter.ViewModel.ColumnMappingImportType.Excel):
                ExcelColumnMapping excelColumnMapping = new ExcelColumnMapping("", destinationColumn, columnUse);
                return(new ExcelColumnMappingViewModel(excelColumnMapping, tableMappingViewModel));

            case (SQLImporter.ViewModel.ColumnMappingImportType.Table):
                TableColumnMapping tableColumnMapping = new TableColumnMapping(null, null, destinationColumn, columnUse);
                return(new TableColumnMappingViewModel(tableColumnMapping, tableMappingViewModel));

            case (SQLImporter.ViewModel.ColumnMappingImportType.Literal):
                LiteralColumnMapping literalColumnMapping = new LiteralColumnMapping("", LiteralType.String, destinationColumn, columnUse);
                return(new LiteralColumnMappingViewModel(literalColumnMapping, tableMappingViewModel));

            default:
                NullColumnMapping nullColumnMapping = new NullColumnMapping(destinationColumn, columnUse);
                return(new NullColumnMappingViewModel(nullColumnMapping, tableMappingViewModel));
            }
        }
Beispiel #9
0
 public LiteralColumnMappingViewModel(LiteralColumnMapping literalColumnMapping,
                                      TableMappingViewModel tableMappingViewModel)
     : base(literalColumnMapping, tableMappingViewModel)
 {
     this.importType = ColumnMappingImportType.Literal;
 }
Beispiel #10
0
 public TableColumnMappingViewModel(TableColumnMapping tableColumnMapping,
                                    TableMappingViewModel tableMappingViewModel)
     : base(tableColumnMapping, tableMappingViewModel)
 {
     this.importType = ColumnMappingImportType.Table;
 }
Beispiel #11
0
 public ExcelColumnMappingViewModel(ExcelColumnMapping excelColumnMapping, TableMappingViewModel tableMappingViewModel) :
     base(excelColumnMapping, tableMappingViewModel)
 {
     this.importType = ColumnMappingImportType.Excel;
 }