Exemplo n.º 1
0
        public static string GetResultTableNameByType(enumErrorType errType)
        {
            string strResultTableName = "LR_ResAutoAttr";
            switch (errType)
            {

                case enumErrorType.Topology:
                    strResultTableName = "LR_ResAutoTopo";
                    break;

                case enumErrorType.LayerIntegrity:
                    strResultTableName = "LR_ResIntLayer";
                    break;

                case enumErrorType.FieldIntegrity:
                    strResultTableName = "LR_ResIntField";
                    break;

                default:
                    strResultTableName = "LR_ResAutoAttr";
                    break;

            }
            return strResultTableName;
        }
Exemplo n.º 2
0
        public static void LogError(ref System.Reflection.MethodBase oMethod,
                                    Exception oException, enumErrorType eErrorType)
        {
            Hashtable oHashtable = new Hashtable();

                    oHashtable["DATETIME"] = DateTime.Now.ToString() + "." + DateTime.Now.Millisecond.ToString().PadLeft(3, '0');
                    oHashtable["MESSAGE"] = oException.Message;
                    oHashtable["TYPE"] = "ERROR";
                    oHashtable["METHOD"] = oMethod.Name;
                    oHashtable["MODULE"] = oMethod.DeclaringType.FullName;
                    oHashtable["THREADID"] = System.Threading.Thread.CurrentThread.ManagedThreadId;
                    oHashtable["PROCID"] = System.Diagnostics.Process.GetCurrentProcess().Id;
                    oHashtable["PROCNAME"] = System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName;

                    string LogMethod = String.Format("{0}, MESSAGE={1}, TYPE={2}, METHOD={3}(), MODULE={4}, THREADID={5}, PROCID={6}, PROCNAME{7}",
                        oHashtable["DATETIME"].ToString(), oHashtable["MESSAGE"],
                        oHashtable["TYPE"], oHashtable["METHOD"], oHashtable["MODULE"],
                        oHashtable["THREADID"], oHashtable["PROCID"], oHashtable["PROCNAME"]);

                CLogHandler.objUDPLogger.SendHash(oHashtable);

                if (eErrorType == enumErrorType.Elevate)
                {
                    throw oException;
                }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 提交意外编辑结果
        /// </summary>
        /// <param name="errType"></param>
        /// <param name="errID"></param>
        /// <param name="isException"></param>
        /// <returns></returns>
        public bool CommitExceptionEdit(enumErrorType errType, string errID, bool isException, string remark)
        {
            string strTable = GetResultTableNameByType(errType);

            object[] objArgs = { strTable, isException, errID, remark == null?remark:remark.Replace("'", "''") };
            return(Hy.Common.Utility.Data.AdoDbHelper.ExecuteSql(this.ResultConnection, string.Format("Update {0} set IsException={1},Remark='{3}' where ErrNum={2}", objArgs)));
        }
Exemplo n.º 4
0
        //-------------------------------------------------------//
        protected void addMSG(string errorStr, enumErrorType ErrorType, string classStr, string errorStr2 = null, string errorStr3 = null, string errorStr4 = null)
        {
            System.Diagnostics.Debug.WriteLine(classStr + " " + errorStr + " " + errorStr2);

            System.DateTime ErrorTimeStamp = System.DateTime.Now;

            System.Console.WriteLine(ErrorType + "/t" + ErrorTimeStamp + "/t" + errorStr + "/t" + classStr + "/t" + errorStr2 + "/t" + errorStr3 + "/t" + errorStr4);
        }
Exemplo n.º 5
0
            //public bool ClearResultRuleList(IDbConnection resultConnection)
            //{
            //    return Hy.Common.Utility.Data.AdoDbHelper.ExecuteSql(resultConnection, "delete from LR_ResultEntryRule");
            //}

            public bool AddVerifiedRule(SchemaRule schemaRule, enumErrorType errType, enumRuleState defaultState)
            {
                string        strObject  = null;
                StringBuilder strBuilder = new StringBuilder("insert into LR_ResultEntryRule(CheckType,RuleInstID,TempInstID,ErrorCount,RuleExeState,TargetFeatClass1,TargetFeatClass2,GZBM,ErrorType) Values ('");

                strObject = schemaRule.ChkTypeName;
                if (strObject == null)
                {
                    strObject = "";
                }
                strBuilder.Append(strObject.Replace("'", "''")); strBuilder.Append("','");

                strObject = schemaRule.arrayRuleParas[0].strInstID;
                if (strObject == null)
                {
                    strObject = "";
                }
                strBuilder.Append(strObject.Replace("'", "''")); strBuilder.Append("','");

                strObject = schemaRule.TempInstID;
                if (strObject == null)
                {
                    strObject = "";
                }
                strBuilder.Append(strObject.Replace("'", "''")); strBuilder.Append("',");

                strBuilder.Append(0); strBuilder.Append(",");
                strBuilder.Append((int)defaultState); strBuilder.Append(",'");

                strObject = schemaRule.FeaClassName;
                if (strObject == null)
                {
                    strObject = "";
                }
                strBuilder.Append(strObject.Replace("'", "''")); strBuilder.Append("','");

                strBuilder.Append("','");


                strObject = schemaRule.arrayRuleParas[0].strGZBM;
                if (strObject == null)
                {
                    strObject = "";
                }
                strBuilder.Append(strObject.Replace("'", "''")); strBuilder.Append("',");

                strBuilder.Append((int)errType);

                strBuilder.Append(")");

                return(Hy.Common.Utility.Data.AdoDbHelper.ExecuteSql(this.m_ResultConnection, strBuilder.ToString()));
            }
Exemplo n.º 6
0
        // 刷入数据库
        private void gvResult_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column != gvResult.Columns[Field_Name_Exception])
            {
                return;
            }

            DataRow rowError = gvResult.GetDataRow(e.RowHandle);

            if (rowError == null)
            {
                return;
            }

            string        strID   = rowError[Field_Name_ErrorID].ToString();
            enumErrorType errType = (enumErrorType)rowError["ErrorType"];

            this.m_ErrorHelper.CommitExceptionEdit(errType, strID, (bool)e.Value, rowError[Field_Name_Remark] as string);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取指定错误ID下,指定页的错误结果
        /// @remark
        /// 1.错误ID可以是集合,用逗号隔开
        /// 2.errCount参数,当第一次调用时使用-1,将返回错误数,此后调用将此错误数传入,可加快效率
        /// </summary>
        /// <param name="errType"></param>
        /// <param name="ruleIDs"></param>
        /// <param name="countPerPage"></param>
        /// <param name="pageIndex"></param>
        /// <param name="errCount"></param>
        /// <returns></returns>
        public DataTable GetErrors(enumErrorType errType, string ruleIDs, int countPerPage, int pageIndex, ref int errCount)
        {
            if (this.ResultConnection == null || this.ResultConnection.State == ConnectionState.Closed)
            {
                return(null);
            }

            string resultTableName = GetResultTableNameByType(errType);
            string strFields       = GetErrorFields(errType);

            if (errCount < 0)
            {
                DataTable dtCount = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.ResultConnection, string.Format("select count(0) from {0} where RuleInstID in ('{1}')", resultTableName, ruleIDs.Replace(",", "','")));
                errCount = (int)dtCount.Rows[0][0];
            }
            int resultCount = countPerPage;

            if (countPerPage * (pageIndex + 1) > errCount)
            {
                resultCount = errCount - countPerPage * pageIndex;
            }

            if (resultCount == 0)
            {
                resultCount = 1;
            }
            object[] objArgs = { resultCount, countPerPage *(pageIndex + 1), resultTableName, ruleIDs.Replace(",", "','"), strFields };
            string   strSQL  = string.Format("select top {0} * from (select top {1} {4} from {2} as Result,LR_ResultEntryRule as Entry where Result.RuleInstID in ('{3}') and Result.RuleInstID=Entry.RuleInstID order by ErrNum Asc) Order by ErrNum Desc", objArgs);

            DataTable dtErrors = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.ResultConnection, strSQL);

            dtErrors.TableName = resultTableName;

            //DataColumn colErrorType = new DataColumn("错误级别",typeof(string));
            //colErrorType.Expression = "IIf(DefectLevel=0,'轻缺陷',IIf(DefectLevel=1,'重缺陷','严重缺陷'))";
            //dtErrors.Columns.Add(colErrorType);
            return(dtErrors);
        }
