本文整理汇总了C#中Epi.Page.SaveToDb方法的典型用法代码示例。如果您正苦于以下问题:C# Page.SaveToDb方法的具体用法?C# Page.SaveToDb怎么用?C# Page.SaveToDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epi.Page
的用法示例。
在下文中一共展示了Page.SaveToDb方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreatePage
/// <summary>
/// Creates a new page and adds it to the page collection
/// </summary>
/// <param name="name">Name of the page</param>
/// <param name="position">Position of the page</param>
/// <returns>The new page object</returns>
public Page CreatePage(string name, int position)
{
#region Input Validation
if (name == null)
{
throw new ArgumentNullException("name");
}
if (position < 0)
{
throw new ArgumentOutOfRangeException("Position");
}
#endregion Input Validation
Page page = null;
this.pages = null;
this.project.Save();
page = new Page(this, 0);
page.Name = name;
page.Position = position;
page.Id = 0;
page.SaveToDb();
return page;
}
示例2: Convert
/// <summary>
/// Start the conversion process
/// </summary>
public void Convert()
{
if (SetStatus != null)
{
SetStatus("Creating form...");
}
project.CreateView(formName, false);
View destinationView = project.Views[formName];
List<int> pages = new List<int>();
foreach(ColumnConversionInfo cci in columnMapping)
{
if(!pages.Contains(cci.PageNumber))
{
pages.Add(cci.PageNumber);
}
}
pages.Sort();
if (SetStatus != null)
{
SetStatus("Creating pages...");
}
for(int i = 0; i < pages.Count; i++)
{
Page page = new Page(destinationView);
page.Name = "Page " + (i + 1).ToString();
page.Position = i;
destinationView.Pages.Add(page);
destinationView.SaveToDb();
page.SaveToDb();
}
if (SetStatus != null)
{
SetStatus("Creating fields...");
}
foreach(ColumnConversionInfo cci in columnMapping)
{
if (SetStatus != null)
{
SetStatus("Creating field " + cci.DestinationColumnName + "...");
}
Page page = destinationView.GetPageByPosition(cci.PageNumber - 1);
Field field = null;
switch(cci.FieldType)
{
case MetaFieldType.Checkbox:
case MetaFieldType.YesNo:
case MetaFieldType.Text:
case MetaFieldType.Multiline:
case MetaFieldType.Date:
case MetaFieldType.DateTime:
case MetaFieldType.Time:
case MetaFieldType.LegalValues:
case MetaFieldType.Number:
field = page.CreateField(cci.FieldType);
break;
default:
throw new ApplicationException("Invalid field type");
//break;
}
SetFieldProperties(field, cci);
page.AddNewField((RenderableField)field);
}
destinationView.SaveToDb();
}