本文整理汇总了C#中FormFieldInfo类的典型用法代码示例。如果您正苦于以下问题:C# FormFieldInfo类的具体用法?C# FormFieldInfo怎么用?C# FormFieldInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FormFieldInfo类属于命名空间,在下文中一共展示了FormFieldInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveValidation
public void SaveValidation(FormFieldInfo ffi)
{
if (ffi != null)
{
ffi.FieldMacroRules = ruleDesigner.Value;
}
}
示例2: SaveProperties
/// <summary>
/// Saves properties to given form field info.
/// </summary>
/// <param name="ffi">Form field info</param>
public void SaveProperties(FormFieldInfo ffi)
{
if (ffi != null)
{
// Save caption
SaveProperty(ffi, FormFieldPropertyEnum.FieldCaption, txtLabel);
// Save explanation text
SaveProperty(ffi, FormFieldPropertyEnum.ExplanationText, txtExplanationText);
// Save description
SaveProperty(ffi, FormFieldPropertyEnum.FieldDescription, txtTooltip);
// Save default value
SaveProperty(ffi, FormFieldPropertyEnum.DefaultValue, defaultValue.EditingControl);
// Save if the field is required
ffi.AllowEmpty = !chkRequired.Checked;
// Save options
if (plcOptions.Visible)
{
ffi.Settings["Options"] = optionsDesigner.OptionsDefinition;
SaveProperty(ffi, FormFieldPropertyEnum.DefaultValue, optionsDesigner);
}
}
}
示例3: LoadRules
public void LoadRules(FormFieldInfo ffi)
{
if (ffi != null)
{
ruleDesigner.Value = ffi.FieldMacroRules;
ruleDesigner.DefaultErrorMessage = ffi.GetPropertyValue(FormFieldPropertyEnum.ValidationErrorMessage);
}
}
示例4: SaveSettings
/// <summary>
/// Saves field settings to given form field info.
/// </summary>
/// <param name="ffi">Form field info</param>
public void SaveSettings(FormFieldInfo ffi)
{
pnlProperties.SaveProperties(ffi);
if (!FieldIsPrimary)
{
pnlValidation.SaveValidation(ffi);
}
}
示例5: GetFieldCaption
/// <summary>
/// Returns field caption of the specified column.
/// </summary>
/// <param name="ffi">Form field info</param>
/// <param name="columnName">Column name</param>
protected string GetFieldCaption(FormFieldInfo ffi, string columnName)
{
string fieldCaption = string.Empty;
// get field caption
if ((ffi == null) || (string.IsNullOrEmpty(ffi.Caption)))
{
fieldCaption = columnName;
}
else
{
fieldCaption = ffi.Caption;
}
return fieldCaption;
}
示例6: GetFieldCaption
/// <summary>
/// Returns field caption of the specified column.
/// </summary>
/// <param name="ffi">Form field info</param>
/// <param name="columnName">Column name</param>
protected string GetFieldCaption(FormFieldInfo ffi, string columnName, MacroResolver resolver)
{
string fieldCaption = string.Empty;
// get field caption
if (ffi != null)
{
fieldCaption = ffi.GetDisplayName(resolver);
}
if (string.IsNullOrEmpty(fieldCaption))
{
fieldCaption = columnName;
}
return fieldCaption;
}
示例7: GetFieldCaption
/// <summary>
/// Returns field caption of the specified column.
/// </summary>
/// <param name="ffi">Form field info</param>
/// <param name="columnName">Column name</param>
protected string GetFieldCaption(FormFieldInfo ffi, string columnName)
{
string fieldCaption = "";
// get field caption
if ((ffi == null) || (ffi.Caption == ""))
{
fieldCaption = columnName;
}
else
{
fieldCaption = ffi.Caption;
}
return fieldCaption;
}
示例8: 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++);
}
}
}
示例9: LoadSettings
/// <summary>
/// Loads settings from form field info.
/// </summary>
/// <param name="ffi">Form field info</param>
public void LoadSettings(FormFieldInfo ffi)
{
FieldIsPrimary = ffi.PrimaryKey;
pnlProperties.LoadProperties(ffi);
if (!FieldIsPrimary)
{
pnlValidation.LoadRules(ffi);
}
else
{
// Reset selected tab value
hdnSelectedTab.Value = null;
}
pnlValidation.Visible = !FieldIsPrimary;
}
示例10: LoadProperties
/// <summary>
/// Loads properties from given form field info.
/// </summary>
/// <param name="ffi">Form field info</param>
public void LoadProperties(FormFieldInfo ffi)
{
if (ffi != null)
{
// Load caption
LoadProperty(ffi, FormFieldPropertyEnum.FieldCaption, txtLabel, mphLabel);
// Load explanation text
LoadProperty(ffi, FormFieldPropertyEnum.ExplanationText, txtExplanationText, mphExplanationText);
// Load tooltip
LoadProperty(ffi, FormFieldPropertyEnum.FieldDescription, txtTooltip, mphTooltip);
// Load default value
LoadDefaultValue(ffi);
// Set required checkbox
chkRequired.Checked = !ffi.AllowEmpty;
plcRequired.Visible = !FormHelper.IsFieldOfType(ffi, FormFieldControlTypeEnum.CheckBoxControl);
LoadOptions(ffi);
}
}
示例11: SaveSelectedField
/// <summary>
/// Save selected field.
/// </summary>
private bool SaveSelectedField()
{
DataClassInfo dci = null;
bool updateInherited = false;
// Ensure the transaction
using (var tr = new CMSLateBoundTransaction())
{
// FormFieldInfo structure with data from updated form
FormFieldInfo ffiUpdated = null;
// FormCategoryInfo structure with data from updated form
FormCategoryInfo fciUpdated = null;
// For some types of forms initialize table manager
string tableName = null;
TableManager tm = null;
if (IsMainForm)
{
switch (mMode)
{
// Do nothing for WebPart
case FieldEditorModeEnum.ClassFormDefinition:
case FieldEditorModeEnum.BizFormDefinition:
case FieldEditorModeEnum.SystemTable:
case FieldEditorModeEnum.CustomTable:
{
// Fill ClassInfo structure with data from database
dci = DataClassInfoProvider.GetDataClassInfo(ClassName);
if (dci != null)
{
// Set table name
tableName = dci.ClassTableName;
tm = new TableManager(dci.ClassConnectionString);
tr.BeginTransaction();
}
else
{
ShowError(GetString("fieldeditor.notablename"));
return false;
}
}
break;
}
}
// Load current XML form definition
if (!LoadFormDefinition())
{
// Form definition was not loaded
return false;
}
string error = null;
switch (SelectedItemType)
{
case FieldEditorSelectedItemEnum.Field:
// Fill FormFieldInfo structure with original data
ffi = FormInfo.GetFormField(SelectedItemName);
// Fill FormFieldInfo structure with updated form data
ffiUpdated = FillFormFieldInfoStructure(ffi);
try
{
error = UpdateFormField(tm, tableName, ffiUpdated);
}
catch (Exception ex)
{
EventLogProvider.LogException("FieldEditor", "SAVE", ex);
// User friendly message for not null setting of column
if (!IsNewItemEdited && ffi.AllowEmpty && !ffiUpdated.AllowEmpty)
{
ShowError(GetString("FieldEditor.ColumnNotAcceptNull"), ex.Message);
}
else
{
ShowError(GetString("general.saveerror"), ex.Message);
}
return false;
}
break;
case FieldEditorSelectedItemEnum.Category:
// Fill FormCategoryInfo structure with original data
fci = FormInfo.GetFormCategory(SelectedItemName);
// Initialize new FormCategoryInfo structure
fciUpdated = new FormCategoryInfo();
error = UpdateFormCategory(fciUpdated);
break;
//.........这里部分代码省略.........
示例12: Update60
public static void Update60()
{
EventLogProvider evp = new EventLogProvider();
evp.LogEvent("I", DateTime.Now, "Upgrade to 6.0", "Upgrade - Start");
DataClassInfo dci = null;
#region "CMS.UserSettings"
try
{
dci = DataClassInfoProvider.GetDataClass("cms.usersettings");
if (dci != null)
{
FormInfo fi = new FormInfo(dci.ClassFormDefinition);
if (fi != null)
{
FormFieldInfo ffi = new FormFieldInfo();
ffi.Name = "UserAuthenticationGUID";
ffi.DataType = FormFieldDataTypeEnum.GUID;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.LabelControl;
ffi.Visible = false;
fi.AddFormField(ffi);
ffi = new FormFieldInfo();
ffi.Name = "UserBounces";
ffi.DataType = FormFieldDataTypeEnum.Integer;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
ffi.Visible = false;
ffi.Caption = "UserBounces";
fi.AddFormField(ffi);
ffi = new FormFieldInfo();
ffi.Name = "UserLinkedInID";
ffi.DataType = FormFieldDataTypeEnum.Text;
ffi.Size = 100;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.LabelControl;
ffi.Visible = false;
fi.AddFormField(ffi);
ffi = new FormFieldInfo();
ffi.Name = "UserLogActivities";
ffi.DataType = FormFieldDataTypeEnum.Boolean;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.LabelControl;
ffi.Visible = false;
fi.AddFormField(ffi);
ffi = new FormFieldInfo();
ffi.Name = "UserPasswordRequestHash";
ffi.DataType = FormFieldDataTypeEnum.Text;
ffi.Size = 100;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.LabelControl;
ffi.Visible = false;
fi.AddFormField(ffi);
dci.ClassFormDefinition = fi.GetXmlDefinition();
TableManager tm = new TableManager(dci.ClassConnectionString);
dci.ClassXmlSchema = tm.GetXmlSchema("CMS_UserSettings");
DataClassInfoProvider.SetDataClass(dci);
// Generate queries
SqlGenerator.GenerateDefaultQueries(dci, true, false);
tm.RefreshCustomViews("CMS_UserSettings");
}
}
}
catch (Exception ex)
{
evp.LogEvent("CMS.UserSettings - Upgrade", "Upgrade", ex);
}
#endregion
#region "Ecommerce - Customer"
try
{
dci = DataClassInfoProvider.GetDataClass("ecommerce.customer");
//.........这里部分代码省略.........
示例13: EditForm_OnBeforeSave
protected void EditForm_OnBeforeSave(object sender, EventArgs e)
{
MacroRuleInfo info = EditForm.EditedObject as MacroRuleInfo;
if (info != null)
{
// Generate automatic fields when present in UserText
FormEngineUserControl control = EditForm.FieldControls["MacroRuleText"];
if (control != null)
{
string userText = ValidationHelper.GetString(control.Value, "");
if (!string.IsNullOrEmpty(userText))
{
Regex regex = RegexHelper.GetRegex("\\{[-_a-zA-Z0-9]*\\}");
MatchCollection match = regex.Matches(userText);
if (match.Count > 0)
{
FormInfo fi = new FormInfo(info.MacroRuleParameters);
foreach (Match m in match)
{
foreach (Capture c in m.Captures)
{
string name = c.Value.Substring(1, c.Value.Length - 2).ToLowerCSafe();
FormFieldInfo ffi = fi.GetFormField(name);
if (ffi == null)
{
ffi = new FormFieldInfo();
ffi.Name = name;
ffi.DataType = FormFieldDataTypeEnum.Text;
ffi.Size = 100;
ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffi.Caption = "select operation";
ffi.AllowEmpty = true;
switch (name)
{
case "_is":
ffi.DefaultValue = ";is";
ffi.Settings["controlname"] = "MacroNegationOperator";
ffi.Settings["EditText"] = "false";
ffi.Settings["Options"] = ";is\r\n!;is not";
break;
case "_was":
ffi.DefaultValue = ";was";
ffi.Settings["controlname"] = "MacroNegationOperator";
ffi.Settings["EditText"] = "false";
ffi.Settings["Options"] = ";was\r\n!;was not";
break;
case "_will":
ffi.DefaultValue = ";will";
ffi.Settings["controlname"] = "MacroNegationOperator";
ffi.Settings["EditText"] = "false";
ffi.Settings["Options"] = ";will\r\n!;will not";
break;
case "_has":
ffi.DefaultValue = ";has";
ffi.Settings["controlname"] = "MacroNegationOperator";
ffi.Settings["EditText"] = "false";
ffi.Settings["Options"] = ";has\r\n!;does not have";
break;
case "_perfectum":
ffi.DefaultValue = ";has";
ffi.Settings["controlname"] = "MacroNegationOperator";
ffi.Settings["EditText"] = "false";
ffi.Settings["Options"] = ";has\r\n!;has not";
break;
case "_any":
ffi.DefaultValue = "false;any";
ffi.Settings["controlname"] = "macro_any-all_bool_selector";
ffi.Settings["EditText"] = "false";
ffi.Settings["Options"] = "false;any\r\ntrue;all";
break;
default:
ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
ffi.Size = 1000;
ffi.Caption = "enter text";
break;
}
fi.AddFormField(ffi);
}
}
}
info.MacroRuleParameters = fi.GetXmlDefinition();
}
}
}
}
if (!string.IsNullOrEmpty(ResourceName))
{
EditForm.EditedObject.SetValue("MacroRuleResourceName", ResourceName);
}
EditForm.EditedObject.SetValue("MacroRuleIsCustom", !SettingsKeyProvider.DevelopmentMode);
}
示例14: SaveSelectedField
/// <summary>
/// Save selected field.
/// </summary>
private void SaveSelectedField()
{
// FormFieldInfo structure with data from updated form
FormFieldInfo ffiUpdated = null;
// FormCategoryInfo structure with data from updated form
FormCategoryInfo fciUpdated = null;
// Determines whether it is a new attribute (or attribute to update)
bool isNewItem = false;
string errorMessage = null;
DataClassInfo dci = null;
WebPartInfo wpi = null;
// Variables for changes in DB tables
string tableName = null;
string oldColumnName = null;
string newColumnName = null;
string newColumnSize = null;
string newColumnType = null;
string newColumnDefaultValue = null; // No default value
bool newColumnAllowNull = true;
if (!IsAlternativeForm)
{
switch (mMode)
{
case FieldEditorModeEnum.WebPartProperties:
// Fill WebPartInfo structure with data from database
wpi = WebPartInfoProvider.GetWebPartInfo(mWebPartId);
break;
case FieldEditorModeEnum.ClassFormDefinition:
case FieldEditorModeEnum.BizFormDefinition:
case FieldEditorModeEnum.SystemTable:
case FieldEditorModeEnum.CustomTable:
// Fill ClassInfo structure with data from database
dci = DataClassInfoProvider.GetDataClass(mClassName);
if (dci != null)
{
// Set table name
tableName = dci.ClassTableName;
}
else
{
lblError.Visible = true;
lblError.ResourceString = "fieldeditor.notablename";
return;
}
break;
}
}
// Load current xml form definition
LoadFormDefinition();
if (SelectedItemType == FieldEditorSelectedItemEnum.Field)
{
// Fill FormFieldInfo structure with original data
ffi = fi.GetFormField(SelectedItemName);
// Fill FormFieldInfo structure with updated form data
ffiUpdated = FillFormFieldInfoStructure(ffi);
// Determine whether it is a new attribute or not
isNewItem = (ffi == null);
// Check if the attribute name already exists
if (isNewItem || (ffi.Name.ToLower() != ffiUpdated.Name.ToLower()))
{
columnNames = fi.GetColumnNames();
if (columnNames != null)
{
foreach (string colName in columnNames)
{
// If name already exists
if (ffiUpdated.Name.ToLower() == colName.ToLower())
{
lblError.Visible = true;
lblError.ResourceString = "TemplateDesigner.ErrorExistingColumnName";
return;
}
}
}
// Check column name duplicity in JOINed tables
if (!IsSystemFieldSelected)
{
// Check whether current column already exists in 'View_CMS_Tree_Joined'
if (IsDocumentType && DocumentHelper.ColumnExistsInSystemTable(ffiUpdated.Name))
{
lblError.Visible = true;
lblError.ResourceString = "TemplateDesigner.ErrorExistingColumnInJoinedTable";
return;
}
// Check whether current column is uniquie in tables used to create views - applied only for system tables
if ((Mode == FieldEditorModeEnum.SystemTable) && FormHelper.ColumnExistsInView(mClassName, ffiUpdated.Name))
//.........这里部分代码省略.........
示例15: FillFormFieldInfoStructure
/// <summary>
/// Returns FormFieldInfo structure with form data.
/// </summary>
/// <param name="ffiOriginal">Original field info</param>
private FormFieldInfo FillFormFieldInfoStructure(FormFieldInfo ffiOriginal)
{
// Field info with updated information
FormFieldInfo ffi = new FormFieldInfo();
// Ensure field GUID
if (ffiOriginal != null)
{
ffi.Guid = ffiOriginal.Guid;
}
if (ffi.Guid == Guid.Empty)
{
ffi.Guid = Guid.NewGuid();
}
// Load FormFieldInfo with data from simple control
if (this.SelectedMode == FieldEditorSelectedModeEnum.Simplified)
{
string selectedType = simpleMode.FieldType;
// Part of database section
ffi.Name = simpleMode.AttributeName;
ffi.Caption = simpleMode.FieldCaption;
ffi.AllowEmpty = simpleMode.AllowEmpty;
ffi.System = simpleMode.IsSystem;
ffi.DefaultValue = simpleMode.GetDefaultValue(ffiOriginal);
ffi.IsMacro = EnableMacrosForDefaultValue && ValidationHelper.IsMacro(ffi.DefaultValue);
// Get control data type
string[] controlDefaultDataType = FormUserControlInfoProvider.GetUserControlDefaultDataType(selectedType);
ffi.DataType = FormHelper.GetFormFieldDataType(controlDefaultDataType[0]);
if (simpleMode.AttributeType == "text")
{
ffi.Size = simpleMode.AttributeSize;
}
else
{
ffi.Size = ValidationHelper.GetInteger(controlDefaultDataType[1], 0);
}
// Remove control prefix if exists
if (selectedType.Contains(controlPrefix))
{
selectedType = selectedType.Substring(controlPrefix.Length);
}
// Store field type
ffi.Settings.Add("controlname", selectedType);
if ((simpleMode.FormData != null) && (simpleMode.FormData.ItemArray.Length > 0))
{
foreach (System.Data.DataColumn column in simpleMode.FormData.Table.Columns)
{
ffi.Settings[column.ColumnName] = simpleMode.FormData.Table.Rows[0][column.Caption];
}
}
if ((Mode == FieldEditorModeEnum.BizFormDefinition) || (DisplayedControls == FieldEditorControlsEnum.Bizforms))
{
ffi.PublicField = simpleMode.PublicField;
}
else
{
ffi.PublicField = false;
}
ffi.Visible = true;
// Existing field -> set advanced settings to original settings
if (ffiOriginal != null)
{
ffi.DataType = ffiOriginal.DataType;
ffi.Visible = ffiOriginal.Visible;
// Part of database section
ffi.Description = ffiOriginal.Description;
// Validation section
ffi.RegularExpression = ffiOriginal.RegularExpression;
ffi.MinStringLength = ffiOriginal.MinStringLength;
ffi.MaxStringLength = ffiOriginal.MaxStringLength;
ffi.MinValue = ffiOriginal.MinValue;
ffi.MaxValue = ffiOriginal.MaxValue;
ffi.MinDateTimeValue = ffiOriginal.MinDateTimeValue;
ffi.MaxDateTimeValue = ffiOriginal.MaxDateTimeValue;
ffi.ValidationErrorMessage = ffiOriginal.ValidationErrorMessage;
// Design section
ffi.CaptionStyle = ffiOriginal.CaptionStyle;
ffi.InputControlStyle = ffiOriginal.InputControlStyle;
ffi.ControlCssClass = ffiOriginal.ControlCssClass;
}
}
// Load FormFieldInfo with data from advanced control
else
{
string selectedType = fieldAppearance.FieldType;
string attributeType = databaseConfiguration.AttributeType;
//.........这里部分代码省略.........