Beispiel #1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            XIMMappingItem testItem = _item.Clone() as XIMMappingItem;

            _controler.SaveSetting(testItem);

            if (_list != null)
            {
                foreach (XIMMappingItem item in _list)
                {
                    if (item == _item ||
                        item.GWDataDBField.Table == GWDataDBTable.None)
                    {
                        continue;
                    }
                    if (item.GWDataDBField.Table == testItem.GWDataDBField.Table &&
                        item.GWDataDBField.FieldName == testItem.GWDataDBField.FieldName)
                    {
                        MessageBox.Show(this, "Element (" + item.Element.XPath +
                                        ") has been mapped to this GC Gateway field ("
                                        + item.GWDataDBField.GetFullFieldName() + "). \r\n\r\n"
                                        + "Pease change another GC Gateway field.", "Warning",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        this.comboBoxField.Focus();
                        return;
                    }
                }
            }

            _controler.SaveSetting(_item);
            _item.RedundancyFlag = this.checkBoxRedundancy.Checked;
            this.DialogResult    = DialogResult.OK;
            this.Close();
        }
Beispiel #2
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            // remove element
            XIMMappingItem item = _listViewCtrl.GetSelectedItem();

            if (item == null)
            {
                return;
            }

            List <XIMMappingItem> list = _listViewCtrl.GetCurrentList();

            list.Remove(item);

            // remove child
            List <XIMMappingItem> rlist = new List <XIMMappingItem>();

            CollectChildItem(list, item, rlist);
            foreach (XIMMappingItem i in rlist)
            {
                list.Remove(i);
            }

            // update parent
            CollectParentItem(list, item);

            // refresh list
            _listViewCtrl.RefreshList(list);
        }
Beispiel #3
0
        private void CollectParentItem(List <XIMMappingItem> list, XIMMappingItem item)
        {
            bool           hasOtherChild = false;
            XIMMappingItem parent        = null;

            foreach (XIMMappingItem i in list)
            {
                if (item.Element.IsChildOf(i.Element))
                {
                    parent = i;
                    foreach (XIMMappingItem j in list)
                    {
                        if (j.Element.IsChildOf(parent.Element))
                        {
                            hasOtherChild = true;
                            break;
                        }
                    }
                    break;
                }
            }

            if (!hasOtherChild && parent != null)
            {
                parent.Element.ClassTypeName = "";
                //list.Remove(parent);
            }
        }
Beispiel #4
0
        private void Edit()
        {
            XIMMappingItem item = _listViewCtrl.GetSelectedItem();

            if (item == null)
            {
                return;
            }

            List <XIMMappingItem> list = null;

            if (_isInbound)
            {
                list = _listViewCtrl.GetCurrentList();
            }

            FormField frm = new FormField(item, list, _dbConnection, _log, _isInbound);

            if (frm.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            //RefreshList();
            _listViewCtrl.SelectItem(item);
        }
Beispiel #5
0
        private void RefreshButtons2()
        {
            XIMMappingItem item = _listViewCtrl.GetSelectedItem();

            this.buttonDelete.Enabled     = (item != null);
            this.buttonAddChild.Enabled   = (item != null && XIMHelper.IsComplex(item.Element.Type));
            this.buttonAddElement.Enabled = (item != null);
        }
Beispiel #6
0
        private void buttonAddChild_Click(object sender, EventArgs e)
        {
            // create new child
            XIMMappingItem item = _listViewCtrl.GetSelectedItem();

            if (item == null || !XIMHelper.IsComplex(item.Element.Type))
            {
                return;
            }

            FormElement frm = new FormElement(item.Element);

            if (frm.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }
            XmlElement ele = frm.Element;

            // expand old child
            if (listViewMain.SelectedItems.Count > 0)
            {
                XmlListViewItem <XIMMappingItem> xitem = listViewMain.SelectedItems[0] as XmlListViewItem <XIMMappingItem>;
                xitem.Checked = true;
            }

            // check if child with the same name is exist
            List <XIMMappingItem> list = _listViewCtrl.GetCurrentList();

            foreach (XIMMappingItem i in list)
            {
                if (i.Element.IsChildOf(item.Element) &&
                    i.Element.GetLastName() == ele.GetLastName())
                {
                    MessageBox.Show(this, "This element already exists.", "Warning",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            // insert new child
            XIMMappingItem citem = new XIMMappingItem(ele);
            int            index = list.IndexOf(item);

            list.Insert(index + 1, citem);

            // display new child
            _listViewCtrl.RefreshList(list);

            foreach (XmlListViewItem <XIMMappingItem> xi in listViewMain.Items)
            {
                if (xi.Item == citem)
                {
                    xi.Selected = true;
                    xi.EnsureVisible();
                    break;
                }
            }
        }
Beispiel #7
0
 private void CollectChildItem(List <XIMMappingItem> list, XIMMappingItem item, List <XIMMappingItem> removelist)
 {
     foreach (XIMMappingItem i in list)
     {
         if (i.Element.IsChildOf(item.Element))
         {
             removelist.Add(i);
             CollectChildItem(list, i, removelist);
         }
     }
 }
Beispiel #8
0
        private void buttonAddElement_Click(object sender, EventArgs e)
        {
            // create new element
            XIMMappingItem item = _listViewCtrl.GetSelectedItem();

            if (item == null)
            {
                return;
            }

            XmlElement tmp = item.Element.Clone();

            tmp.XPath = item.Element.GetXDirectory();
            FormElement frm = new FormElement(tmp);

            if (frm.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }
            XmlElement ele = frm.Element;

            // check if element with the same name is exist
            List <XIMMappingItem> list = _listViewCtrl.GetCurrentList();

            foreach (XIMMappingItem i in list)
            {
                if (i.Element.XPath == ele.XPath)
                {
                    MessageBox.Show(this, "This element already exists.", "Warning",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            // insert new child
            XIMMappingItem citem = new XIMMappingItem(ele);
            int            index = list.IndexOf(item);

            list.Insert(index + 1, citem);

            // display new child
            _listViewCtrl.RefreshList(list);

            foreach (XmlListViewItem <XIMMappingItem> xi in listViewMain.Items)
            {
                if (xi.Item == citem)
                {
                    xi.Selected = true;
                    xi.EnsureVisible();
                    break;
                }
            }
        }
Beispiel #9
0
        public static void SetDataIDMapping(XIMOutboundMessage msg)
        {
            if (msg == null)
            {
                return;
            }
            XIMMappingItem item = new XIMMappingItem();

            item.GWDataDBField = GWDataDBField.i_IndexGuid;
            item.TargetField   = DATAID;
            msg.Rule.QueryResult.MappingList.Add(item);
        }
Beispiel #10
0
        public FormField(XIMMappingItem item, List <XIMMappingItem> list, string dbConnection, Logging log, bool isInbound)
        {
            InitializeComponent();
            this.checkBoxRedundancy.Visible = isInbound;

            _log          = log;
            _dbConnection = dbConnection;

            _item      = item;
            _list      = list;
            _controler = new FieldControler(!isInbound,
                                            this.groupBoxGateway,
                                            this.comboBoxTable,
                                            this.comboBoxField,
                                            this.checkBoxFixValue,
                                            this.textBoxFixValue,
                                            this.checkBoxLUT,
                                            this.comboBoxLUT,
                                            isInbound);

            _controler.OnValueChanged += new EventHandler(_controler_OnValueChanged);
        }