public static void UnLock(IEdmVault7 vault, List <Files.Info> files) { Logger.Add($"Начало регистрации {files?.Count} файлов."); try { ppoSelection = new EdmSelItem[files.Count]; batchUnlocker = (IEdmBatchUnlock)vault.CreateUtility(EdmUtility.EdmUtil_BatchUnlock); var i = 0; foreach (var file in files) { try { var filePath = file.FolderPath + "\\" + file.ConvertFile; fileNameErr = filePath; IEdmFolder5 folder = default(IEdmFolder5); aFile = vault.GetFileFromPath(filePath, out folder); aPos = aFile.GetFirstFolderPosition(); aFolder = aFile.GetNextFolder(aPos); ppoSelection[i] = new EdmSelItem(); ppoSelection[i].mlDocID = aFile.ID; ppoSelection[i].mlProjID = aFolder.ID; i = i + 1; } catch (Exception ex) { Logger.Add($"Ошибка при добавлении файла на регистрацию: {ex.Message} Path: {file.FullFilePath} IdPDM: {file.IdPDM} FolderID: {file.FolderID} Version: {file.CurrentVersion}"); } } // Add selections to the batch of files to check in batchUnlocker.AddSelection((EdmVault5)vault, ppoSelection); if ((batchUnlocker != null)) { batchUnlocker.CreateTree(0, (int)EdmUnlockBuildTreeFlags.Eubtf_ShowCloseAfterCheckinOption + (int)EdmUnlockBuildTreeFlags.Eubtf_MayUnlock); fileList = (IEdmSelectionList6)batchUnlocker.GetFileList((int)EdmUnlockFileListFlag.Euflf_GetUnlocked + (int)EdmUnlockFileListFlag.Euflf_GetUndoLocked + (int)EdmUnlockFileListFlag.Euflf_GetUnprocessed); batchUnlocker.UnlockFiles(0, null); } } catch (COMException ex) { Logger.Add("ERROR BatchUnLock файл: '" + fileNameErr + "', " + ex.StackTrace + " " + ex.Message); } catch (Exception ex) { Logger.Add("ERROR BatchUnLock: '" + fileNameErr + "', " + ex.StackTrace + " " + ex.Message); } Logger.Add($"Завершена регистрации {files?.Count} файлов."); }
public void BatchDelete(List<TaskParam> listType) { var batchDeleter = (IEdmBatchDelete2)HostingForm.Vault2.CreateUtility(EdmUtility.EdmUtil_BatchDelete); IEdmFolder5 ppoRetParentFolder; foreach (var fileName in listType) { if (fileName.Revision == "") continue; aFile = HostingForm.Vault1.GetFileFromPath(fileName.FullFilePath, out ppoRetParentFolder); aPos = aFile.GetFirstFolderPosition(); aFolder = aFile.GetNextFolder(aPos); // Add selected file to the batch batchDeleter.AddFileByPath(fileName.FullFilePath); } // Move files and folder to the Recycle Bin batchDeleter.ComputePermissions(true, null); batchDeleter.CommitDelete(0, null); }
public void BatchUnLock(List<TaskParam> listType) { ppoSelection = new EdmSelItem[listType.Count]; batchUnlocker = (IEdmBatchUnlock)HostingForm.Vault2.CreateUtility(EdmUtility.EdmUtil_BatchUnlock); RootFolder = HostingForm.Vault1.RootFolderPath; var i = 0; foreach (var fileName in listType) { var filePath = RootFolder + fileName.FolderPath + fileName.FileName; if (HostingForm.Vault1.GetFileFromPath(filePath, out ppoRetParentFolder) == null) continue; aFile = HostingForm.Vault1.GetFileFromPath(filePath, out ppoRetParentFolder); aPos = aFile.GetFirstFolderPosition(); aFolder = aFile.GetNextFolder(aPos); ppoSelection[i] = new EdmSelItem(); ppoSelection[i].mlDocID = aFile.ID; ppoSelection[i].mlProjID = aFolder.ID; i = i + 1; } // Add selections to the batch of files to check in batchUnlocker.AddSelection((EdmVault5)HostingForm.Vault1, ppoSelection); if ((batchUnlocker != null)) { batchUnlocker.CreateTree(0, (int)EdmUnlockBuildTreeFlags.Eubtf_ShowCloseAfterCheckinOption + (int)EdmUnlockBuildTreeFlags.Eubtf_MayUnlock); fileList = (IEdmSelectionList6)batchUnlocker.GetFileList((int)EdmUnlockFileListFlag.Euflf_GetUnlocked + (int)EdmUnlockFileListFlag.Euflf_GetUndoLocked + (int)EdmUnlockFileListFlag.Euflf_GetUnprocessed); aPos = fileList.GetHeadPosition(); while (!(aPos.IsNull)) { fileList.GetNext2(aPos, out poSel); } //retVal = batchUnlocker.ShowDlg(this.Handle.ToInt32()); batchUnlocker.UnlockFiles(0, null); } }
//TODO: BatchGet public void BatchGet(List<TaskParam> listType) { batchGetter = (IEdmBatchGet)HostingForm.Vault2.CreateUtility(EdmUtility.EdmUtil_BatchGet); var i = 0; foreach (var taskVar in listType) { aFile = HostingForm.Vault1.GetFileFromPath(taskVar.FullFilePath, out ppoRetParentFolder); aPos = aFile.GetFirstFolderPosition(); aFolder = aFile.GetNextFolder(aPos); batchGetter.AddSelectionEx((EdmVault5)HostingForm.Vault1, aFile.ID, aFolder.ID, taskVar.CurrentVersion); } //batchUnlocker.AddSelection((EdmVault5)vault, ppoSelection); if ((batchGetter != null)) { batchGetter.CreateTree(0, (int)EdmGetCmdFlags.Egcf_Nothing); ////fileCount = batchGetter.FileCount; //fileList = (IEdmSelectionList6)batchGetter.GetFileList((int)EdmGetFileListFlag.Egflf_GetLocked + (int)EdmGetFileListFlag.Egflf_GetFailed + (int)EdmGetFileListFlag.Egflf_GetRetrieved + (int)EdmGetFileListFlag.Egflf_GetUnprocessed); //aPos = fileList.GetHeadPosition(); ////str = "Getting " + fileCount + " files: "; //while (!(aPos.IsNull)) //{ // fileList.GetNext2(aPos, out poSel); // //str = str + Constants.vbLf + poSel.mbsPath; //} //MsgBox(str) //var retVal = batchGetter.ShowDlg(this.Handle.ToInt32()); // No dialog if checking out only one file //if ((retVal)) //{ batchGetter.GetFiles(0, null); //} } }