コード例 #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);
        }
コード例 #2
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);
        }
コード例 #3
0
        private bool CheckbyAdo(string strTableName)
        {
            DataTable ipRecordset = new DataTable();

            //根据级别,取相应的所有地类代码
            string strSql   = "";
            string strWhere = "";

            if (m_structPara.strClass.CompareTo("一级地类") == 0)
            {
                strSql   = "SELECT DISTINCT(LEFT(" + m_structPara.strClassField + ",1)) FROM " + strTableName + "";
                strWhere = "LEFT(" + m_structPara.strClassField + ",1)";
            }
            else if (m_structPara.strClass.CompareTo("二级地类") == 0)
            {
                strSql   = "SELECT DISTINCT(LEFT(" + m_structPara.strClassField + ",2)) FROM " + strTableName + "";
                strWhere = "LEFT(" + m_structPara.strClassField + ",2)";
            }
            else if (m_structPara.strClass.CompareTo("三级地类") == 0)
            {
                strSql   = "SELECT DISTINCT(LEFT(" + m_structPara.strClassField + ",3)) FROM " + strTableName + "";
                strWhere = "LEFT(" + m_structPara.strClassField + ",3)";
            }
            else if (m_structPara.strClass.CompareTo("四级地类") == 0)
            {
                strSql   = "SELECT DISTINCT(LEFT(" + m_structPara.strClassField + ",4)) FROM " + strTableName + "";
                strWhere = "LEFT(" + m_structPara.strClassField + ",4)";
            }
            //打开记录集,并分组
            ipRecordset = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.m_QueryConnection, strSql);

            if (ipRecordset.Rows.Count == 0)
            {
                return(false);
            }

            foreach (DataRow dr in ipRecordset.Rows) //遍历结果集
            {
                if (dr != null)
                {
                    string strCode = dr[0].ToString();

                    DataTable ipRecordsetRes = new DataTable();

                    //根据所在辖区再查
                    string strSql1 = "Select SUM(Shape_Area),SUM(" + m_structPara.strExpression +
                                     "),SUM(Shape_Area-(" +
                                     m_structPara.strExpression + ")) FROM " + strTableName + " Where " + strWhere +
                                     "='" + strCode + "'";

                    //打开记录集,并分组
                    ipRecordsetRes = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.m_QueryConnection, strSql1);

                    if (ipRecordsetRes.Rows.Count == 0)
                    {
                        continue;
                    }
                    foreach (DataRow dr1 in ipRecordsetRes.Rows)
                    {
                        RuleExpression.RESULT res = new RuleExpression.RESULT();

                        res.dbError = Convert.ToDouble(dr1[2]);

                        if (Math.Round(Math.Abs(res.dbError), 2) > m_structPara.dbThreshold)
                        {
                            res.dbCalArea    = Convert.ToDouble(dr1[0]);
                            res.dbSurveyArea = Convert.ToDouble(dr1[1]);
                            res.IDName       = strCode;

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

                            m_arrResult.Add(res);
                        }
                    }
                    ipRecordsetRes.Dispose();
                }
            }
            ipRecordset.Dispose();
            return(true);
        }
コード例 #4
0
ファイル: RulePlotClass.cs プロジェクト: hy1314200/HyDM
        private bool CheckbyAdo(string strTableName)
        {
            DataTable ipRecordset = new DataTable();

            //���ݼ���ȡ��Ӧ�����е������
            string strSql = "";
            string strWhere = "";
            if (m_structPara.strClass.CompareTo("һ������") == 0)
            {
                strSql = "SELECT DISTINCT(LEFT(" + m_structPara.strClassField + ",1)) FROM " + strTableName + "";
                strWhere = "LEFT(" + m_structPara.strClassField + ",1)";
            }
            else if (m_structPara.strClass.CompareTo("��������") == 0)
            {
                strSql = "SELECT DISTINCT(LEFT(" + m_structPara.strClassField + ",2)) FROM " + strTableName + "";
                strWhere = "LEFT(" + m_structPara.strClassField + ",2)";
            }
            else if (m_structPara.strClass.CompareTo("��������") == 0)
            {
                strSql = "SELECT DISTINCT(LEFT(" + m_structPara.strClassField + ",3)) FROM " + strTableName + "";
                strWhere = "LEFT(" + m_structPara.strClassField + ",3)";
            }
            else if (m_structPara.strClass.CompareTo("�ļ�����") == 0)
            {
                strSql = "SELECT DISTINCT(LEFT(" + m_structPara.strClassField + ",4)) FROM " + strTableName + "";
                strWhere = "LEFT(" + m_structPara.strClassField + ",4)";
            }
            //�򿪼�¼����������
            ipRecordset = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.m_QueryConnection, strSql);

            if (ipRecordset.Rows.Count==0)
            {
                return false;
            }

            foreach (DataRow dr in ipRecordset.Rows) //���������
            {
                if (dr != null)
                {
                    string strCode = dr[0].ToString();

                    DataTable ipRecordsetRes = new DataTable();

                    //��������Ͻ���ٲ�
                    string strSql1 = "Select SUM(Shape_Area),SUM(" + m_structPara.strExpression +
                                     "),SUM(Shape_Area-(" +
                                     m_structPara.strExpression + ")) FROM " + strTableName + " Where " + strWhere +
                                     "='" + strCode + "'";

                    //�򿪼�¼����������
                    ipRecordsetRes = Hy.Common.Utility.Data.AdoDbHelper.GetDataTable(this.m_QueryConnection, strSql1);

                    if (ipRecordsetRes.Rows.Count == 0)
                    {
                        continue;
                    }
                    foreach (DataRow dr1 in ipRecordsetRes.Rows)
                    {
                        RuleExpression.RESULT res = new RuleExpression.RESULT();

                        res.dbError = Convert.ToDouble(dr1[2]);

                        if (Math.Round(Math.Abs(res.dbError), 2) > m_structPara.dbThreshold)
                        {

                            res.dbCalArea = Convert.ToDouble(dr1[0]);
                            res.dbSurveyArea = Convert.ToDouble(dr1[1]);
                            res.IDName = strCode;

                            res.strErrInfo = "ABS(�������:" + Math.Round(res.dbCalArea, 2) + "-�������:" +
                                             res.dbSurveyArea.ToString("F2") + ")=" +
                                             Math.Abs(res.dbError).ToString("F2") +
                                             ",�����趨����ֵ" + m_structPara.dbThreshold + "";

                            m_arrResult.Add(res);
                        }
                    }
                    ipRecordsetRes.Dispose();
                }
            }
            ipRecordset.Dispose();
            return true;
        }
コード例 #5
0
ファイル: RulePlot.cs プロジェクト: hy1314200/HyDM
        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;
        }