本文整理汇总了C#中Epi.GetTopTwoTable方法的典型用法代码示例。如果您正苦于以下问题:C# Epi.GetTopTwoTable方法的具体用法?C# Epi.GetTopTwoTable怎么用?C# Epi.GetTopTwoTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epi
的用法示例。
在下文中一共展示了Epi.GetTopTwoTable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckAllFields
/// <summary>
/// Checks all the fields in a given Epi Info 3.5.x view for generic problems.
/// </summary>
/// <param name="view">The Epi Info 3.5.x view</param>
/// <param name="db">The data driver associated with the view's project</param>
private void CheckAllFields(Epi.Epi2000.View view, Epi.Data.IDbDriver db)
{
#region Input Validation
if (view == null)
{
throw new ArgumentNullException("view");
}
if (db == null)
{
throw new ArgumentNullException("db");
}
#endregion // Input Validation
List<DataTable> wideTables = new List<DataTable>();
bool hasTables = false;
foreach (string wideTableName in view.TableNames)
{
if (!string.IsNullOrEmpty(wideTableName) && db.TableExists(wideTableName))
{
DataTable wTable = db.GetTopTwoTable(wideTableName);
wTable.TableName = wideTableName;
wideTables.Add(wTable);
hasTables = true;
}
}
DataTable allFieldsTable = sourceProject.Metadata.GetFieldsAsDataTable(view.Name);
foreach (DataRow fRow in allFieldsTable.Rows)
{
string fieldName = fRow["Name"].ToString();
CheckFieldProperties(view, fRow);
MetaFieldType fieldType = Epi.Epi2000.MetadataDbProvider.InferFieldType(fRow);
if (fieldType == MetaFieldType.CommandButton ||
fieldType == MetaFieldType.Grid ||
fieldType == MetaFieldType.Group ||
fieldType == MetaFieldType.LabelTitle ||
fieldType == MetaFieldType.Mirror ||
fieldType == MetaFieldType.Relate)
{
continue;
}
if (!hasTables)
{
continue;
}
string columnDataType = string.Empty;
string wideTableName = string.Empty;
foreach (DataTable wideTable in wideTables)
{
if (wideTable.Columns.Contains(fieldName))
{
columnDataType = wideTable.Columns[fieldName].DataType.ToString();
wideTableName = wideTable.TableName;
break;
}
}
if (string.IsNullOrEmpty(columnDataType))
{
if (fieldType != MetaFieldType.CommandButton && fieldType != MetaFieldType.Grid && fieldType != MetaFieldType.Group && fieldType != MetaFieldType.LabelTitle && fieldType != MetaFieldType.Mirror && fieldType != MetaFieldType.Relate)
{
errorList.Add(ImportExportMessageType.Error, "3002", string.Format(ImportExportSharedStrings.UPGRADE_PROBLEM_CHECK_ERROR_E3002, fieldName, view.Name));
}
}
else
{
switch (fieldType)
{
case MetaFieldType.Checkbox:
if (!columnDataType.Equals("System.Boolean"))
{
errorList.Add(ImportExportMessageType.Error, "3005", string.Format(ImportExportSharedStrings.UPGRADE_PROBLEM_CHECK_ERROR_E3005, fieldName, view.Name, columnDataType));
}
break;
case MetaFieldType.YesNo:
if (!(columnDataType.Equals("System.Byte") || columnDataType.Equals("System.Byte")))
{
errorList.Add(ImportExportMessageType.Error, "3006", string.Format(ImportExportSharedStrings.UPGRADE_PROBLEM_CHECK_ERROR_E3006, fieldName, view.Name, columnDataType));
}
break;
case MetaFieldType.Codes:
case MetaFieldType.CommentLegal:
case MetaFieldType.LegalValues:
case MetaFieldType.Text:
case MetaFieldType.TextUppercase:
if (!columnDataType.Equals("System.String"))
{
errorList.Add(ImportExportMessageType.Error, "3007", string.Format(ImportExportSharedStrings.UPGRADE_PROBLEM_CHECK_ERROR_E3007, fieldName, view.Name, columnDataType));
//.........这里部分代码省略.........