Exemplo n.º 1
0
    private void UpdateDataType(DataTypeDto dataType, ValueListConfiguration config, bool isMultiple)
    {
        dataType.DbType      = ValueStorageType.Nvarchar.ToString();
        dataType.EditorAlias = Constants.PropertyEditors.Aliases.DropDownListFlexible;

        var flexConfig = new DropDownFlexibleConfiguration {
            Items = config.Items, Multiple = isMultiple
        };

        dataType.Configuration = ConfigurationEditor.ToDatabase(flexConfig, _configurationEditorJsonSerializer);

        Database.Update(dataType);
    }
        public object GetConfiguration(int dataTypeId, string editorAlias, Dictionary <string, PreValueDto> preValues)
        {
            var config = new DropDownFlexibleConfiguration();

            foreach (var preValue in preValues.Values)
            {
                if (preValue.Alias == "multiple")
                {
                    config.Multiple = (preValue.Value == "1");
                }
                else
                {
                    config.Items.Add(new ValueListConfiguration.ValueListItem {
                        Id = preValue.Id, Value = preValue.Value
                    });
                }
            }
            return(config);
        }