Exemplo n.º 1
0
        private bool HandleMapping()
        {
            if (this.lstSourceCSV.SelectedIndex > -1 && this.lstTargetCSV.SelectedIndex > -1)
            {
                RemappingObj obj = this.Conf.remappingObj.Find(t => t.TargetField.Equals(this.lstTargetCSV.SelectedItem.ToString()));

                // check if there is an object with a link to the selected target
                if (obj == null)
                {
                    obj                = new RemappingObj();
                    obj.SourceField    = this.lstSourceCSV.SelectedItem.ToString();
                    obj.SourcefieldIdx = this.lstSourceCSV.SelectedIndex;
                    obj.TargetField    = this.lstTargetCSV.SelectedItem.ToString();
                    obj.TargetFieldIdx = this.lstTargetCSV.SelectedIndex;
                    obj.MappingString  = obj.SourceField + " -> " + obj.TargetField;
                    this.Conf.remappingObj.Add(obj);
                    this.RefreshMappingList();
                    return(true);
                }

                string message = "The selected target is just mapped";
                string caption = "Mapping Error";
                MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(false);
        }
Exemplo n.º 2
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.lstMaps.SelectedIndex > -1)
            {
                string       entry = this.lstMaps.SelectedItem.ToString();
                RemappingObj obj   = this.Conf.remappingObj.Find(o => o.MappingString.Equals(entry));

                if (obj != null)
                {
                    this.Conf.remappingObj.Remove(obj);
                    this.RefreshMappingList();
                }
            }
        }