Example #1
0
        /// <summary>
        /// 检测指定路径下指定名称的任务在数据库中是否存在
        /// </summary>
        /// <param name="strTaskName"></param>
        /// <param name="strTaskPath"></param>
        /// <returns></returns>
        public static bool TaskExistsInDB(string strName, string strPath)
        {
            IDbConnection sysConnection = SysDbHelper.GetSysDbConnection();
            DataTable     tTask         = AdoDbHelper.GetDataTable(sysConnection, string.Format("select * from LR_ModelTask where TaskPath='{0}' and TaskName='{1}'", strPath.Replace("'", "''"), strName.Replace("'", "''")));

            return(tTask.Rows.Count > 0);
        }
Example #2
0
        private string ConstructErrorInfo()
        {
            int            layerid = -1;
            StandardHelper pStand  = new StandardHelper(SysDbHelper.GetSysDbConnection());

            pStand.GetLayerIDByTableName(ref layerid, this.m_SchemaID, m_structPara.strFtName);

            string strSql1 = "Select FieldCode,FieldName From LR_DicField Where LayerID = " + layerid;

            List <FIELDMAP> arrFieldMap = new List <FIELDMAP>();
            DataTable       dt          = new DataTable();

            AdoDbHelper.GetDataTable(SysDbHelper.GetSysDbConnection(), strSql1);
            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            foreach (DataRow dr in dt.Rows)
            {
                string FName  = dr["FieldCode"].ToString(); //字段名
                string FAlias = dr["FieldName"].ToString(); //字段别名

                FIELDMAP fMap = new FIELDMAP();
                fMap.strAlias = FAlias;
                fMap.strName  = FName;
                arrFieldMap.Add(fMap);
            }

            /*string Alias = "", Alias2 = "";
             * pStand.GetAliasByLayerName(ref Alias, m_structPara.strFtName, m_strStdName);
             * pStand.GetAliasByLayerName(ref Alias2, m_structPara.strFtName2, m_strStdName);*/
            int standardID = SysDbHelper.GetStandardIDBySchemaID(this.m_SchemaID);

            if (!string.IsNullOrEmpty(FtName1))
            {
                FtName1 = LayerReader.GetNameByAliasName(m_structPara.strFtName, standardID);
            }
            if (!string.IsNullOrEmpty(FtName2))
            {
                FtName2 = LayerReader.GetNameByAliasName(m_structPara.strFtName, standardID);
            }
            string strErrInfo = m_structPara.strClause;

            for (int i = 0; i < arrFieldMap.Count; i++)
            {
                string strR = arrFieldMap[i].strAlias;
                string strS = arrFieldMap[i].strName;
                strErrInfo.Replace(strS, strR);
            }
            strErrInfo.Replace(m_structPara.strFtName, FtName1);
            strErrInfo.Replace(m_structPara.strFtName2, FtName2);
            strErrInfo = "字段值符合表达式 (" + strErrInfo + ")";

            return(strErrInfo);
        }
Example #3
0
        /// <summary>
        /// 更新Task的状态到数据库
        /// </summary>
        /// <param name="taskID"></param>
        /// <param name="taskState"></param>
        /// <returns></returns>
        public static bool UpdateTaskState(string taskID, enumTaskState taskState)
        {
            if (taskState == enumTaskState.PartlyExcuted)
            {
                return(true);
            }

            string strSQL = string.Format("Update LR_ModelTask set ExeState={0} where TaskID='{1}'", (int)taskState, taskID);

            return(AdoDbHelper.ExecuteSql(SysDbHelper.GetSysDbConnection(), strSQL));
        }
Example #4
0
        public override bool Verify()
        {
            string strSQL = "select AttrTableName,LayerName,LayerOption from LR_DicLayer";

            dtLayer = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(SysDbHelper.GetSysDbConnection(), strSQL);
            if (dtLayer == null)
            {
                SendMessage(enumMessageType.Exception, "在系统库中找不到标准的图层列表");
                return(false);
            }
            return(true);
        }
Example #5
0
        /// <summary>
        /// 通过ID获取Task对象
        /// </summary>
        /// <param name="taskID"></param>
        /// <returns></returns>
        public static Task GetTask(string taskID)
        {
            IDbConnection sysConnection = SysDbHelper.GetSysDbConnection();
            DataTable     tTask         = AdoDbHelper.GetDataTable(sysConnection, string.Format("select * from LR_ModelTask where TaskID='{0}'", taskID));

            if (tTask == null || tTask.Rows.Count == 0)
            {
                return(null);
            }

            return(GetTaskFromDataRow(tTask.Rows[0]));
        }
