예제 #1
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();
            }
        }