public void AddCustomAttribute(CustomAttributeConfigDetail customAttribute) { var newCustomAttribute = new CustomAttributeConfiguration() { ExtendableTypeName = customAttribute.EntityName, Category = customAttribute.Category, AttributeKey = customAttribute.AttributeName, AttributeDetail = customAttribute.AttributeDetail, CustomAttributeType = customAttribute.CustomAttributeType, IsRequired = customAttribute.Required, IsSearchable = customAttribute.Searchable }; switch (newCustomAttribute.CustomAttributeType) { case CustomAttributeType.Numeric: if (customAttribute.NumericMinValue.HasValue) { newCustomAttribute.NumericMinValue = customAttribute.NumericMinValue.Value; } if (customAttribute.NumericMaxValue.HasValue) { newCustomAttribute.NumericMaxValue = customAttribute.NumericMaxValue.Value; } break; case CustomAttributeType.String: if (customAttribute.StringMaxLength.HasValue) { newCustomAttribute.StringMaxLength = customAttribute.StringMaxLength.Value; } break; case CustomAttributeType.DateTime: newCustomAttribute.FutureDateOnly = customAttribute.FutureDateOnly; newCustomAttribute.PastDateOnly = customAttribute.PastDateOnly; break; default: break; } customAttributeConfigRepository.Save(newCustomAttribute); if (newCustomAttribute.CustomAttributeType == CustomAttributeType.Selection) { var newSelectionDataItem = new SelectionDataItem() { AttributeKey = customAttribute.AttributeName, Value = "", SelectionKey = "0" }; selectionDataRepository.Save(newSelectionDataItem); } }
public void AddSelectionDataItem(SelectionDataItemDetail selectionDataItem) { var newSelectionDataItem = new SelectionDataItem() { AttributeKey = selectionDataItem.AttributeKey, Value = selectionDataItem.DataItemValue, SelectionKey = selectionDataItem.SelectionKey }; selectionDataRepository.Save(newSelectionDataItem); }