Ejemplo n.º 1
0
        /// <summary>
        ///  ��������
        /// </summary>
        /// <returns></returns>
        private bool SaveData(ref List<Error> pResult)
        {
            try
            {
                string strSql;
                // �ж���ͼ��ļ������ͣ��㡢�ߡ���
                int nGeoType = GetLayerGeoType(pSrcFeatClass);
                // �����д��Ŀ�������
                if (nGeoType == 1) // ��
                {
                    strSql = "update LR_ResultEntryRule set TargetFeatClass2='" + m_pPara.strTargetLayer +
                             "|' where RuleInstID='" +
                             this.m_InstanceID + "'";
                    Hy.Common.Utility.Data.AdoDbHelper.ExecuteSql(null, strSql);
                }
                //else if (nGeoType == 2) // ��
                //{
                //    strSql = "update LR_ResultEntryRule set TargetFeatClass1='" + m_PointLayerName +
                //             "',TargetFeatClass2='" + m_PointLayerName + "|" + m_pPara.strTargetLayer +
                //             "' where RuleInstID='" + m_RuleInfo.strID + "'";
                //    GT_CARTO.CommonAPI.ado_ExecuteSQL(m_pResultAdoConn, strSql);
                //}
                //else if (nGeoType == 3) // ��
                //{
                //    strSql = "update LR_ResultEntryRule set TargetFeatClass1='" + m_PointLayerName +
                //             "',TargetFeatClass2='" + m_PointLayerName + "|" + m_pPara.strTargetLayer +
                //             "' where RuleInstID='" + m_RuleInfo.strID + "'";
                //    GT_CARTO.CommonAPI.ado_ExecuteSQL(m_pResultAdoConn, strSql);
                //}

                IFields pFields = pSrcFeatClass.Fields;
                int nIndex = pFields.FindField("BSM");

                foreach (DictionaryEntry dn in m_RepeatOIDtoOID)
                {
                    string key = dn.Key.ToString();
                    Error err = new Error();
                    err.DefectLevel = this.m_DefectLevel;
                    err.RuleID = this.InstanceID;
                    err.LayerName = this.m_strSrcLayer;

                    RuleExpression.LRResultInfo pResInfo = new RuleExpression.LRResultInfo();
                    err.OID = Convert.ToInt32(m_PointtoOID[key]);
                    err.ReferOID = dn.Value.ToString();
                    if (nIndex >= 0)
                    {
                        IFeature pFt = pSrcFeatClass.GetFeature(pResInfo.OID);
                        err.BSM =pFt.get_Value(nIndex).ToString();
                        string[] listOID = err.ReferOID.Split(',');
                        string listBSM2 = "";
                        for (int i = 0; i < listOID.Length; i++)
                        {
                            int nOIDTemp = Convert.ToInt32(listOID[i]);
                            IFeature pFt1 = pSrcFeatClass.GetFeature(nOIDTemp);
                            listBSM2 += pFt1.get_Value(nIndex).ToString() + ",";
                        }
                        listBSM2 = listBSM2.Substring(0, listBSM2.Length - 1);
                        err.ReferBSM = listBSM2;
                    }
                    err.Description = string.Format("'{0}'�б�ʶ��Ϊ'{1}'���ʶ��Ϊ'{2}'�ĵ����໥�ص���ʵ�������ڵ���벻ӦС��{3}��", m_pPara.strTargetLayer, pResInfo.BSM, pResInfo.BSM2, m_pPara.dPointDist);
                    pResult.Add(err);
                }
            }
            catch (Exception ex)
            {
                //Hy.Check.Rule.Helper.LogAPI.CheckLog.AppendErrLogs(ex.ToString());
                //��ʾ������Ϣ;
                //XtraMessageBox.Show("RulePointDist:SaveData():" + ex.Message + " ");
                return false;
            }
            return true;
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  保存数据
        /// </summary>
        /// <returns></returns>
        private bool SaveData(ref List <Error> pResult)
        {
            try
            {
                string strSql;
                // 判断是图层的几何类型:点、线、面
                int nGeoType = GetLayerGeoType(pSrcFeatClass);
                // 在入口写入目标表名称
                if (nGeoType == 1) // 点
                {
                    strSql = "update LR_ResultEntryRule set TargetFeatClass2='" + m_pPara.strTargetLayer +
                             "|' where RuleInstID='" +
                             this.m_InstanceID + "'";
                    Hy.Common.Utility.Data.AdoDbHelper.ExecuteSql(null, strSql);
                }
                //else if (nGeoType == 2) // 线
                //{
                //    strSql = "update LR_ResultEntryRule set TargetFeatClass1='" + m_PointLayerName +
                //             "',TargetFeatClass2='" + m_PointLayerName + "|" + m_pPara.strTargetLayer +
                //             "' where RuleInstID='" + m_RuleInfo.strID + "'";
                //    GT_CARTO.CommonAPI.ado_ExecuteSQL(m_pResultAdoConn, strSql);
                //}
                //else if (nGeoType == 3) // 面
                //{
                //    strSql = "update LR_ResultEntryRule set TargetFeatClass1='" + m_PointLayerName +
                //             "',TargetFeatClass2='" + m_PointLayerName + "|" + m_pPara.strTargetLayer +
                //             "' where RuleInstID='" + m_RuleInfo.strID + "'";
                //    GT_CARTO.CommonAPI.ado_ExecuteSQL(m_pResultAdoConn, strSql);
                //}

                IFields pFields = pSrcFeatClass.Fields;
                int     nIndex  = pFields.FindField("BSM");

                foreach (DictionaryEntry dn in m_RepeatOIDtoOID)
                {
                    string key = dn.Key.ToString();
                    Error  err = new Error();
                    err.DefectLevel = this.m_DefectLevel;
                    err.RuleID      = this.InstanceID;
                    err.LayerName   = this.m_strSrcLayer;

                    RuleExpression.LRResultInfo pResInfo = new RuleExpression.LRResultInfo();
                    err.OID      = Convert.ToInt32(m_PointtoOID[key]);
                    err.ReferOID = dn.Value.ToString();
                    if (nIndex >= 0)
                    {
                        IFeature pFt = pSrcFeatClass.GetFeature(pResInfo.OID);
                        err.BSM = pFt.get_Value(nIndex).ToString();
                        string[] listOID  = err.ReferOID.Split(',');
                        string   listBSM2 = "";
                        for (int i = 0; i < listOID.Length; i++)
                        {
                            int      nOIDTemp = Convert.ToInt32(listOID[i]);
                            IFeature pFt1     = pSrcFeatClass.GetFeature(nOIDTemp);
                            listBSM2 += pFt1.get_Value(nIndex).ToString() + ",";
                        }
                        listBSM2     = listBSM2.Substring(0, listBSM2.Length - 1);
                        err.ReferBSM = listBSM2;
                    }
                    err.Description = string.Format("'{0}'中标识码为'{1}'与标识码为'{2}'的地物相互重叠,实地两相邻点距离不应小于{3}。", m_pPara.strTargetLayer, pResInfo.BSM, pResInfo.BSM2, m_pPara.dPointDist);
                    pResult.Add(err);
                }
            }
            catch (Exception ex)
            {
                //Hy.Check.Rule.Helper.LogAPI.CheckLog.AppendErrLogs(ex.ToString());
                //显示错误信息;
                //XtraMessageBox.Show("RulePointDist:SaveData():" + ex.Message + " ");
                return(false);
            }
            return(true);
        }