Ejemplo n.º 1
0
        private void CreateSubDir_Click(object sender, EventArgs e)
        {
            TreeNode  pNode      = this.SelectedNode;
            int       ID         = this.GetNodeID(pNode);
            string    ParentPath = this.GetFtpPathByNode(pNode);
            string    sql        = "select SEQ_UP_DIRS.nextval from dual";
            IDataBase pDataBase  = SysDBConfig.GetInstance().GetOleDataBase("OrclConn");

            pDataBase.OpenConnection();
            string DirID = pDataBase.ExecuteScalar(sql).ToString();
            string Path  = string.Format("{0}/{1}", this.GetFtpPathByNode(pNode), DirID);

            sql = string.Format("insert into up_dirs values({0},'新建目录',{1},'{2}\\{0}',1)", DirID, ID, ParentPath);
            pDataBase.ExecuteNonQuery(sql);
            pDataBase.CloseConnection();

            this.RefreshSubTreeView(pNode);
            pNode.ExpandAll();
            TreeNode NewNode = this.FindNodeByID(int.Parse(DirID));

            IFtpClient pFtpClient = SysDBConfig.GetInstance().GetFtpClient("CHXQ");

            pFtpClient.Connect();
            string FtpPath = GetFtpPathByNode(NewNode);

            pFtpClient.CreateDirectory(FtpPath);
            pFtpClient.Close();
            this.SelectedNode = NewNode;
            this.LabelEdit    = true;
            NewNode.BeginEdit();
        }
Ejemplo n.º 2
0
        private void Delete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否删除该文件夹", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
                == DialogResult.Cancel)
            {
                return;
            }
            TreeNode pNode = this.SelectedNode;
            int      ID    = this.GetNodeID(pNode);

            IFtpClient pFtpClient = SysDBConfig.GetInstance().GetFtpClient("CHXQ");

            pFtpClient.Connect();
            pFtpClient.DeleteDirectory(GetFtpPathByNode(pNode));
            pFtpClient.Close();

            string sql = string.Format("delete from up_dirs where id={0}", ID);

            IDataBase pDataBase = SysDBConfig.GetInstance().GetOleDataBase("OrclConn");

            pDataBase.OpenConnection();
            pDataBase.ExecuteNonQuery(sql);
            pDataBase.CloseConnection();

            this.RefreshSubTreeView(pNode.Parent);
        }
Ejemplo n.º 3
0
        public void UploadFiles(string[] FilePaths, TreeNode pNode)
        {
            IFtpClient pFtpClient = SysDBConfig.GetInstance().GetFtpClient("CHXQ");

            pFtpClient.Connect();
            IDataBase pDataBase = SysDBConfig.GetInstance().GetOleDataBase("OrclConn");

            pDataBase.OpenConnection();
            string DirPath = GetFtpPathByNode(pNode);

            try
            {
                if (!pFtpClient.DirectoryExists(DirPath))
                {
                    pFtpClient.CreateDirectory(DirPath);
                }
                foreach (string FilePath in FilePaths)
                {
                    string RemotePath = string.Format("{0}\\{1}", DirPath, System.IO.Path.GetFileName(FilePath));
                    pFtpClient.UploadFile(FilePath, RemotePath);
                    string           ProcedureName  = "AddFile";
                    IDataParameter[] DataParameters = new IDataParameter[] {
                        new OracleParameter()
                        {
                            ParameterName = "V_FileName", OracleType = OracleType.NVarChar, Value = System.IO.Path.GetFileNameWithoutExtension(FilePath)
                        },
                        new OracleParameter()
                        {
                            ParameterName = "V_Path", OracleType = OracleType.NVarChar, Value = RemotePath
                        },
                        new OracleParameter()
                        {
                            ParameterName = "V_DirID", OracleType = OracleType.Number, Value = this.GetNodeID(pNode)
                        }
                    };
                    pDataBase.ExecuteProcedure(ProcedureName, ref DataParameters);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                pDataBase.CloseConnection();
                pFtpClient.Close();
            }
        }
Ejemplo n.º 4
0
        private void UploadFile(string FilePath, string UploadPath)
        {
            IFtpClient pFtpClient = HR.Utility.SysDBConfig.GetInstance().GetFtpClient("CHXQ");

            pFtpClient.Connect();
            string Dir = System.IO.Path.GetDirectoryName(UploadPath);

            if (!pFtpClient.DirectoryExists(Dir))
            {
                pFtpClient.CreateDirectory(Dir);
            }
            if (pFtpClient.Exists(UploadPath))
            {
                pFtpClient.DeleteFile(UploadPath);
            }
            pFtpClient.UploadFile(FilePath, UploadPath);
            pFtpClient.Close();
        }
Ejemplo n.º 5
0
        public virtual void DownloadFile(string SavePath)
        {
            IFtpClient pFtpClient = SysDBConfig.GetInstance().GetFtpClient("CHXQ");

            pFtpClient.Connect();
            try
            {
                pFtpClient.DownloadFile(SavePath, this.Path);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                pFtpClient.Close();
            }
        }
Ejemplo n.º 6
0
        public void DownloadAD(string SavePath)
        {
            if (string.IsNullOrEmpty(m_CADPath))
            {
                throw new Exception("图纸未上传");
            }
            IFtpClient pFtpClient = HR.Utility.SysDBConfig.GetInstance().GetFtpClient("CHXQ");

            pFtpClient.Connect();
            try
            {
                pFtpClient.DownloadFile(SavePath, this.m_CADPath);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                pFtpClient.Close();
            }
        }
Ejemplo n.º 7
0
        public override void Delete()
        {
            IFtpClient pFtpClient = SysDBConfig.GetInstance().GetFtpClient("CHXQ");

            pFtpClient.Connect();
            try
            {
                pFtpClient.DeleteFile(this.Path);
                string    sql          = string.Format("delete from up_files where ID={0}", this.m_ID);
                IDataBase OrclDataBase = HR.Utility.SysDBConfig.GetInstance().GetOleDataBase("OrclConn");
                OrclDataBase.OpenConnection();
                OrclDataBase.ExecuteNonQuery(sql);
                OrclDataBase.CloseConnection();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                pFtpClient.Close();
            }
        }