Exemplo n.º 1
0
        /// <summary>
        /// 获得分类代码字段名
        /// </summary>
        /// <param name="outErr"></param>
        /// <returns></returns>
        private string GetClassifyName1(out Exception outErr)
        {
            outErr = null;
            Exception eError = null;

            SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable();
            pSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + TopologyCheckClass.GeoDataCheckParaPath, SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError);
            if (eError != null)
            {
                outErr = new Exception("连接库体出错!路径为:" + TopologyCheckClass.GeoDataCheckParaPath);
                pSysTable.CloseDbConnection();
                return("");
            }
            string    str    = "select * from GeoCheckPara where 参数ID=1";//分类代码信息
            DataTable tempDt = pSysTable.GetSQLTable(str, out eError);

            if (eError != null || tempDt.Rows.Count == 0)
            {
                outErr = new Exception("获取分类代码名称信息出错!");
                pSysTable.CloseDbConnection();
                return("");
            }
            pSysTable.CloseDbConnection();
            string pClassifyName = tempDt.Rows[0]["参数值"].ToString();//分类代码字段名

            return(pClassifyName);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 代码检查---根据条件在模板里面进行检查
        /// </summary>
        /// <param name="sqlStr">查询条件</param>
        /// <param name="pGISID">分类代码</param>
        /// <returns></returns>
        private int CodeStandardizeCheck(string sqlStr)
        {
            Exception Error = null;

            SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable();
            pSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + TopologyCheckClass.GeoDataCheckParaPath, SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out Error);
            if (Error != null)
            {
                //SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "连接库体出错!路径为:" + TopologyCheckClass.GeoDataCheckParaPath);
                return(-1);
            }
            //pSysTable.DbConn = (Hook.DataCheckParaSet as IArcgisDataCheckParaSet).DbConnPara;
            //pSysTable.DBType = SysCommon.enumDBType.ACCESS;
            //pSysTable.DBConType = SysCommon.enumDBConType.OLEDB;

            DataTable dt = pSysTable.GetSQLTable(sqlStr, out Error);

            if (Error != null)
            {
                //SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "打开表格出错!");
                pSysTable.CloseDbConnection();
                return(-1);
            }
            if (dt.Rows.Count == 0)
            {
                //在模板里面没有找到该分类代码
                pSysTable.CloseDbConnection();
                return(0);
            }
            else
            {
                pSysTable.CloseDbConnection();
                return(1);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 查找参数值表格
        /// </summary>
        /// <param name="pFeaDataset"></param>
        /// <param name="pSysTable"></param>
        /// <param name="checkParaID">参数ID,唯一标识检查类型</param>
        /// <param name="eError"></param>
        /// <returns></returns>
        private DataTable  GetParaValueTable(SysCommon.DataBase.SysTable pSysTable, int checkParaID, out Exception eError)
        {
            eError = null;
            DataTable mTable = null;

            string    selStr = "select * from GeoCheckPara where 参数ID=" + checkParaID;
            DataTable pTable = pSysTable.GetSQLTable(selStr, out eError);

            if (eError != null)
            {
                eError = new Exception("查询表格错误,表名为:GeoCheckPara,参数ID为:" + checkParaID);
                return(null);
            }

            if (pTable == null || pTable.Rows.Count == 0)
            {
                eError = new Exception("找不到记录,参数ID为:" + checkParaID);
                return(null);
            }
            string ParaType = pTable.Rows[0]["参数类型"].ToString().Trim();            //参数类型

            if (ParaType == "GeoCheckParaValue")
            {
                int    ParaValue = int.Parse(pTable.Rows[0]["参数值"].ToString().Trim()); //参数值,用来标识检查类型
                string str       = "select * from GeoCheckParaValue where 检查类型=" + ParaValue;
                mTable = pSysTable.GetSQLTable(str, out eError);
                if (eError != null)
                {
                    eError = new Exception("查询表格错误,表名为:GeoCheckParaValue,检查类型为:" + ParaValue);
                    return(null);
                }
            }
            return(mTable);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 代码检查---根据条件在模板里面进行检查
        /// </summary>
        /// <param name="sqlStr">查询条件</param>
        /// <param name="pGISID">分类代码</param>
        /// <returns></returns>
        private int CodeStandardizeCheck(string sqlStr)
        {
            Exception Error = null;

            SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable();
            pSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + m_TempletePath, SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out Error);
            if (Error != null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "连接库体出错!路径为:" + m_TempletePath);
                return(-1);
            }
            DataTable dt = pSysTable.GetSQLTable(sqlStr, out Error);

            if (Error != null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "打开表格出错!");
                pSysTable.CloseDbConnection();
                return(-1);
            }
            if (dt.Rows.Count == 0)
            {
                //在模板里面没有找到该分类代码
                pSysTable.CloseDbConnection();
                return(0);
            }
            else
            {
                pSysTable.CloseDbConnection();
                return(1);
            }
        }
Exemplo n.º 5
0
 public string GetTableSql(string sTableName, out Exception ex)
 {
     if (string.IsNullOrEmpty(this.m_MDBFilePath))
     {
         ex = new Exception("没有指定模板文件"); return(null);
     }
     try
     {
         string TarGetTableName = sTableName;
         SysCommon.DataBase.SysTable metaSysTable = new SysCommon.DataBase.SysTable();
         metaSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + this.m_MDBFilePath + ";Persist Security Info=True", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out ex);
         if (ex != null)
         {
             return(null);
         }
         DataTable GetTable = metaSysTable.GetTable(TarGetTableName, out ex);
         if (ex != null)
         {
             return(null);
         }
         string SQL = GetSQLByTable(GetTable, TarGetTableName, out ex);
         return(SQL);
     }
     catch (Exception eError)
     {
         ex = eError;
         return(null);
     }
 }
Exemplo n.º 6
0
        private Dictionary <string, Type> AddField()
        {
            Exception eError = null;
            Dictionary <string, Type> fieldDic = new Dictionary <string, Type>();

            if (ConnStr == "")
            {
                return(null);
            }
            SysCommon.DataBase.SysTable pSysDB = new SysCommon.DataBase.SysTable();
            pSysDB.SetDbConnection(ConnStr, SysCommon.enumDBConType.ORACLE, SysCommon.enumDBType.ORACLE, out eError);
            if (eError != null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "连接元数据库失败!");
                pSysDB.CloseDbConnection();
                return(null);
            }
            string pTableName = "";

            if (cmbType.Text == "标准图幅")
            {
                pTableName = "StandardMapMDTable";
            }
            else if (cmbType.Text == "非标准图幅")
            {
                pTableName = "NonstandardMapMDTable";
            }
            else if (cmbType.Text == "控制点数据")
            {
                pTableName = "ControlPointMDTable";
            }
            DataTable pTable = pSysDB.GetTable(pTableName, out eError);

            if (eError != null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "获取源数据信息表失败!");
                pSysDB.CloseDbConnection();
                return(null);
            }
            pSysDB.CloseDbConnection();
            for (int i = 0; i < pTable.Columns.Count; i++)
            {
                if (pTable.Columns[i].ColumnName.ToString().Trim() == "ID")
                {
                    continue;
                }
                if (pTable.Columns[i].ColumnName.ToString().Trim() == "图形数据")
                {
                    continue;
                }

                if (!cmbField.Items.Contains(pTable.Columns[i].ColumnName.ToString().Trim()))
                {
                    cmbField.Items.Add(pTable.Columns[i].ColumnName.ToString().Trim());
                    fieldDic.Add(pTable.Columns[i].ColumnName.ToString().Trim(), pTable.Columns[i].DataType);
                }
            }
            return(fieldDic);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="sConnectInfo">Oracle连接字符串</param>
        public clsFTPMetaDB(string sConnectInfo)
        {
            Exception ex = null;

            m_DataBaseOper = new SysCommon.DataBase.SysTable();
            m_DataBaseOper.SetDbConnection(sConnectInfo, SysCommon.enumDBConType.ORACLE, SysCommon.enumDBType.ORACLE, out ex);
            if (ex != null)
            {
                this.m_DataBaseOper = null;
            }
        }
