本文整理汇总了C#中Epi.View.SetTableName方法的典型用法代码示例。如果您正苦于以下问题:C# View.SetTableName方法的具体用法?C# View.SetTableName怎么用?C# View.SetTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epi.View
的用法示例。
在下文中一共展示了View.SetTableName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SynchronizeDataTable
/// <summary>
/// Synchronizes metadata and data table
/// [drops and/or inserts data columns in the view table]
/// </summary>
public void SynchronizeDataTable(View view, bool tryCompact = true)
{
try
{
if (isWebMode)
{
return;
}
Boolean noDataTable = dbDriver.TableExists(view.TableName) == false;
if (noDataTable)
{
CreateDataTableForView(view, 1);
}
else
{
foreach (Page page in view.Pages)
{
DataTable fieldMetadataSync = view.GetMetadata().GetFieldMetadataSync(page.Id);
DeleteUndefinedDataFields(page, fieldMetadataSync);
}
if (tryCompact)
{
try
{
dbDriver.CompactDatabase();
if (dbDriver.FullName.Contains("[MS Access]"))
{
string insertStatement = string.Format("insert into {0}([UniqueKey], [GlobalRecordId]) values (@UniqueKey, @GlobalRecordId)", view.TableName);
Query insertQuery = dbDriver.CreateQuery(insertStatement);
insertQuery.Parameters.Add(new QueryParameter("@UniqueKey", DbType.Int16, StartingId - 1));
insertQuery.Parameters.Add(new QueryParameter("@GlobalRecordId", DbType.String, ""));
dbDriver.ExecuteNonQuery(insertQuery);
string deleteStatement = string.Format("delete from {0} where UniqueKey={1} ", view.TableName, StartingId - 1);
Query deleteQuery = dbDriver.CreateQuery(deleteStatement);
dbDriver.ExecuteNonQuery(deleteQuery);
}
}
catch { }
}
view.SetTableName(view.TableName);
foreach (Page page in view.Pages)
{
SynchronizePageTable(page);
}
}
}
catch { }
}
示例2: CreateView
/// <summary>
/// Constructor
/// </summary>
/// <param name="viewName">New <see cref="Epi.View"/> name.</param>
/// <param name="isChildView">Is Related (child) view flag.</param>
/// <returns>New project <see cref="Epi.View"/></returns>
public View CreateView(string viewName, bool isChildView)
{
View newView = new View(this);
newView.Name = viewName;
newView.SetTableName(newView.Name);
newView.IsRelatedView = isChildView;
if (!Views.Contains(newView))
{
Views.Add(newView);
}
Metadata.InsertView(newView);
currentViewElement = newView.ViewElement;
LoadViews();
return newView;
}