示例#1
0
        public async Task AddCustomAttributeAsync(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;
            }

            await _customAttributeConfigRepository.SaveAsync(newCustomAttribute);

            if (newCustomAttribute.CustomAttributeType == CustomAttributeType.Selection)
            {
                var newSelectionDataItem = new SelectionDataItem()
                {
                    AttributeKey = customAttribute.AttributeName,
                    Value        = "",
                    SelectionKey = "0"
                };

                await _selectionDataItemRepository.SaveAsync(newSelectionDataItem);
            }
        }
示例#2
0
        public async Task AddSelectionDataItemAsync(SelectionDataItemDetail selectionDataItem)
        {
            var newSelectionDataItem = new SelectionDataItem()
            {
                AttributeKey = selectionDataItem.AttributeKey,
                Value        = selectionDataItem.DataItemValue,
                SelectionKey = selectionDataItem.SelectionKey
            };

            await _selectionDataItemRepository.SaveAsync(newSelectionDataItem);
        }
示例#3
0
 public void AddSelectionDataItem(SelectionDataItem newItem)
 {
     _selectionDataItemRepository.Save(newItem);
 }