private void removePropertyBtn_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to remove the selected Property?", "Remove Property", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                propertyMapControl.PropertyMap.MappedProperties.Remove(propertyMapControl.SelectedProperty);

                if (AddedMappedProperties.Contains(propertyMapControl.SelectedProperty))
                {
                    AddedMappedProperties.Remove(propertyMapControl.SelectedProperty);
                }
                else
                {
                    DeletedMappedProperties.Add(propertyMapControl.SelectedProperty);
                }

                propertyMapControl.Map();
            }
        }
Exemplo n.º 2
0
        private void RemoveCustomMappedPropertyFromMap(MappedProperty mappedProperty, PropertyMap map)
        {
            if (!mappedProperty.IsCustom)
            {
                return;
            }

            if (MessageBox.Show("Are you sure you want to remove the selected Property?", "Remove Property", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            try
            {
                this.Cursor = Cursors.WaitCursor;

                map.MappedProperties.Remove(mappedProperty);

                if (AddedMappedProperties.Contains(mappedProperty))
                {
                    AddedMappedProperties.Remove(mappedProperty);
                }
                else
                {
                    DeletedMappedProperties.Add(mappedProperty);
                }

                PopulateRequestList();
                PopulateResponseList();
                PopulateContextMenu();
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemplo n.º 3
0
        private bool AddCustomMappedPropertyToMap(PropertyMap map)
        {
            bool retVal = false;

            using (FindPropertyForm form = new FindPropertyForm())
            {
                form.FrontendApplication      = FrontendApplication;
                form.BackendApplication       = BackendApplication;
                form.CanShowCustomProperties  = true;
                form.CanMultiSelectProperties = true;

                if (form.ShowDialog() == DialogResult.OK)
                {
                    foreach (Property property in form.SelectedPropertyList)
                    {
                        MappedProperty newProperty = new MappedProperty();

                        int sequence = 1;

                        if (map.MappedProperties.Count > 0)
                        {
                            sequence = map.MappedProperties.Max(p => p.Sequence) + 1;
                        }

                        newProperty.IsCustom    = true;
                        newProperty.Target      = property;
                        newProperty.PropertyMap = map;
                        newProperty.Sequence    = sequence;

                        map.MappedProperties.Add(newProperty);

                        AddedMappedProperties.Add(newProperty);

                        retVal = true;
                    }
                }
            }

            return(retVal);
        }
        private void addPropertyBtn_Click(object sender, EventArgs e)
        {
            using (FindPropertyForm form = new FindPropertyForm())
            {
                form.CanShowCustomProperties  = true;
                form.CanMultiSelectProperties = true;
                form.FrontendApplication      = FrontendApplication;
                form.BackendApplication       = BackendApplication;
                form.Owner = this;

                if (form.ShowDialog() == DialogResult.OK)
                {
                    foreach (Property property in form.SelectedPropertyList)
                    {
                        MappedProperty newProperty = new MappedProperty();

                        int sequence = 0;

                        if (propertyMapControl.PropertyMap.MappedProperties.Count > 0)
                        {
                            sequence = propertyMapControl.PropertyMap.MappedProperties.Max(p => p.Sequence) + 1;
                        }

                        newProperty.IsCustom    = true;
                        newProperty.Target      = property;
                        newProperty.PropertyMap = propertyMapControl.PropertyMap;
                        newProperty.Sequence    = sequence;

                        propertyMapControl.PropertyMap.MappedProperties.Add(newProperty);

                        AddedMappedProperties.Add(newProperty);
                    }
                }

                propertyMapControl.Map();
            }
        }