Пример #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);
        }
Пример #2
0
        /// <summary>
        /// 指写入数据库记录
        /// </summary>
        /// <param name="task"></param>
        /// <returns></returns>
        public static bool AddTask(Task task)
        {
            try
            {
                IDbConnection sysConnection = SysDbHelper.GetSysDbConnection();
                DataTable     tTask         = AdoDbHelper.GetDataTable(sysConnection, "select * from LR_ModelTask where 1=2");
                DataRow       rowNewTask    = tTask.NewRow();
                rowNewTask["TaskID"]        = task.ID;
                rowNewTask["TaskName"]      = task.Name;
                rowNewTask["TaskPath"]      = task.Path;
                rowNewTask["LibraryName"]   = task.SourcePath;
                rowNewTask["TaskType"]      = (int)task.DatasourceType;
                rowNewTask["SchemaID"]      = task.SchemaID;
                rowNewTask["ExeState"]      = (int)task.State;
                rowNewTask["Institution"]   = task.Institution;
                rowNewTask["Person"]        = task.Creator;
                rowNewTask["CreateTime"]    = task.CreateTime;
                rowNewTask["Remark"]        = task.Remark;
                rowNewTask["MapScale"]      = task.MapScale;
                rowNewTask["TopoTolerance"] = task.TopoTolerance;
                rowNewTask["UseDatasource"] = task.UseSourceDirectly;

                rowNewTask["StandardID"] = SysDbHelper.GetStandardID(task.StandardName);

                rowNewTask["LibraryID"]   = 0;
                rowNewTask["BIsTemplate"] = 0;

                tTask.Rows.Add(rowNewTask);
                return(AdoDbHelper.UpdateTable("LR_ModelTask", tTask, sysConnection));
            }
            catch
            {
                return(false);
            }
        }
Пример #3
0
        public int GetResultsCount()
        {
            int          count  = 0;
            DbDataReader reader = null;

            try
            {
                string strSql = string.Format("select sum(errorcount) as cout from  {0}", COMMONCONST.RESULT_TB_RESULT_ENTRY_RULE);

                reader = AdoDbHelper.GetQueryReader(m_ResultDbConn, strSql) as DbDataReader;
                if (reader.HasRows)
                {
                    reader.Read();
                    count = int.Parse(reader[0].ToString());
                }
                return(count);
            }
            catch
            {
                return(count);
            }
            finally
            {
                reader.Close();
                reader.Dispose();
            }
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="nLayerID">图层的ID</param>
        /// <param name="strStdName">建库标准名称</param>
        /// <param name="strAttrTableName">图层别名</param>
        /// <returns></returns>
        public bool GetLayerIDByTableName(ref int nLayerID, string schemaID, string strAttrTableName)
        {
            try
            {
                int nStdID = SysDbHelper.GetStandardIDBySchemaID(schemaID);

                string strSql = "Select LayerID From LR_DicLayer Where StandardID = " + nStdID + "and AttrTableName = '" +
                                strAttrTableName + "'";
                DataTable dt = new DataTable();
                //	打开表LR_DicStandard
                dt = AdoDbHelper.GetDataTable(this.m_DBConnection, strSql);
                if (dt.Rows.Count == 0)
                {
                    return(false);
                }
                DataRow dr = dt.Rows[0];
                nLayerID = Convert.ToInt32(dr["LayerID"]);
            }
            catch (Exception ex)
            {
                //Hy.Check.Rule.Helper.LogAPI.CheckLog.AppendErrLogs(ex.ToString());
                //显示错误信息;
                //XtraMessageBox.Show("XStandardHelper::GetLayerIDByAlias()" + ex.Message);
                return(false);
            }
            return(true);
        }
Пример #5
0
        /// <summary>
        /// 释放uc中使用的资源
        /// </summary>
        public void UCDispose()
        {
            try
            {
                ////情况dock上的文本
                dockResults.Text = "";
                try
                {
                    this.dockTree.Visibility = DockVisibility.Hidden;
                }
                catch { }
                try
                {
                    this.dockResults.Visibility = DockVisibility.Hidden;
                }
                catch { }

                //try
                //{
                //    this.dockAttribute.Visibility = DockVisibility.Hidden;
                //}
                //catch { }

                //try
                //{
                //    this.dockLegend.Visibility = DockVisibility.Hidden;
                //}
                //catch { }

                this.TocControl.SetBuddyControl(null);
                //删除图上所有的图形要素
                this.UcMap.Map.ClearSelection();
                //删除地图上所有的绘制的要素
                IGraphicsContainer pGraphContainer = UcMap.ActiveView.GraphicsContainer;
                pGraphContainer.DeleteAllElements();

                //清楚所有的图层信息
                UcMap.ClearLayers();
                UcMap.ActiveView.Refresh();

                //清空结果库连接
                if (m_CurrentTask != null)
                {
                    AdoDbHelper.CloseDbConnection(m_CurrentTask.ResultConnection);
                    m_CurrentTask.Release();
                }

                //清空tree的结果
                //ucRulesTree.Dispose();

                //TocControl = null;
                GC.Collect();
            }
            catch
            {
            }
        }
Пример #6
0
        /// <summary>
        /// 获取任务的编号
        /// </summary>
        /// <param name="strModelTaskNumber"></param>
        /// <returns></returns>
        public static bool GetTaskID(out string strModelTaskNumber)//, IDbConnection pConnection)
        {
            IDbConnection pConnection = GetSysDbConnection();
            IDataReader   reader      = null;

            strModelTaskNumber = string.Empty;
            try
            {
                string strdate = DateTime.Today.Year.ToString();
                //给任务添加编号
                strdate = "T" + strdate;
                string strSql = string.Format("SELECT max(TaskID) FROM LR_ModelTask where Left(TaskID,5) =  '{0}'", strdate);

                reader = AdoDbHelper.GetQueryReader(pConnection, strSql);

                //如果为空,表示获取不成功,返回结果
                if (reader == null)
                {
                    return(false);
                }

                if (!(reader as System.Data.OleDb.OleDbDataReader).HasRows)
                {
                    strModelTaskNumber = strdate + "001";
                    return(true);
                }
                while (reader.Read())
                {
                    string strNum = reader[0].ToString();
                    if (string.IsNullOrEmpty(strNum))
                    {
                        strModelTaskNumber = strdate + "001";
                    }
                    else
                    {
                        int nID = Convert.ToInt32(strNum.Substring(1)) + 1;
                        strModelTaskNumber = strNum.Substring(0, 1) + nID.ToString();
                    }
                    return(true);
                }
            }
            catch (Exception exp) //捕捉异常
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                return(false);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
            return(true);
        }
Пример #7
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);
        }
