Exemplo n.º 1
0
        /// <summary>
        /// 数字档案文件分片全部上传好后保存
        /// </summary>
        /// <param name="sourceFilePath">源文件路径</param>
        /// <returns></returns>
        public FileUploadInfo SaveFileOrdinaryChunk(string sourceFilePath)
        {
            try
            {
                var result = new FileUploadInfo();

                LockHelper.Open(sourceFilePath);
                var docService      = new DocService();
                var newFileNamePath = GetDocFileName(docService, sourceFilePath);

                if (newFileNamePath == "FileExists")
                {  // 文件存在,则直接返回
                    LockHelper.Dispose(sourceFilePath);
                    return(result);
                }

                string rentdoctbDetailId = Request["rentdoctbDetailId"];

                // 如果已经有详情了,则直接保存到数据库。
                if (!string.IsNullOrEmpty(rentdoctbDetailId))
                {
                    result = docService.SaveDocFile(sourceFilePath, newFileNamePath, rentdoctbDetailId);
                }
                else
                {
                    //新增的部分,存为临时文件,以.kyee 做为临时文件
                    FileInfo file = new FileInfo(sourceFilePath);
                    file.MoveTo(newFileNamePath);
                }
                LockHelper.Dispose(sourceFilePath);
                return(result);
            }
            catch (Exception ex)
            {
                LockHelper.Dispose(sourceFilePath);
                throw ex;
            }
        }