예제 #1
0
 public TableMapping(DBTable destinationTable, TableMappingImportType importType, ColumnMapping[] mappings)
 {
     this.destinationTable = destinationTable;
     this.importType = importType;
     this.columnMappings = mappings;
     this.index = counter;
     counter++;
 }
        private static void writeColumnMapping(XmlWriter writer, ColumnMapping columnMapping)
        {
            writer.WriteStartElement("ColumnMapping");

            writer.WriteStartAttribute("type");
            writer.WriteValue(columnMapping.GetType().Name);
            writer.WriteEndAttribute();

            writer.WriteStartAttribute("columnUse");
            writer.WriteValue(columnMapping.ColumnUse.ToString());
            writer.WriteEndAttribute();

            writer.WriteStartAttribute("destinationColumnReference");
            writer.WriteValue(columnMapping.DestinationColumn.Name);
            writer.WriteEndAttribute();

            if (columnMapping is ExcelColumnMapping)
            {
                var excelColumnMapping = (ExcelColumnMapping)columnMapping;

                writer.WriteStartAttribute("sourceHeader");
                writer.WriteValue(excelColumnMapping.SourceHeader);
                writer.WriteEndAttribute();

            }
            else if (columnMapping is TableColumnMapping)
            {
                var tableColumnMapping = (TableColumnMapping)columnMapping;

                writer.WriteStartAttribute("sourceTableMappingIndex");
                writer.WriteValue(tableColumnMapping.SourceTableMapping.Index);
                writer.WriteEndAttribute();

                writer.WriteStartAttribute("sourceColumnReference");
                writer.WriteValue(tableColumnMapping.SourceColumn.Name);
                writer.WriteEndAttribute();
            }
            else if (columnMapping is LiteralColumnMapping)
            {
                var literalColumnMapping = (LiteralColumnMapping)columnMapping;

                writer.WriteStartAttribute("literal");
                writer.WriteValue(literalColumnMapping.Literal);
                writer.WriteEndAttribute();

                writer.WriteStartAttribute("literalType");
                writer.WriteValue(literalColumnMapping.LiteralType.ToString());
                writer.WriteEndAttribute();
            }

            writer.WriteEndElement();
            writer.WriteRaw("\n");
        }
        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 ColumnPickerItem(ColumnMapping columnMapping)
 {
     this.columnMapping = columnMapping;
     this.isSelected = columnMapping.ColumnUse != ColumnUse.Exclude;
 }
 private string getColumnMappingValue(ColumnMapping mapping)
 {
     StatementColumnMappingPart columnMappingPart = new StatementColumnMappingPart(mapping, sourceDataRow);
     return columnMappingPart.GetColumnMappingValue();
 }
 public StatementColumnMappingPart(ColumnMapping columnMapping, SourceDataRow sourceDataRow)
 {
     this.columnMapping = columnMapping;
     this.sourceDataRow = sourceDataRow;
 }