Пример #8
0
        public static int GetStandardIDBySchemaID(string schemaID)
        {
            DataTable tStandard = AdoDbHelper.GetDataTable(GetSysDbConnection(), string.Format("select a.StandardID from LR_DicStandard  as a, LR_ModelSchema as b where b.SchemaID='{0}' and a.StandardName=b.StandardName", schemaID));

            if (tStandard == null || tStandard.Rows.Count == 0)
            {
                return(-1);
            }

            return(Convert.ToInt32(tStandard.Rows[0][0]));
        }
Пример #9
0
        public static string GetStandardNameBySchemaID(string schemaID)
        {
            DataTable tStandard = AdoDbHelper.GetDataTable(GetSysDbConnection(), string.Format("select StandardName  from LR_ModelSchema where SchemaID='{0}'", schemaID));

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

            return(tStandard.Rows[0][0] as string);
        }
Пример #10
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));
        }
Пример #11
0
        public static int GetStandardID(string standardName)
        {
            DataTable tStandard = AdoDbHelper.GetDataTable(GetSysDbConnection(), string.Format("select StandardID  from LR_DicStandard where StandardName='{0}'", standardName));

            if (tStandard == null || tStandard.Rows.Count == 0)
            {
                return(-1);
            }

            return(Convert.ToInt32(tStandard.Rows[0][0]));
        }
Пример #12
0
        private bool CheckbyAdo(ref List <Hy.Check.Define.Error> checkResult)
        {
            DataTable ipRecordset = new DataTable();

            try
            {
                string strSql = "Select " + m_structPara.strSheetField + ",SUM(Shape_Area),SUM(" +
                                m_structPara.strExpression + "),SUM(Shape_Area-(" + m_structPara.strExpression + ")) From " +
                                layerName + " GROUP BY " + m_structPara.strSheetField + "";

                ipRecordset = AdoDbHelper.GetDataTable(this.m_QueryConnection, strSql);

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

                checkResult = new List <Hy.Check.Define.Error>();

                foreach (DataRow dr in ipRecordset.Rows) //遍历结果集
                {
                    if (dr != null)
                    {
                        Hy.Check.Define.Error res = new Hy.Check.Define.Error();

                        //误差值
                        double dbError = Convert.ToDouble(dr[3]);
                        //计算面积
                        double dbCalArea = Convert.ToDouble(dr[1]);
                        //调查面积
                        double dbSurveyArea = Convert.ToDouble(dr[2]);

                        res.Description = "ABS(计算面积:" + Math.Round(dbCalArea, 2) + "-调查面积:" +
                                          dbSurveyArea.ToString("F2") + ")=" +
                                          Math.Abs(dbError).ToString("F2") +
                                          ",大于设定的阈值" + m_structPara.dbThreshold + "";

                        checkResult.Add(res);
                    }
                }
            }
            catch (Exception ex)
            {
                SendMessage(enumMessageType.Exception, ex.ToString());
            }
            finally
            {
                if (ipRecordset != null)
                {
                    ipRecordset.Dispose();
                }
            }
            return(true);
        }