Exemplo n.º 8
0
        public clsRefurbishDBinfo(SysCommon.enumDBConType DBConType, SysCommon.enumDBType DBType, string sConInfo)
        {
            Exception ex = null;

            this.m_DBOper = new SysCommon.DataBase.SysTable();
            this.m_DBOper.SetDbConnection(sConInfo, DBConType, DBType, out ex);
            if (ex != null)
            {
                this.m_DBOper = null;
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 初始化列表框
        /// </summary>
        private void InitialForm()
        {
            Exception outError = null;                 //异常

            SysCommon.DataBase.SysTable pSysDB = null; //连接数据库类
            //连接数据库
            ModDBOperate.ConnectDB(out pSysDB, out outError);
            if (outError != null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", outError.Message);
                return;
            }
            string str = "";              //查询字符串

            if (m_BeRole)
            {
                //查询角色基本信息表
                // str = "select * from rolebaseinfo";  //定义查询字符串  3为系统管理员
                str = "select * from rolebaseinfo r join (select roletypeid from roletypeinfo ) t on (r.roletypeid=t.roletypeid) where t.roletypeid<> 3";
            }
            else
            {
                //查询用户基本信息表
                // str = "select * from userbaseinfo";//定义查询字符串  3为系统管理员
                str = "select * from userbaseinfo u join  userrolerelationinfo r on (u.userid=r.userid) join (select roleid,roletypeid from rolebaseinfo) b on (r.roleid=b.roleid) where b.roletypeid<>3";
            }
            //查询角色信息表
            DataTable pTable = pSysDB.GetSQLTable(str, out outError);

            if (outError != null || pTable == null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取角色信息表失败");
                pSysDB.CloseDbConnection();
                m_beSuccedd = false;
                return;
            }
            for (int i = 0; i < pTable.Rows.Count; i++)
            {
                int          pRoleID   = Convert.ToInt32(pTable.Rows[i][0].ToString().Trim()); //角色ID
                string       pRoleName = pTable.Rows[i][1].ToString().Trim();                  //角色名称
                ListViewItem pItem     = new ListViewItem();
                pItem.Text    = pRoleName;
                pItem.Tag     = pRoleID;
                pItem.Checked = false;
                if (!LstViewRole.Items.Contains(pItem))
                {
                    LstViewRole.Items.Add(pItem);
                }
            }
        }
Exemplo n.º 10
0
        //将数据检查结果存入ACCESS中
        private static void InsertRowToAccess(DbConnection dbCon, string tableName, DataErrTreatEvent e)
        {
            SysCommon.DataBase.SysTable sysTable = new SysCommon.DataBase.SysTable();
            sysTable.DbConn    = dbCon;
            sysTable.DBConType = SysCommon.enumDBConType.OLEDB;
            sysTable.DBType    = SysCommon.enumDBType.ACCESS;
            string sql = "insert into " + tableName +
                         "(数据文件路径,检查功能名,错误类型,错误描述,数据图层1,数据OID1,数据图层2,数据OID2,定位点X,定位点Y,检查时间) values(" +
                         "'" + e.ErrInfo.DataFileName + "','" + e.ErrInfo.FunctionName + "','" + GeoDataChecker.GetErrorTypeString(Enum.Parse(typeof(enumErrorType), e.ErrInfo.ErrID.ToString()).ToString()) + "','" + e.ErrInfo.ErrDescription + "','" + e.ErrInfo.OriginClassName + "','" + e.ErrInfo.OriginFeatOID.ToString() + "','" +
                         e.ErrInfo.DestinationClassName + "','" + e.ErrInfo.DestinationFeatOID.ToString() + "'," + e.ErrInfo.MapX + "," + e.ErrInfo.MapY + ",'" + e.ErrInfo.OperatorTime + "')";

            Exception errEx = null;

            sysTable.UpdateTable(sql, out errEx);
        }
        /// <summary>
        /// 根据数据ID获得数据文件名

        /// </summary>
        /// <param name="dataTypeID"></param>
        /// <param name="dataID"></param>
        /// <param name="sysTable"></param>
        /// <param name="eError"></param>
        /// <returns></returns>
        private string GetDataName(int dataTypeID, long dataID, SysCommon.DataBase.SysTable sysTable, out Exception eError)
        {
            eError = null;
            string dataName = "";
            string str      = "";

            try
            {
                switch (dataTypeID)
                {
                case 0:              //标准图幅
                    str = "select * from StandardMapMDTable where ID=" + dataID;
                    break;

                case 1:              //非标准图幅

                    str = "select * from NonstandardMapMDTable where ID=" + dataID;
                    break;;

                case 2:              //控制点测量数据

                    str = "select * from ControlPointMDTable where ID=" + dataID;
                    break;
                }
                DataTable dt = sysTable.GetSQLTable(str, out eError);
                if (eError != null)
                {
                    return("");
                }
                if (dt.Rows.Count == 0)
                {
                    return("");
                }
                dataName = dt.Rows[0]["数据文件名"].ToString();
                return(dataName);
            }
            catch (Exception ex)
            {
                eError = ex;
                return("");
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// chenyafei  20110314 add  content :连接系统维护库
        /// </summary>
        public static void ConnectDB(out SysCommon.DataBase.SysTable pSysDB, out Exception outError)
        {
            outError = null;
            pSysDB   = new SysCommon.DataBase.SysTable();
            string pConnStr = ModuleData.v_AppConnStr;  //连接字符串

            if (pConnStr.Trim() == "")
            {
                outError = new Exception("连接系统维护库失败,系统维护库连接字符串信息为空!");
                return;
            }

            //连接数据库
            pSysDB.SetDbConnection(pConnStr, SysCommon.enumDBConType.ORACLE, SysCommon.enumDBType.ORACLE, out outError);
            if (outError != null)
            {
                outError = new Exception("连接系统维护库失败,原因:" + outError.Message);
                return;
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 根据参数ID获得参数值
        /// </summary>
        /// <param name="pSysTable"></param>
        /// <param name="checkParaID"></param>
        /// <param name="eError"></param>
        /// <returns></returns>
        private string GetParaValue(SysCommon.DataBase.SysTable pSysTable, int checkParaID, out Exception eError)
        {
            eError = null;
            string paraValue = "";

            string    selStr = "select * from GeoCheckPara where 参数ID=" + checkParaID;
            DataTable pTable = pSysTable.GetSQLTable(selStr, out eError);

            if (eError != null)
            {
                eError = new Exception("查询表格错误,表名为:GeoCheckPara,参数ID为:" + checkParaID);
                return("");
            }

            if (pTable == null || pTable.Rows.Count == 0)
            {
                eError = new Exception("找不到记录,参数ID为:" + checkParaID);
                return("");
            }
            paraValue = pTable.Rows[0]["参数值"].ToString().Trim();            //参数类型
            return(paraValue);
        }
Exemplo n.º 14
0
        //将数据检查结果存入Excel中
        private void InsertRowToExcel(DataErrTreatEvent e)
        {
            if (_ErrDbCon != null && _ErrTableName != "")
            {
                SysCommon.DataBase.SysTable sysTable = new SysCommon.DataBase.SysTable();
                sysTable.DbConn    = _ErrDbCon;
                sysTable.DBConType = SysCommon.enumDBConType.OLEDB;
                sysTable.DBType    = SysCommon.enumDBType.ACCESS;
                string sql = "insert into " + _ErrTableName +
                             "(数据文件路径,检查功能名,错误类型,错误描述,数据图层1,数据OID1,数据图层2,数据OID2,定位点X,定位点Y,检查时间) values(" +
                             "'" + e.ErrInfo.DataFileName + "','" + e.ErrInfo.FunctionName + "','" + GeoDataChecker.GetErrorTypeString(Enum.Parse(typeof(enumErrorType), e.ErrInfo.ErrID.ToString()).ToString()) + "','" + e.ErrInfo.ErrDescription + "','" + e.ErrInfo.OriginClassName + "','" + e.ErrInfo.OriginFeatOID.ToString() + "','" +
                             e.ErrInfo.DestinationClassName + "','" + e.ErrInfo.DestinationFeatOID.ToString() + "'," + e.ErrInfo.MapX + "," + e.ErrInfo.MapY + ",'" + e.ErrInfo.OperatorTime + "')";

                Exception errEx = null;
                sysTable.UpdateTable(sql, out errEx);
                if (errEx != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "写入Excel文件出错!");
                    return;
                }
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// guozheng 2011-3-24 added 判断是不是第一次登陆(第一次登陆只有系统管理员,将系统管理员账号显示在界面上)
        /// </summary>
        private void JudgeInitialize()
        {
            Exception outError = null;

            SysCommon.DataBase.SysTable pSysDB = null;
            //连接数据库
            ModDBOperate.ConnectDB(out pSysDB, out outError);
            if (outError != null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接Oracle数据库异常:" + outError.Message + "请检查Oracle数据库运行状态");
                return;
            }
            /////读取用户表,若只有一条记录则认为是系统管理员/////
            string    sSQL         = "SELECT * FROM userbaseinfo";
            DataTable GetUserTable = pSysDB.GetTable("userbaseinfo", out outError);

            if (GetUserTable.Rows.Count == 1)
            {
                ////////将系统管理员的信息显示在界面上////////
                this.txtUser.Text     = GetUserTable.Rows[0]["USERNAME"].ToString();
                this.txtPassword.Text = GetUserTable.Rows[0]["PASSWORD"].ToString();
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 单击开始检查时
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_enter_Click(object sender, EventArgs e)
        {
            Exception eError = null;

            if (txtRange.Text == "")
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "请选择接边范围数据库!");
                return;
            }
            SysCommon.Gis.SysGisDataSet pRangeGisDB = new SysCommon.Gis.SysGisDataSet();
            pRangeGisDB.SetWorkspace(txtRange.Text.ToString().Trim(), SysCommon.enumWSType.PDB, out eError);
            if (eError != null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "接边范围数据库连接失败!");
                return;
            }

            if (ShowException())
            {
                #region 错误日志连接信息
                string logPath = txtLog.Text;
                if (logPath.Trim() == string.Empty)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "请选择日志输出路径!");
                    return;
                }
                if (File.Exists(logPath))
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "数据文件已存在!\n" + logPath);
                }

                //生成日志信息EXCEL格式
                SysCommon.DataBase.SysDataBase pSysLog = new SysCommon.DataBase.SysDataBase();
                pSysLog.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + logPath + "; Extended Properties=Excel 8.0;", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "日志信息表连接失败!");
                    return;
                }
                string strCreateTableSQL = @" CREATE TABLE ";
                strCreateTableSQL += @" 错误日志 ";
                strCreateTableSQL += @" ( ";
                strCreateTableSQL += @" 检查功能名 VARCHAR, ";
                strCreateTableSQL += @" 错误类型 VARCHAR, ";
                strCreateTableSQL += @" 错误描述 VARCHAR, ";
                strCreateTableSQL += @" 数据图层1 VARCHAR, ";
                strCreateTableSQL += @" 数据OID1 VARCHAR, ";
                strCreateTableSQL += @" 数据图层2 VARCHAR, ";
                strCreateTableSQL += @" 数据OID2 VARCHAR, ";
                strCreateTableSQL += @" 定位点X VARCHAR , ";
                strCreateTableSQL += @" 定位点Y VARCHAR , ";
                strCreateTableSQL += @" 检查时间 VARCHAR ,";
                strCreateTableSQL += @" 数据文件路径 VARCHAR ";
                strCreateTableSQL += @" ) ";

                pSysLog.UpdateTable(strCreateTableSQL, out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "插入表头出错!");
                    return;
                }

                #endregion

                double         AreaValue   = Convert.ToDouble(txt_area.Text);   //范围容差
                double         SearchValue = Convert.ToDouble(txt_search.Text); //搜索容差
                DataCheckClass JoinChecks  = new DataCheckClass(_AppHk);
                //将日志表连接信息和表名保存起来
                JoinChecks.ErrDbCon     = pSysLog.DbConn;
                JoinChecks.ErrTableName = "错误日志";
                JoinChecks.AREAValue    = AreaValue;
                JoinChecks.SEARCHValue  = SearchValue;

                SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable();
                string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + TopologyCheckClass.GeoDataCheckParaPath;
                pSysTable.SetDbConnection(conStr, SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "GIS数据检查配置表连接失败!");
                    return;
                }
                //获得接边范围的图层名和字段名
                DataTable mTable = GetParaValueTable(pSysTable, 39, out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "查询GIS数据检察配置表失败!");
                    return;
                }
                if (mTable.Rows.Count == 0)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未进行接边检查参数的配置!");
                    return;
                }
                string rangeLayerName = mTable.Rows[0]["图层"].ToString().Trim();
                string rangeFieldName = mTable.Rows[0]["字段项"].ToString().Trim();
                if (rangeFieldName == "" || rangeLayerName == "")
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "接边检查参数配置不完整!");
                    return;
                }

                //设置界面上初始显示的属性表
                TreeLayer.Nodes[Convert.ToInt32(dataGridViewX1.Tag)].Name = "";
                for (int d = 0; d < dataGridViewX1.Rows.Count; d++)
                {
                    if (Convert.ToBoolean(dataGridViewX1.Rows[d].Cells[0].Value) == true)
                    {
                        string temp = dataGridViewX1.Rows[d].Cells[1].Value.ToString();
                        TreeLayer.Nodes[Convert.ToInt32(dataGridViewX1.Tag)].Name += temp + " ";
                    }
                }

                if (!JoinChecks.Initialize_Tree(pRangeGisDB, rangeLayerName, rangeFieldName, _AppHk.DataTree, TreeLayer, _AppHk, out eError))
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "初始化树图失败!");
                    return;
                }
                //int Pur = PurviewState();//验证是管理员还是作业员

                ///说明:作业员以图幅去进行接边处理,管理员以任务区范围去接边处理
                //if (Pur == 1)
                //{
                ////管理员
                ////初始化数据处理树图
                //if (!JoinChecks.Initialize_Tree("任务区范围", "CASE_NAME", _AppHk.DataTree, TreeLayer, _AppHk))
                //{
                //    return;
                //}
                //}
                //else if(Pur == 0)
                //{
                //    //作业员
                //    //初始化数据处理树图
                //    if (!JoinChecks.Initialize_Tree("图幅范围", "MAP_ID", _AppHk.DataTree, TreeLayer, _AppHk))
                //    {
                //        return;
                //    }
                //}
                this.Close();
                //数据接边检查
                //用线程做速度会很慢主要体现在要素空间查询时
                //System.Threading.ParameterizedThreadStart parstart = new System.Threading.ParameterizedThreadStart(JoinChecks.DoJoinCheck);
                //Thread aThread = new Thread(parstart);
                //_AppHk.CurrentThread = aThread;
                //aThread.Priority = ThreadPriority.Highest;
                //aThread.Start(_AppHk as object);, Pur
                int Pur = 0;        //以图幅进行接边
                JoinChecks.DoJoinCheck(_AppHk as object, Pur);
            }
        }
Exemplo n.º 17
0
        public frmCreateDB(DevComponents.AdvTree.Node ProjectNode)
        {
            InitializeComponent();
            if (ProjectNode == null)
            {
                return;
            }
            m_CurProNode = ProjectNode;
            /////////////////初始化系统维护库连接信息////////
            m_sDBFormat = string.Empty;
            Exception ex = null;

            //cyf 20110603 modify
            if (ModuleData.TempWks == null)
            {
                return;
            }
            //end
            ////////////////获取数据库信息//////////////////
            try
            {
                XmlElement DBInfoEle = ProjectNode.Tag as XmlElement;
                lDBid   = Convert.ToInt64(DBInfoEle.GetAttribute("数据库ID"));
                sDBName = DBInfoEle.GetAttribute("数据库工程名");
                //cyf 20110628 add:
                sDBTypeID   = DBInfoEle.GetAttribute("数据库类型ID");
                sDBFormatID = DBInfoEle.GetAttribute("数据库平台ID");
                sDBStateID  = DBInfoEle.GetAttribute("数据库状态ID");
                //end
                sDBType        = DBInfoEle.GetAttribute("数据库类型");
                sDBFormat      = DBInfoEle.GetAttribute("数据库平台");
                sDBState       = DBInfoEle.GetAttribute("数据库状态");
                this.TitleText = "初始化:" + sDBName + "库体";
                m_sDBFormat    = sDBFormat;
            }
            catch (Exception eError)
            {
                //****************************************************
                if (ModuleData.v_SysLog != null)
                {
                    ModuleData.v_SysLog.Write(eError, null, DateTime.Now);
                }
                //****************************************************
                this.m_DBOper = null;
                return;
            }
            ///////////////判断数据库平台类型,处理界面//////////////////
            #region 判断数据库平台类型,处理界面  cyf 20110628
            this.comBoxType.Text    = sDBFormat;
            this.comBoxType.Enabled = false;
            if (sDBFormatID == enumInterDBFormat.ARCGISPDB.GetHashCode().ToString())
            {
                this.txtServer.Enabled     = false;
                this.txtUser.Enabled       = false;
                this.txtPassWord.Enabled   = false;
                this.txtVersion.Enabled    = false;
                this.txtservername.Enabled = false;
                m_DBFormat = enumInterDBFormat.ARCGISPDB;
            }
            else if (sDBFormatID == enumInterDBFormat.ARCGISGDB.GetHashCode().ToString())
            {
                this.txtServer.Enabled     = false;
                this.txtUser.Enabled       = false;
                this.txtPassWord.Enabled   = false;
                this.txtVersion.Enabled    = false;
                this.txtservername.Enabled = false;
                m_DBFormat = enumInterDBFormat.ARCGISGDB;
            }
            else if (sDBFormatID == enumInterDBFormat.ARCGISSDE.GetHashCode().ToString())
            {
                this.txtVersion.Text = "SDE.DEFAULT";
                m_DBFormat           = enumInterDBFormat.ARCGISSDE;
            }
            else if (sDBFormatID == enumInterDBFormat.GEOSTARACCESS.GetHashCode().ToString())
            {
                this.txtServer.Enabled     = false;
                this.txtUser.Enabled       = false;
                this.txtPassWord.Enabled   = false;
                this.txtVersion.Enabled    = false;
                this.txtservername.Enabled = false;
                m_DBFormat = enumInterDBFormat.GEOSTARACCESS;
            }
            else if (sDBFormatID == enumInterDBFormat.GEOSTARORACLE.GetHashCode().ToString())
            {
                m_DBFormat                 = enumInterDBFormat.GEOSTARORACLE;
                this.btnServer.Enabled     = false;
                this.txtServer.Enabled     = false;
                this.txtservername.Enabled = false;
            }
            else if (sDBFormatID == enumInterDBFormat.GEOSTARORSQLSERVER.GetHashCode().ToString())
            {
                m_DBFormat                 = enumInterDBFormat.GEOSTARORSQLSERVER;
                this.btnServer.Enabled     = false;
                this.txtservername.Enabled = false;
            }
            else if (sDBFormatID == enumInterDBFormat.ORACLESPATIAL.GetHashCode().ToString())
            {
                this.txtDataBase.Enabled   = false;
                this.btnServer.Enabled     = false;
                this.txtVersion.Enabled    = false;
                this.txtservername.Enabled = false;
                m_DBFormat = enumInterDBFormat.ORACLESPATIAL;
            }
            else if (sDBFormatID == enumInterDBFormat.FTP.GetHashCode().ToString())
            {
                this.comBoxType.Text          = "Oracle";
                this.txtDataBase.Enabled      = false;
                this.btnServer.Enabled        = false;
                this.txtVersion.Enabled       = false;
                this.txtservername.Enabled    = false;
                this.txtProjFilePath.Enabled  = false;
                this.textRuleFilePath.Enabled = false;
                m_DBFormat = enumInterDBFormat.FTP;
            }

            //if (sDBType == enumInterDBType.成果文件数据库.ToString())
            //{
            //    m_DBType = enumInterDBType.成果文件数据库;
            //}
            //else if (sDBType == enumInterDBType.地理编码数据库.ToString())
            //{
            //    m_DBType = enumInterDBType.地理编码数据库;
            //}
            //else if (sDBType == enumInterDBType.地名数据库.ToString())
            //{
            //    m_DBType = enumInterDBType.地名数据库;
            //}
            //else if (sDBType == enumInterDBType.高程数据库.ToString())
            //{
            //    m_DBType = enumInterDBType.高程数据库;
            //}
            //else if (sDBType == enumInterDBType.框架要素数据库.ToString())
            //{
            //    m_DBType = enumInterDBType.框架要素数据库;
            //}
            //else if (sDBType == enumInterDBType.影像数据库.ToString())
            //{
            //    m_DBType = enumInterDBType.影像数据库;
            //}
            //end
            #endregion
            //////////////获取连接信息显示在窗口上//////////////////////
            if (ProjectNode.Tag != null)
            {
                XmlElement InfoEle = ProjectNode.Tag as XmlElement;
                connectInfo = InfoEle.GetAttribute("数据库连接信息");
                string[] constr = connectInfo.Split('|');
                try
                {
                    //cyf 20110628 modify
                    if (sDBTypeID == enumInterDBType.成果文件数据库.GetHashCode().ToString())
                    {
                        string OracleConstr = constr[6];
                        m_sDBConnectStr = constr[0] + "|" + constr[1] + "|" + constr[2] + "|" + constr[3] + "|" + constr[4] + "|" + constr[5];
                        string User   = string.Empty; ///////Oracle用户
                        string Server = string.Empty; ///////Oracle服务名
                        string Pass   = string.Empty; ///////Oracle用户密码
                        ExplainOracleConectInfo(OracleConstr, out User, out Server, out Pass, out ex);
                        if (ex != null)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取元信息库连接信息失败,\n原因:" + ex.Message);
                            return;
                        }
                        this.txtServer.Text   = Server;
                        this.txtUser.Text     = User;
                        this.txtPassWord.Text = Pass;
                    }
                    else
                    {
                        this.txtServer.Text     = constr[0];
                        this.txtservername.Text = constr[1];
                        this.txtDataBase.Text   = constr[2];
                        this.txtUser.Text       = constr[3];
                        this.txtPassWord.Text   = constr[4];
                        this.txtVersion.Text    = constr[5];
                    }
                    //end
                }
                catch (Exception eError)
                {
                    //****************************************************
                    if (ModuleData.v_SysLog != null)
                    {
                        ModuleData.v_SysLog.Write(eError, null, DateTime.Now);
                    }
                    //****************************************************
                }
            }
        }
