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);
            }
        }
Пример #2
0
        void SetMappings()
        {
            List <KeyValuePair <string, string> > map = new List <KeyValuePair <string, string> >();

            //Fields to map
            foreach (RepeaterItem row in Repeater1.Items)
            {
                Label        label = (Label)row.FindControl("Label1");
                DropDownList list  = (DropDownList)row.FindControl("DropDownList2");
                map.Add(new KeyValuePair <string, string>(list.SelectedValue, label.Text));
            }
            Session["Mappings"] = TableProcessor.SerializeFieldsMap(map);
        }