/// <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); } }
/// <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); }
/// <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); }
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); }
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); }
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])); }
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])); }
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); }
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); }
/// <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])); }
/// <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); }
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)); }
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); } }
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); } }
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); }
/// <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); }
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); }
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); }
/// <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); }
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); }
/// <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(); } } }
/// <summary> /// 获取所有图层(DataTable对象) /// 开放给知道图层表结构的开发/应用或者配合GetLayerFromDataRow@see::GetLayerFromDataRow方法使用 /// </summary> /// <returns></returns> public static DataTable GetAllLayers() { IDbConnection sysConnection = SysDbHelper.GetSysDbConnection(); return(AdoDbHelper.GetDataTable(sysConnection, "select * from LR_DicLayer")); }
private List <Error> GetTKXSResult(DataTable pRecord) { DataTable pDt = null; DataTable tkxs1Dt = null; try { List <Error> pResAttr = new List <Error>(); string strZLDWDM = "座落单位代码"; string strXZQDM = "行政区代码"; if (pRecord.Rows.Count > 0) { DataRow dr = pRecord.Rows[0]; DataColumnCollection dcCollection = pRecord.Columns; string sqlStr = "select * from " + COMMONCONST.TB_DIST_TKXS; AdoDbHelper.OpenTable(COMMONCONST.TB_DIST_TKXS, ref pDt, base.m_QueryConnection); if (pDt == null || pDt.Rows.Count == 0) { return(null); } //到TKXS1表中查找相应数据(全部tkxs的集合),字段顺序与DIST_TKXS一致 sqlStr = "select XZQDM,XZQMC,T2DEGREE,T6DEGREE,T15DEGREE,T25DEGREE,P2DEGREE,P6DEGREE,P15DEGREE,P25DEGREE from " + COMMONCONST.TB_TKXS1 + " where XZQDM = '" + pDt.Rows[0]["XZQDM"].ToString() + "'"; tkxs1Dt = AdoDbHelper.GetDataTable(base.m_QueryConnection, sqlStr); for (int i = 0; i < dcCollection.Count; i++) { DataColumn dc = dcCollection[i]; string strColumnName = dc.ColumnName; double value; if (!double.TryParse(dr[strColumnName].ToString(), out value) || strColumnName.Trim().Equals("xzqdm", StringComparison.OrdinalIgnoreCase) || strColumnName.Trim().Equals("xzqmc", StringComparison.OrdinalIgnoreCase)) { continue; } if (Math.Round(value, 4) > 0.10) { bool flag = false; int index = (i == 2 ? i : ((2 * i) + (2 * (i - 3)))); string[] tkxs1Values = tkxs1Dt.Rows[0][i].ToString().Split(','); Hashtable tkxs1HsTable = new Hashtable(); foreach (string dnStr in tkxs1Values) { if (!tkxs1HsTable.ContainsKey(dnStr)) { tkxs1HsTable.Add(double.Parse(dnStr), null); } } for (int j = 0; j < 4; j++) { double tempValue; double.TryParse(pDt.Rows[0][index + j].ToString(), out tempValue); if (tempValue != 0 && !tkxs1HsTable.ContainsKey(tempValue)) { flag = true; break; } } if (!flag) { pRecord.Rows[0][i] = 0; continue; } // 添家结果记录 Error err = new Error(); err.DefectLevel = this.m_DefectLevel; err.RuleID = this.InstanceID; err.LayerName = COMMONCONST.TABLENAME; err.ReferLayerName = m_structPara.strFtName2; string str = strColumnName.Replace(COMMONCONST.TB_DIST_TKXS, "田坎系数"); err.Description = "本软件提取的'" + str + "'与省级上报的'" + str + "'不相等"; pResAttr.Add(err); } } } return(pResAttr); } catch (Exception ex) { //Hy.Check.Rule.Helper.LogAPI.CheckLog.AppendErrLogs(ex.ToString()); return(null); } finally { if (pDt != null) { pDt.Dispose(); } if (tkxs1Dt != null) { tkxs1Dt.Dispose(); } } }
public override bool Check(ref List <Error> checkResult) { //System.Diagnostics.Stopwatch MyWatch = new System.Diagnostics.Stopwatch(); //MyWatch.Start(); System.Data.OleDb.OleDbDataReader reader = null; try { DataTable pRecordset = new DataTable(); if (m_structPara.strScript == "行政区层中行政区代码与行政区名称不匹配") { string strTemp = "select objectid,BSM,xzqdm, xzqmc,qsdwmc from(select a2.objectid,a2.BSM,a2.xzqdm,a2.xzqmc, a1.qsdwdm,a1.qsdwmc from qsdmb a1 inner join xzq a2 on left(a1.qsdwdm,12)=left(a2.xzqdm,12) where mid(qsdwdm,12,1)<>'0' and right(qsdwdm,7)='0000000') where Trim(a2.xzqmc)<>Trim(a1.qsdwmc)"; pRecordset = AdoDbHelper.GetDataTable(base.m_QueryConnection, strTemp); if (pRecordset == null || pRecordset.Rows.Count == 0) { string strLog = "当前规则的SQL查询语句设置有误,无法执行多表关系检查!"; SendMessage(enumMessageType.RuleError, strLog); return(false); } } else if (m_structPara.strScript.Contains("权属代码表不一致") || m_structPara.strScript.Contains("权属单位代码表不一致")) { reader = AdoDbHelper.GetQueryReader(base.m_QueryConnection, m_structPara.strClause) as OleDbDataReader; if (reader == null) { string strLog = "当前规则的SQL查询语句设置有误,无法执行多表关系检查!"; SendMessage(enumMessageType.RuleError, strLog); return(false); } pRecordset.Load(reader); } else { pRecordset = AdoDbHelper.GetDataTable(base.m_QueryConnection, m_structPara.strClause); if (pRecordset == null || pRecordset.Rows.Count == 0) { string strLog = "当前规则的SQL查询语句设置有误,无法执行多表关系检查!"; SendMessage(enumMessageType.RuleError, strLog); return(false); } } string strSql = ""; bool bTable = false; if (FtName1.Contains("表") || FtName2.Contains("表")) { if (m_structPara.strFtName2.Equals("qsdmb", StringComparison.OrdinalIgnoreCase)) { strSql = "update LR_ResultEntryRule set TargetFeatClass1= '" + FtName1 + "',TargetFeatClass2='" + FtName2 + "|' where RuleInstID='" + base.m_InstanceID + "'"; } else { strSql = "update LR_ResultEntryRule set TargetFeatClass1= '" + COMMONCONST.TABLENAME + "',TargetFeatClass2='|' where RuleInstID='" + base.m_InstanceID + "'"; bTable = true; } } else { strSql = "update LR_ResultEntryRule set TargetFeatClass1= '" + FtName1 + "',TargetFeatClass2='" + FtName2 + "|' where RuleInstID='" + base.m_InstanceID + "'"; } AdoDbHelper.ExecuteSql(m_ResultConnection, strSql); //获取需要特殊处理的规则别名 Hashtable hashtable = GetEnumHash(); if (hashtable.Contains(m_structPara.strAlias)) { if (m_structPara.strAlias.Equals("省级上报田坎系数与上报数据中田坎系数是否一致检查")) { checkResult = GetTKXSResult(pRecordset); } else { checkResult = GetAttrResult(pRecordset); } } else { checkResult = GetResult(pRecordset, bTable); } if (pRecordset != null) { pRecordset.Dispose(); return(true); } } catch (Exception ex) { SendMessage(enumMessageType.RuleError, string.Format("意外失败,信息:{0}", ex.Message)); SendMessage(enumMessageType.Exception, ex.ToString()); return(false); } finally { if (reader != null) { reader.Dispose(); reader.Close(); GC.Collect(); } } //MyWatch.Stop(); //System.Windows.Forms.MessageBox.Show("时间:" + MyWatch.ElapsedMilliseconds.ToString() + "毫秒"); return(true); }
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); }
/// <summary> /// 获取系统库中所有记录 /// </summary> /// <returns></returns> public static DataTable GetAllTaskRecord() { IDbConnection sysConnection = SysDbHelper.GetSysDbConnection(); return(AdoDbHelper.GetDataTable(sysConnection, "select * from LR_ModelTask where BIsTemplate=0")); }