Exemplo n.º 18
0
        public override void OnClick()
        {
            SysCommon.Error.frmInformation eerorFrm = new SysCommon.Error.frmInformation("是", "否", "删除数据将无法恢复,确定吗?");
            eerorFrm.Owner = (m_Hook as Plugin.Application.IAppFormRef).MainForm;
            if (eerorFrm.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            //执行成果数据删除操作(在列表中选中要删除的数据项,进行删除)

            Exception ex = null;

            #region 获取连接信息
            DevComponents.AdvTree.Node mDBNode     = m_Hook.ProjectTree.SelectedNode;
            DevComponents.AdvTree.Node Deltreenode = null;
            string ipStr    = "";
            string ip       = "";
            string id       = "";
            string password = "";
            string ConnStr  = "";
            int    datatype = -1;
            SysCommon.DataBase.SysTable pSysDB = new SysCommon.DataBase.SysTable();    //属性库连接类

            while (mDBNode.Parent != null)
            {
                mDBNode = mDBNode.Parent;
            }
            if (mDBNode.Name == "文件连接")
            {
                Deltreenode = mDBNode;
                System.Xml.XmlElement dbElem = mDBNode.Tag as System.Xml.XmlElement;
                if (dbElem == null)
                {
                    return;
                }
                ipStr    = dbElem.GetAttribute("MetaDBConn");
                ip       = dbElem.GetAttribute("服务器");
                id       = dbElem.GetAttribute("用户");
                password = dbElem.GetAttribute("密码");
                //ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ipStr + ";Persist Security Info=True";//元数据连接字符串
                ConnStr = ipStr;
                pSysDB.SetDbConnection(ConnStr, SysCommon.enumDBConType.ORACLE, SysCommon.enumDBType.ORACLE, out ex);
            }
            else
            {
                return;
            }
            #endregion
            if (EnumTreeNodeType.DATAITEM.ToString() == m_Hook.ProjectTree.SelectedNode.DataKey.ToString())
            {
                #region 在树节点上选择要删除的数据
                if (m_Hook.ProjectTree.SelectedNode.Tag == null)
                {
                    return;
                }
                if (m_Hook.ProjectTree.SelectedNode.Tag.ToString() == "")
                {
                    return;
                }
                long   dataID   = int.Parse(m_Hook.ProjectTree.SelectedNode.Tag.ToString());//数据
                string DataType = m_Hook.ProjectTree.SelectedNode.Parent.Tag.ToString();;
                try
                {
                    datatype = Convert.ToInt32(DataType);
                }
                catch
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误提示!", "获取数据类型失败!");
                    return;
                }
                if (2 != datatype)////数据类型不为控制点控制点数据

                {
                    string FilePath = m_Hook.ProjectTree.SelectedNode.Name;
                    string FileName = m_Hook.ProjectTree.SelectedNode.Text.Trim();
                    bool   Delstate = ModDBOperator.DelDataItem(FilePath, FileName, ip, id, password, out ex);
                    if (!Delstate)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "文件库中删除文件:" + FilePath + "/" + FileName + "失败!" + "\n请确认文件是否存在或是否为占用状态!");
                        return;
                    }
                    m_Hook.ProjectTree.SelectedNode.Remove();
                    ModDBOperator.DelDataItem(dataID, datatype, pSysDB, out ex);
                    if (null != ex)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "元信息数据库中删除数据文件记录失败!");
                        return;
                    }
                }
                else/////数据类型为控制点数据

                {
                    ModDBOperator.DelDataItem(dataID, datatype, pSysDB, out ex);
                    if (null != ex)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "元信息数据库中删除数据文件记录失败!");
                        return;
                    }
                    m_Hook.ProjectTree.SelectedNode.Remove();
                }
                #endregion
            }
            else if (m_Hook.DataInfoGrid.Rows.Count > 0)
            {
                #region 其他所有节点
                DevComponents.AdvTree.Node Selnode = m_Hook.ProjectTree.SelectedNode;
                if (null == Selnode.DataKey)
                {
                    return;
                }
                string ID       = "";
                long   lid      = -1;
                string FileName = "";
                string FilePath = "";
                string type     = "";

                FrmProcessBar frmbar = new FrmProcessBar();
                frmbar.SetFrmProcessBarText("删除操作:");
                frmbar.Show();
                List <int> delrowlist = new List <int>();
                if (EnumTreeNodeType.PRODUCTPYPE.ToString() == Selnode.DataKey.ToString())
                {
                    #region  中的是产品类型节点(标准、非标准、控制点数据)
                    type = Selnode.Text;
                    switch (type)
                    {
                    case "标准图幅":
                        datatype = 0;
                        break;

                    case "非标准图幅":
                        datatype = 1;
                        break;

                    case "控制点数据":
                        datatype = 2;
                        break;

                    default:
                        datatype = -1;
                        break;
                    }
                    if (datatype == -1)
                    {
                        return;
                    }
                    frmbar.SetFrmProcessBarMax((long)m_Hook.DataInfoGrid.Rows.Count);
                    for (int i = 0; i < m_Hook.DataInfoGrid.Rows.Count; i++)
                    {
                        frmbar.SetFrmProcessBarValue((long)i);
                        Application.DoEvents();
                        if (false == m_Hook.DataInfoGrid.Rows[i].Selected)
                        {
                            continue;
                        }
                        try
                        {
                            ID = m_Hook.DataInfoGrid.Rows[i].Cells["ID"].FormattedValue.ToString().Trim();
                            if (string.IsNullOrEmpty(ID))
                            {
                                continue;
                            }
                            lid      = Convert.ToInt64(ID);
                            FileName = m_Hook.DataInfoGrid.Rows[i].Cells["数据文件名"].FormattedValue.ToString().Trim();
                            FilePath = m_Hook.DataInfoGrid.Rows[i].Cells["存储位置"].FormattedValue.ToString().Trim();
                        }
                        catch
                        {
                            eerorFrm       = new SysCommon.Error.frmInformation("是", "否", "数据文件:" + FileName + "删除失败,是否继续删除?");
                            eerorFrm.Owner = (m_Hook as Plugin.Application.IAppFormRef).MainForm;
                            if (eerorFrm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                continue;
                            }
                            else
                            {
                                frmbar.Close();
                                return;
                            }
                        }

                        #region 在文件库中删除数据文件

                        //////////////////在文件库中删除数据文件////////////////////////////////
                        frmbar.SetFrmProcessBarText("正在删除文件:" + FileName);
                        Application.DoEvents();
                        if (2 != datatype)////数据类型为控制点控制点数据不执行文件的删除操作

                        {
                            bool Delstate = ModDBOperator.DelDataItem(FilePath, FileName, ip, id, password, out ex);
                            if (!Delstate)
                            {
                                eerorFrm       = new SysCommon.Error.frmInformation("是", "否", "数据文件\n'" + FilePath + "/" + FileName + "'\n删除失败。\n" + "请确认文件是否存在或是否为占用状态" + "!\n是否继续删除?");
                                eerorFrm.Owner = (m_Hook as Plugin.Application.IAppFormRef).MainForm;
                                if (eerorFrm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                {
                                    continue;
                                }
                                else
                                {
                                    frmbar.Close();
                                    return;
                                }
                            }
                        }
                        #endregion
                        #region 在元数据表中删除成果信息
                        ///////////////////在元数据表中删除成果信息/////////////////////////
                        ModDBOperator.DelDataItem(lid, datatype, pSysDB, out ex);
                        if (null != ex)
                        {
                            eerorFrm       = new SysCommon.Error.frmInformation("是", "否", "数据文件\n'" + FileName + "'\n元信息删除失败。\n" + "请确认元信息库的连接信息。" + "!\n是否继续删除?");
                            eerorFrm.Owner = (m_Hook as Plugin.Application.IAppFormRef).MainForm;
                            if (eerorFrm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                continue;
                            }
                            else
                            {
                                frmbar.Close();
                                return;
                            }
                        }
                        // m_Hook.DataInfoGrid.Rows.Remove(m_Hook.DataInfoGrid.Rows[i]);
                        // i = i - 1;
                        delrowlist.Add(i);
                        #endregion
                        #region 在树节点中删除文件节点

                        /////////////////////在树节点中删除文件节点///////////////////////////
                        ModDBOperator.DelNodeByNameAndText(Deltreenode, FilePath, FileName, out ex);
                        if (null != ex)
                        {
                            eerorFrm       = new SysCommon.Error.frmInformation("是", "否", "树节点删除失败。原因为:\n" + ex.Message + "!\n是否继续删除?");
                            eerorFrm.Owner = (m_Hook as Plugin.Application.IAppFormRef).MainForm;
                            if (eerorFrm.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                            {
                                frmbar.Close();
                                return;
                            }
                            //else
                            //    return;
                        }
                        #endregion
                    }
                    #endregion
                }
                else  //除产品类型节点以外的所有节点
                {
                    frmbar.SetFrmProcessBarMax((long)m_Hook.DataInfoGrid.Rows.Count);
                    for (int i = 0; i < m_Hook.DataInfoGrid.Rows.Count; i++)
                    {
                        #region 获取必要信息
                        if (false == m_Hook.DataInfoGrid.Rows[i].Selected)
                        {
                            continue;
                        }
                        frmbar.SetFrmProcessBarValue((long)i);
                        int DataType = -1;//产品的类型(标准,非标准,属性)
                        try
                        {
                            ID = m_Hook.DataInfoGrid.Rows[i].Cells["ID"].FormattedValue.ToString().Trim();
                            if (string.IsNullOrEmpty(ID))
                            {
                                continue;
                            }
                            lid      = Convert.ToInt64(ID);
                            FileName = m_Hook.DataInfoGrid.Rows[i].Cells["数据文件名"].FormattedValue.ToString().Trim();
                            FilePath = m_Hook.DataInfoGrid.Rows[i].Cells["存储位置"].FormattedValue.ToString().Trim();
                            type     = m_Hook.DataInfoGrid.Rows[i].Cells["数据类型"].FormattedValue.ToString().Trim();
                            if ("标准图幅数据" == type)
                            {
                                datatype = EnumDataType.标准图幅.GetHashCode();
                            }
                            else if ("非标准图幅数据" == type)
                            {
                                datatype = EnumDataType.非标准图幅.GetHashCode();
                            }
                            else if ("控制点数据" == type)
                            {
                                datatype = EnumDataType.控制点数据.GetHashCode();
                            }
                        }
                        catch
                        {
                            eerorFrm       = new SysCommon.Error.frmInformation("是", "否", "数据文件:" + FileName + "删除失败。原因为:数据文件的ID获取失败\n" + "是否继续删除?");
                            eerorFrm.Owner = (m_Hook as Plugin.Application.IAppFormRef).MainForm;
                            if (eerorFrm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                continue;
                            }
                            else
                            {
                                frmbar.Close();
                                return;
                            }
                        }
                        #endregion
                        #region 在元信息表中删除
                        frmbar.SetFrmProcessBarText("正在删除文件:" + FileName);
                        if (ex != null)
                        {
                            ex = new Exception("连接元数据库失败!连接地址为:" + ConnStr);
                            pSysDB.CloseDbConnection();
                            return;
                        }
                        if (lid != -1 && datatype != -1)
                        {
                            ModDBOperator.DelDataItem(lid, datatype, pSysDB, out ex);
                            if (null != ex)
                            {
                                eerorFrm       = new SysCommon.Error.frmInformation("是", "否", "数据文件元信息删除失败。\n" + "请检查元信息库连接信息" + "!\n是否继续删除?");
                                eerorFrm.Owner = (m_Hook as Plugin.Application.IAppFormRef).MainForm;
                                if (eerorFrm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                {
                                    continue;
                                }
                                else
                                {
                                    frmbar.Close();
                                    return;
                                }
                            }
                        }

                        #endregion
                        #region 在文件库中删除

                        if (2 != datatype)////数据类型为控制点控制点数据则不进行文件的删除操作
                        {
                            bool Delstate = ModDBOperator.DelDataItem(FilePath, FileName, ip, id, password, out ex);
                            if (!Delstate)
                            {
                                eerorFrm       = new SysCommon.Error.frmInformation("是", "否", "数据文件\n'" + FilePath + "/" + FileName + "'\n删除失败。\n" + " 请确认文件是否存在或是否为占用状态。" + "\n是否继续删除?");
                                eerorFrm.Owner = (m_Hook as Plugin.Application.IAppFormRef).MainForm;
                                if (eerorFrm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                {
                                    continue;
                                }
                                else
                                {
                                    frmbar.Close();
                                    return;
                                }
                            }
                        }
                        #endregion
                        #region 记录DataGrid中要删除的行
                        delrowlist.Add(i);
                        #endregion
                        #region 在树节点中删除文件节点

                        ModDBOperator.DelNodeByNameAndText(Deltreenode, FilePath, FileName, out ex);
                        if (null != ex)
                        {
                            eerorFrm       = new SysCommon.Error.frmInformation("是", "否", "树节点删除失败。原因为:\n" + ex.Message + "!\n是否继续删除?");
                            eerorFrm.Owner = (m_Hook as Plugin.Application.IAppFormRef).MainForm;
                            if (eerorFrm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                continue;
                            }
                            else
                            {
                                frmbar.Close();
                                return;
                            }
                        }
                        #endregion
                    }
                }
                /////数据列表中移除相应的行
                if (null != delrowlist)
                {
                    for (int j = 0; j < delrowlist.Count; j++)
                    {
                        m_Hook.DataInfoGrid.Rows.Remove(m_Hook.DataInfoGrid.Rows[delrowlist[j] - j]);
                    }
                }
                frmbar.Close();
                #endregion
            }
            #region 图层处理
            if (ModData.v_AppFileDB.MapControl.LayerCount > 0 && datatype != 2)
            {
                IGroupLayer Glayer = null;
                for (int i = 0; i < ModData.v_AppFileDB.MapControl.LayerCount; i++)
                {
                    ILayer getlayer = ModData.v_AppFileDB.MapControl.get_Layer(i);
                    if (getlayer.Name == "项目范围图")
                    {
                        Glayer = getlayer as IGroupLayer;
                    }
                }
                if (null != Glayer)
                {
                    ICompositeLayer comlayer  = Glayer as ICompositeLayer;
                    string          layername = null;
                    switch (datatype)
                    {
                    case 0:
                        layername = "MapFrame_";
                        break;

                    case 1:
                        layername = "Range_";
                        break;

                    default:
                        layername = "_";
                        break;
                    }
                    if (comlayer != null)
                    {
                        for (int i = 0; i < comlayer.Count; i++)
                        {
                            ILayer orglayer = comlayer.get_Layer(i);
                            string lname    = orglayer.Name;
                            if (lname.Contains(layername))
                            {
                                Glayer.Delete(orglayer);
                                ModData.v_AppFileDB.TOCControl.Update();
                                ModData.v_AppFileDB.MapControl.ActiveView.Refresh();
                            }
                        }
                    }
                }
            }
            if (datatype == EnumDataType.控制点数据.GetHashCode())
            {
                IGraphicsContainer pGra = ModData.v_AppFileDB.MapControl.Map as IGraphicsContainer;
                pGra.DeleteAllElements();
                ModData.v_AppFileDB.MapControl.ActiveView.Refresh();
            }
            #endregion


            //刷新时间列表框

            ModDBOperator.LoadComboxTime(ConnStr, out ex);
            if (ex != null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "加载时间列表框失败," + ex.Message);
                return;
            }
        }
        public override void OnClick()
        {
            Exception eError = null;

            SysCommon.DataBase.SysTable pSysDB = new SysCommon.DataBase.SysTable();

            try
            {
                //设置查询条件后,执行查询操作

                ///连接数据库

                /// //string ipStr = v_DBNode.Text.Trim();//ip
                //if (ipStr == "") return;
                //string ipStr = "//" + ipStr + "//MetaDataBase//MetaDataBase.mdb";//元数据库路径
                XmlElement dbElem = v_DBNode.Tag as XmlElement;
                if (dbElem == null)
                {
                    return;
                }
                string ipStr = dbElem.GetAttribute("MetaDBConn");

                //string ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ipStr + ";Persist Security Info=True";//元数据连接字符串
                //pSysDB.SetDbConnection(ConnStr, SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError);
                pSysDB.SetDbConnection(ipStr, SysCommon.enumDBConType.ORACLE, SysCommon.enumDBType.ORACLE, out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "连接元数据库失败!");
                    pSysDB.CloseDbConnection();
                    return;
                }

                if (v_CondiStr == "")
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "请设置查询条件!");
                    pSysDB.CloseDbConnection();
                    return;
                }

                DataTable resultDT = pSysDB.GetSQLTable(v_CondiStr, out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "查询成果索引表出错!");
                    pSysDB.CloseDbConnection();
                    return;
                }


                ///将查询到的结果在界面上表现出来(查询结果包括数据信息和元信息)
                #region 将结果保存在DataTable中

                DataTable tempDT = ModDBOperator.CreateDataInfoTable();
                for (int i = 0; i < resultDT.Rows.Count; i++)
                {
                    string dataID   = "";      //数据ID
                    string DataName = "";      //数据文件名

                    string projectID   = "";   //项目ID
                    string productID   = "";   //产品ID
                    string projectName = "";   //项目名称
                    string productName = "";   //产品名称
                    string scale       = "";   //比例尺

                    string rangNO = "";        //范围号

                    string dataFormatID = "";  //数据格式ID
                    string dataTypeID   = "";  //数据类型ID
                    string dataFormat   = "";  //数据格式名

                    string dataType = "";      //数据类型名

                    //string saveTime = "";      //存储时间
                    string savePath = "";      //存储路径
                    string fromDate = "";      //生产日期

                    dataID       = resultDT.Rows[i]["数据ID"].ToString().Trim();
                    projectID    = resultDT.Rows[i]["项目ID"].ToString().Trim();
                    productID    = resultDT.Rows[i]["产品ID"].ToString().Trim();
                    scale        = resultDT.Rows[i]["比例尺分母"].ToString().Trim();
                    rangNO       = resultDT.Rows[i]["范围号"].ToString().Trim();
                    dataFormatID = resultDT.Rows[i]["数据格式编号"].ToString().Trim();
                    dataTypeID   = resultDT.Rows[i]["数据类型编号"].ToString().Trim();
                    //saveTime = resultDT.Rows[i]["存储时间"].ToString().Trim();
                    savePath = resultDT.Rows[i]["存储位置"].ToString().Trim();
                    fromDate = resultDT.Rows[i]["生产日期"].ToString().Trim();

                    projectName = ModDBOperator.GetProjectName(long.Parse(projectID), pSysDB, out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取项目名称出错!");
                        pSysDB.CloseDbConnection();
                        return;
                    }

                    productName = ModDBOperator.GetProductName(long.Parse(productID), pSysDB, out eError);
                    if (eError != null || productName == "")
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取产品名称出错!");
                        pSysDB.CloseDbConnection();
                        return;
                    }
                    if (dataTypeID == "")
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "为填写数据类型,请检查!");
                        pSysDB.CloseDbConnection();
                        return;
                    }
                    DataName = GetDataName(int.Parse(dataTypeID), long.Parse(dataID), pSysDB, out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取数据文件名称出错!");
                        pSysDB.CloseDbConnection();
                        return;
                    }

                    switch (int.Parse(dataFormatID))
                    {
                    case 0:
                        dataFormat = "DLG";
                        break;

                    case 1:
                        dataFormat = "DEM";
                        break;

                    case 2:
                        dataFormat = "DOM";
                        break;

                    case 3:
                        dataFormat = "DRG";
                        break;
                    }

                    switch (int.Parse(dataTypeID))
                    {
                    case 0:
                        dataType = "标准图幅数据";
                        break;

                    case 1:
                        dataType = "非标准图幅数据";
                        break;

                    case 2:
                        dataType = "控制点数据";
                        break;
                    }

                    DataRow newRow = tempDT.NewRow();
                    newRow["ID"]    = dataID;
                    newRow["项目名称"]  = projectName;
                    newRow["产品名称"]  = productName;
                    newRow["数据文件名"] = DataName;
                    newRow["数据类型"]  = dataType;
                    newRow["比例尺"]   = scale;
                    newRow["范围号"]   = rangNO;
                    newRow["存储位置"]  = savePath;
                    //newRow["存储时间"] = saveTime;
                    newRow["生产日期"] = fromDate;
                    newRow["项目ID"] = projectID.ToString();
                    newRow["产品ID"] = productID.ToString();
                    tempDT.Rows.Add(newRow);
                }
                #endregion

                #region 将DataTable与DataGrid进行绑定
                //清空表格
                if (m_Hook.DataInfoGrid.DataSource != null)
                {
                    m_Hook.DataInfoGrid.DataSource = null;
                }
                //绑定
                m_Hook.DataInfoGrid.DataSource    = tempDT;
                m_Hook.DataInfoGrid.ReadOnly      = true;
                m_Hook.DataInfoGrid.Visible       = true;
                m_Hook.DataInfoGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
                for (int j = 0; j < m_Hook.DataInfoGrid.Columns.Count; j++)
                {
                    //m_Hook.DataInfoGrid.Columns[j].Width = (m_Hook.DataInfoGrid.Width - 20) / m_Hook.DataInfoGrid.Columns.Count;
                    m_Hook.DataInfoGrid.Columns[j].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
                }
                m_Hook.DataInfoGrid.RowHeadersWidth = 20;
                m_Hook.DataInfoGrid.Refresh();

                pSysDB.CloseDbConnection();
                #endregion
            }
            catch (Exception eR)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未知错误:" + eR.Message);
                pSysDB.CloseDbConnection();
                return;
            }
        }
