Example #1
0
        public ColumnMapFrame_VarTarget()
        {
            InitializeComponent();
            m_invoker = new ControlInvoker(this);
            var col = (DataGridViewComboBoxColumn)lbtarget.Columns[1];

            foreach (var type in GenericTransform.GetColExprTypes())
            {
                col.Items.Add(type.ToString());
                m_types[type.ToString()] = type;
            }
        }
Example #2
0
        public void SetBindings(ITabularDataStore source, ITabularDataStore target)
        {
            using (WaitContext wc = new WaitContext())
            {
                Async.SafeOpen(source.Connection);
                Async.SafeOpen(target.Connection);
                try
                {
                    IAsyncResult res1 = source.BeginGetRowFormat(null);
                    Async.WaitFor(res1);
                    m_source = source.EndGetRowFormat(res1);
                }
                catch (Exception err)
                {
                    throw new BulkCopyInputError("DAE-00181", err);
                }

                if (m_source.Columns.Count == 0)
                {
                    throw new ExpectedError("DAE-00182 " + Texts.Get("s_no_columns_detected_in_imported_source"));
                }

                IAsyncResult res2 = target.BeginGetRowFormat(null);
                Async.WaitFor(res2);
                m_target = target.EndGetRowFormat(res2);

                int acty     = labValue.Top + labValue.Height + 10;
                int colindex = 0;
                foreach (IColumnStructure col in m_target.Columns)
                {
                    Label lab = new Label();
                    Controls.Add(lab);
                    lab.Left = labTarget.Left;
                    lab.Top  = acty;
                    lab.Text = col.ColumnName + " :";

                    CheckBox skip = new CheckBox();
                    Controls.Add(skip);
                    skip.Top   = acty;
                    skip.Width = 30;
                    skip.Left  = labSkip.Left;
                    m_checks.Add(skip);
                    skip.Tag             = colindex;
                    skip.CheckedChanged += new EventHandler(skip_CheckedChanged);

                    ComboBox type = new ComboBox();
                    Controls.Add(type);
                    type.Left          = labType.Left;
                    type.Top           = acty;
                    type.DropDownStyle = ComboBoxStyle.DropDownList;
                    GenericTransform.GetColExprTypes(type.Items);
                    type.SelectedIndex = 0;
                    type.Tag           = colindex;
                    m_typeCombos.Add(type);

                    ComboBox sel = new ComboBox();
                    Controls.Add(sel);
                    sel.Left            = labValue.Left;
                    sel.Top             = acty;
                    sel.DropDownStyle   = ComboBoxStyle.DropDown;
                    sel.DropDownClosed += new EventHandler(sel_DropDownClosed);
                    sel.Tag             = colindex;
                    foreach (IColumnStructure srccol in m_source.Columns)
                    {
                        sel.Items.Add(srccol.ColumnName);
                    }
                    sel.SelectedIndex = sel.Items.IndexOf(col.ColumnName);
                    if (sel.SelectedIndex < 0)
                    {
                        if (col.ColumnOrder < sel.Items.Count)
                        {
                            sel.SelectedIndex = col.ColumnOrder;
                        }
                        else
                        {
                            sel.SelectedIndex = 0;
                        }
                    }
                    m_combos.Add(sel);

                    acty += Math.Max(sel.Height, lab.Height) * 5 / 4;
                    colindex++;
                }
            }
        }