Пример #1
0
        public override bool Verify()
        {
            int standardID = SysDbHelper.GetStandardIDBySchemaID(this.m_SchemaID);

            lyr = LayerReader.GetLayerByAliasName(m_structFrePara.strFtName, standardID);
            if (lyr == null)
            {
                SendMessage(enumMessageType.VerifyError, "当前方案所在的标准中找不到名为“" + m_structFrePara.strFtName + "”的图层");
                return(false);
            }

            return(true);
        }
Пример #2
0
        public override bool Verify()
        {
            // 获取标准ID
            int nStdID = SysDbHelper.GetStandardID(this.m_strStdName);

            lyr = LayerReader.GetLayerByAliasName(m_psPara.strFtName, nStdID);
            if (lyr == null)
            {
                SendMessage(enumMessageType.VerifyError, string.Format("标准中不存在图层“{0}”", m_psPara.strFtName));
                return(false);
            }

            // 获取实际字值名
            Helper.StandardHelper helper = new Hy.Check.Rule.Helper.StandardHelper(this.m_QueryConnection);
            strFieldCode = FieldReader.GetNameByAliasName(m_psPara.strCodeField, lyr.ID);
            if (string.IsNullOrEmpty(strFieldCode))
            {
                SendMessage(enumMessageType.VerifyError, string.Format("标准图层中不存在字段“{0}”", m_psPara.strCodeField));
                return(false);
            }

            strFieldCodeType = helper.GetLayerFieldType(strFieldCode, lyr.AttributeTableName);
            if (string.IsNullOrEmpty(strFieldCodeType))
            {
                SendMessage(enumMessageType.VerifyError, string.Format("数据图层中不存在字段“{0}”", m_psPara.strCodeField));
                return(false);
            }

            if (m_psPara.strNameField != "")
            {
                strFieldName = FieldReader.GetNameByAliasName(m_psPara.strNameField, lyr.ID);
            }
            else
            {
                SendMessage(enumMessageType.VerifyError, "没有配置字段");
                return(false);
            }

            return(true);
        }
Пример #3
0
        public override bool Verify()
        {
            standarID = SysDbHelper.GetStandardIDBySchemaID(this.m_SchemaID);

            StandardLayer lyr = LayerReader.GetLayerByAliasName(m_psPara.strTargetLayer, standarID);

            if (lyr == null)
            {
                SendMessage(enumMessageType.VerifyError, "当前方案所在的标准中找不到名为“" + m_psPara.strTargetLayer + "”的图层");
                return(false);
            }

            strLayerName = lyr.Name;
            strCodeField = FieldReader.GetNameByAliasName(m_psPara.strCodeField, lyr.ID);
            if (string.IsNullOrEmpty(strCodeField))
            {
                SendMessage(enumMessageType.VerifyError, string.Format("当前方案所在的标准中找不到名为“{0}”的图层", m_psPara.strCodeField));
                return(false);
            }

            return(true);
        }
Пример #4
0
        public override bool Verify()
        {
            //先取得要进行空间关系查询的ILayer
            IFeatureWorkspace ipFtWS = (IFeatureWorkspace)m_BaseWorkspace;

            int standarID = SysDbHelper.GetStandardIDBySchemaID(this.m_SchemaID);

            StandardLayer lyrSource = LayerReader.GetLayerByAliasName(m_pPara.strGeographyObject, standarID);

            if (lyrSource == null)
            {
                SendMessage(enumMessageType.VerifyError, string.Format("当前方案所在的标准中批不到名为“{0}”的图层", m_pPara.strGeographyObject));
                return(false);
            }

            strSrcLayer = lyrSource.Name;
            if (m_pPara.arrayGraphSpeckleField.Count > 0)
            {
                strSrcFiled = FieldReader.GetNameByAliasName(m_pPara.arrayGraphSpeckleField[0], lyrSource.ID);
                if (string.IsNullOrEmpty(strSrcFiled))
                {
                    SendMessage(enumMessageType.VerifyError, string.Format("当前方案所在的标准中批不到名为“{0}”的图层", m_pPara.arrayGraphSpeckleField[0]));
                    return(false);
                }
            }

            StandardLayer lyrRel = LayerReader.GetLayerByAliasName(m_pPara.strGraphSpeckle, standarID);

            strRelLayer = lyrRel.Name;
            if (m_pPara.arrayGeographyObjectField.Count > 0)
            {
                strRelField = FieldReader.GetNameByAliasName(m_pPara.arrayGeographyObjectField[0], lyrRel.ID);
                if (string.IsNullOrEmpty(strRelField))
                {
                    SendMessage(enumMessageType.VerifyError, string.Format("当前方案所在的标准中批不到名为“{0}”的图层", m_pPara.arrayGeographyObjectField[0]));
                    return(false);
                }
            }
            //得到目标图层和关系图层的featureclass
            IFeatureClass pSrcFeatClass = null;
            IFeatureClass pRelFeatClass = null;
            IWorkspace    TempWorkspace = null;

            IWorkspace2 wsTest = ipFtWS as IWorkspace2;

            // 原始数据准备
            // 打开“源”
            try
            {
                pSrcFeatClass = ipFtWS.OpenFeatureClass(strSrcLayer);
            }
            catch
            {
                SendMessage(enumMessageType.VerifyError, "当前工作数据库的关系图层" + strSrcLayer + "不存在,无法执行检查!");
                return(false);
            }
            m_srcfcname = strSrcLayer;
            if (pSrcFeatClass.FeatureCount(null) == 0)
            {
                Marshal.ReleaseComObject(pSrcFeatClass);
                SendMessage(enumMessageType.VerifyError, "当前工作数据库的关系图层" + strSrcLayer + "为空,无法执行检查!");
                return(false);
            }
            if (pSrcFeatClass != null)
            {
                Marshal.ReleaseComObject(pSrcFeatClass);
                pSrcFeatClass = null;
            }
            // 打开“目标”
            try
            {
                pRelFeatClass = ipFtWS.OpenFeatureClass(strRelLayer);
            }
            catch
            {
                SendMessage(enumMessageType.VerifyError, "当前工作数据库的目标图层" + strRelLayer + "不存在,无法执行检查!");
                return(false);
            }

            if (pRelFeatClass.FeatureCount(null) == 0)
            {
                Marshal.ReleaseComObject(pRelFeatClass);
                SendMessage(enumMessageType.VerifyError, "当前工作数据库的关系图层" + strSrcLayer + "为空,无法执行检查!");
                return(false);
            }

            if (pRelFeatClass != null)
            {
                Marshal.ReleaseComObject(pRelFeatClass);
                pRelFeatClass = null;
            }

            return(true);
        }