Exemplo n.º 20
0
        public override void OnClick()
        {
            //FrmMathematicsCheck mFrmMathematicsCheck = new FrmMathematicsCheck(_AppHk, enumErrorType.线长度逻辑性);
            //mFrmMathematicsCheck.ShowDialog();

            Exception eError = null;

            FrmLineLengthCheck pFrmLineLengthCheck = new FrmLineLengthCheck();

            if (pFrmLineLengthCheck.ShowDialog() == DialogResult.OK)
            {
                #region 错误日志保存
                //错误日志连接信息
                string logPath = TopologyCheckClass.GeoLogPath + "Log" + System.DateTime.Today.Year.ToString() + System.DateTime.Today.Month.ToString() + System.DateTime.Today.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString() + ".xls";;
                if (File.Exists(logPath))
                {
                    if (SysCommon.Error.ErrorHandle.ShowFrmInformation("是", "否", "日志文件\n'" + logPath + "'\n已经存在,是否替换?"))
                    {
                        File.Delete(logPath);
                    }
                    else
                    {
                        return;
                    }
                }
                //生成日志信息EXCEL格式
                SysCommon.DataBase.SysDataBase pSysLog = new SysCommon.DataBase.SysDataBase();
                pSysLog.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + logPath + "; Extended Properties=Excel 8.0;", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "日志信息表连接失败!");
                    return;
                }
                string strCreateTableSQL = @" CREATE TABLE ";
                strCreateTableSQL += @" 错误日志 ";
                strCreateTableSQL += @" ( ";
                strCreateTableSQL += @" 检查功能名 VARCHAR, ";
                strCreateTableSQL += @" 错误类型 VARCHAR, ";
                strCreateTableSQL += @" 错误描述 VARCHAR, ";
                strCreateTableSQL += @" 数据图层1 VARCHAR, ";
                strCreateTableSQL += @" 数据OID1 VARCHAR, ";
                strCreateTableSQL += @" 数据图层2 VARCHAR, ";
                strCreateTableSQL += @" 数据OID2 VARCHAR, ";
                strCreateTableSQL += @" 定位点X VARCHAR , ";
                strCreateTableSQL += @" 定位点Y VARCHAR , ";
                strCreateTableSQL += @" 检查时间 VARCHAR ,";
                strCreateTableSQL += @" 数据文件路径 VARCHAR ";
                strCreateTableSQL += @" ) ";

                pSysLog.UpdateTable(strCreateTableSQL, out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "插入表头出错!");
                    pSysLog.CloseDbConnection();
                    return;
                }

                DataCheckClass dataCheckCls = new DataCheckClass(_AppHk);
                //将日志表连接信息和表名保存起来
                dataCheckCls.ErrDbCon     = pSysLog.DbConn;
                dataCheckCls.ErrTableName = "错误日志";
                #endregion

                #region 获得要检查的IFeatureClass的集合
                //将Mapcontrol上所有的图层名保存起来
                List <IFeatureClass> LstFeaClass = new List <IFeatureClass>();
                for (int i = 0; i < _AppHk.MapControl.LayerCount; i++)
                {
                    ILayer player = _AppHk.MapControl.get_Layer(i);
                    if (player is IGroupLayer)
                    {
                        ICompositeLayer pComLayer = player as ICompositeLayer;
                        for (int j = 0; j < pComLayer.Count; j++)
                        {
                            ILayer        mLayer        = pComLayer.get_Layer(j);
                            IFeatureLayer mfeatureLayer = mLayer as IFeatureLayer;
                            if (mfeatureLayer == null)
                            {
                                continue;
                            }
                            IFeatureClass pfeaCls = mfeatureLayer.FeatureClass;
                            if (!LstFeaClass.Contains(pfeaCls))
                            {
                                LstFeaClass.Add(pfeaCls);
                            }
                        }
                    }
                    else
                    {
                        IFeatureLayer pfeatureLayer = player as IFeatureLayer;
                        if (pfeatureLayer == null)
                        {
                            continue;
                        }
                        IFeatureClass mFeaCls = pfeatureLayer.FeatureClass;
                        if (!LstFeaClass.Contains(mFeaCls))
                        {
                            LstFeaClass.Add(mFeaCls);
                        }
                    }
                }
                #endregion
                try
                {
                    SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable();
                    string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + TopologyCheckClass.GeoDataCheckParaPath;
                    pSysTable.SetDbConnection(conStr, SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "GIS数据检查配置表连接失败!");
                        pSysLog.CloseDbConnection();
                        return;
                    }

                    //分类代码字段名
                    string codeName = TopologyCheckClass.GetCodeName(pSysTable, out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message);
                        pSysLog.CloseDbConnection();
                        pSysTable.CloseDbConnection();
                        return;
                    }

                    DataTable mTable = TopologyCheckClass.GetParaValueTable(pSysTable, 3, out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message);
                        pSysLog.CloseDbConnection();
                        pSysTable.CloseDbConnection();
                        return;
                    }
                    if (mTable.Rows.Count == 0)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未进行线长度检查配置!");
                        pSysLog.CloseDbConnection();
                        pSysTable.CloseDbConnection();
                        return;
                    }
                    //执行线长度逻辑性检查
                    double pmax = pFrmLineLengthCheck.MaxValue;
                    double pmin = pFrmLineLengthCheck.MinValue;
                    LineLogicCheck(dataCheckCls, LstFeaClass, mTable, codeName, pmin.ToString(), pmax.ToString(), out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "线长度逻辑性检查失败。" + eError.Message);
                        pSysLog.CloseDbConnection();
                        pSysTable.CloseDbConnection();
                        return;
                    }
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "数据检查完成!");

                    pSysLog.CloseDbConnection();
                    pSysTable.CloseDbConnection();
                    //隐藏进度条
                    dataCheckCls.ShowProgressBar(false);
                }
                catch (Exception ex)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", ex.Message);
                    pSysLog.CloseDbConnection();
                    return;
                }
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// chenyafei 20110311 add content:初始化界面
        /// </summary>
        private void InitilComboBox()
        {
            Exception outError = null;

            #region 初始化性别列表框
            ComboBoxItem item = new ComboBoxItem("男", 0);
            this.comboSex.Items.Add(item);
            item = new ComboBoxItem("女", 1);
            this.comboSex.Items.Add(item);
            this.comboSex.SelectedIndex = 0;
            #endregion

            #region 初始化角色列表框
            //连接系统维护库
            SysCommon.DataBase.SysTable pSysDB = null;
            ModDBOperate.ConnectDB(out pSysDB, out outError);
            if (outError != null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", outError.Message);
                m_BeSuccedd = false;
                return;
            }
            //查询角色基本信息表
            string selStr = string.Empty;
            if (this._user == null)
            {
                selStr = "select * from rolebaseinfo WHERE rolebaseinfo.ROLETYPEID<>3";   //查询角色字符串,3为系统管理员角色,系统管理员角色不能添加
            }
            else
            {
                //cyf 20110602 delete
                //if (this._user.RoleTypeID==EnumRoleType.系统管理员.GetHashCode())
                //    selStr = "select * from rolebaseinfo";
                //else
                //    selStr = "select * from rolebaseinfo WHERE rolebaseinfo.ROLETYPEID<>3";
                //end
            }
            DataTable pTable = pSysDB.GetSQLTable(selStr, out outError);
            if (outError != null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "查询角色基本信息表失败,原因:" + outError.Message);
                m_BeSuccedd = false;
                pSysDB.CloseDbConnection();
                return;
            }
            pSysDB.CloseDbConnection();
            //遍历表格记录,将角色信息加载到ComboBox中
            for (int i = 0; i < pTable.Rows.Count; i++)
            {
                string roleID   = "";   //角色ID
                string roleName = "";   //角色名称
                roleID   = pTable.Rows[i][0].ToString().Trim();
                roleName = pTable.Rows[i][1].ToString().Trim();
                ComboBoxItem pItem = new ComboBoxItem(roleName, roleID);
                cmbRole.Items.Add(pItem);
            }
            if (cmbRole.Items.Count > 0)
            {
                cmbRole.SelectedIndex = 0;
            }
            #endregion
        }