Exemplo n.º 8
0
        public static string GetResultTableNameByType(enumErrorType errType)
        {
            string strResultTableName = "LR_ResAutoAttr";

            switch (errType)
            {
            case enumErrorType.Topology:
                strResultTableName = "LR_ResAutoTopo";
                break;

            case enumErrorType.LayerIntegrity:
                strResultTableName = "LR_ResIntLayer";
                break;

            case enumErrorType.FieldIntegrity:
                strResultTableName = "LR_ResIntField";
                break;

            default:
                strResultTableName = "LR_ResAutoAttr";
                break;
            }
            return(strResultTableName);
        }
Exemplo n.º 9
0
        private string GetErrorFields(enumErrorType errType)
        {
            string strFields = "";

            switch (errType)
            {
            case enumErrorType.Topology:
                strFields = @"
Result.ErrNum,
Entry.GZBM as 规则编码,
Result.YSTC as 图层,
Result.SourceBSM as 标识码11,
Result.SourceOID as OID,
Result.MBTC as 图层2,
Result.TargetBSM as 标识码222,
Result.TargetOID as OID2,
Result.Reason as 错误描述,
IIF(Result.DefectLevel=-1,'未定义',IIf(Result.DefectLevel=0,'轻缺陷',IIf(Result.DefectLevel=1,'重缺陷','严重缺陷'))) as 缺陷级别,
Result.IsException as 是否例外,
Result.Remark as 备注,
Result.DefectLevel as DefectLevel,
Result.JHLX as JHLX,
Entry.ErrorType as ErrorType,
Result.SourceLayerID as SourceLayerID,
Result.TargetLayerID as TargetLayerID,
Result.TPTC as TPTC,
Result.ArcGISRule as ArcGISRule
";
                break;

            case enumErrorType.FieldIntegrity:
                strFields = @"
Result.ErrNum,
Entry.GZBM as 规则编码,
Result.AttrTabName as 图层,
Result.ErrorReason as 错误描述,
IIF(Result.DefectLevel=-1,'未定义',IIf(Result.DefectLevel=0,'轻缺陷',IIf(Result.DefectLevel=1,'重缺陷','严重缺陷'))) as 缺陷级别,
Result.IsException as 是否例外,
Result.Remark as 备注,
Result.DefectLevel as DefectLevel,
Entry.ErrorType as ErrorType,
Result.FieldName as FieldName,
Result.FieldType as FieldType
";
                break;

            case enumErrorType.LayerIntegrity:
                strFields = @"
Result.ErrNum,
Entry.GZBM as 规则编码,
Result.ErrorLayerName as 图层,
Result.ErrorReason as 错误描述,
IIF(Result.DefectLevel=-1,'未定义',IIf(Result.DefectLevel=0,'轻缺陷',IIf(Result.DefectLevel=1,'重缺陷','严重缺陷'))) as 缺陷级别,
Result.IsException as 是否例外,
Result.Remark as 备注,
Result.DefectLevel as DefectLevel,
Entry.ErrorType as ErrorType
";
                break;

            default:
                strFields = @"
Result.ErrNum,
Entry.GZBM as 规则编码,
Result.TargetFeatClass1 as 图层,
Result.BSM as 标识码,
Result.TargetFeatClass2 as 图层2,
Result.BSM2 as 标识码2,
Result.ErrMsg as 错误描述,
IIF(Result.DefectLevel=-1,'未定义',IIf(Result.DefectLevel=0,'轻缺陷',IIf(Result.DefectLevel=1,'重缺陷','严重缺陷'))) as 缺陷级别,
Result.OID as ObjectID,
Result.OID2 as ObjectID2,
Result.IsException as 是否例外,
Result.Remark as 备注,
Result.DefectLevel as DefectLevel,
Entry.ErrorType as ErrorType
";
                break;
            }

            return(strFields);
        }
