本文整理汇总了C#中FormFieldInfo.SetPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:C# FormFieldInfo.SetPropertyValue方法的具体用法?C# FormFieldInfo.SetPropertyValue怎么用?C# FormFieldInfo.SetPropertyValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormFieldInfo
的用法示例。
在下文中一共展示了FormFieldInfo.SetPropertyValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: editForm_OnBeforeDataLoad
protected void editForm_OnBeforeDataLoad(object sender, EventArgs e)
{
if ((Variant == null) || !Variant.IsProductVariant)
{
EditedObject = null;
return;
}
CheckEditedObjectSiteID(Variant.SKUSiteID);
var optionsDs = SKUInfoProvider.GetSKUs()
.WhereIn("SKUID",
VariantOptionInfoProvider.GetVariantOptions()
.Column("OptionSKUID")
.WhereEquals("VariantSKUID", Variant.SKUID)
);
var attrPos = GetAttributesPosition();
foreach (var option in optionsDs)
{
if (option.Parent != null)
{
string categoryCodeName = option.Parent.Generalized.ObjectCodeName;
options.Add(categoryCodeName, option);
FormFieldInfo ffOption = new FormFieldInfo
{
Name = categoryCodeName,
AllowEmpty = true,
Size = 400,
FieldType = FormFieldControlTypeEnum.LabelControl,
DataType = FieldDataType.Text,
IsDummyField = true,
};
OptionCategoryInfo parentOptionCategory = (OptionCategoryInfo)option.Parent;
ffOption.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, HTMLHelper.HTMLEncode(ResHelper.LocalizeString(option.SKUName)));
// Show category live site display name instead of category display name in case it is available
ffOption.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, HTMLHelper.HTMLEncode(ResHelper.LocalizeString(parentOptionCategory.CategoryTitle)));
//Insert field to the form on specified position
editForm.FormInformation.AddFormItem(ffOption, attrPos++);
}
}
}
示例2: InitCustomTable
/// <summary>
/// Initializes the custom table
/// </summary>
/// <param name="dci">DataClassInfo of the custom table</param>
/// <param name="fi">Form info</param>
/// <param name="tm">Table manager</param>
private void InitCustomTable(DataClassInfo dci, FormInfo fi, TableManager tm)
{
// Created by
if (chkItemCreatedBy.Checked && !fi.FieldExists("ItemCreatedBy"))
{
FormFieldInfo ffi = new FormFieldInfo();
// Fill FormInfo object
ffi.Name = "ItemCreatedBy";
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "Created by");
ffi.DataType = FieldDataType.Integer;
ffi.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, string.Empty);
ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
ffi.PrimaryKey = false;
ffi.System = true;
ffi.Visible = false;
ffi.Size = 0;
ffi.AllowEmpty = true;
fi.AddFormItem(ffi);
}
// Created when
if (chkItemCreatedWhen.Checked && !fi.FieldExists("ItemCreatedWhen"))
{
FormFieldInfo ffi = new FormFieldInfo();
// Fill FormInfo object
ffi.Name = "ItemCreatedWhen";
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "Created when");
ffi.DataType = FieldDataType.DateTime;
ffi.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, string.Empty);
ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
ffi.PrimaryKey = false;
ffi.System = true;
ffi.Visible = false;
ffi.Size = 0;
ffi.AllowEmpty = true;
fi.AddFormItem(ffi);
}
// Modified by
if (chkItemModifiedBy.Checked && !fi.FieldExists("ItemModifiedBy"))
{
FormFieldInfo ffi = new FormFieldInfo();
// Fill FormInfo object
ffi.Name = "ItemModifiedBy";
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "Modified by");
ffi.DataType = FieldDataType.Integer;
ffi.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, string.Empty);
ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
ffi.PrimaryKey = false;
ffi.System = true;
ffi.Visible = false;
ffi.Size = 0;
ffi.AllowEmpty = true;
fi.AddFormItem(ffi);
}
// Modified when
if (chkItemModifiedWhen.Checked && !fi.FieldExists("ItemModifiedWhen"))
{
FormFieldInfo ffi = new FormFieldInfo();
// Fill FormInfo object
ffi.Name = "ItemModifiedWhen";
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "Modified when");
ffi.DataType = FieldDataType.DateTime;
ffi.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, string.Empty);
ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
ffi.PrimaryKey = false;
ffi.System = true;
ffi.Visible = false;
ffi.Size = 0;
ffi.AllowEmpty = true;
fi.AddFormItem(ffi);
}
// Item order
if (chkItemOrder.Checked && !fi.FieldExists("ItemOrder"))
{
FormFieldInfo ffi = new FormFieldInfo();
//.........这里部分代码省略.........
示例3: CreateEmptyFormInfo
/// <summary>
/// Creates an empty form info for the new class
/// </summary>
private FormInfo CreateEmptyFormInfo()
{
// Create empty form definition
var fi = new FormInfo();
var ffiPK = new FormFieldInfo();
// Fill FormInfo object
ffiPK.Name = txtPKName.Text;
ffiPK.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, txtPKName.Text);
ffiPK.DataType = FieldDataType.Integer;
ffiPK.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
ffiPK.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, string.Empty);
ffiPK.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffiPK.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
ffiPK.PrimaryKey = true;
ffiPK.System = false;
ffiPK.Visible = false;
ffiPK.Size = 0;
ffiPK.AllowEmpty = false;
// Add field to form definition
fi.AddFormItem(ffiPK);
return fi;
}
示例4: CreateGuidField
/// <summary>
/// Creates the GUID field
/// </summary>
private static FormFieldInfo CreateGuidField()
{
FormFieldInfo ffiGuid = new FormFieldInfo();
// Fill FormInfo object
ffiGuid.Name = "ItemGUID";
ffiGuid.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "GUID");
ffiGuid.DataType = FieldDataType.Guid;
ffiGuid.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
ffiGuid.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, String.Empty);
ffiGuid.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffiGuid.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
ffiGuid.PrimaryKey = false;
ffiGuid.System = true;
ffiGuid.Visible = false;
ffiGuid.Size = 0;
ffiGuid.AllowEmpty = false;
return ffiGuid;
}
示例5: InitCustomTable
/// <summary>
/// Initializes the custom table
/// </summary>
/// <param name="dci">DataClassInfo of the custom table</param>
/// <param name="fi">Form info</param>
private void InitCustomTable(DataClassInfo dci, FormInfo fi)
{
// Created by
if (chkItemCreatedBy.Checked && !fi.FieldExists("ItemCreatedBy"))
{
FormFieldInfo ffi = new FormFieldInfo();
// Fill FormInfo object
ffi.Name = "ItemCreatedBy";
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "Created by");
ffi.DataType = FieldDataType.Integer;
ffi.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, string.Empty);
ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
ffi.PrimaryKey = false;
ffi.System = true;
ffi.Visible = false;
ffi.Size = 0;
ffi.AllowEmpty = true;
fi.AddFormItem(ffi);
}
// Created when
if (chkItemCreatedWhen.Checked && !fi.FieldExists("ItemCreatedWhen"))
{
FormFieldInfo ffi = new FormFieldInfo();
// Fill FormInfo object
ffi.Name = "ItemCreatedWhen";
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "Created when");
ffi.DataType = FieldDataType.DateTime;
ffi.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, string.Empty);
ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
ffi.PrimaryKey = false;
ffi.System = true;
ffi.Visible = false;
ffi.Size = 0;
ffi.AllowEmpty = true;
fi.AddFormItem(ffi);
}
// Modified by
if (chkItemModifiedBy.Checked && !fi.FieldExists("ItemModifiedBy"))
{
FormFieldInfo ffi = new FormFieldInfo();
// Fill FormInfo object
ffi.Name = "ItemModifiedBy";
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "Modified by");
ffi.DataType = FieldDataType.Integer;
ffi.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, string.Empty);
ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
ffi.PrimaryKey = false;
ffi.System = true;
ffi.Visible = false;
ffi.Size = 0;
ffi.AllowEmpty = true;
fi.AddFormItem(ffi);
}
// Modified when
if (chkItemModifiedWhen.Checked && !fi.FieldExists("ItemModifiedWhen"))
{
FormFieldInfo ffi = new FormFieldInfo();
// Fill FormInfo object
ffi.Name = "ItemModifiedWhen";
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "Modified when");
ffi.DataType = FieldDataType.DateTime;
ffi.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, string.Empty);
ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
ffi.PrimaryKey = false;
ffi.System = true;
ffi.Visible = false;
ffi.Size = 0;
ffi.AllowEmpty = true;
fi.AddFormItem(ffi);
}
// Item order
if (chkItemOrder.Checked && !fi.FieldExists("ItemOrder"))
{
FormFieldInfo ffi = new FormFieldInfo();
//.........这里部分代码省略.........
示例6: InitClass
/// <summary>
/// Initializes class.
/// </summary>
/// <param name="dci">DataClassInfo</param>
/// <param name="fi">Form info</param>
private void InitClass(DataClassInfo dci, FormInfo fi)
{
// Get class code name
var pkName = txtPKName.Text.Trim();
var codeName = pkName.Substring(0, pkName.Length - 2);
// Guid
if (chkClassGuid.Checked && !fi.FieldExists(codeName + "Guid"))
{
fi.AddFormItem(CreateGuidField(codeName + "Guid"));
}
// Last modified
if (chkClassLastModified.Checked && !fi.FieldExists(codeName + "LastModified"))
{
FormFieldInfo ffi = new FormFieldInfo();
// Fill FormInfo object
ffi.Name = codeName + "LastModified";
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "Last modified");
ffi.DataType = FieldDataType.DateTime;
ffi.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, String.Empty);
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, String.Empty);
ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
ffi.PrimaryKey = false;
ffi.System = true;
ffi.Visible = false;
ffi.Size = 0;
ffi.AllowEmpty = false;
fi.AddFormItem(ffi);
}
UpdateDataClass(dci, fi);
}
示例7: CreateFormFieldInfo
/// <summary>
/// Creates new FormFieldInfo from given SettingKeyInfo.
/// </summary>
/// <param name="setting">Setting key info.</param>
private FormFieldInfo CreateFormFieldInfo(SettingsKeyInfo setting)
{
var ffi = new FormFieldInfo
{
Name = setting.KeyName,
DataType = setting.KeyType,
FieldType = FormHelper.GetFormFieldDefaultControlType(setting.KeyType, false)
};
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, setting.KeyDisplayName);
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, setting.KeyDescription);
ffi.SetPropertyValue(FormFieldPropertyEnum.ExplanationText, setting.KeyExplanationText);
ffi.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, setting.KeyDefaultValue);
return ffi;
}
示例8: SaveProperty
private void SaveProperty(FormFieldInfo ffi, FormFieldPropertyEnum property, FormEngineUserControl control)
{
if (control.Visible)
{
if (control is LocalizableFormEngineUserControl)
{
// Save translation
((LocalizableFormEngineUserControl)control).Save();
}
ffi.SetPropertyValue(property, ValidationHelper.GetString(control.Value, String.Empty));
}
}
示例9: CreateGUID
/// <summary>
/// Adds GUID field to form definition.
/// </summary>
private void CreateGUID()
{
try
{
// Create GUID field
FormFieldInfo ffiGuid = new FormFieldInfo();
// Fill FormInfo object
ffiGuid.Name = "ItemGUID";
ffiGuid.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "GUID");
ffiGuid.DataType = FieldDataType.Guid;
ffiGuid.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
ffiGuid.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, String.Empty);
ffiGuid.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffiGuid.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
ffiGuid.PrimaryKey = false;
ffiGuid.System = true;
ffiGuid.Visible = false;
ffiGuid.Size = 0;
ffiGuid.AllowEmpty = false;
FormInfo.AddFormItem(ffiGuid);
// Update table structure - columns could be added
bool old = TableManager.UpdateSystemFields;
TableManager.UpdateSystemFields = true;
string schema = FormInfo.GetXmlDefinition();
TableManager tm = new TableManager(null);
tm.UpdateTableByDefinition(dci.ClassTableName, schema);
TableManager.UpdateSystemFields = old;
// Update xml schema and form definition
dci.ClassFormDefinition = schema;
dci.ClassXmlSchema = tm.GetXmlSchema(dci.ClassTableName);
dci.Generalized.LogEvents = false;
// Save the data
DataClassInfoProvider.SetDataClassInfo(dci);
dci.Generalized.LogEvents = true;
// Clear the default queries
QueryInfoProvider.ClearDefaultQueries(dci, true, false);
// Clear the object type hashtable
ProviderStringDictionary.ReloadDictionaries(className, true);
// Clear the classes hashtable
ProviderStringDictionary.ReloadDictionaries("cms.class", true);
// Clear class strucures
ClassStructureInfo.Remove(className, true);
// Ensure GUIDs for all items
using (CMSActionContext ctx = new CMSActionContext())
{
ctx.UpdateSystemFields = false;
ctx.LogSynchronization = false;
DataSet dsItems = CustomTableItemProvider.GetItems(className);
if (!DataHelper.DataSourceIsEmpty(dsItems))
{
foreach (DataRow dr in dsItems.Tables[0].Rows)
{
CustomTableItem item = CustomTableItem.New(className, dr);
item.ItemGUID = Guid.NewGuid();
item.Update();
}
}
}
// Log event
UserInfo currentUser = MembershipContext.AuthenticatedUser;
EventLogProvider.LogEvent(EventType.INFORMATION, "Custom table", "GENERATEGUID", string.Format(ResHelper.GetAPIString("customtable.GUIDGenerated", "Field 'ItemGUID' for custom table '{0}' was created and GUID values were generated."), dci.ClassName), null, currentUser.UserID, currentUser.UserName);
URLHelper.Redirect(URLHelper.AddParameterToUrl(RequestContext.CurrentURL, "gen", "1"));
}
catch (Exception ex)
{
FieldEditor.ShowError(GetString("customtable.ErrorGUID") + ex.Message);
// Log event
EventLogProvider.LogException("Custom table", "GENERATEGUID", ex);
}
}
示例10: SetCaptionToField
/// <summary>
/// Sets the caption of field, if resource with given caption key is available.
/// </summary>
/// <param name="ffi">Form field info</param>
/// <param name="captionKey">Resource key of caption</param>
private void SetCaptionToField(FormFieldInfo ffi, string captionKey)
{
// Set detailed caption
string caption = GetString(captionKey);
if (!caption.EqualsCSafe(captionKey, true))
{
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, caption);
}
}
示例11: PrepareNewField
/// <summary>
/// Prepares new field.
/// </summary>
/// <param name="controlName">Code name of used control</param>
private FormFieldInfo PrepareNewField(string controlName)
{
FormFieldInfo ffi = new FormFieldInfo();
string[] controlDefaultDataType = FormUserControlInfoProvider.GetUserControlDefaultDataType(controlName);
ffi.DataType = controlDefaultDataType[0];
ffi.Size = ValidationHelper.GetInteger(controlDefaultDataType[1], 0);
ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
FormUserControlInfo control = FormUserControlInfoProvider.GetFormUserControlInfo(controlName);
if (control != null)
{
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, control.UserControlDisplayName);
}
ffi.AllowEmpty = true;
ffi.PublicField = true;
ffi.Name = GetUniqueFieldName(controlName);
ffi.Settings["controlname"] = controlName;
// For list controls create three default options
if (FormHelper.HasListControl(ffi))
{
SpecialFieldsDefinition optionDefinition = new SpecialFieldsDefinition();
for (int i = 1; i <= 3; i++)
{
optionDefinition.Add(new SpecialField
{
Value = OptionsDesigner.DEFAULT_OPTION + i,
Text = OptionsDesigner.DEFAULT_OPTION + i
});
}
ffi.Settings["Options"] = optionDefinition.ToString();
}
if (controlName.EqualsCSafe("CalendarControl"))
{
ffi.Settings["EditTime"] = false;
}
return ffi;
}
示例12: SetFieldAppearance
/// <summary>
/// Sets the field appearance
/// </summary>
/// <param name="formFieldInfo">Form field info</param>
private void SetFieldAppearance(FormFieldInfo formFieldInfo)
{
DataRow settingsData = null;
// Do not save additional field settings if field is hidden
formFieldInfo.Visible = chkDisplayInForm.Checked;
if (formFieldInfo.Visible)
{
// Field appearance section
fieldAppearance.FieldInfo = formFieldInfo;
fieldAppearance.Save();
string selectedType = fieldAppearance.FieldType;
// Validation section
validationSettings.FieldInfo = formFieldInfo;
validationSettings.Save();
// Design section
cssSettings.FieldInfo = formFieldInfo;
cssSettings.Save();
// HtmlEnvelope section
htmlEnvelope.FieldInfo = formFieldInfo;
htmlEnvelope.Save();
// Field advanced section
formFieldInfo.SetPropertyValue(FormFieldPropertyEnum.VisibleMacro, fieldAdvancedSettings.VisibleMacro, true);
formFieldInfo.SetPropertyValue(FormFieldPropertyEnum.EnabledMacro, fieldAdvancedSettings.EnabledMacro, true);
formFieldInfo.DisplayInSimpleMode = fieldAdvancedSettings.DisplayInSimpleMode;
formFieldInfo.HasDependingFields = fieldAdvancedSettings.HasDependingFields;
formFieldInfo.DependsOnAnotherField = fieldAdvancedSettings.DependsOnAnotherField;
// Get control settings data
settingsData = controlSettings.FormData;
// Store macro table
formFieldInfo.SettingsMacroTable = controlSettings.MacroTable;
formFieldInfo.Settings["controlname"] = selectedType;
}
formFieldInfo.DisplayIn = String.Empty;
if (chkDisplayInDashBoard.Checked)
{
formFieldInfo.DisplayIn = DisplayIn;
}
// Store settings
if ((settingsData != null) && (settingsData.ItemArray.Length > 0))
{
foreach (DataColumn column in settingsData.Table.Columns)
{
formFieldInfo.Settings[column.ColumnName] = settingsData.Table.Rows[0][column.Caption];
}
}
formFieldInfo.FieldType = FormFieldControlTypeEnum.CustomUserControl;
}
示例13: SetVariantAttributes
/// <summary>
/// Creates category with variant attributes.
/// </summary>
/// <param name="optionsDs">Product options</param>
private void SetVariantAttributes(IEnumerable<SKUInfo> optionsDs)
{
// Get attributes category index - just before representing category
var attrPos = editForm.FormInformation.ItemsList.FindIndex(f =>
(f is FormCategoryInfo) && ((FormCategoryInfo)f).CategoryName.EqualsCSafe("com.sku.representingcategory"));
// Create attributes category
var attCategory = new FormCategoryInfo()
{
CategoryName = "Attributes",
IsDummy = true,
};
attCategory.SetPropertyValue(FormCategoryPropertyEnum.Caption, HTMLHelper.HTMLEncode(GetString("com.variant.attributes")));
editForm.FormInformation.AddFormItem(attCategory, attrPos++);
foreach (var option in optionsDs)
{
if (option.Parent != null)
{
string categoryCodeName = option.Parent.Generalized.ObjectCodeName;
options.Add(categoryCodeName, option);
FormFieldInfo ffOption = new FormFieldInfo
{
Name = categoryCodeName,
AllowEmpty = true,
Size = 400,
FieldType = FormFieldControlTypeEnum.LabelControl,
DataType = FieldDataType.Text,
IsDummyField = true,
};
OptionCategoryInfo parentOptionCategory = (OptionCategoryInfo)option.Parent;
ffOption.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, HTMLHelper.HTMLEncode(ResHelper.LocalizeString(option.SKUName)));
// Show category live site display name instead of category display name in case it is available
ffOption.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, HTMLHelper.HTMLEncode(ResHelper.LocalizeString(parentOptionCategory.CategoryTitle)));
//Insert field to the form on specified position
editForm.FormInformation.AddFormItem(ffOption, attrPos++);
}
}
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:49,代码来源:Product_Edit_Variant_Edit.aspx.cs