Exemple #1
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);
        }
Exemple #2
0
        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();
                }
            }
        }