Hi,
I'm trying to get a ProductFieldTypeProvider to work. I have started with the class below and thought that it should show up in the list field types. But it don't. I need to create a product field type where I can select UserGroups.
Are there any basic exmaples of a ProductFieldTypeProvider somewhere perhaps?
namespace Softgear.Industrilas.Data.Provider
{
[AddInName("Mindflower.UserGroupSelectProvider")]
[AddInLabel("User Group Selector")]
[AddInActive(true)]
[Serializable]
public class UserGroupSelectProvider : ProductFieldTypeProvider, IDropDownOptions
{
private Lazy<Dictionary<string, string>> _options;
public UserGroupSelectProvider()
{
_options = new Lazy<Dictionary<string, string>>();
}
public override object GetValue(object value, string languageId, Dictionary<string, string> settings)
{
return "Testing usergroups";
}
public override string GetAppenderInfo(string languageId, string settings)
{
return GetAppenderInfo(languageId, GetParameterValues(settings));
}
public override string GetAppenderInfo(string languageId, Dictionary<string, string> settings)
{
return "AppenderInfo";
}
protected override void Render(TextWriter writer, string id, bool enabled, string value, bool hasError, string text, string title)
{
throw new NotImplementedException();
}
[AddInParameter("Usergroups")]
[AddInParameterEditor(typeof(UserGroupParameterEditor), "multiple=false;")]
[AddInParameterGroup("Source")]
public string[] Usergroups { get; set; }
public Hashtable GetOptions(string dropdownName)
{
// Get Hashtable
Hashtable options = new Hashtable();
foreach (var key in _options.Value.Keys)
{
options.Add(key, _options.Value[key]);
}
// Return the hashtable
return options;
}
}
}