Exemplo n.º 10
0
        public bool CommitExceptionEdit(enumErrorType errorType, DataTable dtError)
        {
            string strTable = GetResultTableNameByType(errorType);

            return(Hy.Common.Utility.Data.AdoDbHelper.UpdateTable(strTable, dtError, this.ResultConnection));
        }
Exemplo n.º 11
0
            //public bool ClearResultRuleList(IDbConnection resultConnection)
            //{
            //    return Hy.Common.Utility.Data.AdoDbHelper.ExecuteSql(resultConnection, "delete from LR_ResultEntryRule");
            //}
            public bool AddVerifiedRule(SchemaRule schemaRule,enumErrorType errType, enumRuleState defaultState)
            {
                string strObject = null;
                StringBuilder strBuilder = new StringBuilder("insert into LR_ResultEntryRule(CheckType,RuleInstID,TempInstID,ErrorCount,RuleExeState,TargetFeatClass1,TargetFeatClass2,GZBM,ErrorType) Values ('");
                strObject = schemaRule.ChkTypeName;
                if (strObject == null) strObject = "";
                strBuilder.Append(strObject.Replace("'", "''")); strBuilder.Append("','");

                strObject = schemaRule.arrayRuleParas[0].strInstID;
                if (strObject == null) strObject = "";
                strBuilder.Append(strObject.Replace("'", "''")); strBuilder.Append("','");

                strObject = schemaRule.TempInstID;
                if (strObject == null) strObject = "";
                strBuilder.Append(strObject.Replace("'", "''")); strBuilder.Append("',");

                strBuilder.Append(0); strBuilder.Append(",");
                strBuilder.Append((int)defaultState); strBuilder.Append(",'");

                strObject = schemaRule.FeaClassName;
                if (strObject == null) strObject = "";
                strBuilder.Append(strObject.Replace("'", "''")); strBuilder.Append("','");

                strBuilder.Append("','");

                strObject = schemaRule.arrayRuleParas[0].strGZBM;
                if (strObject == null) strObject = "";
                strBuilder.Append(strObject.Replace("'", "''"));strBuilder.Append("',");

                strBuilder.Append((int)errType);

                strBuilder.Append(")");

                return Hy.Common.Utility.Data.AdoDbHelper.ExecuteSql(this.m_ResultConnection, strBuilder.ToString());
            }
