Пример #1
0
        /// <summary>
        /// 点击一键上传之前检查文件夹
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void CheckFolderUploadToDb(string forderPath, FileManager.Model.UserModel user)
        {
            try
            {
                string dirPath = forderPath;
                if (!Directory.Exists(dirPath))
                {
                    MessageBox.Show("服务器配置路径不正确,请联系管理员处理!");
                    return;
                }

                ClearCache();

                // 获取配置信息
                Model.SystemConfig config = SystemConfigBll.GetConfig();

                // 设置数据库连接
                string conn = string.Format("server={0};uid={1};pwd={2};database={3};", config.DbAddress, config.DbUser, config.DbPassword, config.DbName);
                // 打开连接
                using (connection = new System.Data.SqlClient.SqlConnection(conn))
                {
                    // 此处查询出所有文件内容
                    DirectoryInfo rootDirInfo = new DirectoryInfo(dirPath);
                    this.textBox1.AppendText("\r\n文件夹:" + dirPath);

                    CheckFolderUploadAllToDb(rootDirInfo, 0, user.UserName, user.CurProject.ID);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex.Message, ex);
            }
        }
Пример #2
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="forderPath"></param>
        /// <param name="user"></param>
        public FrmWait(string forderPath, FileManager.Model.UserModel user, int type)
        {
            this.forderPath = forderPath;
            this.user       = user;
            this.type       = type;

            InitializeComponent();

            if (type == 1)
            {
                this.lodding.Text = "安装中...";
                this.Text         = "服务端安装";
            }
        }
Пример #3
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="forderPath"></param>
        /// <param name="user"></param>
        public FrmWait(string forderPath, FileManager.Model.UserModel user, int type, int parentId)
        {
            this.forderPath = forderPath;
            this.user       = user;
            this.type       = type;
            this.parentId   = parentId;

            InitializeComponent();

            if (type == 1 || type == 2)
            {
                this.lodding.Text = "下载中...";
                this.Text         = "文件下载";
            }
        }
Пример #4
0
        /// <summary>
        /// 点击一键上传之前检查文件夹
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void CheckFolderDownloadFromDb(string forderPath, FileManager.Model.UserModel user)
        {
            try
            {
                string dirPath = forderPath;

                //needAddOrMordifyFiles.Clear();
                ClearCache();
                if (!Directory.Exists(dirPath))
                {
                    //文件夹不存在,全部新增
                    List <Model.FileModel> fileLists = GetAllServerFiles(
                        new Model.ForderModel()
                    {
                        ID         = 0,
                        Project_Id = user.CurProject.ID
                    });

                    foreach (var item in fileLists)
                    {
                        AddFileToCache(item.ClientPath, item);
                        AddNeedAllDownloadFilesToCache(item.ClientPath, item);
                    }

                    //Directory.CreateDirectory(dirPath);
                }

                //此处查询出所有文件内容
                DirectoryInfo rootDirInfo = new DirectoryInfo(dirPath);
                CheckFolderDownloadAllFromDb(rootDirInfo, 0, user.UserName, user.CurProject.ID);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex.Message, ex);
            }
        }
Пример #5
0
 public FrmCheckFile(string forderPath, FileManager.Model.UserModel user)
 {
     this.forderPath = forderPath;
     this.user       = user;
     InitializeComponent();
 }