当前位置: 首页>>代码示例>>C#>>正文


C# Epi.GetTopTwoTable方法代码示例

本文整理汇总了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));
//.........这里部分代码省略.........
开发者ID:NALSS,项目名称:epiinfo-82474,代码行数:101,代码来源:ProjectAnalyzer.cs


注:本文中的Epi.GetTopTwoTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。