Ejemplo n.º 1
0
        public override bool Verify()
        {
            //根据别名取featureclass的名字
            int standardID = SysDbHelper.GetStandardIDBySchemaID(this.m_SchemaID);

            strSrcLayer = LayerReader.GetNameByAliasName(m_pPara.strTargetLayer, standardID);
            strRelLayer = LayerReader.GetNameByAliasName(m_pPara.strRelLayer, standardID);

            if (this.m_BaseWorkspace != null)
            {
                if (!(this.m_BaseWorkspace as IWorkspace2).get_NameExists(esriDatasetType.esriDTFeatureClass, strSrcLayer))
                {
                    string strLog = "当前工作数据库的关系图层" + strSrcLayer + "不存在,无法执行检查!";
                    SendMessage(enumMessageType.RuleError, strLog);
                    return(false);
                }

                if (!(this.m_BaseWorkspace as IWorkspace2).get_NameExists(esriDatasetType.esriDTFeatureClass, strSrcLayer))
                {
                    string strLog = "当前工作数据库的目标图层" + strRelLayer + "不存在,无法执行检查!";
                    SendMessage(enumMessageType.RuleError, strLog);
                    return(false);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        private void RenameClassObject(IDataset dsCurrent, int standardID)
        {
            if (dsCurrent == null)
            {
                return;
            }

            Hy.Check.Define.StandardLayer standardLayer = LayerReader.GetLayerByName(dsCurrent.Name, standardID);
            //string strAliasName = Hy.Check.Rule.Helper.LayerReader.GetAliasName(dsCurrent.Name, standardID);
            if (standardLayer != null)// dsCurrent.Name != strAliasName)
            {
                ISchemaLock schemaLock = dsCurrent as ISchemaLock;
                schemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);

                IClassSchemaEdit classSchemaEdit = dsCurrent as IClassSchemaEdit;
                if (classSchemaEdit != null)
                {
                    classSchemaEdit.AlterAliasName(standardLayer.AliasName);

                    ITable tCurrent = dsCurrent as ITable;
                    if (tCurrent != null)
                    {
                        List <Hy.Check.Define.StandardField> fields = FieldReader.GetFieldsByLayer(standardLayer.ID);
                        for (int i = 0; i < fields.Count; i++)
                        {
                            if (tCurrent.Fields.FindField(fields[i].Name) > -1)
                            {
                                classSchemaEdit.AlterFieldAliasName(fields[i].Name, fields[i].AliasName);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private string ConstructErrorInfo()
        {
            string        strInfo;
            string        strFields = "";
            StandardLayer lyr       = LayerReader.GetLayerByName(m_structInvalidPara.strFtName, this.m_StandarID);

            if (lyr == null)
            {
                return("");
            }
            int lyrID = lyr.ID;

            if (m_structInvalidPara.fieldArray.Count > 0)
            {
                for (int i = 0; i < m_structInvalidPara.fieldArray.Count; i++)
                {
                    string strTFields = FieldReader.GetNameByAliasName(m_structInvalidPara.fieldArray[i], lyrID);
                    strFields = strFields + "|" + strTFields;
                }
            }
            string strCharset;

            strCharset = m_structInvalidPara.charSetArray[0];
            for (int j = 1; j < m_structInvalidPara.charSetArray.Count; j++)
            {
                strCharset += "," + m_structInvalidPara.charSetArray[j];
            }
            strInfo = "字段 " + strFields + " 值中含有不符合要求的字符(" + strCharset + ")中的一个或多个";

            return(strInfo);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///通过图层别名获取图层名称
        /// </summary>
        /// <param name="strAliasName">Name of the STR alias.</param>
        /// <returns></returns>
        protected string GetLayerName(string strAliasName)
        {
            if (string.IsNullOrEmpty(strAliasName))
            {
                return(null);
            }
            int standardID = SysDbHelper.GetStandardIDBySchemaID(this.m_SchemaID);

            return(LayerReader.GetNameByAliasName(strAliasName, standardID));
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        public override bool Verify()
        {
            //根据别名取图层名
            int standardID = SysDbHelper.GetStandardIDBySchemaID(this.m_SchemaID);

            layerName = LayerReader.GetNameByAliasName(m_structPara.strFtName, standardID);
            if (string.IsNullOrEmpty(layerName))
            {
                SendMessage(enumMessageType.VerifyError, string.Format("当前标准中不存在图层“{0}”", m_structPara.strFtName));
                return(false);
            }
            return(true);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        public override bool Verify()
        {
            //根据别名取featureclass的名字
            int standardID = SysDbHelper.GetStandardIDBySchemaID(this.m_SchemaID);

            layerName = LayerReader.GetNameByAliasName(m_structPara.strFtName, standardID);

            //清除以前结果
            if (this.m_QueryConnection == null)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 9
0
        private void cmbStandard_SelectedIndexChanged(object sender, EventArgs e)
        {
            // 方案联动
            cmbSchema.Properties.Items.Clear();

            if (cmbStandard.SelectedIndex < 0)
            {
                return;
            }

            m_DicSchema = SysDbHelper.GetSchemasInfo(cmbStandard.SelectedItem as string);
            if (m_DicSchema == null)
            {
                dxErrorProvider.SetError(cmbStandard, "当前标准下没有配置检查方案");
                return;
            }
            Dictionary <string, string> .Enumerator enSchema = m_DicSchema.GetEnumerator();
            while (enSchema.MoveNext())
            {
                cmbSchema.Properties.Items.Add(enSchema.Current);
            }
            if (cmbSchema.Properties.Items.Count > 0)
            {
                cmbSchema.SelectedIndex = 0;
            }

            // 空间参考图层联动
            List <StandardLayer> lyrList = LayerReader.GetLayersByStandard(m_StandardIDList[cmbStandard.SelectedIndex]);
            int count = lyrList.Count;

            for (int i = 0; i < count; i++)
            {
                if (lyrList[i].Type == enumLayerType.Table ||
                    lyrList[i].Type == enumLayerType.UnKnown)
                {
                    continue;
                }
                cmbSpatialRefLayer.Properties.Items.Add(new KeyValuePair <string, string>(lyrList[i].Name, lyrList[i].AliasName));
            }
            if (cmbSpatialRefLayer.Properties.Items.Count > 0)
            {
                cmbSpatialRefLayer.SelectedIndex = 0;
            }
        }
Ejemplo n.º 10
0
        public override bool Verify()
        {
            m_StandarID = SysDbHelper.GetStandardIDBySchemaID(this.m_SchemaID);
            //根据别名取图层名
            m_layerName = LayerReader.GetNameByAliasName(m_structInvalidPara.strFtName, m_StandarID);

            if (m_QueryWorkspace == null)
            {
                return(false);
            }

            if (!(m_QueryWorkspace as IWorkspace2).get_NameExists(esriDatasetType.esriDTTable, m_layerName))
            {
                string strLog = "当前工作数据库中不存在图层" + m_layerName + ",无法执行非法字符检查!";
                SendMessage(enumMessageType.RuleError, strLog);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
0
        private string ConstructErrorInfo()
        {
            string strInfo;

            strInfo = "线长度小于域值" + COMMONCONST.dLengthThread + " ";
            string        strFields = "";
            StandardLayer distLayer = LayerReader.GetLayerByName(m_structLengthPara.strFtName, SysDbHelper.GetStandardIDBySchemaID(this.m_SchemaID));

            if (m_structLengthPara.fieldArray != null)
            {
                for (int i = 0; i < m_structLengthPara.fieldArray.Count; i++)
                {
                    strFields = strFields + "|" + FieldReader.GetAliasName(m_structLengthPara.fieldArray[i], distLayer.ID);
                }
                strFields = strFields.Remove(0, 1);
                strFields = strFields + " 字段都为空";
                strInfo   = strInfo + ",并且 " + strFields;
            }


            return(strInfo);
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
0
        private string ConstructErrorInfo()
        {
            string        strInfo   = "";
            string        strFields = "";
            StandardLayer distLayer = LayerReader.GetLayerByName(m_structBlankPara.strFtName, SysDbHelper.GetStandardIDBySchemaID(this.m_SchemaID));

            if (m_structBlankPara.fieldArray.Count > 0)
            {
                for (int i = 1; i < m_structBlankPara.fieldArray.Count; i++)
                {
                    strFields = strFields + "|" + FieldReader.GetAliasName(m_structBlankPara.fieldArray[i], distLayer.ID);
                }
                strFields = strFields.Remove(0, 1);
            }
            if (m_structBlankPara.iType == 0)
            {
                strInfo = "字段 " + strFields + " 都为空";
            }
            else if (m_structBlankPara.iType == 1)
            {
                strInfo = "字段 " + strFields + " 中有一个或多个为空";
            }
            return(strInfo);
        }
Ejemplo n.º 15
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);
        }