Esempio n. 1
0
        //根据成果类型获取共享目录  ygc 2012-9-6
        private string GetSharedPath(string DataType)
        {
            if (m_Workspace == null)
            {
                return(null);
            }
            SysCommon.Gis.SysGisTable sysTable = new SysCommon.Gis.SysGisTable(m_Workspace);
            Exception ex = null;
            Dictionary <string, object> newdic = new Dictionary <string, object>();

            try
            {
                newdic = sysTable.GetRow("RESULTDIR", "PATHNAME='" + DataType + "'", out ex);
            }
            catch
            {
            }
            if (newdic == null)
            {
                return(null);
            }
            if (newdic.Count == 0)
            {
                return(null);
            }
            return(newdic["DATADIR"].ToString());
        }
Esempio n. 2
0
        private void bttOpen_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection pSelectedRowC = dataGridVRe.SelectedRows;

            if (pSelectedRowC.Count != 1)
            {
                MessageBox.Show("请选中一条相关的记录再进行查看操作!", "提示!"); return;
            }
            string strPath   = dataGridVRe.Rows[pSelectedRowC[0].Index].Cells["CumFilePath"].Value.ToString();
            string DataType  = dataGridVRe.Rows[pSelectedRowC[0].Index].Cells["CmnType"].Value.ToString();
            string ShardPath = GetSharedPath(DataType);

            if (ShardPath == null)
            {
                MessageBox.Show("业务库中不存在该共享目录!", "提示"); return;
            }
            SysCommon.Gis.SysGisTable sysTable = new SysCommon.Gis.SysGisTable(m_Workspace);
            Exception ex = null;

            if (!Directory.Exists(ShardPath))
            {
                Dictionary <string, object> dicDataRow = new Dictionary <string, object>();
                dicDataRow = sysTable.GetRow("RESULTDIR", "PATHNAME='" + DataType + "'", out ex);
                bool t = Connect(dicDataRow["COMPUTERIP"].ToString(), dicDataRow["USER_"].ToString(), dicDataRow["PASSWORD_"].ToString());
            }

            if (!Directory.Exists(ShardPath))
            {
                MessageBox.Show("无法连接到成果目录", "提示");
                return;
            }

            if (!File.Exists(strPath))
            {
                MessageBox.Show("成果数据目录已被损坏!", "提示!"); return;
            }
            System.Diagnostics.Process.Start(strPath);
        }
Esempio n. 3
0
        private void bttModify_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection pSelectedRowC = dataGridVRe.SelectedRows;

            if (pSelectedRowC.Count != 1)
            {
                MessageBox.Show("请选中一条相关的记录再进行修改操作!", "提示!"); return;
            }
            string strPath   = dataGridVRe.Rows[pSelectedRowC[0].Index].Cells["CumFilePath"].Value.ToString();
            string DataType  = dataGridVRe.Rows[pSelectedRowC[0].Index].Cells["CmnType"].Value.ToString();
            string ShardPath = GetSharedPath(DataType);

            if (ShardPath == null)
            {
                MessageBox.Show("业务库中不存在该共享目录!", "提示"); return;
            }
            SysCommon.Gis.SysGisTable sysTable = new SysCommon.Gis.SysGisTable(m_Workspace);
            Exception ex = null;

            if (!Directory.Exists(ShardPath))
            {
                Dictionary <string, object> dicDataRow = new Dictionary <string, object>();
                dicDataRow = sysTable.GetRow("RESULTDIR", "PATHNAME='" + DataType + "'", out ex);
                bool t = Connect(dicDataRow["COMPUTERIP"].ToString(), dicDataRow["USER_"].ToString(), dicDataRow["PASSWORD_"].ToString());
            }

            if (!Directory.Exists(ShardPath))
            {
                MessageBox.Show("无法连接到成果目录", "提示");
                return;
            }
            if (!File.Exists(strPath))
            {
                MessageBox.Show("成果数据目录已被损坏!", "提示!"); return;
            }
            string strName = dataGridVRe.Rows[pSelectedRowC[0].Index].Cells["CumFileName"].Value.ToString();
            string strType = dataGridVRe.Rows[pSelectedRowC[0].Index].Cells["CmnType"].Value.ToString();

            FrmModifyName pFrmModifyName = new FrmModifyName(this, strPath);

            pFrmModifyName.strModifyValue = Path.GetFileNameWithoutExtension(strPath);
            if (pFrmModifyName.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            ///重组修改后的文件名和文件路径
            m_ModifyName = m_ModifyName + Path.GetExtension(strPath);
            strPath      = Path.GetDirectoryName(strPath) + "\\" + m_ModifyName;
            Dictionary <string, object> dicData = new Dictionary <string, object>();

            dicData.Add("DATATYPE", strType);
            dicData.Add("DATANAME", m_ModifyName);
            dicData.Add("DATAPATH", strPath);

            ///更新系统表中得数据
            if (UpTableRow("RESULTLIST", "DATANAME='" + strName + "'", dicData))
            {
                ///文件进行重命名
                File.Move(dataGridVRe.Rows[pSelectedRowC[0].Index].Cells["CumFilePath"].Value.ToString(), strPath);
                dataGridVRe.Rows[pSelectedRowC[0].Index].Cells["CumFilePath"].Value = strPath;
                dataGridVRe.Rows[pSelectedRowC[0].Index].Cells["CumFileName"].Value = m_ModifyName;
                MessageBox.Show("修改成功!", "提示!");
            }
            else
            {
                MessageBox.Show("成果数据:" + dataGridVRe.Rows[pSelectedRowC[0].Index].Cells["CumFileName"].Value.ToString() + "修改失败!", "提示!");
            }
        }