本文整理汇总了C#中FormInfo.GetXmlDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# FormInfo.GetXmlDefinition方法的具体用法?C# FormInfo.GetXmlDefinition怎么用?C# FormInfo.GetXmlDefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormInfo
的用法示例。
在下文中一共展示了FormInfo.GetXmlDefinition方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateDefinition
/// <summary>
/// Generates default form definition.
/// </summary>
private void GenerateDefinition()
{
// Get info on the class
var classInfo = DataClassInfoProvider.GetDataClassInfo(QueryHelper.GetInteger("classid", 0));
if (classInfo == null)
{
return;
}
var manager = new TableManager(classInfo.ClassConnectionString);
// Update schema and definition for existing class
classInfo.ClassXmlSchema = manager.GetXmlSchema(classInfo.ClassTableName);
var fi = new FormInfo();
try
{
fi.LoadFromDataStructure(classInfo.ClassTableName, manager, true);
}
catch (Exception ex)
{
// Show error message if something caused unhandled exception
LogAndShowError("ClassFields", "GenerateDefinition", ex);
return;
}
classInfo.ClassFormDefinition = fi.GetXmlDefinition();
DataClassInfoProvider.SetDataClassInfo(classInfo);
URLHelper.Redirect(URLHelper.AddParameterToUrl(RequestContext.CurrentURL, "gen", "1"));
}
示例2: InitForm
/// <summary>
/// Initializes the form.
/// </summary>
/// <param name="basicForm">Form</param>
/// <param name="dr">Data row with the data</param>
/// <param name="fi">Form info</param>
private void InitForm(BasicForm basicForm, DataRow dr, FormInfo fi)
{
if (basicForm != null)
{
basicForm.DataRow = dr;
if (webPartInstance != null)
{
basicForm.MacroTable = webPartInstance.MacroTable;
}
else
{
basicForm.MacroTable = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
}
if (!RequestHelper.IsPostBack() && (webPartInstance != null))
{
fi = new FormInfo(fi.GetXmlDefinition());
// Load the collapsed/un-collapsed state of categories
var categories = fi.GetCategoryNames();
foreach (string category in categories)
{
FormCategoryInfo fci = fi.GetFormCategory(category);
if (ValidationHelper.GetBoolean(fci.GetPropertyValue(FormCategoryPropertyEnum.Collapsible, basicForm.ContextResolver), false) && ValidationHelper.GetBoolean(fci.GetPropertyValue(FormCategoryPropertyEnum.CollapsedByDefault, basicForm.ContextResolver), false) && ValidationHelper.GetBoolean(webPartInstance.GetValue("cat_open_" + category), false))
{
fci.SetPropertyValue(FormCategoryPropertyEnum.CollapsedByDefault, "false");
}
}
}
basicForm.SubmitButton.Visible = false;
basicForm.SiteName = SiteContext.CurrentSiteName;
basicForm.FormInformation = fi;
basicForm.ShowPrivateFields = true;
basicForm.OnItemValidation += formElem_OnItemValidation;
basicForm.ReloadData();
}
}
示例3: 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");
//.........这里部分代码省略.........
示例4: 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);
}
示例5: InitCustomTable
//.........这里部分代码省略.........
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();
// Fill FormInfo object
ffi.Name = "ItemOrder";
ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "Order");
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);
}
// GUID
if (chkItemGUID.Checked && !fi.FieldExists("ItemGUID"))
{
var ffiGuid = CreateGuidField();
fi.AddFormItem(ffiGuid);
}
// Update table structure - columns could be added
bool old = TableManager.UpdateSystemFields;
TableManager.UpdateSystemFields = true;
string schema = fi.GetXmlDefinition();
tm.UpdateTableByDefinition(dci.ClassTableName, schema);
TableManager.UpdateSystemFields = old;
// Update xml schema and form definition
dci.ClassFormDefinition = schema;
dci.ClassXmlSchema = tm.GetXmlSchema(dci.ClassTableName);
using (CMSActionContext context = new CMSActionContext())
{
// Disable logging into event log
context.LogEvents = false;
DataClassInfoProvider.SetDataClassInfo(dci);
}
}
示例6: UpdateClasses
/// <summary>
/// Update form definitions of classes (especially system tables).
/// </summary>
private static void UpdateClasses()
{
DataSet classes = GetFormDefinitions();
if (!DataHelper.DataSourceIsEmpty(classes))
{
foreach (DataRow row in classes.Tables[0].Rows)
{
string objectName = DataHelper.GetStringValue(row, FORM_DEFINITION_NAME_COLUMN);
string newDefinition = DataHelper.GetStringValue(row, FORM_DEFINITION_VALUE_COLUMN);
if (!string.IsNullOrEmpty(objectName) && !string.IsNullOrEmpty(newDefinition))
{
var dataClass = DataClassInfoProvider.GetDataClassInfo(objectName);
if (dataClass != null)
{
var newVersionFi = new FormInfo(newDefinition);
// Copy custom fields only for system tables
if (dataClass.ClassShowAsSystemTable)
{
var oldVersionFi = new FormInfo(dataClass.ClassFormDefinition);
CopyCustomFields(oldVersionFi, newVersionFi, false);
}
// Save the modified form definition
dataClass.ClassFormDefinition = newVersionFi.GetXmlDefinition();
// Update the scheme
dataClass.ClassXmlSchema = new TableManager(dataClass.ClassConnectionString).GetXmlSchema(dataClass.ClassTableName);
// Save the new definition
dataClass.Update();
}
}
}
}
}
示例7: UpdateAlternativeForms
/// <summary>
/// Updates an existing alternative forms form definitions. Appends existing custom fields to new version definitions.
/// </summary>
private static void UpdateAlternativeForms()
{
DataSet classes = GetFormDefinitions(true);
if (!DataHelper.DataSourceIsEmpty(classes))
{
foreach (DataRow row in classes.Tables[0].Rows)
{
string objectName = DataHelper.GetStringValue(row, FORM_DEFINITION_NAME_COLUMN);
string newDefinition = DataHelper.GetStringValue(row, FORM_DEFINITION_VALUE_COLUMN);
if (!string.IsNullOrEmpty(objectName) && !string.IsNullOrEmpty(newDefinition))
{
var altForm = AlternativeFormInfoProvider.GetAlternativeFormInfo(objectName);
if (altForm != null)
{
var mainDci = DataClassInfoProvider.GetDataClassInfo(altForm.FormClassID);
var classFormDefinition = mainDci.ClassFormDefinition;
if (altForm.FormCoupledClassID > 0)
{
// If coupled class is defined combine form definitions
var coupledDci = DataClassInfoProvider.GetDataClassInfo(altForm.FormCoupledClassID);
if (coupledDci != null)
{
classFormDefinition = FormHelper.MergeFormDefinitions(classFormDefinition, coupledDci.ClassFormDefinition);
}
}
var oldVersionDefinition = FormHelper.MergeFormDefinitions(classFormDefinition, altForm.FormDefinition);
var newVersionDefinition = FormHelper.MergeFormDefinitions(classFormDefinition, newDefinition);
var newVersionFi = new FormInfo(newVersionDefinition);
var oldVersionFi = new FormInfo(oldVersionDefinition);
CopyCustomFields(oldVersionFi, newVersionFi, true);
// Save the modified form definition
altForm.FormDefinition = FormHelper.GetFormDefinitionDifference(classFormDefinition, newVersionFi.GetXmlDefinition(), true);
altForm.Update();
}
}
}
}
}
示例8: UpdateDataClass
/// <summary>
/// Updates DataClassInfo and modifies database accordingly.
/// </summary>
/// <param name="dci">DataClassInfo</param>
/// <param name="fi">Form info</param>
private void UpdateDataClass(DataClassInfo dci, FormInfo fi)
{
// Update definition
dci.ClassFormDefinition = fi.GetXmlDefinition();
// Update database structure
DataClassInfoProvider.EnsureDatabaseStructure(dci, true);
DataClassInfoProvider.SetDataClassInfo(dci);
}
示例9: wzdNewDocType_NextButtonClick
//.........这里部分代码省略.........
if ((owner != "") && (owner.ToLower() != "dbo"))
{
TableManager.ChangeDBObjectOwner(tableName, owner);
tableName = DataHelper.GetSafeOwner(owner) + "." + tableName;
}
}
catch
{
}
// Create empty form definition
fi = new FormInfo("<form></form>");
ffiPrimaryKey = new FormFieldInfo();
// Fill FormInfo object
ffiPrimaryKey.Name = txtPKName.Text;
ffiPrimaryKey.Caption = txtPKName.Text;
ffiPrimaryKey.DataType = FormFieldDataTypeEnum.Integer;
ffiPrimaryKey.DefaultValue = "";
ffiPrimaryKey.Description = "";
ffiPrimaryKey.FieldType = FormFieldControlTypeEnum.CustomUserControl;
ffiPrimaryKey.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLower();
ffiPrimaryKey.PrimaryKey = true;
ffiPrimaryKey.System = false;
ffiPrimaryKey.Visible = true;
ffiPrimaryKey.Size = 0;
ffiPrimaryKey.AllowEmpty = false;
// Add field to form definition
fi.AddFormField(ffiPrimaryKey);
dci.ClassTableName = tableName;
dci.ClassXmlSchema = TableManager.GetXmlSchema(dci.ClassTableName);
dci.ClassFormDefinition = fi.GetXmlDefinition();
dci.ClassIsCoupledClass = true;
dci.ClassInheritsFromClassID = ValidationHelper.GetInteger(selInherits.Value, 0);
// Update class in DB
using (CMSActionContext context = new CMSActionContext())
{
// Disable logging into event log
context.LogEvents = false;
DataClassInfoProvider.SetDataClass(dci);
// Ensure inherited fields
if (dci.ClassInheritsFromClassID > 0)
{
DataClassInfo parentCi = DataClassInfoProvider.GetDataClass(dci.ClassInheritsFromClassID);
if (parentCi != null)
{
FormHelper.UpdateInheritedClass(parentCi, dci);
}
}
}
if (this.Mode == NewClassWizardModeEnum.CustomTable)
{
#region "Custom tables optional columns"
if (chkItemCreatedBy.Checked)
{
FormFieldInfo ffi = new FormFieldInfo();
// Fill FormInfo object
示例10: Upgrade55R2
public static void Upgrade55R2()
{
EventLogProvider evp = new EventLogProvider();
evp.LogEvent("I", DateTime.Now, "Upgrade to 5.5 R2", "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 = "UserSkype";
ffi.DataType = FormFieldDataTypeEnum.Text;
ffi.Size = 100;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
ffi.Visible = false;
ffi.Caption = "User Skype account";
ffi.DefaultValue = String.Empty;
ffi.Description = String.Empty;
ffi.RegularExpression = String.Empty;
fi.AddFormField(ffi);
ffi = new FormFieldInfo();
ffi.Name = "UserIM";
ffi.DataType = FormFieldDataTypeEnum.Text;
ffi.Size = 100;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
ffi.Visible = false;
ffi.Caption = "User instant messenger";
ffi.DefaultValue = String.Empty;
ffi.Description = String.Empty;
ffi.RegularExpression = String.Empty;
fi.AddFormField(ffi);
ffi = new FormFieldInfo();
ffi.Name = "UserPhone";
ffi.DataType = FormFieldDataTypeEnum.Text;
ffi.Size = 26;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
ffi.Visible = false;
ffi.Caption = "User phone";
ffi.DefaultValue = String.Empty;
ffi.Description = "User phone number.";
ffi.RegularExpression = String.Empty;
fi.AddFormField(ffi);
ffi = new FormFieldInfo();
ffi.Name = "UserPosition";
ffi.DataType = FormFieldDataTypeEnum.Text;
ffi.Size = 200;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = false;
ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
ffi.Visible = false;
ffi.Caption = "Position";
ffi.DefaultValue = String.Empty;
ffi.Description = String.Empty;
ffi.RegularExpression = String.Empty;
fi.AddFormField(ffi);
dci.ClassFormDefinition = fi.GetXmlDefinition();
dci.ClassXmlSchema = TableManager.GetXmlSchema("CMS_UserSettings");
DataClassInfoProvider.SetDataClass(dci);
// Generate queries
SqlGenerator.GenerateDefaultQueries(dci, true, false);
}
}
}
catch (Exception ex)
{
evp.LogEvent("CMS.UserSettings - Upgrade", "Upgrade", ex);
}
#endregion
#region "WebTemplate meta file"
//.........这里部分代码省略.........
示例11: UpdateClasses
/// <summary>
/// Update form definitions of classes (especially system tables).
/// </summary>
private static void UpdateClasses()
{
DataSet classes = GetFormDefinitions();
if (!DataHelper.DataSourceIsEmpty(classes))
{
foreach (DataRow row in classes.Tables[0].Rows)
{
string objectName = DataHelper.GetStringValue(row, FORM_DEFINITION_NAME_COLUMN);
string newDefinition = DataHelper.GetStringValue(row, FORM_DEFINITION_VALUE_COLUMN);
if (!string.IsNullOrEmpty(objectName) && !string.IsNullOrEmpty(newDefinition))
{
var dataClass = DataClassInfoProvider.GetDataClassInfo(objectName);
if (dataClass != null)
{
var newVersionFi = new FormInfo(newDefinition);
var oldVersionFi = new FormInfo(dataClass.ClassFormDefinition);
// Get removed system fields
var removedfields = GetRemovedSystemFields(oldVersionFi, newVersionFi);
if (removedfields != null)
{
// Remove the system fields from class's alt.forms
foreach (var field in removedfields)
{
FormHelper.RemoveFieldFromAlternativeForms(dataClass, field, 0);
}
}
// Copy custom fields only for system tables
if (dataClass.ClassShowAsSystemTable)
{
CopyCustomFields(oldVersionFi, newVersionFi, false, true);
}
// Save the modified form definition
dataClass.ClassFormDefinition = newVersionFi.GetXmlDefinition();
// Update the scheme
dataClass.ClassXmlSchema = new TableManager(dataClass.ClassConnectionString).GetXmlSchema(dataClass.ClassTableName);
// Update search settings
dataClass.ClassSearchSettings = SearchHelper.CleanSearchSettings(dataClass);
// Save the new definition
dataClass.Update();
}
}
}
}
}
示例12: InitForm
/// <summary>
/// Initializes the form.
/// </summary>
/// <param name="form">Form</param>
/// <param name="dr">Data row with the data</param>
/// <param name="fi">Form info</param>
private void InitForm(BasicForm form, DataRow dr, FormInfo fi)
{
if (form != null)
{
form.DataRow = dr;
if (webPartInstance != null)
{
form.MacroTable = webPartInstance.MacroTable;
}
else
{
form.MacroTable = new Hashtable();
}
if (!RequestHelper.IsPostBack() && (webPartInstance != null))
{
fi = new FormInfo(fi.GetXmlDefinition());
// Load the collapsed/un-collapsed state of categories
var categories = fi.GetCategoryNames();
foreach (string category in categories)
{
FormCategoryInfo fci = fi.GetFormCategory(category);
if (fci.CategoryCollapsible && fci.CategoryCollapsedByDefault && ValidationHelper.GetBoolean(webPartInstance.GetValue("cat_open_" + category), false))
{
fci.CategoryCollapsedByDefault = false;
}
}
}
form.SubmitButton.Visible = false;
form.SiteName = CMSContext.CurrentSiteName;
form.FormInformation = fi;
form.ShowPrivateFields = true;
form.OnItemValidation += formElem_OnItemValidation;
form.ReloadData();
}
}