Exemplo n.º 12
0
        private string GetErrorFields(enumErrorType errType)
        {
            string strFields = "";
            switch (errType)
            {

                case enumErrorType.Topology:
                    strFields = @"
            Result.ErrNum,
            Entry.GZBM as 规则编码,
            Result.YSTC as 图层,
            Result.SourceBSM as 标识码11,
            Result.SourceOID as OID,
            Result.MBTC as 图层2,
            Result.TargetBSM as 标识码222,
            Result.TargetOID as OID2,
            Result.Reason as 错误描述,
            IIF(Result.DefectLevel=-1,'未定义',IIf(Result.DefectLevel=0,'轻缺陷',IIf(Result.DefectLevel=1,'重缺陷','严重缺陷'))) as 缺陷级别,
            Result.IsException as 是否例外,
            Result.Remark as 备注,
            Result.DefectLevel as DefectLevel,
            Result.JHLX as JHLX,
            Entry.ErrorType as ErrorType,
            Result.SourceLayerID as SourceLayerID,
            Result.TargetLayerID as TargetLayerID,
            Result.TPTC as TPTC,
            Result.ArcGISRule as ArcGISRule
            ";
                    break;

                case enumErrorType.FieldIntegrity:
                    strFields = @"
            Result.ErrNum,
            Entry.GZBM as 规则编码,
            Result.AttrTabName as 图层,
            Result.ErrorReason as 错误描述,
            IIF(Result.DefectLevel=-1,'未定义',IIf(Result.DefectLevel=0,'轻缺陷',IIf(Result.DefectLevel=1,'重缺陷','严重缺陷'))) as 缺陷级别,
            Result.IsException as 是否例外,
            Result.Remark as 备注,
            Result.DefectLevel as DefectLevel,
            Entry.ErrorType as ErrorType,
            Result.FieldName as FieldName,
            Result.FieldType as FieldType
            ";
                    break;

                case enumErrorType.LayerIntegrity:
                    strFields = @"
            Result.ErrNum,
            Entry.GZBM as 规则编码,
            Result.ErrorLayerName as 图层,
            Result.ErrorReason as 错误描述,
            IIF(Result.DefectLevel=-1,'未定义',IIf(Result.DefectLevel=0,'轻缺陷',IIf(Result.DefectLevel=1,'重缺陷','严重缺陷'))) as 缺陷级别,
            Result.IsException as 是否例外,
            Result.Remark as 备注,
            Result.DefectLevel as DefectLevel,
            Entry.ErrorType as ErrorType
            ";
                    break;

                default:
                    strFields = @"
            Result.ErrNum,
            Entry.GZBM as 规则编码,
            Result.TargetFeatClass1 as 图层,
            Result.BSM as 标识码,
            Result.TargetFeatClass2 as 图层2,
            Result.BSM2 as 标识码2,
            Result.ErrMsg as 错误描述,
            IIF(Result.DefectLevel=-1,'未定义',IIf(Result.DefectLevel=0,'轻缺陷',IIf(Result.DefectLevel=1,'重缺陷','严重缺陷'))) as 缺陷级别,
            Result.OID as ObjectID,
            Result.OID2 as ObjectID2,
            Result.IsException as 是否例外,
            Result.Remark as 备注,
            Result.DefectLevel as DefectLevel,
            Entry.ErrorType as ErrorType
            ";
                    break;
            }

            return strFields;
        }
