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();
        }
 public void SetRecordProcessor(string filename)
 {
     if (rp != null && rp.GetType().Name == Path.GetFileNameWithoutExtension(filename))
     {
         return;                  //already loaded
     }
     rp = TableProcessor.LoadRecordProcessor(filename);
 }
        public FormTableProcessor()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            tp = new TableProcessorNS.TableProcessor();
        }
        protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
        {
            Session["progress"] = new BaseProgress();
            SetMappings();
            //Start Processing
            TableProcessorNS.TableProcessor tp = new TableProcessorNS.TableProcessor();
            tp.Progress = (BaseProgress)Session["progress"];

            string inputFileName  = Session["InputFileName"].ToString().Trim();
            string outputFileName = Path.Combine(Path.GetDirectoryName(inputFileName), TextBoxOutputFileName.Text);

            tp.InputDatabase          = DatabaseAdapterFactory.CreateReader(Path.GetExtension(inputFileName), CheckBoxEditMode.Checked);
            tp.InputDatabase.FileName = inputFileName;
            tp.InputDatabase.Connect(inputFileName);
            List <string> tables = (List <string>)Session["tables"];

            tp.tableName = tables[0];
            List <string> modules = (List <string>)Session["Modules"];

            tp.SetRecordProcessor(Server.MapPath(Path.Combine("Modules", modules[0])));

            tp.InputFieldNamesMap = TableProcessor.DeserializeFieldsMap((string)Session["Mappings"]);



            //If Edit mode - copy original and open for wrtiting
            if (CheckBoxEditMode.Checked)
            {
                tp.OutputDatabase = DatabaseAdapterFactory.CreateWriter(Path.GetExtension(outputFileName));
                tp.ProcessMode    = ProcessMode.pmEdit;
            }

            tp.OutputDatabase.FileName = outputFileName;

            Thread run = new Thread(new ThreadStart(tp.Process));

            run.Start();
            Response.Write("Process started");
        }
 private void SetRecordProcessor(Assembly irp)
 {
     rp = TableProcessor.LoadRecordProcessor(irp);
 }