Ejemplo n.º 1
0
        private void buttonEditMapping_Click(object sender, EventArgs e)
        {
            if (this.listViewMappings.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select the item which you want to edit.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            GWDataDBField dbf = (GWDataDBField)listViewMappings.SelectedItems[0].Tag;

            MergeFieldMapping map = listViewMappings.SelectedItems[0].SubItems[1].Tag as MergeFieldMapping;

            if (map == null)
            {
                map = new MergeFieldMapping();
                map.OutboundTable = dbf.Table.ToString();
                map.OutboundField = dbf.FieldName;
                map.InboundTable  = dbf.Table.ToString();
                map.InboundField  = dbf.FieldName;
            }

            FConfigMergeMappping frm = new FConfigMergeMappping();

            if (frm.ShowDialog(this, map) == DialogResult.OK)
            {
                map = frm.Mapping.Clone();
                listViewMappings.SelectedItems[0].SubItems[2].Text = "<==";
                listViewMappings.SelectedItems[0].SubItems[3].Text = map.InboundTable + "." + map.InboundField;
                listViewMappings.SelectedItems[0].SubItems[1].Tag  = map;

                this.listViewMappings.ItemCheck          -= new ItemCheckEventHandler(listViewMappings_ItemCheck);
                listViewMappings.SelectedItems[0].Checked = true;
                this.listViewMappings.ItemCheck          += new ItemCheckEventHandler(listViewMappings_ItemCheck);
            }
        }
Ejemplo n.º 2
0
        private void listViewMappings_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (e.NewValue == CheckState.Unchecked)
            {
                this.listViewMappings.Items[e.Index].SubItems[2].Text = string.Empty;
                this.listViewMappings.Items[e.Index].SubItems[3].Text = string.Empty;
                this.listViewMappings.Items[e.Index].SubItems[1].Tag  = null;
            }
            else
            {
                GWDataDBField dbf = (GWDataDBField)listViewMappings.Items[e.Index].Tag;

                MergeFieldMapping map = listViewMappings.Items[e.Index].SubItems[1].Tag as MergeFieldMapping;
                if (map == null)
                {
                    map = new MergeFieldMapping();
                    map.OutboundTable = dbf.Table.ToString();
                    map.OutboundField = dbf.FieldName;
                    map.InboundTable  = dbf.Table.ToString();
                    map.InboundField  = dbf.FieldName;
                }

                this.listViewMappings.Items[e.Index].SubItems[2].Text = "<==";
                this.listViewMappings.Items[e.Index].SubItems[3].Text = map.InboundTable + "." + map.InboundField;
                this.listViewMappings.Items[e.Index].SubItems[1].Tag  = map;
            }
        }
Ejemplo n.º 3
0
        private void LoadMappings(MergeFieldMappings mappings)
        {
            this.listViewMappings.ItemCheck -= new ItemCheckEventHandler(listViewMappings_ItemCheck);
            for (int i = 0; i < listViewMappings.Items.Count; i++)
            {
                GWDataDBField dbf = (GWDataDBField)listViewMappings.Items[i].Tag;

                MergeFieldMapping map = mappings.FindMapping(dbf.Table.ToString(), dbf.FieldName);
                if (map != null)
                {
                    this.listViewMappings.Items[i].Checked          = true;
                    this.listViewMappings.Items[i].SubItems[2].Text = "<==";
                    this.listViewMappings.Items[i].SubItems[3].Text = map.InboundTable + "." + map.InboundField;
                    this.listViewMappings.Items[i].SubItems[1].Tag  = map;
                }
                else
                {
                    this.listViewMappings.Items[i].Checked          = false;
                    this.listViewMappings.Items[i].SubItems[2].Text = string.Empty;
                    this.listViewMappings.Items[i].SubItems[3].Text = string.Empty;
                    this.listViewMappings.Items[i].SubItems[1].Tag  = null;
                }
            }

            this.listViewMappings.ItemCheck += new ItemCheckEventHandler(listViewMappings_ItemCheck);
        }
Ejemplo n.º 4
0
        internal DialogResult ShowDialog(IWin32Window owner, MergeFieldMapping map)
        {
            _map = map;

            LoadMapping();

            return(this.ShowDialog(owner));
        }
Ejemplo n.º 5
0
        private bool SaveFieldMapping()
        {
            GWDataDBTable table = (GWDataDBTable)Enum.Parse(typeof(GWDataDBTable), comboBoxTable.Text);

            if (table == GWDataDBTable.None)
            {
                MessageBox.Show("Please select inbound table and field.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                comboBoxTable.Focus();
                return(false);
            }

            Mapping = new MergeFieldMapping();
            Mapping.OutboundTable = _map.OutboundTable;
            Mapping.OutboundField = _map.OutboundField;
            Mapping.InboundTable  = comboBoxTable.Text.Trim();
            Mapping.InboundField  = comboBoxField.Text.Trim();

            return(true);
        }
Ejemplo n.º 6
0
        //private void ShowMergeFields()
        //{
        //    this.lvMergeFields.Items.Clear();
        //    if (_CurrIOChannel == null)
        //        return;
        //    if (_CurrEventType == null)
        //        return;
        //    MergeFields mgfs = _CurrEventType.MergeFields;
        //    for (int i = 0; i < mgfs.Count; i++)
        //    {
        //        ListViewItem lvi = lvMergeFields.Items.Add((i + 1).ToString());

        //        MergeField f = (MergeField)mgfs[i];
        //        lvi.Tag = f;
        //        lvi.SubItems.Add(f.Table);
        //        lvi.SubItems.Add(f.FieldName);
        //    }
        //}

        private void ShowMergeFieldMappings()
        {
            this.lvMergeFields.Items.Clear();
            if (_CurrIOChannel == null)
            {
                return;
            }
            if (_CurrEventType == null)
            {
                return;
            }
            MergeFieldMappings mfms = _CurrEventType.MergeFieldMappings;

            for (int i = 0; i < mfms.Count; i++)
            {
                ListViewItem lvi = lvMergeFields.Items.Add((i + 1).ToString());

                MergeFieldMapping m = (MergeFieldMapping)mfms[i];
                lvi.Tag = m;
                lvi.SubItems.Add(m.OutboundTable + "." + m.OutboundField + "(Out) <== " + m.InboundTable + "." + m.InboundField);
            }
        }