Exemplo n.º 13
0
        /// <summary>
        /// 获取指定错误ID下,指定页的错误结果
        /// @remark 
        /// 1.错误ID可以是集合,用逗号隔开
        /// 2.errCount参数,当第一次调用时使用-1,将返回错误数,此后调用将此错误数传入,可加快效率
        /// </summary>
        /// <param name="errType"></param>
        /// <param name="ruleIDs"></param>
        /// <param name="countPerPage"></param>
        /// <param name="pageIndex"></param>
        /// <param name="errCount"></param>
        /// <returns></returns>
        public DataTable GetErrors(enumErrorType errType, string ruleIDs,int countPerPage,int pageIndex,ref int errCount)
        {
            if (this.ResultConnection == null || this.ResultConnection.State == ConnectionState.Closed)
                return null;

            string resultTableName= GetResultTableNameByType(errType);
            string strFields = GetErrorFields(errType);
            if (errCount < 0)
            {
                DataTable dtCount = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.ResultConnection, string.Format("select count(0) from {0} where RuleInstID in ('{1}')", resultTableName,  ruleIDs.Replace(",", "','")));
                errCount = (int)dtCount.Rows[0][0];
            }
            int resultCount = countPerPage;
            if(countPerPage * (pageIndex + 1) > errCount)
                resultCount=errCount - countPerPage * pageIndex ;

            if (resultCount == 0) resultCount = 1;
            object[] objArgs = { resultCount, countPerPage * (pageIndex + 1), resultTableName, ruleIDs.Replace(",", "','"),strFields };
            string strSQL = string.Format("select top {0} * from (select top {1} {4} from {2} as Result,LR_ResultEntryRule as Entry where Result.RuleInstID in ('{3}') and Result.RuleInstID=Entry.RuleInstID order by ErrNum Asc) Order by ErrNum Desc", objArgs);

            DataTable dtErrors= Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.ResultConnection, strSQL);
            dtErrors.TableName = resultTableName;

            //DataColumn colErrorType = new DataColumn("错误级别",typeof(string));
            //colErrorType.Expression = "IIf(DefectLevel=0,'轻缺陷',IIf(DefectLevel=1,'重缺陷','严重缺陷'))";
            //dtErrors.Columns.Add(colErrorType);
            return dtErrors;
        }
