Exemplo n.º 1
0
        public override void OnClick()
        {
            //修改操作
            //获得参照要素
            Exception pError = null;

            ModData.m_CurOperType = EnumUpdateType.修改;
            if (ModData.m_orgMap == null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "请先加载参照图层");
                return;
            }
            //获得参照要素
            ModData.m_OrgFeature = ClsUpdate.getFea(ModData.m_orgMap, EnumFeatureType.参照要素, out pError);
            if (pError != null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", pError.Message);
                return;
            }
        }
Exemplo n.º 2
0
        public override void OnClick()
        {
            Exception pError = null;
            DateTime  pNow   = DateTime.Now;

            if (ModData.m_ObjWS == null)
            {
                return;
            }

            if (ModData.m_CurOperType == EnumUpdateType.新增)
            {
                #region 新增的处理
                if (ModData.m_OrgFeature == null)
                {
                    return;
                }
                //获得目标要素类
                if (ModData.m_CurLayer == null || ModData.m_CurLayer is IGroupLayer)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "在处理前请先选择目标图层");
                    return;
                }
                IFeatureLayer pFeaLayer = ModData.m_CurLayer as IFeatureLayer;
                if (pFeaLayer == null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "在处理前请先选择目标图层");
                    return;
                }

                IFeatureClass pObjFeaCls = null;//目标要素类

                pObjFeaCls = pFeaLayer.FeatureClass;
                if (pObjFeaCls == null)
                {
                    return;
                }
                if (pObjFeaCls.ShapeType != ModData.m_OrgFeature.Shape.GeometryType)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "源要素和目标要素几何类型不一致!");
                    return;
                }
                //**********************************************************************************************
                //guozheng added 系统运行日志,功能记录
                if (SysCommon.Log.Module.SysLog == null)
                {
                    SysCommon.Log.Module.SysLog = new SysCommon.Log.clsWriteSystemFunctionLog();
                }
                List <string> Pra = new List <string>();
                Pra.Add("源要素:OID:" + ModData.m_OrgFeature.OID.ToString() + "  图层:" + (ModData.m_OrgFeature.Table as IDataset).Name);
                Pra.Add("目标图层" + (pObjFeaCls as IDataset).Name);
                SysCommon.Log.Module.SysLog.Write("一致性更新处理:" + EnumUpdateType.新增.ToString(), Pra);
                //**********************************************************************************************
                ClsUpdate.UpdateFea(m_Hook.MapControl.Map, ModData.m_OrgFeature, null, pObjFeaCls, ModData.m_ObjWS, EnumUpdateType.新增, out pError);
                if (pError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "新增要素失败!\n" + pError.Message);
                    return;
                }
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "操作成功");
                #endregion
            }
            else
            {
                //获得目标要素
                IFeature pObjFea = ClsUpdate.getFea(m_Hook.MapControl.Map, EnumFeatureType.更新要素, out pError);
                if (pError != null || pObjFea == null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", pError.Message);
                    return;
                }
                IFeatureClass pObjFeaCls = pObjFea.Class as IFeatureClass;//目标要素类
                if (pObjFeaCls == null)
                {
                    return;
                }
                if (ModData.m_CurOperType == EnumUpdateType.修改)
                {
                    #region 修改的处理
                    if (ModData.m_OrgFeature == null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取参照要素失败!");
                        return;
                    }
                    //**********************************************************************************************
                    //guozheng added 系统运行日志,功能记录
                    if (SysCommon.Log.Module.SysLog == null)
                    {
                        SysCommon.Log.Module.SysLog = new SysCommon.Log.clsWriteSystemFunctionLog();
                    }
                    List <string> Pra = new List <string>();
                    Pra.Add("源要素:OID:" + ModData.m_OrgFeature.OID.ToString() + "  图层:" + (ModData.m_OrgFeature.Table as IDataset).Name);
                    Pra.Add("目标图层" + (pObjFeaCls as IDataset).Name);
                    Pra.Add("目标要素:OID:" + pObjFea.OID.ToString() + "  图层:" + (pObjFea.Table as IDataset).Name);
                    SysCommon.Log.Module.SysLog.Write("一致性更新处理:" + EnumUpdateType.修改.ToString(), Pra);
                    //**********************************************************************************************
                    //进行联动更新
                    ClsUpdate.UpdateFea(m_Hook.MapControl.Map, ModData.m_OrgFeature, pObjFea, pObjFeaCls, ModData.m_ObjWS, EnumUpdateType.修改, out pError);
                    if (pError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "修改要素失败!\n" + pError.Message);
                        return;
                    }
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "操作成功");
                    #endregion
                }
                else
                {
                    #region  除的处理
                    //**********************************************************************************************
                    //guozheng added 系统运行日志,功能记录
                    if (SysCommon.Log.Module.SysLog == null)
                    {
                        SysCommon.Log.Module.SysLog = new SysCommon.Log.clsWriteSystemFunctionLog();
                    }
                    List <string> Pra = new List <string>();
                    Pra.Add("目标图层" + (pObjFeaCls as IDataset).Name);
                    Pra.Add("目标要素:OID:" + pObjFea.OID.ToString() + "  图层:" + (pObjFea.Table as IDataset).Name);
                    SysCommon.Log.Module.SysLog.Write("一致性更新处理:" + EnumUpdateType.除.ToString(), Pra);
                    //**********************************************************************************************
                    //进行联动更新
                    ClsUpdate.UpdateFea(m_Hook.MapControl.Map, null, pObjFea, pObjFeaCls, ModData.m_ObjWS, EnumUpdateType.除, out pError);
                    if (pError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "删除要素失败!\n" + pError.Message);
                        return;
                    }
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "操作成功");
                    #endregion
                }
            }
        }