Пример #13
0
        public static string GetStandardName(int standardID)
        {
            DataTable tStandard = AdoDbHelper.GetDataTable(GetSysDbConnection(), string.Format("select StandardName from LR_DicStandard where StandardID={0}", standardID));

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

            return(tStandard.Rows[0][0] as string);
        }
Пример #14
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]));
        }
Пример #15
0
        // 保存结果,主要用于CRuleDistrict,CRulePlotClass,CRuleSheet,CRuleStatAdminRegion
        public bool SaveResult(string strTargetFc)
        {
            try
            {
                string strSql = "delete * from LR_ResAutoStat_PlotClass where RuleInstID='" + base.m_InstanceID + "'";
                Hy.Common.Utility.Data.AdoDbHelper.ExecuteSql(base.m_ResultConnection, strSql);
                //------------------------------------------------//
                //				在结果表中存储结果				  //
                //------------------------------------------------//
                DataTable ipRecordset = new DataTable();

                if (!AdoDbHelper.OpenTable("LR_ResAutoStat_PlotClass", ref ipRecordset, base.m_ResultConnection))
                {
                    return(false);
                }

                for (int i = 0; i < m_arrResult.Count; i++)
                {
                    RuleExpression.RESULT res = m_arrResult[i];
                    //------设置字段数据
                    DataRow dr = ipRecordset.NewRow();
                    dr["RuleInstID"] = base.m_InstanceID;
                    dr["目标图层"]       = strTargetFc;
                    dr["统计内容名称"]     = res.IDName;
                    dr["计算面积"]       = res.dbCalArea;
                    dr["调查面积"]       = res.dbSurveyArea;
                    string strErr = "" + Math.Abs(res.dbError / res.dbCalArea) * 100 + "";
                    dr["误差(百分比)"] = strErr;
                    dr["错误消息"]    = res.strErrInfo;

                    //------添加新记录
                    ipRecordset.Rows.Add(dr);

                    //更新记录
                    ipRecordset.AcceptChanges();
                }

                AdoDbHelper.UpdateTable("LR_ResAutoStat_PlotClass", ipRecordset, base.m_ResultConnection);

                //关闭记录集
                ipRecordset.Dispose();
            }
            catch (Exception ex)
            {
                //Hy.Check.Rule.Helper.LogAPI.CheckLog.AppendErrLogs(ex.ToString());
                //显示错误信息
                //XtraMessageBox.Show("CRulePlot::SaveResult():" + ex.Message + "");
                return(false);
            }

            return(true);
        }