Exemplo n.º 14
0
 /// <summary>
 /// 提交意外编辑结果
 /// </summary>
 /// <param name="errType"></param>
 /// <param name="errID"></param>
 /// <param name="isException"></param>
 /// <returns></returns>
 public bool CommitExceptionEdit(enumErrorType errType, string errID, bool isException, string remark)
 {
     string strTable = GetResultTableNameByType(errType);
     object[] objArgs = { strTable, isException, errID, remark==null?remark:remark.Replace("'","''") };
     return Hy.Common.Utility.Data.AdoDbHelper.ExecuteSql(this.ResultConnection, string.Format("Update {0} set IsException={1},Remark='{3}' where ErrNum={2}", objArgs));
 }
Exemplo n.º 15
0
 public bool CommitExceptionEdit(enumErrorType errorType, DataTable dtError)
 {
     string strTable = GetResultTableNameByType(errorType);
     return Hy.Common.Utility.Data.AdoDbHelper.UpdateTable(strTable, dtError, this.ResultConnection);
 }
Exemplo n.º 16
0
        private IFeature GetFeature(DataRow rowError, string strLayerName)
        {
            IMap theMap = this.m_HookHelper.FocusMap;
            MapLayersController mapController = new MapLayersController(theMap);
            enumErrorType       errType       = (enumErrorType)Convert.ToInt32(rowError["ErrorType"]);

            switch (errType)
            {
            case enumErrorType.Topology:
            {
                ITopologyLayer topoLayerTarget = mapController.GetLayer(strLayerName) as ITopologyLayer;
                if (topoLayerTarget == null)
                {
                    return(null);
                }

                ITopology topology = topoLayerTarget.Topology;
                IErrorFeatureContainer errFeatureContainer = topology as IErrorFeatureContainer;
                esriTopologyRuleType   ruleType            = (esriTopologyRuleType)Convert.ToInt32(rowError[Field_Name_TopologyRuleType]);
                //string strGeoType = rowError[Field_Name_TopologyGeometryType] as string;
                //esriGeometryType geoType = (strGeoType == "点" ? esriGeometryType.esriGeometryPoint : (strGeoType == "线" ? esriGeometryType.esriGeometryLine : esriGeometryType.esriGeometryPolygon));
                esriGeometryType geoType = (esriGeometryType)Convert.ToInt32(rowError[Field_Name_TopologyGeometryType]);
                int sourceClassID        = (int)rowError["SourceLayerID"];
                int sourceOID            = (int)rowError["OID"];
                int targetClassID        = (int)rowError["TargetLayerID"];
                int targetOID            = Convert.ToInt32(rowError["OID2"]);

                return(errFeatureContainer.get_ErrorFeature((topology as IGeoDataset).SpatialReference, ruleType, geoType, sourceClassID, sourceOID, targetClassID, targetOID) as IFeature);
            }
            break;

            case enumErrorType.Normal:
            {
                IFeatureLayer flyrTarget = mapController.GetLayer(strLayerName) as IFeatureLayer;
                if (flyrTarget == null)
                {
                    return(null);
                }

                // 改为优先从OID查找定位
                if (rowError.Table.Columns.Contains(Field_Name_TargetOID) && rowError[Field_Name_TargetOID] != DBNull.Value)
                {
                    return(flyrTarget.FeatureClass.GetFeature((int)rowError[Field_Name_TargetOID]));
                }
                else if (rowError.Table.Columns.Contains(Field_Name_TargetBSM) && !string.IsNullOrEmpty(rowError[Field_Name_TargetBSM] as string))
                {
                    IQueryFilter qFilter    = new QueryFilterClass();
                    IFields      fields     = flyrTarget.FeatureClass.Fields;
                    int          fieldIndex = fields.FindField("BSM");
                    if (fieldIndex < 0)
                    {
                        return(null);
                    }

                    IField bsmField = fields.get_Field(fieldIndex);
                    if (bsmField.Type == esriFieldType.esriFieldTypeInteger)
                    {
                        qFilter.WhereClause = string.Format("BSM={0}", rowError[Field_Name_TargetBSM]);
                    }
                    else
                    {
                        qFilter.WhereClause = string.Format("BSM='{0}'", rowError[Field_Name_TargetBSM]);
                    }
                    IFeatureCursor fCursor = flyrTarget.FeatureClass.Search(qFilter, false);

                    return(fCursor.NextFeature());
                }
                else
                {
                    return(null);
                }
            }

            default: return(null);
            }
        }