Exemplo n.º 22
0
        /// <summary>
        /// 查询表格
        /// </summary>
        /// <param name="pSysDB"></param>
        /// <param name="pRowsArr"></param>
        /// <param name="resaultTable"></param>
        /// <param name="eError"></param>
        private void showResault(SysCommon.DataBase.SysTable pSysDB, DataTable pTable, DataTable resaultTable, out Exception eError)
        {
            eError = null;
            bool b = false;

            for (int i = 0; i < pTable.Rows.Count; i++)
            {
                string dataID      = "";
                string projectName = "";
                string productName = "";
                string DataName    = "";
                string RangeNo     = "";
                string pSacle      = "";
                string pPath       = "";
                string pTime       = "";
                string productType = "";
                string projectID   = "";
                string productID   = "";

                dataID = pTable.Rows[i]["ID"].ToString().Trim();
                for (int j = 0; j < m_Hook.DataInfoGrid.Rows.Count; j++)
                {
                    if (m_Hook.DataInfoGrid.Rows[j].Cells[0].FormattedValue.ToString().Trim() == dataID)
                    {
                        b = true;
                        break;
                    }
                }
                if (b)
                {
                    continue;
                }
                DataName  = pTable.Rows[i]["数据文件名"].ToString().Trim();
                productID = pTable.Rows[i]["产品ID"].ToString().Trim();
                pPath     = pTable.Rows[i]["存储位置"].ToString().Trim();
                pTime     = pTable.Rows[i]["生产日期"].ToString().Trim();
                if (cmbType.Text == "标准图幅")
                {
                    RangeNo     = pTable.Rows[i]["图幅号"].ToString().Trim();
                    productType = "标准图幅数据";
                }
                else if (cmbType.Text == "非标准图幅")
                {
                    RangeNo     = pTable.Rows[i]["块图号"].ToString().Trim();
                    productType = "非标准图幅数据";
                }
                else if (cmbType.Text == "控制点数据")
                {
                    productType = "控制点数据";
                }
                //查询产品信息表

                string    str          = "select * from ProductMDTable where ID=" + long.Parse(productID);
                DataTable productTable = pSysDB.GetSQLTable(str, out eError);
                if (eError != null)
                {
                    eError = new Exception("查询产品信息表出错!");
                    return;
                }
                if (productTable.Rows.Count == 0)
                {
                    eError = new Exception("查询产品信息表出错!");
                    return;
                }
                productName = productTable.Rows[0]["产品名称"].ToString().Trim();
                projectID   = productTable.Rows[0]["项目ID"].ToString().Trim();
                pSacle      = productTable.Rows[0]["比例尺分母"].ToString().Trim();
                //查询项目信息表

                str = "select * from ProjectMDTable where ID=" + long.Parse(projectID);
                DataTable projectTable = pSysDB.GetSQLTable(str, out eError);
                if (eError != null)
                {
                    eError = new Exception("查询项目信息表出错!");
                    return;
                }
                if (productTable.Rows.Count == 0)
                {
                    eError = new Exception("查询项目信息表出错!");
                    return;
                }
                projectName = projectTable.Rows[0]["项目名称"].ToString().Trim();

                //添加行

                DataRow newRow = resaultTable.NewRow();
                newRow[0]  = dataID;
                newRow[1]  = projectName;
                newRow[2]  = productName;
                newRow[3]  = DataName;
                newRow[4]  = RangeNo;
                newRow[5]  = pSacle;
                newRow[6]  = pPath;
                newRow[7]  = pTime;
                newRow[8]  = productType;
                newRow[9]  = projectID;
                newRow[10] = productID;
                resaultTable.Rows.Add(newRow);

                //刷新表格
                m_Hook.DataInfoGrid.Update();
                m_Hook.DataInfoGrid.Refresh();
            }
        }
Exemplo n.º 23
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            this.Hide();
            Exception eError    = null;
            string    fieldVale = txtValue.Text.ToString();    //字段值

            if (fieldVale == "")
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "请填写关键字!");
                return;
            }
            string strMatch = cmbMatch.Text.Trim();       //匹配类型

            #region 申明表格并进行绑定

            DataTable resalutDT = ModDBOperator.CreateDataInfoTable();
            //清空表格
            if (m_Hook.DataInfoGrid.DataSource != null)
            {
                m_Hook.DataInfoGrid.DataSource = null;
            }
            //绑定
            m_Hook.DataInfoGrid.DataSource    = resalutDT;
            m_Hook.DataInfoGrid.ReadOnly      = true;
            m_Hook.DataInfoGrid.Visible       = true;
            m_Hook.DataInfoGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            for (int j = 0; j < m_Hook.DataInfoGrid.Columns.Count; j++)
            {
                //m_Hook.DataInfoGrid.Columns[j].Width = (m_Hook.DataInfoGrid.Width - 20) / m_Hook.DataInfoGrid.Columns.Count;
                m_Hook.DataInfoGrid.Columns[j].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            }
            m_Hook.DataInfoGrid.RowHeadersWidth = 20;
            #endregion

            #region 连接数据库

            if (ConnStr == "")
            {
                return;
            }
            SysCommon.DataBase.SysTable pSysDB = new SysCommon.DataBase.SysTable();
            pSysDB.SetDbConnection(ConnStr, SysCommon.enumDBConType.ORACLE, SysCommon.enumDBType.ORACLE, out eError);
            if (eError != null)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "连接元数据库失败!");
                pSysDB.CloseDbConnection();
                return;
            }
            #endregion
            #region 首先查询成果索引表,获得符合条件的数据ID
            string dataIDStandarStr    = ""; //标准图幅过滤条件
            string dataIDNonStandarStr = ""; //非标准图幅过滤条件

            string dataIDControlStr = "";    //控制点过滤条件

            string wherestr = GetWhereStr(); //过滤条件
            string str2     = "";
            if (wherestr != "")
            {
                str2 = "select * from ProductIndexTable where " + wherestr; //查询成果索引表

                DataTable tempDt = pSysDB.GetSQLTable(str2, out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "查询成果索引表失败!");
                    pSysDB.CloseDbConnection();
                    return;
                }
                for (int i = 0; i < tempDt.Rows.Count; i++)
                {
                    int  dataType = Convert.ToInt32(tempDt.Rows[i]["数据类型编号"].ToString());
                    long pDataId  = Convert.ToInt64(tempDt.Rows[i]["数据ID"].ToString());
                    if (dataType == 0)
                    {
                        //标准图幅
                        dataIDStandarStr += pDataId + ",";
                    }
                    else if (dataType == 1)
                    {
                        //非标准图幅

                        dataIDNonStandarStr += pDataId + ",";
                    }
                    else if (dataType == 2)
                    {
                        //控制点数据

                        dataIDControlStr += pDataId + ",";
                    }
                }
                if (dataIDStandarStr != "")
                {
                    dataIDStandarStr = dataIDStandarStr.Substring(0, dataIDStandarStr.Length - 1);
                }
                if (dataIDNonStandarStr != "")
                {
                    dataIDNonStandarStr = dataIDNonStandarStr.Substring(0, dataIDNonStandarStr.Length - 1);
                }
                if (dataIDControlStr != "")
                {
                    dataIDControlStr = dataIDControlStr.Substring(0, dataIDControlStr.Length - 1);
                }
            }
            #endregion
            //再次进行过滤查询表格
            string pTableName  = "";
            string restrainStr = "";
            if (cmbType.Text == "标准图幅")
            {
                pTableName = "StandardMapMDTable";
                if (dataIDStandarStr != "")
                {
                    restrainStr = dataIDStandarStr;
                }
            }
            else if (cmbType.Text == "非标准图幅")
            {
                pTableName = "NonstandardMapMDTable";
                if (dataIDNonStandarStr != "")
                {
                    restrainStr = dataIDNonStandarStr;
                }
            }
            else if (cmbType.Text == "控制点数据")
            {
                pTableName = "ControlPointMDTable";
                if (dataIDControlStr != "")
                {
                    restrainStr = dataIDControlStr;
                }
            }
            //DataTable mTable = pSysDB.GetTable(pTableName, out eError);
            //if (eError != null)
            //{
            //    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "获取源数据信息表失败!");
            //    return;
            //}

            try
            {
                if (cmbField.Text == "所有字段")
                {
                    if (m_FieldDic == null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "没有可用的字段!");
                        pSysDB.CloseDbConnection();
                        return;
                    }
                    foreach (KeyValuePair <string, Type> pField in m_FieldDic)
                    {
                        string fName = pField.Key.Trim();
                        Type   fType = pField.Value;
                        string pSQL  = GetSQL(fName, fieldVale, fType, strMatch, out eError);
                        if (eError != null)
                        {
                            pSysDB.CloseDbConnection();
                            return;
                        }
                        string str1 = "";
                        if (m_Hook.ProjectTree.SelectedNode.DataKey.ToString() == EnumTreeNodeType.DATABASE.ToString())
                        {
                            //如果是数据库节点没有任何限制条件
                            str1 = "select * from " + pTableName + " where " + pSQL;
                        }
                        else
                        {
                            //如果是其他的节点则肯定 有限制条件

                            if (restrainStr != "")
                            {
                                //查询到数据

                                str1 = "select * from " + pTableName + " where ID in (" + restrainStr + ") and " + pSQL;
                            }
                            else
                            {
                                //查不到数据

                                return;
                            }
                        }
                        //str1 = "select * from " + pTableName + " where ID in (" + restrainStr + ") and 数据文件名 like '%3%'";
                        DataTable pTable = pSysDB.GetSQLTable(str1, out eError);
                        if (eError != null)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "获取源数据信息表失败!");
                            return;
                        }
                        //DataRow[] pRowArr = mTable.Select(pSQL);

                        showResault(pSysDB, pTable, resalutDT, out eError);
                        if (eError != null)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", eError.Message);
                            pSysDB.CloseDbConnection();
                            return;
                        }
                    }
                }
                else
                {
                    string fieldName = cmbField.Text.Trim();
                    Type   fieldType = m_FieldDic[fieldName];
                    string selSQL    = GetSQL(fieldName, fieldVale, fieldType, strMatch, out eError);
                    if (eError != null)
                    {
                        pSysDB.CloseDbConnection();
                        return;
                    }
                    string str1 = "";
                    if (m_Hook.ProjectTree.SelectedNode.DataKey.ToString() == EnumTreeNodeType.DATABASE.ToString())
                    {
                        //如果是数据库节点没有任何限制条件
                        str1 = "select * from " + pTableName + " where " + selSQL;
                    }
                    else
                    {
                        //如果是其他的节点则肯定 有限制条件

                        if (restrainStr != "")
                        {
                            //查询到数据

                            str1 = "select * from " + pTableName + " where " + selSQL + " and ID in (" + restrainStr + ")";
                        }
                        else
                        {
                            //查不到数据

                            m_Hook.DataInfoGrid.Update();
                            m_Hook.DataInfoGrid.Refresh();
                            return;
                        }
                    }
                    DataTable pTable = pSysDB.GetSQLTable(str1, out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "获取源数据信息表失败!");
                        return;
                    }
                    //DataRow[] pRowsArr = mTable.Select(selSQL);

                    showResault(pSysDB, pTable, resalutDT, out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", eError.Message);
                        pSysDB.CloseDbConnection();
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", ex.Message);
            }
            pSysDB.CloseDbConnection();
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Exemplo n.º 24
0
        /// <summary>
        /// 导出一条记录

        /// </summary>
        /// <param name="dataID">数据ID</param>
        /// <param name="insertStr">插入字符串</param>
        /// <param name="orgTable">源表格</param>
        /// <param name="desSysTable">目标表格</param>
        /// <param name="path">存储路径</param>
        /// <param name="eError"></param>
        private void OutPutOneRacord(long dataID, string insertStr, DataTable orgTable, SysCommon.DataBase.SysTable desSysTable, string path, out Exception eError)
        {
            eError = null;
            string insertallStr = insertStr;
            string pointName    = "";//控制点名

            DataRow[] drs = orgTable.Select("ID =" + dataID);
            if (drs.Length == 0)
            {
                eError = new Exception("未找到ID为:'" + dataID + "'的记录");
                return;
            }
            DataRow dr = drs[0];

            for (int i = 5; i < dr.Table.Columns.Count - 1; i++)
            {
                Type   columType  = dr.Table.Columns[i].DataType;
                string columValue = dr[i].ToString();
                string str        = ModDBOperator.GetSQlEX(columType, columValue);
                insertallStr += str + ",";
            }
            insertallStr = insertallStr.Substring(0, insertallStr.Length - 1) + ")";
            //导出元数据

            desSysTable.UpdateTable(insertallStr, out eError);
            if (eError != null)
            {
                return;
            }

            //创建数据文件
            pointName = dr[5].ToString();
            string pDataName = path + "\\" + pointName + ".dwg";       //数据文件名

            if (File.Exists(pDataName))
            {
                if (SysCommon.Error.ErrorHandle.ShowFrmInformation("是", "否", "已存在同名文件,是否替换?"))
                {
                    File.Delete(pDataName);
                }
                else
                {
                    return;
                }
            }
            if (dr[dr.Table.Columns.Count - 1].ToString() != "")
            {
                byte[] picByte = dr[dr.Table.Columns.Count - 1] as byte[];
                if (picByte.Length > 0)
                {
                    FileStream pFStream = new FileStream(pDataName, FileMode.CreateNew, FileAccess.Write);
                    pFStream.Write(picByte, 0, picByte.Length);
                    MemoryStream meStream = new MemoryStream(picByte, true);
                    meStream.Write(picByte, 0, picByte.Length);
                }
            }
        }
