本文整理汇总了C#中FormInfo.CombineWithForm方法的典型用法代码示例。如果您正苦于以下问题:C# FormInfo.CombineWithForm方法的具体用法?C# FormInfo.CombineWithForm怎么用?C# FormInfo.CombineWithForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormInfo
的用法示例。
在下文中一共展示了FormInfo.CombineWithForm方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyCustomFields
/// <summary>
/// Copies custom fields from old version of form definition to the new form definition.
/// </summary>
/// <param name="oldVersionFi">Old version form definition</param>
/// <param name="newVersionFi">New version form definition</param>
/// <param name="overwrite">Indicates whether existing fields should be overwritten. Alternative form fields need to be overwritten due to the combination with upgraded class form.</param>
private static void CopyCustomFields(FormInfo oldVersionFi, FormInfo newVersionFi, bool overwrite)
{
// Remove all system fields from old definition to get only custom fields
oldVersionFi.RemoveFields(f => f.System);
// Combine forms so that custom fields from old definition are appended to the new definition
newVersionFi.CombineWithForm(oldVersionFi, new CombineWithFormSettings
{
IncludeCategories = false,
RemoveEmptyCategories = true,
OverwriteExisting = overwrite
});
}
示例2: ReloadSearch
/// <summary>
/// Reload data.
/// </summary>
/// <param name="setAutomatically">Indicates whether search options should be set automatically</param>
public void ReloadSearch(bool setAutomatically)
{
ClassFields.ItemID = ItemID;
ClassFields.ReloadData(setAutomatically, true);
// Initialize properties
List<IFormItem> itemList = null;
FormFieldInfo formField = null;
// Load DataClass
dci = DataClassInfoProvider.GetDataClass(ItemID);
if (dci != null)
{
// Load XML definition
fi = FormHelper.GetFormInfo(dci.ClassName, true);
if (CMSString.Compare(dci.ClassName, "cms.user", true) == 0)
{
plcImage.Visible = false;
ClassFields.DisplaySetAutomatically = false;
pnlIndent.Visible = true;
document = DataClassInfoProvider.GetDataClass("cms.usersettings");
if (document != null)
{
FormInfo fiSettings = FormHelper.GetFormInfo(document.ClassName, true);
fi.CombineWithForm(fiSettings, true, String.Empty);
}
}
// Get all fields
itemList = fi.GetFormElements(true, true);
}
if (itemList != null)
{
if (itemList.Any())
{
pnlIndent.Visible = true;
}
// Store each field to array
foreach (object item in itemList)
{
if (item is FormFieldInfo)
{
formField = ((FormFieldInfo)(item));
object[] obj = { formField.Name, FormHelper.GetDataType(formField.DataType) };
attributes.Add(obj);
}
}
}
ReloadControls();
}
示例3: ReloadSearch
/// <summary>
/// Reload data.
/// </summary>
/// <param name="setAutomatically">Indicates whether search options should be set automatically</param>
public void ReloadSearch(bool setAutomatically)
{
ClassFields.ItemID = ItemID;
ClassFields.ReloadData(setAutomatically, true);
// Initialize properties
List<IField> itemList = null;
if (ClassInfo != null)
{
// Load XML definition
fi = FormHelper.GetFormInfo(ClassInfo.ClassName, true);
if (CMSString.Compare(ClassInfo.ClassName, "cms.user", true) == 0)
{
plcImage.Visible = false;
ClassFields.DisplaySetAutomatically = false;
pnlIndent.Visible = true;
document = DataClassInfoProvider.GetDataClassInfo("cms.usersettings");
if (document != null)
{
FormInfo fiSettings = FormHelper.GetFormInfo(document.ClassName, true);
fi.CombineWithForm(fiSettings, true, String.Empty);
}
}
// Get all fields
itemList = fi.GetFormElements(true, true);
}
if (itemList != null)
{
if (itemList.Any())
{
pnlIndent.Visible = true;
}
// Store each field to array
foreach (var item in itemList)
{
var formField = item as FormFieldInfo;
if (formField != null)
{
object[] obj = { formField.Name, DataTypeManager.GetSystemType(TypeEnum.Field, formField.DataType) };
attributes.Add(obj);
}
}
}
if (AdvancedMode)
{
ReloadControls();
}
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:59,代码来源:SearchFields.ascx.cs
示例4: CopyCustomFields
/// <summary>
/// Copies custom fields from old version of form definition to the new form definition.
/// </summary>
/// <param name="oldVersionFi">Old version form definition</param>
/// <param name="newVersionFi">New version form definition</param>
/// <param name="overwrite">Indicates whether existing fields should be overwritten. Alternative form fields need to be overwritten due to the combination with upgraded class form.</param>
/// <param name="isSystemTable">Indicates whether the class is customizable.</param>
private static void CopyCustomFields(FormInfo oldVersionFi, FormInfo newVersionFi, bool overwrite, bool isSystemTable)
{
// Remove all system fields from old definition to get only custom fields
// Remove all dummy fields from old definition for non-customizable classes (Since v9 is condition f => f.System sufficient because dummy fields created in development mode are system)
// * Dummy field in alternative forms are not marked as system in version < v9 and should be updated. Without this condition the old version of dummy field was used instead of new one.
// * Dummy field is not removed from customizable classes due to possible customization.
oldVersionFi.RemoveFields(f => f.System || (f.IsDummyField && !isSystemTable));
// Combine forms so that custom fields from old definition are appended to the new definition
newVersionFi.CombineWithForm(oldVersionFi, new CombineWithFormSettings
{
IncludeCategories = false,
RemoveEmptyCategories = true,
OverwriteExisting = overwrite
});
}