Example #6
0
        public override bool Check(ref List <Error> checkResult)
        {
            try
            {
                List <Error> m_pRuleResult = new List <Error>();

                List <string>         aryFtCode = new List <string>();
                Helper.StandardHelper StdHelp   = new Hy.Check.Rule.Helper.StandardHelper(SysDbHelper.GetSysDbConnection());
                StdHelp.GetLayerCodes(ref aryFtCode, m_psPara.strTargetLayer, standarID);


                if (aryFtCode == null) //如果编码类型为空
                {
                    string strSql = "select OBJECTID,BSM from " + strLayerName;

                    DataTable ipRecordset = new DataTable();
                    ipRecordset = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.m_QueryConnection, strSql);
                    if (ipRecordset == null)
                    {
                        return(false);
                    }

                    // 从DataTable中获取名称
                    foreach (DataRow dr in ipRecordset.Rows) // 遍历结果集
                    {
                        if (dr != null)
                        {
                            int nOID = Convert.ToInt32(dr["ObjectID"]);

                            // 添家结果记录
                            Error pResInfo = new Error();
                            pResInfo.DefectLevel = this.m_DefectLevel;
                            pResInfo.RuleID      = this.InstanceID;

                            pResInfo.OID       = nOID;
                            pResInfo.BSM       = dr["BSM"].ToString();
                            pResInfo.LayerName = m_psPara.strTargetLayer;                        // 目标图层

                            // 错误信息
                            string strMsg;
                            strMsg = string.Format("'{0}'层标识码为'{1}'的'{2}'字段对应的要素类型代码为空", pResInfo.LayerName, pResInfo.BSM, strCodeField);
                            if (m_psPara.strRemark != null && m_psPara.strRemark.Trim() != "")
                            {
                                pResInfo.Description = m_psPara.strRemark;
                            }
                            else
                            {
                                pResInfo.Description = strMsg;
                            }
                            m_pRuleResult.Add(pResInfo);

                            break;
                        }
                    }

                    checkResult = m_pRuleResult;

                    // 关闭记录集
                    ipRecordset.Dispose();
                }
                else
                {
                    try
                    {
                        string strSql;
                        string strFtCode = "";
                        for (int i = 0; i < aryFtCode.Count; i++)
                        {
                            string strTmp;
                            strTmp     = aryFtCode[i];
                            strFtCode += strTmp;
                        }

                        strSql = "select OBJECTID,BSM,YSDM from " + strLayerName + " where (" + strCodeField + " not in ('" +
                                 strFtCode.Substring(0, strFtCode.Length) + "')) or (" + strCodeField + " is null )";

                        DataTable ipRecordset = new DataTable();
                        ipRecordset = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.m_QueryConnection, strSql);
                        if (ipRecordset == null)
                        {
                            return(false);
                        }

                        // 从DataTable中获取名称
                        foreach (DataRow dr in ipRecordset.Rows) // 遍历结果集
                        {
                            if (dr != null)
                            {
                                int nOID = Convert.ToInt32(dr["ObjectID"]);

                                // 添家结果记录
                                Error pResInfo = new Error();
                                pResInfo.DefectLevel = this.m_DefectLevel;
                                pResInfo.RuleID      = this.InstanceID;

                                pResInfo.OID       = nOID;
                                pResInfo.BSM       = dr["BSM"].ToString();
                                pResInfo.LayerName = m_psPara.strTargetLayer;                        // 目标图层

                                // 错误信息
                                string strMsg;
                                strMsg = string.Format("'{0}'层标识码为'{1}'的'{2}({3})'字段的值'{4}'不正确。应为:{5}", pResInfo.LayerName, pResInfo.BSM, m_psPara.strCodeField, strCodeField, dr["YSDM"], strFtCode);
                                if (m_psPara.strRemark != null && !string.IsNullOrEmpty(m_psPara.strRemark.Trim()))
                                {
                                    pResInfo.Description = m_psPara.strRemark;
                                }
                                else
                                {
                                    pResInfo.Description = strMsg;
                                }
                                m_pRuleResult.Add(pResInfo);
                            }
                        }

                        checkResult = m_pRuleResult;

                        // 关闭记录集
                        ipRecordset.Dispose();
                    }
                    catch (Exception ex)
                    {
                        SendMessage(enumMessageType.Exception, ex.ToString());
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                SendMessage(enumMessageType.Exception, ex.ToString());
                return(false);
            }
            return(true);
        }
