private void btnCreateProperty_Click(object sender, EventArgs e) { Dictionary <string, object> searchProp = new Dictionary <string, object>(); searchProp.Add("Application.Id", BackendApplication.Id); searchProp.Add("Name", "CustomProperties"); IList <BusinessEntity> beList = modelService.GetAllDomainObjectsByPropertyValues <BusinessEntity>(searchProp); if (beList.Count > 0) { using (CreatePropertyForm createPropertyForm = new CreatePropertyForm(beList[0])) { if (createPropertyForm.ShowDialog() == DialogResult.OK) { if (SelectedPropertyList == null) { SelectedPropertyList = new List <Property>(); } // Add the property to selected list and set as selected property SelectedPropertyList.Add(createPropertyForm.Property); this.SelectedProperty = createPropertyForm.Property; DialogResult = DialogResult.OK; } } } }
private void mapNewBtn_Click(object sender, EventArgs e) { if (propertyListView.SelectedItems.Count > 0) { MappedProperty mappedProperty = propertyListView.SelectedItems[0].Tag as MappedProperty; if (FindTargetProperty((DbProperty)mappedProperty.Source) != null) { if (MessageBox.Show("You are trying to map a field, that has been found to be connected to a table and column, to a new custom property.\nIs this what you want?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } } using (CreatePropertyForm createPropertyForm = new CreatePropertyForm(BusinessEntity)) { createPropertyForm.BackendApplication = BackendApplication; createPropertyForm.DbProperty = mappedProperty.Source as DbProperty; if (createPropertyForm.ShowDialog() == DialogResult.OK) { try { mappedProperty.Target = createPropertyForm.Property; UpdateResponseProperty(mappedProperty); DbProperty dbProp = mappedProperty.Source as DbProperty; if (string.IsNullOrEmpty(dbProp.DbDatatype)) { if (mappedProperty.Target.Type == typeof(string)) { dbProp.DbDatatype = "VARCHAR2"; if ((dbProp.PropertyType == DbPropertyType.InOut) || (dbProp.PropertyType == DbPropertyType.Out)) { dbProp.Length = 255; } } } propertyListView.SelectedItems[0].SubItems[3].Text = mappedProperty.Target.Name; propertyListView.SelectedItems[0].SubItems[4].Text = mappedProperty.Target.Type.ToString(); detailGrid.SelectedObject = mappedProperty; // Update the colors UpdateListViewColors(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } } }