示例#1
0
        /// <summary>
        /// 获取所有的权重信息的哈希表
        /// </summary>
        /// <returns></returns>
        private void GetRuleRightWeight()
        {
            try
            {
                //DataTable dt = null; // = GT_CARTO.CommonAPI.ado_OpenTable() .ado_Execute(CommonAPI.Get_DBConnection(), sql);
                //GT_CARTO.CommonAPI.ado_OpenTable("LR_EvaHMWeight", ref dt, GT_CARTO.CommonAPI.Get_DBConnection());
                DataTable dt = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(SysDbHelper.GetSysDbConnection(), "select * from LR_EvaHMWeight");
                if (dt.Rows.Count < 1)
                {
                    return;
                }
                foreach (DataRow dr in dt.Rows)
                {
                    string key = dr["ElementID"].ToString();
                    if (key != "" && !hashRuleWeight.ContainsKey(key))
                    {
                        hashRuleWeight[key] = dr["ErrType"].ToString();
                    }
                }
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                //GT_CONST.LogAPI.CheckLog.AppendErrLogs(ex.ToString());
            }
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TemplateRules"/> class.
 /// </summary>
 /// <param name="schemaId">The schema id.</param>
 public TemplateRules(string schemaId)
 {
     m_strSchemaId = schemaId;
     m_RulesParaDt = SysDbHelper.GetSchemaRulesPara(m_strSchemaId);
     m_EvaWeightHt = SysDbHelper.GetEvaWeightTable(schemaId, ref m_TopoWeightHt);
     m_ruleDt      = SysDbHelper.GetSchemaTemplateRules(m_strSchemaId);
     m_RuleClassDt = SysDbHelper.GetAllModelRules();
     init();
 }
示例#3
0
        private bool GetRuleClassify()
        {
            m_ClassifyLevelRules = new List <ClassifyRule>();
            DataTable result      = null;
            DataTable yjdatatable = null;

            try
            {
                result = SysDbHelper.GetRulesClassifyList(m_strSchemaId);

                if (result == null || result.Rows.Count == 0)
                {
                    return(false);
                }
                yjdatatable = AdoDbHelper.GetDataTable(SysDbHelper.GetSysDbConnection(), string.Format("select yjmlmc,yjmlbm from LR_CheckTypeModel where SchemaId='{0}' group by yjmlmc,yjmlbm order by yjmlbm ", m_strSchemaId));

                foreach (DataRow dr in yjdatatable.Rows)
                {
                    int          parseBm    = int.Parse(dr["YJMLBM"].ToString());
                    ClassifyRule rule       = InitRuleLevel(dr["YJMLMC"].ToString(), parseBm);
                    int          rulesCount = 0;
                    rule.SubRules      = GetChildRules(parseBm.ToString(), "EJMLMC", "EJMLBM", 1, result, out rulesCount);
                    rule.SubRulesCount = rulesCount;//CalculateRulesCount(rule.SubRules);
                    m_ClassifyLevelRules.Add(rule);
                }
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());
            }
            finally
            {
                if (result != null)
                {
                    result.Dispose();
                    result = null;
                }
                if (yjdatatable != null)
                {
                    yjdatatable.Dispose();
                    yjdatatable = null;
                }
            }

            return(true);
        }
示例#4
0
 static DefectHelper()
 {
     try
     {
         DataTable dtDefectLevel = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(SysDbHelper.GetSysDbConnection(), "select ElementID as RuleID,IIF(ErrType='轻缺陷',0,IIF(ErrType='重缺陷',1,2)) as DefectLevel from LR_EvaHMWeight");
         m_DictDefectLevel = new Dictionary <string, enumDefectLevel>();
         for (int i = 0; i < dtDefectLevel.Rows.Count; i++)
         {
             m_DictDefectLevel.Add(dtDefectLevel.Rows[i][0] as string, (enumDefectLevel)Convert.ToInt32(dtDefectLevel.Rows[i][1]));
         }
     }
     catch (Exception exp)
     {
         Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());
     }
 }