Example #7
0
        public override bool Check(ref List <Error> checkResult)
        {
            try
            {
                string    strFeatAlias      = m_psPara.strFtName;
                string    strFieldCodeAlias = m_psPara.strCodeField;
                string    strLibName        = m_psPara.strCodeDataTable;
                string    strSQL;
                string    strFeat;
                DataTable dt;
                string    var = null;

                long nVersion = m_psPara.nVersionID;

                var = lyr.AttributeTableName;
                string pLayerName = var;
                strFeat = pLayerName;


                // 错误列表对象
                List <Error> pResult = new List <Error>();
                checkResult = pResult;

                // 1、进行第一次搜索,所以不满足条件的记录加入错误结果集
                if (strFieldName == "")
                {
                    strSQL = "select distinct " + strFieldCode + " from " + strFeat + "";
                }
                else
                {
                    strSQL = "select distinct " + strFieldCode + "," + strFieldName + " from " + strFeat + "";
                }

                dt = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.m_QueryConnection, strSQL);

                //strfieldcode 编码字段是否为字符类型;
                bool bIsStrType = false;

                if (dt != null)
                {
                    // 遍历唯一值
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr != null)
                        {
                            // 获取唯一值
                            string pCode = "";


                            DataRow dr1 = dr;

                            var   = dr1[0].ToString();
                            pCode = var;

                            if (string.IsNullOrEmpty(var))
                            {
                                if (strFieldName == "")
                                {
                                    strSQL = "select OBJECTID,BSM from " + strFeat + " where (" + strFieldCode +
                                             " is Null or " + strFieldCode + "='')";
                                }
                                else
                                {
                                    var = dr1[1].ToString();

                                    if (var != "") //如果var的类型为string型
                                    {
                                        string strName = var.ToString();

                                        strSQL = "select OBJECTID,BSM from " + strFeat + " where (" + strFieldCode +
                                                 " is null or " + strFieldCode + " ='' ) and " + strFieldName + " = '" +
                                                 strName + "'";
                                    }
                                    else if (var == null || var == "")
                                    {
                                        strSQL = "select OBJECTID,BSM from " + strFeat + " where (" + strFieldCode +
                                                 " is Null or " + strFieldCode + " ='' ) and (" +
                                                 strFieldName + " is null or " + strFieldName + " ='' )";
                                    }
                                }
                                DataTable pDt = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.m_QueryConnection, strSQL);

                                if (pDt != null)
                                {
                                    // 遍历记录集,返回错误
                                    foreach (DataRow datarow in pDt.Rows)
                                    {
                                        if (datarow != null)
                                        {
                                            // 获取OID
                                            //object varOID = datarow[0];

                                            // 生成错误结构
                                            Error pInfo = new Error();
                                            pInfo.DefectLevel = this.m_DefectLevel;
                                            pInfo.RuleID      = this.InstanceID;

                                            pInfo.OID       = Convert.ToInt32(datarow["OBJECTID"]);
                                            pInfo.BSM       = datarow["BSM"].ToString();
                                            pInfo.LayerName = strFeatAlias;

                                            //if (strFieldName == "")
                                            //{
                                            //    //pInfo.strErrInfo = "该图层的字段" + strFieldCodeAlias + "(" + strFieldCode +
                                            //    //                   ")值为空!";
                                            //    //pInfo.strErrInfo = string.Format(Helper.ErrMsgFormat.ERR_4201_1, strFeatAlias, pInfo.BSM, strFieldCodeAlias);
                                            pInfo.Description = string.Format("'{0}'层标识码为'{1}'的'{2}'字段的值不正确,不能为空", strFeatAlias, pInfo.BSM, strFieldCodeAlias);
                                            //}

                                            pResult.Add(pInfo);
                                        }
                                    }

                                    pDt.Dispose();
                                }
                            }
                            else
                            {
                                bIsStrType = true;

                                pCode = var;
                            }

                            string strName1 = "";
                            if (strFieldName == "")
                            {
                                strSQL = "select 编码 from " + strLibName + " where 规范号 = " + nVersion + " and 编码 = '" +
                                         pCode +
                                         "'";
                            }
                            else
                            {
                                DataRow dr3 = dr;

                                var = dr3[1].ToString();

                                string pName = var;
                                strName1 = pName;
                                strSQL   = "select 编码,名称 from " + strLibName + " where 规范号 = " + nVersion + " and 编码 = '" +
                                           pCode +
                                           "' and 名称='" + strName1 + "'";
                            }

                            // 在字典中查找这个唯一值, 如果找不到,那么字段属性为这个值的所有记录都必须找出来,返回其OID
                            DataTable ipRSCode = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(SysDbHelper.GetSysDbConnection(), strSQL);


                            if (ipRSCode == null || ipRSCode.Rows.Count == 0)
                            {
                                // 搜索字段属性为这个唯一值的所有记录
                                if (strFieldName == "")
                                {
                                    if (bIsStrType)
                                    {
                                        if (strFieldCodeType == "System.Int32" || strFieldCodeType == "System.Int64" ||
                                            strFieldCodeType == "System.Double")
                                        {
                                            strSQL = "select OBJECTID,BSM from " + strFeat + " where " + strFieldCode +
                                                     " = " +
                                                     pCode +
                                                     "";
                                        }
                                        else if (strFieldCodeType == "System.String" || strFieldCodeType == "System.Char")
                                        {
                                            strSQL = "select OBJECTID,BSM from " + strFeat + " where " +
                                                     strFieldCode + " = '" +
                                                     pCode +
                                                     "'";
                                        }
                                        else
                                        {
                                            strSQL = "select OBJECTID,BSM from " + strFeat + " where " +
                                                     strFieldCode + " = '" +
                                                     pCode +
                                                     "'";
                                        }
                                    }
                                    else
                                    {
                                        if (pCode.Length > 0)
                                        {
                                            strSQL = "select OBJECTID,BSM from " + strFeat + " where " + strFieldCode +
                                                     "= " +
                                                     pCode +
                                                     "";
                                        }
                                        else
                                        {
                                            strSQL = "select OBJECTID,BSM from " + strFeat + " where " + strFieldCode +
                                                     " is null ";
                                        }
                                    }
                                }
                                else
                                {
                                    if (bIsStrType)
                                    {
                                        strSQL = "select OBJECTID,BSM from " + strFeat + " where " + strFieldCode +
                                                 "= '" +
                                                 pCode +
                                                 "' and " +
                                                 strFieldName + " = '" + strName1 + "'";
                                    }
                                    else
                                    {
                                        if (pCode.Length > 0)
                                        {
                                            strSQL = "select OBJECTID,BSM from '" + strFeat + "' where '" + strFieldCode +
                                                     "'= " +
                                                     pCode +
                                                     "and '" +
                                                     strFieldName + "'='" + strName1 + "'";
                                        }
                                        else
                                        {
                                            strSQL = "select OBJECTID,BSM from " + strFeat + " where " + strFieldCode +
                                                     " is null and " +
                                                     strFieldName + " = '" + strName1 + "'";
                                        }
                                    }
                                }

                                DataTable pDt = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.m_QueryConnection, strSQL);

                                // 遍历记录集,返回错误
                                foreach (DataRow pDr in pDt.Rows)
                                {
                                    if (pDr != null)
                                    {
                                        if (pCode == "")
                                        {
                                            continue;
                                        }

                                        // 生成错误结构
                                        Error pInfo = new Error();
                                        pInfo.DefectLevel = this.m_DefectLevel;
                                        pInfo.RuleID      = this.InstanceID;
                                        pInfo.LayerName   = strFeatAlias;

                                        // 获取OID
                                        pInfo.OID = Convert.ToInt32(pDr["OBJECTID"]);

                                        pInfo.BSM = pDr["BSM"].ToString();


                                        if (strFieldName == "")
                                        {
                                            //pInfo.strErrInfo = "该图层的字段" + strFieldCodeAlias + "(" + strFieldCode + ")编码" +
                                            //                   pCode + "在标准库中不存在!";
                                            //pInfo.strErrInfo = string.Format(Helper.ErrMsgFormat.ERR_RuleCode_1_1, strFeatAlias,pInfo.BSM, strFieldCodeAlias, strFieldCode, pCode);
                                            pInfo.Description = string.Format("'{0}'层标识码为'{1}'的'{2}({3})'字段的值'{4}'在标准编码中不存在", strFeatAlias, pInfo.BSM, strFieldCodeAlias, strFieldCode, pCode);
                                        }
                                        else
                                        {
                                            pInfo.Description  = pCode;
                                            pInfo.Description += "|";
                                            pInfo.Description += strName1;
                                        }

                                        pResult.Add(pInfo);
                                    }
                                }
                                if (pDt != null)
                                {
                                    pDt.Dispose();
                                }
                            }
                        }
                    }
                    dt.Dispose();
                } // 遍历唯一值结束


                // 如果只进行编码的检查,那不需要进行第二步了
                if (strFieldName == "")
                {
                    return(true);
                }

                int nCount = pResult.Count;

                // 2、进行第二次搜索,将代码存在的设置成不匹配,代码不存在的设置成代码不存在
                for (int i = 0; i < nCount; i++)
                {
                    Error pInfo = pResult[i];


                    string[] strArray = pInfo.Description.Split('|');

                    string strCode = "";
                    string strName = "";
                    if (strArray.Length == 2)
                    {
                        strCode = strArray[0];
                        strName = strArray[1];
                    }

                    strSQL = "select 编码 from " + strLibName + " where 规范号 = " + nVersion + " and 编码 = '" + strCode + "'";

                    // 在字典中查找这编码,找到说明错误类型是代码和名称不匹配,反之是代码不存在
                    DataTable ipRSCode = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(SysDbHelper.GetSysDbConnection(), strSQL);

                    if (ipRSCode != null && ipRSCode.Rows.Count != 0)
                    {
                        //pInfo.strErrInfo = strFieldCodeAlias + "'" + strCode + "'和" + m_psPara.strNameField + "'" + strAliasName +
                        //                   "'不匹配!";
                        //pInfo.strErrInfo = string.Format(Helper.ErrMsgFormat.ERR_RuleCode_2, strFeatAlias, pInfo.BSM, strFieldCodeAlias, strCode, m_psPara.strNameField, strAliasName);
                        pInfo.Description = string.Format("'{0}'层标识码为'{1}'的'{2}'的值'{3}'与'{4}'的值'{5}'不匹配", strFeatAlias, pInfo.BSM, strFieldCodeAlias, strCode, m_psPara.strNameField, strName);
                    }
                    else
                    {
                        //pInfo.strErrInfo = strFieldCodeAlias + "'" + strCode + "'在标准库中不存在!";
                        //pInfo.strErrInfo = string.Format(Helper.ErrMsgFormat.ERR_RuleCode_1_2, strFeatAlias,pInfo.BSM ,strFieldCodeAlias, strCode);
                        pInfo.Description = string.Format("'{0}'层标识码为'{1}'的'{2}({3})'字段的值'{4}'在标准编码中不存在", strFeatAlias, pInfo.BSM, strFieldCodeAlias, strFieldCode, strCode);
                    }
                    if (pInfo.Description == null)
                    {
                        pInfo.Description = "";
                    }
                }
            }
            catch (Exception ex)
            {
                SendMessage(enumMessageType.Exception, ex.ToString());
                return(false);
            }
            return(true);
        }