Пример #16
0
        /// <summary>
        /// 获取权重信息对照表
        /// </summary>
        /// <param name="TopoTable">拓扑错误信息的权重信息:key:ArcGISRule,value:ErrType</param>
        /// <returns>返回属性表的权重信息,key:RuleInstID,value:ErrType</returns>
        public static Hashtable GetEvaWeightTableByModelID(string EvModelId, ref Hashtable TopoTable)
        {
            Hashtable AttrHash = new Hashtable();

            TopoTable = new Hashtable();
            DataTable dt = new DataTable();

            try
            {
                if (string.IsNullOrEmpty(EvModelId))
                {
                    return(null);
                }
                string strSql = string.Format("select * from LR_EvaHMWeight where ModelID='{0}'", EvModelId);

                dt = AdoDbHelper.GetDataTable(GetSysDbConnection(), strSql);
                if (dt == null || dt.Rows.Count == 0)
                {
                    return(null);
                }

                foreach (DataRow dr in dt.Rows)
                {
                    if (!Convert.ToBoolean(dr["IsTopoRule"]))
                    {
                        if (!AttrHash.Contains(dr["ElementID"].ToString()))
                        {
                            AttrHash.Add(dr["ElementID"].ToString(), dr["ErrType"].ToString());
                        }
                    }
                    else
                    {
                        if (!TopoTable.Contains(dr["ArcGISRule"].ToString()))
                        {
                            TopoTable.Add(dr["ArcGISRule"].ToString(), dr["ErrType"].ToString());
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                return(null);
            }
            finally
            {
                dt.Dispose();
            }
            return(AttrHash);
        }
Пример #17
0
        private DataTable GetErrors(IDbConnection resultConnection)
        {
            string strSQL = @"SELECT
                            b.CheckType as 检查类型,
                            a.TargetFeatClass1 as 源图层,
                            a.BSM as 标识码,
                            a.TargetFeatClass2 as 目标图层,
                            a.BSM2 as 标识码2,
                            b.GZBM as 规则编码,
                            a.ErrMsg as 错误描述
                            from LR_ResAutoAttr as a, LR_ResultEntryRule as b where a.RuleInstID=b.RuleInstID

                                union all

                            SELECT
                            b.CheckType as 检查类型,
                            a.YSTC  as 源图层,
                            a.SourceBSM as 标识码,
                            a.MBTC as 目标图层,
                            a.TargetBSM as 标识码2,
                            b.GZBM as 规则编码,
                            a.Reason as 错误描述
                            from LR_ResAutoTopo as a, LR_ResultEntryRule as b where a.RuleInstID=b.RuleInstID

                                union all

                            SELECT
                            b.CheckType as 检查类型,
                            a.AttrTabName as 源图层,
                            '' as 标识码,
                            '' as 目标图层,
                            '' as 标识码2,
                            b.GZBM as 规则编码,
                            a.ErrorReason as 错误描述
                            from LR_ResIntField as a, LR_ResultEntryRule as b where a.RuleInstID=b.RuleInstID

                                union all

                            SELECT
                            b.CheckType as 检查类型,
                            a.ErrorLayerName as 源图层,
                            '' as 标识码,
                            '' as 目标图层,
                            '' as 标识码2,
                            b.GZBM as 规则编码,
                            a.ErrorReason as 错误描述
                            from LR_ResIntLayer as a, LR_ResultEntryRule as b where a.RuleInstID=b.RuleInstID";

            return(AdoDbHelper.GetDataTable(resultConnection, strSQL));
        }
Пример #18
0
        public DataTable GetAllResults()
        {
            DataTable res = new DataTable();

            try
            {
                string strSql = string.Format("select RuleErrId,CheckType ,RuleInstID,RuleExeState,ErrorCount,TargetFeatClass1,GZBM,ErrorType from  {0}", COMMONCONST.RESULT_TB_RESULT_ENTRY_RULE);

                return(AdoDbHelper.GetDataTable(m_ResultDbConn, strSql));
            }
            catch
            {
                return(res);
            }
        }
Пример #19
0
        public DataTable GetLayersResults()
        {
            DataTable res = new DataTable();

            try
            {
                string strSql = string.Format("SELECT checkType,targetfeatclass1,sum(errorcount)  as ErrCount,max(RuleErrID) as ruleId from {0} group by targetfeatclass1,checktype order by max(RuleErrID)", COMMONCONST.RESULT_TB_RESULT_ENTRY_RULE);

                return(AdoDbHelper.GetDataTable(m_ResultDbConn, strSql));
            }
            catch
            {
                return(res);
            }
        }
Пример #20
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);
        }
Пример #21
0
        /// <summary>
        /// 获取所有规则类信息
        /// </summary>
        /// <returns></returns>
        public static DataTable GetAllModelRules()
        {
            DataTable dt = null;

            try
            {
                string strSQL = "select * from LR_ModelRule";
                dt = AdoDbHelper.GetDataTable(GetSysDbConnection(), strSQL);
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                return(dt);
            }
            return(dt);
        }
Пример #22
0
        private bool CheckbyAdo(string strTableName)
        {
            DataTable ipRecordset = new DataTable();

            string strSql = "Select OBJECTID,BSM," + m_structPara.strExpression + ",TBMJ,TBMJ-(" +
                            m_structPara.strExpression + ") From " + strTableName + " WHERE ABS(TBMJ-(" +
                            m_structPara.strExpression + ")) > " + m_structPara.dbThreshold + "";

            ipRecordset = AdoDbHelper.GetDataTable(base.m_ResultConnection, strSql);

            if (ipRecordset == null || ipRecordset.Rows.Count == 0)
            {
                SendMessage(enumMessageType.RuleError, string.Format("检查失败:语句{0}执行失败", strSql));
                return(false);
            }

            foreach (DataRow dr in ipRecordset.Rows)
            {
                if (dr != null)
                {
                    RuleExpression.RESULT res = new RuleExpression.RESULT();

                    res.dbError = Convert.ToDouble(dr[4]);

                    if (Math.Round(Math.Abs(res.dbError), 5) > 0.01)
                    {
                        res.nOID         = Convert.ToInt32(dr[0]);
                        res.BSM          = Convert.ToInt32(dr[1]);
                        res.dbCalArea    = Convert.ToDouble(dr[2]);
                        res.dbSurveyArea = Convert.ToDouble(dr[3]);

                        //res.strErrInfo = "标识码为{0}的图斑面积和(图斑地类面积+零星地物面积+扣除地类面积+线状地物面积)之差为" +
                        //                 Math.Abs(res.dbError).ToString("F2") +
                        //                 "平方米,大于设定的阈值0.01平方米";
                        res.strErrInfo = string.Format("{0}标识码为{1}的图斑面积{2}与(图斑地类面积+零星地物面积+扣除地类面积+线状地物面积){3}之差为{4}平方米,应≤0.01平方米", m_structPara.strFtName, res.BSM, res.dbSurveyArea, res.dbCalArea, Math.Abs(res.dbError).ToString("F2"));

                        m_arrResult.Add(res);
                    }
                }
            }
            ipRecordset.Dispose();

            return(true);
        }
Пример #23
0
        /// <summary>
        /// 获取系统库中的方案信息.
        /// </summary>
        /// <returns>Dictionary&lt;SchemaID,SchemaName&gt;</returns>
        public static Dictionary <string, string> GetSchemasInfo(string standardName)
        {
            IDataReader reader = null;
            Dictionary <string, string> schemaInfo = new Dictionary <string, string>();

            try
            {
                if (string.IsNullOrEmpty(standardName))
                {
                    return(null);
                }
                string strSql = string.Format("SELECT SchemaID,SchemaName  FROM LR_ModelSchema where  standardName='{0}'", standardName);

                reader = AdoDbHelper.GetQueryReader(GetSysDbConnection(), strSql);

                //如果为空,表示获取不成功,返回结果
                if (reader == null)
                {
                    return(null);
                }
                while (reader.Read())
                {
                    schemaInfo.Add(reader[0].ToString(), reader[1].ToString());
                }
                return(schemaInfo);
            }
            catch (Exception exp) //捕捉异常
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                return(null);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
        }
Пример #24
0
        public static DataTable GetSchemaRulesPara(string schemaId)
        {
            DataTable dt = null;

            try
            {
                if (string.IsNullOrEmpty(schemaId))
                {
                    return(dt);
                }
                string strSql = String.Format("SELECT * FROM LR_ModelSchemaPara WHERE SchemaID='{0}'", schemaId);
                dt = AdoDbHelper.GetDataTable(GetSysDbConnection(), strSql);
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                return(dt);
            }
            return(dt);
        }
Пример #25
0
        /// <summary>
        /// 获取上一级规则的规则列表.用于规则列表分级
        /// </summary>
        /// <param name="schemaId">The schema id.</param>
        /// <returns></returns>
        public static DataTable GetRulesClassifyList(string schemaId)
        {
            DataTable dt = null;

            try
            {
                if (string.IsNullOrEmpty(schemaId))
                {
                    return(dt);
                }
                string strSql = String.Format("SELECT * FROM LR_CheckTypeModel WHERE SchemaID='{0}' order by YJMLBM,EJMLBM,SJMLBM", schemaId);
                dt = AdoDbHelper.GetDataTable(GetSysDbConnection(), strSql);
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                return(dt);
            }
            return(dt);
        }
Пример #26
0
        public static DataTable GetEvaluateModel(string EvModelId)
        {
            DataTable dt = null;

            try
            {
                if (string.IsNullOrEmpty(EvModelId))
                {
                    return(dt);
                }
                string strSql = String.Format("SELECT * FROM LR_EvaluateModel WHERE ModelID='{0}'", EvModelId);
                dt = AdoDbHelper.GetDataTable(GetSysDbConnection(), strSql);
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                return(dt);
            }
            return(dt);
        }
Пример #27
0
        /// <summary>
        /// 获取权重信息对照表
        /// </summary>
        /// <param name="TopoTable">拓扑错误信息的权重信息:key:ArcGISRule,value:ErrType</param>
        /// <returns>返回属性表的权重信息,key:RuleInstID,value:ErrType</returns>
        public static Hashtable GetEvaWeightTable(string schemaId, ref Hashtable topoTable)
        {
            DataTable dt = new DataTable();

            DataTable dt1 = null;

            try
            {
                if (string.IsNullOrEmpty(schemaId))
                {
                    return(null);
                }
                string strSql = String.Format("SELECT * FROM LR_EvaluateModel WHERE SchemaId='{0}'", schemaId);
                dt1 = AdoDbHelper.GetDataTable(GetSysDbConnection(), strSql);
                if (dt1 == null || dt1.Rows.Count == 0)
                {
                    return(null);
                }
                string strModelId = dt1.Rows[0]["ModelID"].ToString();

                return(GetEvaWeightTableByModelID(strModelId, ref topoTable));
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                return(null);
            }
            finally
            {
                dt.Dispose();

                if (dt1 != null)
                {
                    dt1.Dispose();
                }
            }
        }
Пример #28
0
        /// <summary>
        /// 获取系统库中的标准信息.
        /// </summary>
        /// <returns>Dictionary<standardId,standardName></returns>
        public static Dictionary <int, string> GetStandardInfo()
        {
            IDataReader reader = null;
            Dictionary <int, string> standardInfo = new Dictionary <int, string>();

            try
            {
                string strSql = "SELECT StandardID,StandardName  FROM LR_DicStandard order by StandardID";

                reader = AdoDbHelper.GetQueryReader(GetSysDbConnection(), strSql);

                //如果为空,表示获取不成功,返回结果
                if (reader == null)
                {
                    return(null);
                }
                while (reader.Read())
                {
                    standardInfo.Add(Convert.ToInt32(reader[0]), reader[1].ToString());
                }
                return(standardInfo);
            }
            catch (Exception exp) //捕捉异常
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

                return(null);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
        }
Пример #29
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"));
        }
