예제 #1
0
        private void FileListView_DragDrop(object sender, DragEventArgs e)
        {
            int Index = this.InsertionMark.Index;

            if (Index == -1)
            {
                return;
            }

            if (this.InsertionMark.AppearsAfterItem)
            {
                Index++;
            }
            Dictionary <ListViewItem, int> items = (Dictionary <ListViewItem, int>)e.Data.GetData(typeof(Dictionary <ListViewItem, int>));

            foreach (var item in items)
            {
                this.Items.Insert(Index, (ListViewItem)item.Key.Clone());
                this.Items.Remove(item.Key);
                if (item.Value >= Index)
                {
                    Index++;
                }
            }
            string sql = string.Empty;

            foreach (ListViewItem item in this.Items)
            {
                sql = string.Format("update up_files set SORTID='{0}' where ID={1}", item.Index, item.Name);
                SysDBConfig.GetInstance().GetOleDataBase("OrclConn").ExecuteQuery(sql);
            }
            //sql=sql.TrimEnd('\n');
            //sql = sql.TrimEnd(';');
            //SysDBConfig.GetInstance().OleDataBase.ExecuteQuery(sql);
        }
예제 #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);
        }
예제 #3
0
        /// <summary>
        /// 验证登录信息
        /// </summary>
        /// <param name="UserName">登录用户名</param>
        /// <param name="Password">登录密码</param>
        /// <returns></returns>
        public static bool ValidateLogin(string UserName, string Password, ref string UserID)
        {
            //string EncryptPassword = AG.COM.SDM.Utility.Security.EncryptDES(Password.Trim());
            string pUser = UserName.ToLower();
            //string EncryptPassword = Security.EncryptDES(Password).ToLower();
            string strHQL;

            if (!string.IsNullOrEmpty(Password))
            {
                strHQL = string.Format("select t.ID from hr_staff  t where lower(t.Name)='{0}' and lower(t.PASSWORD)='{1}'", pUser, Password);
            }
            else
            {
                strHQL = string.Format("select t.ID from hr_staff  t where lower(t.Name)='{0}' and lower(t.PASSWORD) is null", pUser);
            }
            IDataBase pDataBase = SysDBConfig.GetInstance().GetOleDataBase();

            pDataBase.OpenConnection();
            object value = pDataBase.ExecuteScalar(strHQL);

            pDataBase.CloseConnection();
            if (value != null)
            {
                UserID = value.ToString();
                return(true);
            }
            else
            {
                UserID = string.Empty;
                return(false);
            }
        }
예제 #4
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();
        }
예제 #5
0
        public override DataTable GetDataSourceTable()
        {
            string sql = string.Format("select ID,Name,parent as parentid,0 as imagetype,path"
                                       + " from up_dirs where xmid={0} and Type={1}", m_XMID, pDirType);
            DataSet   ds = SysDBConfig.GetInstance().GetOleDataBase("OrclConn").ExecuteQuery(sql);
            DataTable dt = ds.Tables[0];

            DataRow[] pRows = dt.Select(string.Format("parentid=-1"));
            this.m_RootID = pRows[0]["ID"];
            return(dt);
        }
예제 #6
0
        public FtpFile(int ID) : base(ID)
        {
            string    sql    = string.Format("select Name,Path from up_files where ID={0}", ID);
            DataTable pTable = SysDBConfig.GetInstance().GetOleDataBase("OrclConn").ExecuteQuery(sql).Tables[0];

            if (pTable.Rows.Count > 0)
            {
                m_Name = pTable.Rows[0]["Name"].ToString();
                m_Path = pTable.Rows[0]["Path"].ToString();
                m_ID   = ID;
            }
        }
예제 #7
0
        public void LoadFileNamesByDir(int DirID)
        {
            string    sql = string.Format("select ID from up_files where  Dir={0} order by sortid", DirID);
            DataSet   ds  = SysDBConfig.GetInstance().GetOleDataBase("OrclConn").ExecuteQuery(sql);
            DataTable dt  = ds.Tables[0];

            IFile[] pFiles = new IFile[dt.Rows.Count];
            for (int i = 0; i < pFiles.Length; i++)
            {
                pFiles[i] = new FtpFile(int.Parse(dt.Rows[i]["ID"].ToString()));
            }
            LoadFileNamesList(pFiles);
        }
예제 #8
0
        protected override void OnAfterLabelEdit(NodeLabelEditEventArgs e)
        {
            string   NewName = e.Label;
            TreeNode pNode   = this.SelectedNode;
            string   sql     = string.Format("update up_dirs set name='{0}' where id={1}",
                                             NewName, this.GetNodeID(pNode));
            IDataBase pDataBase = SysDBConfig.GetInstance().GetOleDataBase("OrclConn");

            pDataBase.OpenConnection();
            pDataBase.ExecuteNonQuery(sql);
            pDataBase.CloseConnection();
            this.LabelEdit = false;
        }
예제 #9
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();
            }
        }
예제 #10
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();
            }
        }
예제 #11
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();
            }
        }