Example #8
0
        //public static bool DeleteTask(TaskInfo task)
        //{
        //    return false;
        //}

        /// <summary>
        /// 指删除数据库记录
        /// </summary>
        /// <param name="taskID"></param>
        /// <returns></returns>
        public static bool DeleteTask(string taskID)
        {
            IDbConnection sysConnection = SysDbHelper.GetSysDbConnection();

            return(AdoDbHelper.ExecuteSql(sysConnection, string.Format("delete from LR_ModelTask where TaskID='{0}'", taskID)));
        }
Example #9
0
        /// <summary>
        /// 获取系统库中所有记录
        /// </summary>
        /// <returns></returns>
        public static DataTable GetAllTaskRecord()
        {
            IDbConnection sysConnection = SysDbHelper.GetSysDbConnection();

            return(AdoDbHelper.GetDataTable(sysConnection, "select * from LR_ModelTask where BIsTemplate=0"));
        }
Example #10
0
        public override bool Check(ref List <Error> checkResult)
        {
            IFeatureWorkspace ipFtWS = (IFeatureWorkspace)m_BaseWorkspace;

            try
            {
                List <Error>  pResult   = new List <Error>();
                string        strAlias  = m_pFieldPara.strAlias;
                List <string> listLayer = m_pFieldPara.m_LyrFldMap;
                System.Collections.Hashtable hashtable = new System.Collections.Hashtable();

                for (int i = 0; i < listLayer.Count; i++)
                {
                    string strTemp = listLayer[i];
                    int    nIndex  = strTemp.IndexOf('&');
                    if (nIndex < 0)
                    {
                        continue;
                    }
                    string str = strTemp.Substring(0, nIndex);
                    if (!hashtable.Contains(str))
                    {
                        hashtable.Add(str, "");
                    }
                }

                DataTable dtLayer = new DataTable();
                string    strSQL  = "select AttrTableName,LayerName,LayerID from LR_DicLayer";

                dtLayer = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(SysDbHelper.GetSysDbConnection(), strSQL);
                if (dtLayer == null)
                {
                    return(false);
                }

                foreach (DataRow drLayer in dtLayer.Rows)
                {
                    if (drLayer != null)
                    {
                        string strLayerCode = drLayer["AttrTableName"].ToString();
                        string strLayerName = drLayer["LayerName"].ToString();
                        int    nLayerID     = Convert.ToInt32(drLayer["LayerID"]);

                        if (!hashtable.Contains(strLayerName))
                        {
                            continue;
                        }

                        IFeatureClass pFtCls = null;
                        try
                        {
                            pFtCls = ipFtWS.OpenFeatureClass(strLayerCode);
                        }
                        catch
                        {
                            continue;
                        }
                        IFields pFields = pFtCls.Fields;

                        if (pFields == null)
                        {
                            continue;
                        }
                        int    lFieldCount = pFields.FieldCount;
                        IField pField;

                        DataTable dtFields     = new DataTable();
                        string    strSQLFields = "select * from LR_DicField where LayerID = " + nLayerID + "";
                        dtFields = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(SysDbHelper.GetSysDbConnection(), strSQLFields);
                        if (dtFields == null)
                        {
                            FieldError LRFieldErrorInfo = new FieldError();
                            LRFieldErrorInfo.DefectLevel     = this.DefectLevel;
                            LRFieldErrorInfo.strAttrTabName  = strLayerName;
                            LRFieldErrorInfo.strFieldName    = null;
                            LRFieldErrorInfo.m_strRuleInstID = this.m_InstanceID;
                            LRFieldErrorInfo.strErrorMsg     = string.Format("{0}层对应的属性字段,在《土地利用现状数据库标准》中不存在", strLayerName);

                            pResult.Add(LRFieldErrorInfo);

                            continue;
                        }

                        ///检查图层中是否存在多余字段
                        for (int i = 0; i < lFieldCount; i++)
                        {
                            if (strLayerName == "注记")
                            {
                                break;
                            }
                            pField = pFields.get_Field(i);
                            if (pField.Name.ToUpper().Contains("OBJECTID") ||
                                pField.Name.ToLower().Contains("shape"))
                            {
                                continue;
                            }

                            int k           = 0;
                            int nFieldCount = dtFields.Rows.Count;
                            for (k = 0; k < nFieldCount; k++)
                            {
                                DataRow drField    = dtFields.Rows[k];
                                string  strStdName = drField["FieldName"].ToString();
                                string  strStdCode = drField["FieldCode"].ToString();
                                if (strStdCode.Trim().Equals("objectid", StringComparison.OrdinalIgnoreCase) ||
                                    strStdCode.Trim().Equals("object id", StringComparison.OrdinalIgnoreCase) ||
                                    strStdCode.Trim().Equals("shape", StringComparison.OrdinalIgnoreCase))
                                {
                                    continue;
                                }
                                if (pField.Name.Trim().Equals(strStdCode.Trim(), StringComparison.OrdinalIgnoreCase))
                                {
                                    break;
                                }
                            }
                            if (k == nFieldCount)
                            {
                                if (!pField.AliasName.Contains("本软件"))
                                {
                                    FieldError LRFieldErrorInfo2 = new FieldError();
                                    LRFieldErrorInfo2.DefectLevel     = this.DefectLevel;
                                    LRFieldErrorInfo2.strAttrTabName  = strLayerName;
                                    LRFieldErrorInfo2.strFieldName    = pField.Name;
                                    LRFieldErrorInfo2.m_strRuleInstID = this.m_InstanceID;
                                    LRFieldErrorInfo2.strErrorMsg     = string.Format(Helper.ErrMsgFormat.ERR_410100001_1, strLayerName, pField.Name);

                                    pResult.Add(LRFieldErrorInfo2);
                                }
                            }
                        }

                        ///检查标准中的字段在图层中是否存在,已经图层的字段是否和标准相符合
                        //二次for循环迭代控制器,add by wangxiang 20111201
                        int flag = 0;
                        foreach (DataRow drField in dtFields.Rows)
                        {
                            if (drField != null)
                            {
                                string strStdName = drField["FieldName"].ToString();
                                string strStdCode = drField["FieldCode"].ToString();

                                if (strStdCode.Trim().Equals("objectid", StringComparison.OrdinalIgnoreCase) ||
                                    strStdCode.Trim().Equals("object id", StringComparison.OrdinalIgnoreCase) ||
                                    strStdCode.Trim().Equals("shape", StringComparison.OrdinalIgnoreCase))
                                {
                                    continue;
                                }

                                int nStdType = Convert.ToInt32(drField["FieldType"]);


                                string strStdFldType = Hy.Common.Utility.Data.AdoDbHelper.GetFieldTypeName(nStdType);

                                FieldError FieldErrInfo1 = new FieldError();
                                FieldErrInfo1.DefectLevel     = this.DefectLevel;
                                FieldErrInfo1.strAttrTabName  = strLayerName;
                                FieldErrInfo1.strFieldName    = "" + strStdCode + "(" + strStdName + ")";
                                FieldErrInfo1.strStdFieldType = strStdFldType;
                                FieldErrInfo1.m_strRuleInstID = this.m_InstanceID;

                                int i = 0;
                                for (i = 0; i < lFieldCount && flag < lFieldCount; i++)
                                {
                                    pField = pFields.get_Field(i);


                                    if (pField.Name.Trim() == strStdCode.Trim())
                                    {
                                        flag++;
                                        esriFieldType pType = pField.Type;

                                        if (nStdType == 3)
                                        {
                                            nStdType = 4;
                                        }
                                        esriFieldType pDTType = TopoHelper.en_GetEsriFieldByEnum(nStdType);
                                        if (pType == pDTType)
                                        {
                                            if (pType != esriFieldType.esriFieldTypeString)
                                            {
                                                break;
                                            }

                                            if (pField.Length != Convert.ToInt32(drField["Length"])) //字段长度不正确
                                            {
                                                if (strLayerCode.Equals("JBNTBHTB", StringComparison.OrdinalIgnoreCase) && pField.Name.Trim().Equals("jbnttbbh", StringComparison.OrdinalIgnoreCase))
                                                {
                                                    FieldErrInfo1.strErrorMsg = string.Format(Helper.ErrMsgFormat.ERR_410100001_4, strLayerName, pField.Name, pField.Length, Convert.ToInt32(drField["Length"]));
                                                }
                                                else
                                                {
                                                    FieldErrInfo1.strErrorMsg = string.Format(Helper.ErrMsgFormat.ERR_410100001_4, strLayerName, pField.Name, pField.Length, Convert.ToInt32(drField["Length"]));
                                                }
                                                pResult.Add(FieldErrInfo1);
                                                break;
                                            }


                                            break;
                                        }
                                        else
                                        {
                                            if (pDTType != esriFieldType.esriFieldTypeBlob)
                                            {
                                                FieldErrInfo1.strErrorMsg = string.Format(Helper.ErrMsgFormat.ERR_410100001_3, strLayerName, pField.Name, TopoHelper.en_GetFieldTypebyEsriField(pType), TopoHelper.en_GetFieldTypebyEsriField(pDTType));
                                                pResult.Add(FieldErrInfo1);
                                            }

                                            break;
                                        }
                                    }
                                }

                                if (i == lFieldCount)
                                {
                                    if (drField["FieldOption"].ToString().Trim() != "fz")
                                    {
                                        FieldErrInfo1.strErrorMsg = string.Format(Helper.ErrMsgFormat.ERR_410100001_2, strLayerName, drField["FieldName"].ToString());
                                        pResult.Add(FieldErrInfo1);
                                    }
                                }
                            }
                        }
                        if (pFtCls != null)
                        {
                            Marshal.ReleaseComObject(pFtCls);
                            pFtCls = null;
                        }
                    }
                }

                checkResult = pResult;
            }
            catch (Exception ex)
            {
                SendMessage(enumMessageType.Exception, ex.ToString());
                return(false);
            }

            return(true);
        }