/// <summary> /// Triggers the DefaultPropertiesChanged event. /// </summary> protected virtual void OnDefaultPropertiesChanged(bool isAdding, DefaultPropertyValue propDef) { if (DefaultPropertiesChanged != null) { DefaultPropertiesChanged(this, new DefaultProperyValuesChangedEventArgs(isAdding, propDef)); } }
private DefaultPropertyValue CreateAndAssignDefaultPropertyValue(ISupportDefaultPropertyValues supportPropertiesObject, PropertyDefinition propertyDef, OperationReport operationReport) { OperationReport report = GuardAgainstNulls.ArgsContainsNull(new object[] { supportPropertiesObject, propertyDef }); if (!report.Success) { operationReport.SetValues(report); return(null); } report = ValidateCanAssociateDefaultPropertyValueToObject(supportPropertiesObject, propertyDef); if (!report.Success) { operationReport.SetValues(report); return(null); } var propDefaultValue = new DefaultPropertyValue(propertyDef); supportPropertiesObject.AddDefaultPropertyValue(propDefaultValue); lock (typeProperties) { typeProperties[supportPropertiesObject.UserTypeID].Add(propDefaultValue.Name, propDefaultValue); } return(propDefaultValue); }
public void SetNewDefaultValue(Type annotType, DefaultPropertyValue dpv) { if (this.defaultPropertyValues.ContainsKey(annotType)) { this.defaultPropertyValues[annotType] = dpv; } else { this.defaultPropertyValues.Add(annotType, dpv); } }
/// <summary> /// Initializes a new instance of the <see cref="DefaultPropertyValueDescriptor"/> class. /// </summary> /// <param name="propertyDefinition">The property definition.</param> public DefaultPropertyValueDescriptor(DefaultPropertyValue propertyDefinition) : base(propertyDefinition.Name, new Attribute[0]) { CustomField = propertyDefinition; _componentType = typeof(PublishableDomainObject); }
private void CreateAndAssignPropertyValue(ISupportPropertyValues dynamicPropertyObject, DefaultPropertyValue propertyDefValue) { dynamicPropertyObject.AddPropertyValue(propertyDefValue.CreatePropertyValue()); }
public OperationReport UpdatePropertyDefinition(ISupportDefaultPropertyValues domainObject, DefaultPropertyValue propDefValue) { OperationReport newOperationReport = new OperationReport { Success = true }; if (!domainObject.HasProperty(propDefValue.StaticInstanceID)) { newOperationReport.Success = false; newOperationReport.AddNotification(string.Format("The domain object {0} does not contain the property definition value {1}", domainObject.Name, propDefValue.Name)); return(newOperationReport); } //get the transaction for the worktype name or id? need to be consistent. try { var Trans = GetPersistTransactionFor(domainObject.Id); Trans.SaveOrUpdate(propDefValue); //save the newly defined propertydefinition value object (to get the id) and add to the worktype } catch (Exception ex) { newOperationReport.AddNotification(ex.Message, ex); } return(newOperationReport); }
/// <summary> /// Adds the default property value. /// </summary> /// <param name = "defaultPropValue">The dyn prop def value.</param> public virtual void AddDefaultPropertyValue(DefaultPropertyValue defaultPropValue) { defaultPropValue.PropertyOwner = this; DefaultPropertyValueContainer.AddProperty(defaultPropValue); OnDefaultPropertiesChanged(true, defaultPropValue); }
/// <summary> /// Removes the default property value. /// </summary> /// <param name = "dynPropDefValue">The dyn prop def value.</param> public virtual void RemoveDefaultPropertyValue(DefaultPropertyValue dynPropDefValue) { DefaultPropertyValueContainer.Remove(dynPropDefValue); OnDefaultPropertiesChanged(false, dynPropDefValue); }
public void SetNewDefaultValue(Type annotType, DefaultPropertyValue dpv) { if (this.defaultPropertyValues.ContainsKey(annotType)) this.defaultPropertyValues[annotType] = dpv; else this.defaultPropertyValues.Add(annotType, dpv); }
/// <summary> /// Initializes a new instance of the DefaultPropertiesChangedEventArgs class. /// </summary> /// <param name = "isAdding"></param> /// <param name = "property"></param> public DefaultProperyValuesChangedEventArgs(bool isAdding, DefaultPropertyValue property) { Add = isAdding; Property = property; }