private void buttonMapFields_Click(object sender, EventArgs e) { if (comboBoxTableName.SelectedIndex == -1) { MessageBox.Show("Select source table first"); } FormFieldsMap mapForm = new FormFieldsMap(); mapForm.targetFields = tp.GetTransformFields(); mapForm.inputFields = tp.InputDatabase.GetFields(tp.tableName); //apply current settings //DeserializeFieldsMap(textBoxFieldsMapping.Text); if (mapForm.ShowDialog() == DialogResult.OK) { //Update fields mapping from UI mapForm.getMapping(); tp.InputFieldNamesMap.Clear(); foreach (var pair in mapForm.Target2InputFields) { //Save as Inut field to target field map tp.InputFieldNamesMap.Add(new KeyValuePair <string, string>(pair.Value, pair.Key)); } textBoxFieldsMapping.Text = TableProcessor.SerializeFieldsMap(tp.InputFieldNamesMap); } }
void FillMapFields() { string filename = Session["InputFileName"].ToString(); //input fields IDatabaseAdapter inputDatabase = DatabaseAdapterFactory.CreateReader(Path.GetExtension(filename), CheckBoxEditMode.Checked); List <string> tables = (List <string>)Session["tables"]; inputDatabase.Connect(filename); Dictionary <string, int> fields = inputDatabase.GetFields(tables[0]); //target fields TableProcessorNS.TableProcessor tp = new TableProcessorNS.TableProcessor(); List <string> modules = (List <string>)Session["Modules"]; var processorFileName = Server.MapPath(Path.Combine("Modules", modules[0])); tp.SetRecordProcessor(processorFileName); Dictionary <Field, bool> transformFields = tp.GetTransformFields(); DataTable transformFieldsTable = new DataTable(); transformFieldsTable = new DataTable(); transformFieldsTable.Columns.Add("targetField"); transformFieldsTable.Columns.Add("inputField"); transformFieldsTable.Columns["targetField"].ReadOnly = true; foreach (KeyValuePair <Field, bool> row in transformFields) { transformFieldsTable.Rows.Add(row.Key.Name, ""); } Repeater1.DataSource = transformFieldsTable; Repeater1.DataBind(); }