示例#5
0
        /// <summary>
        /// 获取所有图层(DataTable对象)
        /// 开放给知道图层表结构的开发/应用或者配合GetLayerFromDataRow@see::GetLayerFromDataRow方法使用
        /// </summary>
        /// <returns></returns>
        public static DataTable GetAllLayers()
        {
            IDbConnection sysConnection = SysDbHelper.GetSysDbConnection();

            return(AdoDbHelper.GetDataTable(sysConnection, "select * from LR_DicLayer"));
        }
示例#6
0
        private bool InsertNomarlError(IFeatureClass destFClass)
        {
            try
            {
                string strSQL = @"
                            SELECT
                            b.CheckType,
                            a.TargetFeatClass1 as YSTC,
                            a.BSM as SourceBSM,
                            a.TargetFeatClass2 as MBTC,
                            a.BSM2 as BSM2,
                            '' as TopoLayerName,
                            a.ErrMsg as Description,
                            IIF(a.IsException,1,0) as IsException,
                            IIf(a.Remark is Null,'',a.Remark) as Remark,
                            b.GZBM,
                            a.OID as OID
                            
                            from LR_ResAutoAttr as a, LR_ResultEntryRule as b where a.RuleInstID=b.RuleInstID";


                DataTable      dtError      = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.ResultConnection, strSQL);
                IFeatureCursor fCusorInsert = destFClass.Insert(false);
                Dictionary <string, IFeatureClass> dictFeatureClass = new Dictionary <string, IFeatureClass>();
                Dictionary <int, int> dictFieldIndex = new Dictionary <int, int>();
                for (int i = 0; i < m_FieldCaptions.Count; i++)
                {
                    dictFieldIndex.Add(i, destFClass.FindField(m_FieldCaptions[i]));
                }
                int xFieldIndex = destFClass.FindField("X坐标");
                int yFieldIndex = destFClass.FindField("Y坐标");

                for (int i = 0; i < dtError.Rows.Count; i++)
                {
                    DataRow       rowError = dtError.Rows[i];
                    IFeatureClass curFClass;
                    string        strFClassAlias = rowError["YSTC"] as string;
                    if (!dictFeatureClass.ContainsKey(strFClassAlias))
                    {
                        int           standardID = SysDbHelper.GetStandardIDBySchemaID(this.SchemaID);
                        string        strFClass  = LayerReader.GetNameByAliasName(strFClassAlias, standardID);
                        IFeatureClass fClass     = (this.BaseWorkspace as IFeatureWorkspace).OpenFeatureClass(strFClass);
                        dictFeatureClass.Add(strFClassAlias, fClass);
                        curFClass = fClass;
                    }
                    else
                    {
                        curFClass = dictFeatureClass[strFClassAlias];
                    }

                    if (curFClass == null)
                    {
                        continue;
                    }

                    object objOID = rowError["OID"];
                    if (objOID == null)
                    {
                        continue;
                    }

                    int      oid        = Convert.ToInt32(objOID);
                    IFeature srcFeature = curFClass.GetFeature(oid);
                    if (srcFeature == null)
                    {
                        continue;
                    }

                    IFeatureBuffer fNew = destFClass.CreateFeatureBuffer();
                    for (int j = 0; j < m_FieldCaptions.Count; j++)
                    {
                        int fIndex = dictFieldIndex[j];
                        if (fIndex < 0)
                        {
                            continue;
                        }

                        fNew.set_Value(fIndex, rowError[j]);
                    }
                    fNew.Shape = GetErrorGeometry(srcFeature);
                    IPoint point = fNew.Shape as IPoint;
                    fNew.set_Value(xFieldIndex, point.X);
                    fNew.set_Value(yFieldIndex, point.Y);

                    fCusorInsert.InsertFeature(fNew);

                    if (i % 2000 == 0)
                    {
                        fCusorInsert.Flush();
                    }
                }

                fCusorInsert.Flush();

                return(true);
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                return(false);
            }
        }
示例#7
0
        public static DataTable GetAllFields()
        {
            IDbConnection sysConnection = SysDbHelper.GetSysDbConnection();

            return(Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(sysConnection, "select * from LR_DicField"));
        }