Exemplo n.º 25
0
        public override void OnClick()
        {
            Exception           eError = null;
            FolderBrowserDialog pFolderBrowserDialog = new FolderBrowserDialog();

            if (pFolderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                ///获得树图上选择的工程节点
                #region 获得工程树图上的参数信息
                ///获得树图上选择的工程节点
                //cyf 20110626 modify
                DevComponents.AdvTree.Node pCurNode   = m_Hook.ProjectTree.SelectedNode;   //当前树节点,栅格数据节点
                DevComponents.AdvTree.Node pDBProNode = m_Hook.ProjectTree.SelectedNode;   //获得工程树图节点
                while (pDBProNode.Parent != null)
                {
                    pDBProNode = pDBProNode.Parent;
                }
                if (pDBProNode.DataKeyString != "project")
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取工程树图节点失败!");
                    return;
                }
                //end
                //cyf  20110609 modify:
                //string pProjectname = pCurNode.Name;
                string pProjectname = pDBProNode.Text;
                //end
                System.Xml.XmlNode Projectnode = m_Hook.DBXmlDocument.SelectSingleNode("工程管理/工程[@名称='" + pProjectname + "']");
                //cyf
                if (Projectnode == null)
                {
                    return;
                }
                //end
                //cyf 20110626 modify:获取栅格数据图层的存储类型
                //获得栅格数据库类型
                //System.Xml.XmlElement DbTypeElem = Projectnode.SelectSingleNode(".//内容//栅格数据库") as System.Xml.XmlElement;
                //string dbType = DbTypeElem.GetAttribute("存储类型");   //栅格编目、栅格数据集
                XmlElement pCurElem = null;  //图层xml节点
                try { pCurElem = pCurNode.Tag as XmlElement; }
                catch { }
                if (pCurElem == null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取图层xml节点失败!");
                    return;
                }
                string dbType             = pCurElem.GetAttribute("存储类型").Trim(); //栅格数据存储类型
                string pDesRasterCollName = pCurElem.GetAttribute("名称").Trim();   //栅格数据名称

                //获得栅格目录,栅格数据集名称
                //System.Xml.XmlElement DbcataLogNameElem = Projectnode.SelectSingleNode(".//栅格数据库/连接信息/库体") as System.Xml.XmlElement;
                //if (DbcataLogNameElem == null) return;
                //string pDesRasterCollName = DbcataLogNameElem.GetAttribute("名称");    //栅格数据名称
                //if (pDesRasterCollName == "") return;
                //end

                //获得连接信息
                System.Xml.XmlElement DbConnElem = Projectnode.SelectSingleNode(".//栅格数据库/连接信息") as System.Xml.XmlElement;
                string pType     = DbConnElem.GetAttribute("类型");
                string pServer   = DbConnElem.GetAttribute("服务器");
                string pInstance = DbConnElem.GetAttribute("服务名");
                string pDataBase = DbConnElem.GetAttribute("数据库");
                string pUser     = DbConnElem.GetAttribute("用户");
                string pPassword = DbConnElem.GetAttribute("密码");
                string pVersion  = DbConnElem.GetAttribute("版本");
                //cyf 20110609 add
                string pConnectInfo = "";         //连接信息字符串
                pConnectInfo = pType + "," + pServer + "," + pInstance + "," + pDataBase + "," + pUser + "," + pPassword + "," + pVersion;
                //end
                #endregion
                #region 设置数据库连接信息
                SysCommon.Gis.SysGisDataSet pSysDt = new SysCommon.Gis.SysGisDataSet();
                if (pType.ToUpper() == "PDB")
                {
                    pSysDt.SetWorkspace(pDataBase, SysCommon.enumWSType.PDB, out eError);
                }
                else if (pType.ToUpper() == "GDB")
                {
                    pSysDt.SetWorkspace(pDataBase, SysCommon.enumWSType.GDB, out eError);
                }
                else if (pType.ToUpper() == "SDE")
                {
                    pSysDt.SetWorkspace(pServer, pInstance, "", pUser, pPassword, pVersion, out eError);
                    pDesRasterCollName = pUser + "." + pDesRasterCollName;
                }
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接数据库失败!");
                    return;
                }
                #endregion

                //cyf 20110609 add:读取栅格数据入库日志,
                #region 检查是否存在已经入库的数据
                SysCommon.DataBase.SysTable pSysTable = null;
                Dictionary <string, string> DicbeInDb = new Dictionary <string, string>();  //用来已经入库的栅格数据的源路径和目标连接信息
                if (File.Exists(ModData.RasterInDBLog))
                {
                    //若存在栅格数据入库日志,则将入库过的数据的路径保存起来
                    pSysTable = new SysCommon.DataBase.SysTable();
                    pSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ModData.RasterInDBLog + ";Persist Security Info=True", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接栅格入库日志表失败!");
                        return;
                    }
                    //获得栅格入库日志表
                    DataTable pTable = pSysTable.GetTable("rasterfileinfo", out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取栅格入库日志表失败!");
                        pSysTable.CloseDbConnection();
                        return;
                    }
                    for (int i = 0; i < pTable.Rows.Count; i++)
                    {
                        string pFileName = pTable.Rows[i][0].ToString();
                        string pDesPath  = pTable.Rows[i][2].ToString();
                        if (!DicbeInDb.ContainsKey(pFileName))
                        {
                            DicbeInDb.Add(pFileName, pDesPath);
                        }
                    }
                    //关闭连接
                    pSysTable.CloseDbConnection();
                    //cyf 20110610 modify
                    if (pTable.Rows.Count > 0)
                    {
                        //存在已经入库的数据
                        RasterErrInfoFrm pRasterErrInfoFrm = new RasterErrInfoFrm(pTable);
                        if (pRasterErrInfoFrm.ShowDialog() != DialogResult.OK)
                        {
                            //若不继续入库,则返回
                            return;
                        }
                    }
                    //end
                }

                #endregion
                //end
                //cyf 20110609
                //连接栅格数据入库日志表
                if (!File.Exists(ModData.RasterInDBLog))
                {
                    if (File.Exists(ModData.RasterInDBTemp))
                    {
                        File.Copy(ModData.RasterInDBTemp, ModData.RasterInDBLog);
                    }
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "没有找到日志表模板:" + ModData.RasterInDBTemp);
                    return;
                }
                pSysTable = new SysCommon.DataBase.SysTable();
                pSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ModData.RasterInDBLog + ";Persist Security Info=True", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接栅格入库日志表失败!");
                    return;
                }
                //获得文件夹下面所有的子文件
                string        pRootFile      = pFolderBrowserDialog.SelectedPath;// 选择的文件夹路径
                DirectoryInfo pDirectoryInfo = new DirectoryInfo(pRootFile);
                //FileInfo[] pFileInfoArr = pDirectoryInfo.GetFiles("*.tif", SearchOption.AllDirectories);
                FileInfo[] pFileInfoArr = pDirectoryInfo.GetFiles("*.*", SearchOption.AllDirectories);
                //添加进度条
                if (pAppFormRef.ProgressBar != null)
                {
                    pAppFormRef.ProgressBar.Visible = true;
                    pAppFormRef.ProgressBar.Maximum = pFileInfoArr.Length;
                    pAppFormRef.ProgressBar.Minimum = 0;
                    pAppFormRef.ProgressBar.Value   = 0;
                    Application.DoEvents();
                }
                //end
                for (int i = 0; i < pFileInfoArr.Length; i++)
                {
                    FileInfo pFileInfo = pFileInfoArr[i];
                    string   pFileName = pFileInfo.FullName; //文件名

                    if (!pFileName.ToLower().EndsWith("tif") && !pFileName.ToLower().EndsWith("img"))
                    {
                        //如果不是TIF文件和IMG文件则不参与检查
                        //进度条加1
                        if (pAppFormRef.ProgressBar != null)
                        {
                            pAppFormRef.ProgressBar.Value++;
                            Application.DoEvents();
                        }
                        continue;
                    }
                    //cyf 20110609 add:对入库过的数据进行判断和筛选
                    if (DicbeInDb.ContainsKey(pFileName))
                    {
                        //已经进行入库
                        if (DicbeInDb[pFileName] == pConnectInfo)
                        {
                            //如果源的路径与目标的路径都相同,则说明已经入库了
                            //进度条加1
                            if (pAppFormRef.ProgressBar != null)
                            {
                                pAppFormRef.ProgressBar.Value++;
                                Application.DoEvents();
                            }
                            continue;
                        }
                    }
                    //end
                    //cyf 20110610 add:文字提示
                    if (pAppFormRef != null)
                    {
                        pAppFormRef.OperatorTips = "正在进行数据" + pFileName + "入库...";
                        Application.DoEvents();
                    }
                    //end
                    //cyf 20110610 adds
                    string Starime = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();  //开始时间
                    //end
                    //进行数据入库
                    string fileFullName = pFileName;
                    if (dbType == "栅格数据集")
                    {
                        //栅格数据集入库
                        InputRasterDataset(pDesRasterCollName, fileFullName, pSysDt.WorkSpace, out eError);
                    }
                    else if (dbType == "栅格编目")
                    {
                        //栅格编目数据入库
                        InputRasterCatalogData(pDesRasterCollName, fileFullName, pSysDt.WorkSpace, out eError);
                    }
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "栅格数据入库出错!\n" + eError.Message);
                        return;
                    }
                    //若入库成功,则将入库成功的数据添加到栅格数据日志表中
                    //cyf 20110609 插入栅格数据日志表中
                    string insertStr = "insert into rasterfileinfo values('" + pFileName + "','" + Starime + "','" + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + "','" + pConnectInfo + "')";
                    pSysTable.UpdateTable(insertStr, out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "插入栅格入库日志表失败!");
                        continue;
                    }
                    //进度条加1
                    if (pAppFormRef.ProgressBar != null)
                    {
                        pAppFormRef.ProgressBar.Value++;
                        Application.DoEvents();
                    }
                    //end
                }
                //cyf  20110609 add:
                //关闭连接
                pSysTable.CloseDbConnection();
                //end
                //if (dbType == "栅格编目")
                //{
                //    InputRasterCatalogData(pDesRasterCollName, fileList, pSysDt.WorkSpace, out eError);
                //}
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "栅格数据入库完成!");

                //cyf 20110609 add
                if (pAppFormRef.ProgressBar != null)
                {
                    pAppFormRef.ProgressBar.Visible = false;
                    //cyf 20110610 add:清空文字提示
                    pAppFormRef.OperatorTips = "";
                    //end
                }
                //end

                //cyf 20110610 add:栅格正常结束的日志
                if (File.Exists(ModData.RasterInDBLog))
                {
                    File.Delete(ModData.RasterInDBLog);
                }
                //end
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// 创建元信息库体结构
        /// </summary>
        /// <param name="ex">返回错误信息</param>
        public void Creat(out Exception ex)
        {
            ex = null;
            if (this.m_DataBaseOper == null)
            {
                ex = new Exception("元信息Oracle数据库连接信息未初始化"); return;
            }
            string sql = string.Empty;

            if (!System.IO.File.Exists(ModuleData.v_FTPDbSchameFile))
            {
                ex = new Exception("FTP元信息库模板文件:" + ModuleData.v_FTPDbSchameFile + " 并不存在");
                return;
            }
            try
            {
                SysCommon.DataBase.SysTable metaSysTable = new SysCommon.DataBase.SysTable();
                metaSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ModuleData.v_FTPDbSchameFile + ";Persist Security Info=True", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out ex);
                if (ex != null)
                {
                    return;
                }
                List <string> TableNames = new List <string>();
                TableNames.Add("ControlPointMDTable");   ////////控制点元信息表
                TableNames.Add("DataFormatTable");       ////////////数据格式表
                TableNames.Add("DataTypeTable");         //////////////数据类型表
                TableNames.Add("NonstandardMapMDTable"); //////非标准图幅元信息表
                TableNames.Add("ProductIndexTable");     //////////产品索引表
                TableNames.Add("ProductMDTable");        /////////////产品元信息表
                TableNames.Add("ProjectMDTable");        /////////////项目元信息表
                TableNames.Add("StandardMapMDTable");    /////////标准图幅元信息表
                this.m_DataBaseOper.StartTransaction();
                foreach (string sTable in TableNames)
                {
                    DataTable GetTable = metaSysTable.GetTable(sTable, out ex);
                    if (ex != null)
                    {
                        return;
                    }
                    string SQL = string.Empty;/////////////在Oracle中建立表的SQL语句
                    SQL += "CREATE TABLE " + sTable + "(";
                    for (int i = 0; i < GetTable.Columns.Count; i++)
                    {
                        DataColumn GetColumn   = GetTable.Columns[i];
                        string     sColumnName = GetColumn.ColumnName;

                        int iColumnLen = GetColumn.MaxLength;
                        if (iColumnLen < 0)
                        {
                            iColumnLen = 100;
                        }
                        if (sColumnName == "存储位置")
                        {
                            iColumnLen = 500;
                        }

                        if (GetColumn.DataType.FullName == "System.String")
                        {
                            SQL += sColumnName;
                            SQL += " VARCHAR2(" + iColumnLen.ToString() + "),";
                        }
                        else if (GetColumn.DataType.FullName == "System.Decimal" || GetColumn.DataType.FullName == "System.Int32" || GetColumn.DataType.FullName == "System.Int64" || GetColumn.DataType.FullName == "System.Int16")
                        {
                            SQL += sColumnName;
                            SQL += " NUMBER,";
                        }
                        else if (GetColumn.DataType.FullName == "System.Double" || GetColumn.DataType.FullName == "System.Single")
                        {
                            SQL += sColumnName;
                            SQL += " NUMBER,";
                        }
                        else if (GetColumn.DataType.FullName == "System.DateTime")
                        {
                            SQL += sColumnName;
                            SQL += " DATE,";
                        }
                        else if (GetColumn.DataType.FullName == "System.Byte[]")
                        {
                            SQL += sColumnName;
                            SQL += " BLOB,";
                        }
                    }
                    SQL  = SQL.Substring(0, SQL.LastIndexOf(','));
                    SQL += " )";
                    if (!m_DataBaseOper.UpdateTable(SQL, out ex))
                    {
                        ex = new Exception("表:" + sTable + " 创建失败,\n原因:" + ex.Message);
                        this.m_DataBaseOper.EndTransaction(false);
                        return;
                    }
                }
            }
            catch (Exception eError)
            {
                ex = eError;
                return;
            }
            try
            {
                //////插入数据格式记录,图幅数据类型记录///////////////////////////////////////////////////////////////////
                string[] insertsql = new string[4];
                insertsql[0] = "INSERT INTO DataFormatTable(数据格式编号,数据格式) VALUES(0,'DLG')";
                insertsql[1] = "INSERT INTO DataFormatTable(数据格式编号,数据格式) VALUES(1,'DOM')";
                insertsql[2] = "INSERT INTO DataFormatTable(数据格式编号,数据格式) VALUES(2,'DEM')";
                insertsql[3] = "INSERT INTO DataFormatTable(数据格式编号,数据格式) VALUES(3,'DRG')";
                for (int i = 0; i < insertsql.Length; i++)
                {
                    this.m_DataBaseOper.UpdateTable(insertsql[i], out ex);
                    if (ex != null)
                    {
                        ex = new Exception("数据格式表初始化失败,\n原因:" + ex.Message);
                        this.m_DataBaseOper.EndTransaction(false);
                        return;
                    }
                }
                ////////
                insertsql    = new string[3];
                insertsql[0] = "INSERT INTO DataTypeTable(图幅类型编号,图幅类型) VALUES(0,'标准图幅')";
                insertsql[1] = "INSERT INTO DataTypeTable(图幅类型编号,图幅类型) VALUES(1,'非标准图幅')";
                insertsql[2] = "INSERT INTO DataTypeTable(图幅类型编号,图幅类型) VALUES(2,'属性信息')";
                for (int i = 0; i < insertsql.Length; i++)
                {
                    this.m_DataBaseOper.UpdateTable(insertsql[i], out ex);
                    if (ex != null)
                    {
                        ex = new Exception("图幅类型表初始化失败,\n原因:" + ex.Message);
                        this.m_DataBaseOper.EndTransaction(false);
                        return;
                    }
                }
                ////////
                this.m_DataBaseOper.EndTransaction(true);
            }
            catch (Exception eError)
            {
                ex = new Exception("成果文件库元信息库初始化失败,\n原因:" + eError.Message);
                return;
            }
        }
