Esempio n. 1
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);
        }
Esempio n. 2
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;
        }