Пример #30
0
        private bool CheckbyAdo(ref List <Hy.Check.Define.Error> checkResult)
        {
            DataTable ipRecordset = new DataTable();

            try
            {
                //根据级别,取相应的所有地类代码
                string strSql = "";
                strSql = "SELECT " + m_structPara.strCodeField + ",Shape_Area FROM " + FatherLayerName + "";

                //打开记录集
                ipRecordset = AdoDbHelper.GetDataTable(this.m_QueryConnection, strSql);

                if (ipRecordset == null)
                {
                    return(false);
                }
                checkResult = new List <Hy.Check.Define.Error>();

                foreach (DataRow dr in ipRecordset.Rows) //遍历结果集
                {
                    if (dr != null)
                    {
                        string IDName    = dr[0].ToString();
                        double dbCalArea = Convert.ToDouble(dr[1]);

                        //与子图层关联的子段值,如:行政区名
                        DataTable ipRecordsetRes = new DataTable();

                        //根据所属区域所指定面积进行统计
                        string strSql1 = "Select SUM(" + m_structPara.strCompareField + ") FROM " + ChildLayerName +
                                         " Where " + m_structPara.strOwnerField + "='" + IDName + "'";

                        ipRecordsetRes = AdoDbHelper.GetDataTable(this.m_QueryConnection, strSql1);
                        //打开字段表记录集
                        if (ipRecordsetRes == null)
                        {
                            continue;
                        }

                        foreach (DataRow dr1 in ipRecordsetRes.Rows)
                        {
                            Error res = new Error();

                            double dbSurveyArea = Convert.ToDouble(dr1[0]);
                            double dbError      = dbCalArea - dbSurveyArea;
                            res.LayerName      = FatherLayerName;
                            res.ReferLayerName = ChildLayerName;

                            if (Math.Round(Math.Abs(dbError), 2) > m_structPara.dbThreshold)
                            {
                                res.Description = "ABS(计算面积:" + Math.Round(dbCalArea, 2) + "-调查面积:" +
                                                  dbSurveyArea.ToString("F2") + ")=" +
                                                  Math.Abs(dbError).ToString("F2") +
                                                  ",大于设定的阈值" + m_structPara.dbThreshold + "";
                                checkResult.Add(res);
                            }
                        }
                        ipRecordsetRes.Dispose();
                    }
                }
            }
            catch
            {
                return(false);
            }
            finally
            {
                if (ipRecordset != null)
                {
                    ipRecordset.Dispose();
                }
            }
            return(true);
        }