Exemplo n.º 27
0
        public void OnDataCheck()
        {
            Exception eError = null;

            if (Hook == null)
            {
                return;
            }
            IArcgisDataCheckParaSet dataCheckParaSet = Hook.DataCheckParaSet as IArcgisDataCheckParaSet;

            if (dataCheckParaSet == null)
            {
                return;
            }
            if (dataCheckParaSet.Workspace == null)
            {
                return;
            }

            //实现代码
            SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable();
            pSysTable.DbConn    = dataCheckParaSet.DbConnPara;
            pSysTable.DBConType = SysCommon.enumDBConType.OLEDB;
            pSysTable.DBType    = SysCommon.enumDBType.ACCESS;

            //高程点图层,参数ID为19(还需要改进)
            string pointFeaclsname = TopologyCheckClass.GetParaValue(pSysTable, 19, out eError);

            if (eError != null)
            {
                eError = new Exception("读取数据减配置表失败。" + eError.Message);
                return;
            }
            //等高线图层,参数ID为20
            string lineFeaclsname = TopologyCheckClass.GetParaValue(pSysTable, 20, out eError);

            if (eError != null)
            {
                eError = new Exception("读取数据减配置表失败。" + eError.Message);
                return;
            }
            //高程点高程字段名,参数ID为22
            string pointFieldsname = TopologyCheckClass.GetParaValue(pSysTable, 22, out eError);

            if (eError != null)
            {
                eError = new Exception("读取数据减配置表失败。" + eError.Message);
                return;
            }
            //等高线高程字段名,参数ID为23
            string lineFieldname = TopologyCheckClass.GetParaValue(pSysTable, 23, out eError);

            if (eError != null)
            {
                eError = new Exception("读取数据减配置表失败。" + eError.Message);
                return;
            }
            //等高线间距值,参数ID为21
            string intervalValue = TopologyCheckClass.GetParaValue(pSysTable, 21, out eError);

            if (eError != null)
            {
                eError = new Exception("读取数据减配置表失败。" + eError.Message);
                return;
            }
            //高程点搜索半径,参数ID为38
            string radiu = TopologyCheckClass.GetParaValue(pSysTable, 38, out eError);

            if (eError != null)
            {
                eError = new Exception("读取数据减配置表失败。" + eError.Message);
                return;
            }

            SysCommon.Gis.SysGisDataSet sysGisDataSet = new SysCommon.Gis.SysGisDataSet(dataCheckParaSet.Workspace);
            List <IDataset>             LstFeaClass   = sysGisDataSet.GetAllFeatureClass();

            if (LstFeaClass.Count == 0)
            {
                return;
            }

            //执行等高线点线矛盾检查
            PointLineElevCheck(Hook, LstFeaClass, lineFeaclsname, lineFieldname, pointFeaclsname, pointFieldsname, Convert.ToDouble(intervalValue), out eError);
            if (eError != null)
            {
                eError = new Exception("等高线点线矛盾检查失败!" + eError.Message);
                return;
            }
            #region
            ////获取所有数据集
            //SysCommon.Gis.SysGisDataSet sysGisDataSet = new SysCommon.Gis.SysGisDataSet(dataCheckParaSet.Workspace);
            //List<string> featureDatasetNames = sysGisDataSet.GetAllFeatureDatasetNames();
            //if (featureDatasetNames.Count == 0) return;
            //foreach (string name in featureDatasetNames)
            //{
            //    IFeatureDataset featureDataset = sysGisDataSet.GetFeatureDataset(name, out eError);
            //    if (eError != null) continue;

            //    //高程点图层,参数ID为19(还需要改进)
            //    string pointFeaclsname = TopologyCheckClass.GetParaValue(pSysTable, 19, out eError);
            //    if (eError != null)
            //    {
            //        eError=new Exception("读取数据减配置表失败。" + eError.Message);
            //        return;
            //    }
            //    //等高线图层,参数ID为20
            //    string lineFeaclsname = TopologyCheckClass.GetParaValue(pSysTable, 20, out eError);
            //    if (eError != null)
            //    {
            //        eError = new Exception("读取数据减配置表失败。" + eError.Message);
            //        return;
            //    }
            //    //高程点高程字段名,参数ID为22
            //    string pointFieldsname = TopologyCheckClass.GetParaValue(pSysTable, 22, out eError);
            //    if (eError != null)
            //    {
            //        eError = new Exception("读取数据减配置表失败。" + eError.Message);
            //        return;
            //    }
            //    //等高线高程字段名,参数ID为23
            //    string lineFieldname = TopologyCheckClass.GetParaValue(pSysTable, 23, out eError);
            //    if (eError != null)
            //    {
            //        eError = new Exception("读取数据减配置表失败。" + eError.Message);
            //        return;
            //    }
            //    //等高线间距值,参数ID为21
            //    string intervalValue = TopologyCheckClass.GetParaValue(pSysTable, 21, out eError);
            //    if (eError != null)
            //    {
            //        eError = new Exception("读取数据减配置表失败。" + eError.Message);
            //        return;
            //    }
            //    //高程点搜索半径,参数ID为38
            //    string radiu = TopologyCheckClass.GetParaValue(pSysTable, 38, out eError);
            //    if (eError != null)
            //    {
            //        eError = new Exception("读取数据减配置表失败。" + eError.Message);
            //        return;
            //    }
            //    //执行等高线点线矛盾检查
            //    PointLineElevCheck(Hook,featureDataset, lineFeaclsname, lineFieldname, pointFeaclsname, pointFieldsname, Convert.ToDouble(intervalValue), out eError);
            //    if (eError != null)
            //    {
            //        eError = new Exception("等高线点线矛盾检查失败!" + eError.Message);
            //        return;
            //    }
            //}

            #endregion
        }
