private string SaveDWGNewVersion(FormCollection saveForm, BsonDocument oldfileDoc, DataOperation dataOp)
        {
            string localPath   = PageReq.GetForm("uploadFileList");
            string name        = PageReq.GetForm("name");
            string subMapParam = PageReq.GetForm("subMapParam");
            string newGuid2d   = PageReq.GetForm("guid2d");

            BsonDocument fileDoc = new BsonDocument();

            fileDoc.Add("version", (oldfileDoc.Int("version") + 1).ToString());
            fileDoc.Add("localPath", localPath);
            fileDoc.Add("ext", Path.GetExtension(localPath));
            fileDoc.Add("name", string.IsNullOrEmpty(name) == true ? Path.GetFileName(localPath) : name);
            fileDoc.Add("subMapParam", subMapParam);
            fileDoc.Add("guid2d", newGuid2d);
            var query = Query.EQ("fileId", oldfileDoc.String("fileId"));

            dataOp.Update("FileLibrary", query, fileDoc);

            BsonDocument fileVerDoc = new BsonDocument();

            fileVerDoc.Add("name", fileDoc.String("name"));
            fileVerDoc.Add("ext", fileDoc.String("ext"));
            fileVerDoc.Add("localPath", localPath);
            fileVerDoc.Add("version", fileDoc.String("version"));
            fileVerDoc.Add("subMapParam", subMapParam);
            fileVerDoc.Add("guid2d", newGuid2d);
            fileVerDoc.Add("fileId", oldfileDoc.String("fileId"));
            InvokeResult result = dataOp.Insert("FileLibVersion", fileVerDoc);

            fileVerDoc = result.BsonInfo;
            int fileRelId = 0;

            if (result.Status == Status.Successful)
            {
                var relResult = dataOp.Update("FileRelation", "db.FileRelation.distinct('_id',{'fileId':'" + fileDoc.String("fileId") + "'})", "version=" + fileDoc.String("version"));
                fileRelId = result.BsonInfo.Int("fileRelId");
            }

            List <FileParam> paramList = new List <FileParam>();
            FileParam        fp        = new FileParam();

            fp.path     = localPath;
            fp.ext      = fileDoc.String("ext");
            fp.strParam = string.Format("{0}@{1}-{2}-{3}", "sysObject", fileRelId, oldfileDoc.String("fileId"), fileVerDoc.String("fileVerId"));
            paramList.Add(fp);
            JavaScriptSerializer script = new JavaScriptSerializer();
            string   strJson            = script.Serialize(paramList);
            PageJson json = new PageJson();

            json.Success = result.Status == Status.Successful ? true : false;
            string keyValue  = saveForm["keyValue"] != null ? saveForm["keyValue"] : "0";
            var    strResult = json.ToString() + "|" + strJson + "|" + keyValue;

            return(strResult);
        }
        /// <summary>
        /// 上传多个文件
        /// </summary>
        /// <param name="saveForm"></param>
        /// <returns></returns>
        public string SaveMultipleUploadFiles(FormCollection saveForm)
        {
            DataOperation dataOp = new DataOperation();

            string tableName    = PageReq.GetForm("tableName");
            string keyName      = PageReq.GetForm("keyName");
            string keyValue     = saveForm["keyValue"].ToString();
            string localPath    = PageReq.GetForm("uploadFileList");
            string fileSaveType = saveForm["fileSaveType"] != null ? saveForm["fileSaveType"] : "multiply";
            int    fileTypeId   = PageReq.GetFormInt("fileTypeId");
            int    fileObjId    = PageReq.GetFormInt("fileObjId");
            int    uploadType   = PageReq.GetFormInt("uploadType");
            string subMapParam  = PageReq.GetForm("subMapParam");
            string guid2d       = PageReq.GetForm("guid2d");
            string oldGuid2d    = PageReq.GetForm("oldguid2d");
            bool   isPreDefine  = saveForm["isPreDefine"] != null?bool.Parse(saveForm["isPreDefine"]) : false;

            Dictionary <string, string> propDic  = new Dictionary <string, string>();
            FileOperationHelper         opHelper = new FileOperationHelper();
            List <InvokeResult <FileUploadSaveResult> > result = new List <InvokeResult <FileUploadSaveResult> >();

            localPath = localPath.Replace("\\\\", "\\");

            #region 如果保存类型为单个single 则删除旧的所有关联文件
            if (!string.IsNullOrEmpty(fileSaveType))
            {
                if (fileSaveType == "single")
                {
                    opHelper.DeleteFile(tableName, keyName, keyValue);
                }
            }
            #endregion

            #region 通过关联读取对象属性
            if (!string.IsNullOrEmpty(localPath.Trim()))
            {
                string[] fileStr = Regex.Split(localPath, @"\|H\|", RegexOptions.IgnoreCase);
                Dictionary <string, string> filePath = new Dictionary <string, string>();
                foreach (string file in fileStr)
                {
                    string[] filePaths = Regex.Split(file, @"\|Y\|", RegexOptions.IgnoreCase);

                    if (filePaths.Length > 0)
                    {
                        string[] subfile = Regex.Split(filePaths[0], @"\|Z\|", RegexOptions.IgnoreCase);
                        if (subfile.Length > 0)
                        {
                            if (!filePath.Keys.Contains(subfile[0]))
                            {
                                if (filePaths.Length >= 2)
                                {
                                    filePath.Add(subfile[0], filePaths[1]);
                                }
                                else
                                {
                                    filePath.Add(subfile[0], "");
                                }
                            }
                        }
                    }
                }

                if (fileObjId != 0)
                {
                    List <BsonDocument> docs = new List <BsonDocument>();
                    docs = dataOp.FindAllByKeyVal("FileObjPropertyRelation", "fileObjId", fileObjId.ToString()).ToList();

                    List <string> strList = new List <string>();
                    strList = docs.Select(t => t.Text("filePropId")).Distinct().ToList();
                    var doccList = dataOp.FindAllByKeyValList("FileProperty", "filePropId", strList);
                    foreach (var item in doccList)
                    {
                        var formValue = saveForm[item.Text("dataKey")];
                        if (formValue != null)
                        {
                            propDic.Add(item.Text("dataKey"), formValue.ToString());
                        }
                    }
                }

                List <FileUploadObject> singleList = new List <FileUploadObject>(); //纯文档上传
                List <FileUploadObject> objList    = new List <FileUploadObject>(); //当前传入类型文件上传
                foreach (var str in filePath)
                {
                    FileUploadObject obj = new FileUploadObject();
                    obj.fileTypeId   = fileTypeId;
                    obj.fileObjId    = fileObjId;
                    obj.localPath    = str.Key;
                    obj.tableName    = tableName;
                    obj.keyName      = keyName;
                    obj.keyValue     = keyValue;
                    obj.uploadType   = uploadType;
                    obj.isPreDefine  = isPreDefine;
                    obj.isCover      = false;
                    obj.propvalueDic = propDic;
                    obj.rootDir      = str.Value;
                    obj.subMapParam  = subMapParam;
                    obj.guid2d       = guid2d;
                    if (uploadType != 0 && (obj.rootDir == "null" || obj.rootDir.Trim() == ""))
                    {
                        singleList.Add(obj);
                    }
                    else
                    {
                        objList.Add(obj);
                    }
                }

                result = opHelper.UploadMultipleFiles(objList, (UploadType)uploadType);//(UploadType)uploadType
                if (singleList.Count > 0)
                {
                    result = opHelper.UploadMultipleFiles(singleList, (UploadType)0);
                }
            }
            else
            {
                PageJson jsonone = new PageJson();
                jsonone.Success = false;
                return(jsonone.ToString() + "|");
            }
            #endregion

            PageJson json = new PageJson();
            var      ret  = opHelper.ResultConver(result);

            #region 如果有关联的文件Id列表,则保存关联记录
            string     fileVerIds    = PageReq.GetForm("fileVerIds");
            List <int> fileVerIdList = fileVerIds.SplitToIntList(",");

            if (ret.Status == Status.Successful && fileVerIdList.Count > 0)
            {
                List <StorageData> saveList = new List <StorageData>();
                foreach (var tempVerId in fileVerIdList)
                {
                    StorageData tempData = new StorageData();

                    tempData.Name     = "FileAlterRelation";
                    tempData.Type     = StorageType.Insert;
                    tempData.Document = new BsonDocument().Add("alterFileId", result.FirstOrDefault().Value.fileId.ToString())
                                        .Add("fileVerId", tempVerId);

                    saveList.Add(tempData);
                }

                dataOp.BatchSaveStorageData(saveList);
            }
            #endregion

            json.Success = ret.Status == Status.Successful ? true : false;
            var strResult = json.ToString() + "|" + ret.Value + "|" + keyValue;
            return(strResult);
        }