Exemplo n.º 28
0
        private void btnAddUser_Click(object sender, EventArgs e)
        {
            Exception exError = null;

            try
            {
                #region 进行界面控制
                if (txtComment.Text.Length > 200)
                {
                    ErrorHandle.ShowInform("提示", "备注内容太长!");
                    txtComment.Focus();
                    return;
                }
                if (txtTrueName.Text.IndexOf(" ") != -1)
                {
                    errorProvider.SetError(txtTrueName, "用户名不能有空格");
                    return;
                }
                //验证
                if (string.IsNullOrEmpty(this.txtTrueName.Text))
                {
                    errorProvider.SetError(txtTrueName, "用户真实名不能为空!");
                    return;
                }
                else if (string.IsNullOrEmpty(this.txtPassword.Text))
                {
                    errorProvider.SetError(txtPassword, "密码不能为空!");
                    return;
                }
                else if (this.comboSex.Text == "")
                {
                    errorProvider.SetError(comboSex, "请选择用户角色!");
                    return;
                }
                else if (this.comboSex.Text == "请选择")
                {
                    errorProvider.SetError(comboSex, "请选择性别!");
                    return;
                }
                else if (string.IsNullOrEmpty(this.txtPosition.Text))
                {
                    errorProvider.SetError(txtPosition, "姓名不能为空!");
                    return;
                }
                if (txtTrueName.Text == "Admin")
                {
                    ErrorHandle.ShowInform("提示", "此用户已存在,请重新输入!");
                    txtTrueName.Focus();
                    return;
                }
                #endregion

                //l连接系统维护库
                SysCommon.DataBase.SysTable pSysDB = null;
                ModDBOperate.ConnectDB(out pSysDB, out exError);
                if (exError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", exError.Message);
                    return;
                }

                #region 首先要判断用户名不能重复

                //用户名不能与超级管理员同名
                string[] arr = ModuleData.v_AppConnStr.Split(';');
                if (arr.Length != 3)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接字符串不正确!");
                    return;
                }

                if (txtTrueName.Text.Trim() == arr[1].Substring(arr[1].IndexOf('=') + 1))
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "存在同名的用户!");
                    pSysDB.CloseDbConnection();
                    return;
                }

                //不能与数据库中的用户同名
                string    str        = "select * from userbaseinfo where USERNAME='******'";
                DataTable pUserTable = pSysDB.GetSQLTable(str, out exError);
                if (exError != null || pUserTable == null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "查询用户基本信息表失败!");
                    pSysDB.CloseDbConnection();
                    return;
                }

                #endregion

                //判断是更新还是添加
                if (_user != null)
                {
                    // (修改用户) 判断是否存在同名用户
                    if (pUserTable.Rows.Count > 1)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "存在同名的用户!");
                        pSysDB.CloseDbConnection();
                        return;
                    }

                    #region 用户修改,1、需要修改用户基本信息表,2、需要修改用户角色关系表,3、更新用户登录信息
                    pSysDB.StartTransaction();
                    //更新用户信息

                    #region 更新用户信息表
                    //若用户的基本信息发生了变更,则更新用户基本信息表
                    int    pUserID     = _user.ID; //用户ID
                    int    pRoleTypeID = _user.RoleTypeID;
                    string updateStr   = "";
                    if (m_UserName != txtTrueName.Text.Trim() || m_Password != txtPassword.Text.Trim() || comboSex.Text.Trim() != m_Sex || txtPosition.Text.Trim() != m_Position || txtComment.Text.Trim() != m_Remark)
                    {
                        //只要其中有一项基本信息发生了变化,就更injiben信息表
                        updateStr = "update userbaseinfo set UserName='******', Password='******', Sex='" + comboSex.Text.Trim() + "', Job='" + txtPosition.Text.Trim() + "', Remark='" + txtComment.Text.Trim() + "' where UserID=" + pUserID;
                        pSysDB.UpdateTable(updateStr, out exError);
                        if (exError != null)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "更新用户信息表失败!");
                            pSysDB.EndTransaction(false);
                            pSysDB.CloseDbConnection();
                            return;
                        }
                    }
                    #endregion
                    if (cmbRole.Text.Trim() != m_OldRoleName)
                    {
                        //说明用户对应的角色也进行了更新
                        #region 更新用户角色关系表
                        if ((cmbRole.SelectedItem as ComboBoxItem).Value == null || (cmbRole.SelectedItem as ComboBoxItem).Value.ToString().Trim() == "")
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取角色ID失败!");
                            pSysDB.EndTransaction(false);
                            pSysDB.CloseDbConnection();
                            return;
                        }
                        int       pRoleID = -1; //角色ID  Convert.ToInt32((cmbRole.SelectedItem as ComboBoxItem).Value.ToString().Trim());
                        string    mStr    = "select * from rolebaseinfo where ROLENAME='" + cmbRole.Text.Trim() + "'";
                        DataTable tTable  = pSysDB.GetSQLTable(mStr, out exError);
                        if (exError != null || tTable == null)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "查询角色信息表失败!");
                            pSysDB.EndTransaction(false);
                            pSysDB.CloseDbConnection();
                            return;
                        }
                        if (tTable.Rows.Count == 0)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取角色ID失败!");
                            pSysDB.EndTransaction(false);
                            pSysDB.CloseDbConnection();
                            return;
                        }
                        pRoleID = Convert.ToInt32(tTable.Rows[0][0].ToString().Trim());
                        //首先查询用户角色关系表,看是否存在这个记录
                        //******************************************************************
                        //guozheng added 2011-3-24
                        string    sSQL     = "SELECT ROLEID FROM rolebaseinfo WHERE ROLETYPEID=" + _user.RoleTypeID;
                        DataTable GetTable = pSysDB.GetSQLTable(sSQL, out exError);
                        if (exError != null || GetTable == null)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "查询用户角色关系表失败!");
                            pSysDB.EndTransaction(false);
                            pSysDB.CloseDbConnection();
                            return;
                        }
                        if (GetTable.Rows.Count < 0)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "没有找到该用户对应的角色信息"); return;
                        }
                        //******************************************************************
                        string    tempStr  = "select * from userrolerelationinfo where ROLEID=" + GetTable.Rows[0][0].ToString() + " and USERID=" + pUserID;
                        DataTable temTable = pSysDB.GetSQLTable(tempStr, out exError);
                        if (exError != null || temTable == null)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "查询用户角色关系表失败!");
                            pSysDB.EndTransaction(false);
                            pSysDB.CloseDbConnection();
                            return;
                        }
                        if (temTable.Rows.Count == 0)
                        {
                            //若不存在,则插入关系记录
                            updateStr = "insert into userrolerelationinfo(USERID,ROLEID) values (" + pUserID + "," + pRoleID + ")";
                        }
                        else
                        {
                            //若存在,则更新关系记录
                            updateStr = "update userrolerelationinfo set ROLEID=" + pRoleID + " where USERID=" + pUserID;
                        }

                        pSysDB.UpdateTable(updateStr, out exError);
                        if (exError != null)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "更新用户角色关系表失败!");
                            pSysDB.EndTransaction(false);
                            pSysDB.CloseDbConnection();
                            return;
                        }
                        #endregion

                        //获得角色类型
                        tempStr  = "select * from rolebaseinfo where ROLEID=" + pRoleID;
                        temTable = pSysDB.GetSQLTable(tempStr, out exError);
                        if (exError != null || temTable == null)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "查询角色基本信息表失败!");
                            pSysDB.EndTransaction(false);
                            pSysDB.CloseDbConnection();
                            return;
                        }
                        if (temTable.Rows.Count == 0)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "不存在该角色");
                            pSysDB.EndTransaction(false);
                            pSysDB.CloseDbConnection();
                            return;
                        }
                        pRoleTypeID = Convert.ToInt32(temTable.Rows[0][2].ToString().Trim());
                    }

                    pSysDB.EndTransaction(true);
                    pSysDB.CloseDbConnection();
                    #region 更新用户登录信息
                    ModuleData.m_User            = new User();
                    ModuleData.m_User.ID         = pUserID;
                    ModuleData.m_User.Name       = txtTrueName.Text.Trim();
                    ModuleData.m_User.Password   = txtPassword.Text.Trim();
                    ModuleData.m_User.Sex        = comboSex.Text.Trim();
                    ModuleData.m_User.Position   = txtPosition.Text.Trim();
                    ModuleData.m_User.Remark     = txtComment.Text.Trim();
                    ModuleData.m_User.Role       = cmbRole.Text.Trim();
                    ModuleData.m_User.RoleTypeID = pRoleTypeID;
                    #endregion
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "修改用户信息成功!");
                    #endregion
                }
                else
                {
                    //(新增用户)判断是否存在同名用户
                    if (pUserTable.Rows.Count > 0)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "存在同名的用户!");
                        pSysDB.CloseDbConnection();
                        return;
                    }
                    //添加用户信息
                    #region 添加用户,1、需要添加用户基本信息表,2、需要添加用户角色关系表
                    pSysDB.StartTransaction();

                    #region 获得用户ID
                    int       pUserID   = -1;
                    string    seleStr   = "select Max(UserID) from userbaseinfo";
                    DataTable tempTable = pSysDB.GetSQLTable(seleStr, out exError);
                    if (exError != null || tempTable == null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "查询用户信息表失败!");
                        pSysDB.CloseDbConnection();
                        return;
                    }
                    if (tempTable.Rows.Count == 0)
                    {
                        pUserID = 1;
                    }
                    else
                    {
                        if (tempTable.Rows[0][0].ToString().Trim() == "")
                        {
                            pUserID = 1;
                        }
                        else
                        {
                            pUserID = Convert.ToInt32(tempTable.Rows[0][0].ToString().Trim()) + 1;
                        }
                    }
                    if (pUserID == -1)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取用户ID失败!");
                        return;
                    }
                    #endregion

                    #region 更新用户基本信息表
                    string insertStr = "insert into userbaseinfo(UserID,UserName,Password,Sex,Job,Remark) values(" + pUserID + ",'" + txtTrueName.Text.Trim() + "','" + txtPassword.Text.Trim() + "','" + comboSex.Text.Trim() + "','" + txtPosition.Text.Trim() + "','" + txtComment.Text.Trim() + "')";

                    pSysDB.UpdateTable(insertStr, out exError);
                    if (exError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "更新用户表信息失败!");
                        pSysDB.EndTransaction(false);
                        pSysDB.CloseDbConnection();
                        return;
                    }
                    #endregion
                    #region 更新用户角色表

                    //获得角色ID
                    int pRoleID = -1;   //角色ID
                    if ((cmbRole.SelectedItem as ComboBoxItem).Value == null || (cmbRole.SelectedItem as ComboBoxItem).Value.ToString().Trim() == "")
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取角色ID失败!");
                        pSysDB.EndTransaction(false);
                        pSysDB.CloseDbConnection();
                        return;
                    }
                    pRoleID = Convert.ToInt32((cmbRole.SelectedItem as ComboBoxItem).Value.ToString().Trim());

                    //插入数据到角色关系表里面
                    string inseStr = "insert into userrolerelationinfo(UserID,RoleID) values(" + pUserID + "," + pRoleID + ")";
                    pSysDB.UpdateTable(inseStr, out exError);
                    if (exError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "更新用户角色关系表失败!");
                        pSysDB.EndTransaction(false);
                        pSysDB.CloseDbConnection();
                        return;
                    }
                    #endregion
                    pSysDB.EndTransaction(true);
                    pSysDB.CloseDbConnection();

                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示 ", "添加用户信息成功!");

                    #endregion
                }

                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                exError = ex;
            }
        }
Exemplo n.º 29
0
        public void OnDataCheck()
        {
            Exception eError = null;

            if (Hook == null)
            {
                return;
            }
            IArcgisDataCheckParaSet dataCheckParaSet = Hook.DataCheckParaSet as IArcgisDataCheckParaSet;

            if (dataCheckParaSet == null)
            {
                return;
            }
            if (dataCheckParaSet.Workspace == null)
            {
                return;
            }

            //实现代码
            SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable();
            pSysTable.DbConn    = dataCheckParaSet.DbConnPara;
            pSysTable.DBConType = SysCommon.enumDBConType.OLEDB;
            pSysTable.DBType    = SysCommon.enumDBType.ACCESS;

            //获取所有数据集
            SysCommon.Gis.SysGisDataSet sysGisDataSet = new SysCommon.Gis.SysGisDataSet(dataCheckParaSet.Workspace);
            List <string> featureDatasetNames         = sysGisDataSet.GetAllFeatureDatasetNames();

            if (featureDatasetNames.Count == 0)
            {
                return;
            }

            //设置进度条
            ProgressChangeEvent eInfo = new ProgressChangeEvent();

            eInfo.Max = featureDatasetNames.Count;
            int pValue = 0;

            //遍历数据集,并进行检查
            foreach (string name in featureDatasetNames)
            {
                IFeatureDataset featureDataset = sysGisDataSet.GetFeatureDataset(name, out eError);
                if (eError != null)
                {
                    continue;
                }

                //线线重合检查,参数为45
                DataTable mTable = TopologyCheckClass.GetParaValueTable(featureDataset, pSysTable, 45, out eError);
                if (eError != null)
                {
                    //SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message);
                    return;
                }
                if (mTable.Rows.Count == 0)
                {
                    continue;
                }
                AreaTopoCheck2(Hook, featureDataset, mTable, esriTopologyRuleType.esriTRTLineCoveredByLineClass, out eError);
                if (eError != null)
                {
                    eError = new Exception("线线重合检查失败!" + eError.Message);
                    return;
                }

                //进度条加1
                pValue++;
                eInfo.Value = pValue;
                GeoDataChecker.GeoDataChecker_ProgressShow((object)GeoDataChecker._ProgressBarInner, eInfo);
            }
        }
Exemplo n.º 30
0
        public override void OnClick()
        {
            Exception eError = null;

            #region 通过树节点获取源数据库的连接地址
            DevComponents.AdvTree.Node DBNode = null;
            string treeNodeType = m_Hook.ProjectTree.SelectedNode.DataKey.ToString();
            if (treeNodeType == "")
            {
                return;
            }
            DBNode = m_Hook.ProjectTree.SelectedNode;//数据库节点,根节点

            while (DBNode.Parent != null)
            {
                DBNode = DBNode.Parent;
            }

            if (DBNode.DataKey.ToString() != EnumTreeNodeType.DATABASE.ToString())
            {
                return;
            }
            if (DBNode.Name != "文件连接")
            {
                return;
            }
            XmlElement connElem = DBNode.Tag as XmlElement;
            if (connElem == null)
            {
                return;
            }
            string conStr = connElem.GetAttribute("MetaDBConn");

            #endregion

            SaveFileDialog saveDial = new SaveFileDialog();
            saveDial.Title  = "保存数据";
            saveDial.Filter = "控制点数据(*.mdb)|*.mdb";
            if (saveDial.ShowDialog() == DialogResult.OK)
            {
                FrmProcessBar frmbar = new FrmProcessBar();
                frmbar.Show();

                string   pFileName   = saveDial.FileName;
                FileInfo pFileInfo   = new FileInfo(ModData.v_TempControlDB);
                FileInfo desFileInfo = pFileInfo.CopyTo(pFileName, true);         //文件存储路径加名称

                string path = desFileInfo.DirectoryName;                          //文件存储路径

                //连接目标表

                SysCommon.DataBase.SysTable desSysTable = new SysCommon.DataBase.SysTable();
                desSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pFileName + ";Persist Security Info=True", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "连接元数据库失败!\n连接地址为:" + pFileName);
                    desSysTable.CloseDbConnection();
                    return;
                }
                //获得目标表格
                DataTable desTable = desSysTable.GetTable("metadata", out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message + "在库中不存在表格'metadata',请检查!");
                    desSysTable.CloseDbConnection();
                    return;
                }

                //insert 语句
                string insertStr = "insert into metadata (";
                for (int i = 1; i < desTable.Columns.Count; i++)
                {
                    //第一列为自动编号ID,从第二列开始

                    insertStr += desTable.Columns[i].ColumnName + ",";
                }
                insertStr  = insertStr.Substring(0, insertStr.Length - 1) + ")";
                insertStr += " values (";

                //连接源数据库
                SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable();
                ////pSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + conStr + ";Persist Security Info=True", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError);
                pSysTable.SetDbConnection(conStr, SysCommon.enumDBConType.ORACLE, SysCommon.enumDBType.ORACLE, out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "连接元数据库失败!\n连接地址为:" + conStr);
                    pSysTable.CloseDbConnection();
                    desSysTable.CloseDbConnection();
                    return;
                }
                //源数据表格

                DataTable ordDt = pSysTable.GetTable("ControlPointMDTable", out eError);
                if (eError != null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "查询控制点元信息出错!");
                    pSysTable.CloseDbConnection();
                    desSysTable.CloseDbConnection();
                    return;
                }
                pSysTable.CloseDbConnection();

                if (desTable.Columns.Count + 5 != ordDt.Columns.Count)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "目标数据库与源数据库字段结构不一致!");
                    desSysTable.CloseDbConnection();
                    return;
                }
                #region 遍历要导出的数据
                //设置进度条最大值

                frmbar.SetFrmProcessBarMax(m_Hook.DataInfoGrid.SelectedRows.Count);
                int pValue = 0;
                for (int i = 0; i < m_Hook.DataInfoGrid.RowCount; i++)
                {
                    if (m_Hook.DataInfoGrid.Rows[i].Selected)
                    {
                        string savePath = m_Hook.DataInfoGrid.Rows[i].Cells["存储位置"].FormattedValue.ToString().Trim();
                        if (!savePath.Contains("控制点数据"))
                        {
                            //其他数据导出
                            //pValue++;
                            //frmbar.SetFrmProcessBarValue(pValue);
                            continue;
                        }
                        frmbar.SetFrmProcessBarText("正在进行下载数据:" + m_Hook.DataInfoGrid.Rows[i].Cells["数据文件名"].FormattedValue.ToString().Trim());

                        if (m_Hook.DataInfoGrid.Rows[i].Cells["ID"].FormattedValue.ToString().Trim() == "")
                        {
                            return;
                        }
                        long dataID = Convert.ToInt64(m_Hook.DataInfoGrid.Rows[i].Cells["ID"].FormattedValue.ToString().Trim());
                        //执行导出操作
                        OutPutOneRacord(dataID, insertStr, ordDt, desSysTable, path, out eError);
                        if (eError != null)
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message);
                            desSysTable.CloseDbConnection();
                            frmbar.Dispose();
                            frmbar.Close();
                            return;
                        }
                        pValue++;
                        frmbar.SetFrmProcessBarValue(pValue);
                    }
                }
                #endregion

                frmbar.Dispose();
                frmbar.Close();
            }
        }