static void PrintProperties(Vault.Currency.Connections.Connection connection, Vault.Currency.Entities.FileIteration fileInteration) { foreach (var key in propDefs.Keys) { // Print the Name from the Definition and the Value from the Property object propValue = connection.PropertyManager.GetPropertyValue( fileInteration, propDefs[key], null); try { MessageBox.Show(propDefs[key].DisplayName + ": " + (propValue == null ? "" : propValue.ToString())); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public static String GetProperty(Vault.Currency.Connections.Connection connection, Vault.Currency.Entities.FileIteration fileInteration, string key) { // Print the Name from the Definition and the Value from the Property object propValue = connection.PropertyManager.GetPropertyValue( fileInteration, propDefs[key], null); try { return(propValue == null ? "" : propValue.ToString()); } catch (Exception ex) { //MessageBox.Show(ex.Message); return(null); } }
public CustEnt[] getCustomentitiesbyPropNameMulti(VDF.Vault.Currency.Connections.Connection connection, SrchCond[] srchConds) { try { // using (WebServiceManager serviceManager = connection.WebServiceManager) //using will log out after usage { string bookmark = string.Empty; SrchStatus status = null; custEntities = connection.WebServiceManager.CustomEntityService.FindCustomEntitiesBySearchConditions(srchConds, null, ref bookmark, out status); } } catch (SystemException ex) { result = ex.ToString(); } return(custEntities); }
private void login() { foreach (Framework.Forms.Controls.GridLayout layout in vaultBrowserControl1.AvailableLayouts) { m_availableLayouts.Add(layout); ToolStripMenuItem item = new ToolStripMenuItem(layout.Name); item.Tag = layout; item.CheckOnClick = true; item.Click += new EventHandler(switchViewDropdown_itemClick); switchView_toolStripSplitButton.DropDownItems.Add(item); m_viewButtons.Add(item); } m_conn = Vault.Forms.Library.Login(null); controlStates(m_conn != null); if (m_conn != null) { initalizeGrid(); } }
private void HelloVault() { m_conn = Vault.Forms.Library.Login(null); ServiceManager = m_conn.WebServiceManager; InventorProjectRootFolder = new DirectoryInfo(ServiceManager.DocumentService.GetRequiredWorkingFolderLocation()); //need this for later. if (m_conn != null) { foreach (var filePath in SelectedItemPaths) { if (filePath.Contains(InventorProjectRootFolder.ToString())) { MessageBox.Show("File is within the Vault Working Folder"); } else { MessageBox.Show("File is NOT within the Vault Working Folder"); } } } }
public static EntLfCyc getFolderCurrentlifeCycle(VDF.Vault.Currency.Connections.Connection connection, string folderPath) { try { Autodesk.Connectivity.WebServices.Folder fld = FolderHelper.gefolderbyfolderPath(connection, folderPath); if (fld.LfCyc != null) { resultFLC = fld.LfCyc; } else { return(null); } } catch (SystemException ex) { Debug.Write(ex.ToString()); //MessageBox.Show(ex.ToString()); } return(resultFLC); }
public Dictionary <string, string> getCUSTENTPropertyVal(VDF.Vault.Currency.Connections.Connection connection, string entityClassIDs, CustEnt custEnt) { try { using (WebServiceManager serviceManager = connection.WebServiceManager) //using will log out after usage { var propDefs = connection.PropertyManager.GetPropertyDefinitions(entityClassIDs, null, VDF.Vault.Currency.Properties.PropertyDefinitionFilter.IncludeAll); VDF.Vault.Currency.Entities.CustomObject custObj = new VDF.Vault.Currency.Entities.CustomObject(connection, custEnt); foreach (var key in propDefs.Keys) { object propValue = connection.PropertyManager.GetPropertyValue(custObj, propDefs[key], null); custPropDict.Add(propDefs[key].DisplayName.ToString(), propValue == null ? "" : propValue.ToString()); } } } catch (SystemException ex) { result = ex.ToString(); } return(custPropDict); }
private void InventorRelease_Shown(object sender, EventArgs e) { //save each available layout of the browser control as well as generate a button to use in the switch view dropdown foreach (VDF.Forms.Controls.GridLayout layout in vaultBrowserControl.AvailableLayouts) { m_availableLayouts.Add(layout); ToolStripMenuItem item = new ToolStripMenuItem(layout.Name); item.Tag = layout; item.CheckOnClick = true; item.Click += new EventHandler(switchViewDropdown_itemClick); switchView_toolStripSplitButton.DropDownItems.Add(item); m_viewButtons.Add(item); } vaultConnection = VDF.Vault.Forms.Library.Login(null); controlStates(vaultConnection != null); if (vaultConnection != null) { initalizeGrid(); } }
public static File gefilebyfilePath(VDF.Vault.Currency.Connections.Connection connection, string filePath) { Autodesk.Connectivity.WebServices.File selectedFile = null; try { if (checkifFileExists(connection, filePath)) { selectedFile = connection.WebServiceManager.DocumentService.FindLatestFilesByPaths(filePath.ToSingleArray()).First(); } else { return(null); } } catch (SystemException ex) { Debug.Write(ex.ToString()); //MessageBox.Show(ex.ToString()); } return(selectedFile); }
public static Dictionary <long, PropDef> getPropertiesbyClass(VDF.Vault.Currency.Connections.Connection connection, string entityClassIDs) { Dictionary <long, PropDef> props = new Dictionary <long, PropDef>(); try { using (WebServiceManager serviceManager = connection.WebServiceManager) //using will log out after usage { var propDefs = serviceManager.PropertyService.GetPropertyDefinitionsByEntityClassId(entityClassIDs); foreach (var item in propDefs) { props.Add(item.Id, item); } } } catch (SystemException ex) { } return(props); }
public static string downloadVaultFilebyID(VDF.Vault.Currency.Connections.Connection connection, string path, long selectedFileID) { try { using (WebServiceManager serviceManager = connection.WebServiceManager) { Autodesk.Connectivity.WebServices.File localFile = serviceManager.DocumentService.GetFileById(selectedFileID); var FileDownloadTicket = serviceManager.DocumentService.GetDownloadTicketsByFileIds(new long[] { selectedFileID }); FilestoreService fileStoreService = serviceManager.FilestoreService; var fileBytes = fileStoreService.DownloadFilePart(FileDownloadTicket[0].Bytes, 0, localFile.FileSize, false); //MessageBox.Show(path + "\\" + localFile.Name); System.IO.File.WriteAllBytes(path + "\\" + localFile.Name, fileBytes); //Check if file exist if (!System.IO.File.Exists(path + "\\" + localFile.Name)) { //failedFiles.Add(file); statusMess = "File Download Failed!"; ZGHCC.writeLog(statusMess); } else { statusMess = path + "\\" + localFile.Name; //fileExt = System.IO.Path.GetExtension(localFile.Name); ZGHCC.writeLog(statusMess); } } //statusMess = "Success"; } catch (SystemException ex) { statusMess = null; Debug.Write("\nError: " + ex.ToString()); statusMess = "Error: \n" + ex.ToString(); } return(statusMess); //Autodesk.Connectivity.WebServices.File localFile = serviceManager.DocumentService.GetFileById(file.Id); }
public void Reload(VDF.Vault.Currency.Connections.Connection conn, IEnumerable <VDF.Vault.Currency.Entities.IEntity> entities, long propDefIdOrderNumber, long propDefIdOrderFileId, PropInst[] propInsts) { var configuration = new VDF.Vault.Forms.Controls.VaultBrowserControl.Configuration( conn, "Grid.OrganisationOrder.LinkProperties", null); configuration.AddInitialColumn("Name"); configuration.AddInitialSortCriteria("Name", true); var orderPropertyExtensionProvider = new OrderPropertyExtensionProvider( propDefIdOrderNumber, propDefIdOrderFileId, propInsts); configuration.AddPropertyExtensionProvider(orderPropertyExtensionProvider); _navigationModel = new VDF.Vault.Forms.Models.ViewVaultNavigationModel(); _navigationModel.AddContent(entities); vaultBrowserControl1.SetDataSource(configuration, _navigationModel); }
public static object getItemPropValue(VDF.Vault.Currency.Connections.Connection connection, string entityClassIDs, Item item, string propName) { try { using (WebServiceManager serviceManager = connection.WebServiceManager) //using will log out after usage { var propSvc = serviceManager.PropertyService; PropDef propDef = getPropertyDefDetails(connection, entityClassIDs, propName); //MessageBox.Show(">>> :: " + propDef.DispName + propDef.Id + " | " ); var properties = propSvc.GetProperties("ITEM", new long[] { item.Id }, new long[] { propDef.Id }); if (properties != null) { //MessageBox.Show(" | " + properties); foreach (PropInst prop in properties) { if (item != null) { resultObj = prop.Val == null ? "" : prop.Val.ToString(); if (string.IsNullOrEmpty(resultObj.ToString())) { //MessageBox.Show(propName + " | " + resultObj.GetType().ToString() + " | " + resultObj.ToString()); resultObj = "null"; } else { //MessageBox.Show(">>> " + propName + resultObj.GetType().ToString() + " | " + resultObj.ToString()); } } } } } } catch (SystemException ex) { resultObj = ex.ToString(); } return(resultObj); }
public static VDF.Vault.Currency.Entities.FileIteration CheckInFile(VDF.Vault.Currency.Connections.Connection connection, VDF.Vault.Currency.Entities.FileIteration fileIteration, string comment, List <AWS.FileAssocLite> oldAssociations, string fullVaultPath, FileInfo localFile) { List <AWS.FileAssocParam> newAssociations = FileOperations.UpdateFileAssociations(connection, fileIteration, oldAssociations); try { return(connection.FileManager.CheckinFile(fileIteration, comment: comment, keepCheckedOut: false, associations: newAssociations.ToArray(), bom: null, copyBom: false, newFileName: null, classification: fileIteration.FileClassification, hidden: false, filePath: new VDF.Currency.FilePathAbsolute(localFile))); } catch { return(null); } }
public static void updateFilePropertyBulkbyFileId(VDF.Vault.Currency.Connections.Connection connection, long fileMasterID, Dictionary <string, string> vaultfilePropsString) { try { Dictionary <PropDef, object> vaultfileProps = new Dictionary <PropDef, object>(); vaultfileProps.Clear(); foreach (var prop in vaultfilePropsString) { vaultfileProps.Add(PropertyHelper.getPropertyDefDetails(connection, "FILE", prop.Key), prop.Value); } Autodesk.Connectivity.WebServices.File[] selFile = connection.WebServiceManager.DocumentService.GetFilesByMasterId(fileMasterID); updateFilePropertiesBulk(connection, selFile[0], vaultfileProps); } catch (SystemException ex) { //statusMess = null; Debug.Write("\nError: " + ex.ToString()); MessageBox.Show(ex.ToString()); } }
public EntityPickerDialog(VDF.Vault.Currency.Connections.Connection conn, IEnumerable <VDF.Vault.Currency.Entities.IEntity> entities, string title, Icon icon, string persistenceKey) { InitializeComponent(); Text = title; if (icon != null) { Icon = icon; } var configuration = new VDF.Vault.Forms.Controls.VaultBrowserControl.Configuration( conn, persistenceKey, null); configuration.AddInitialColumn("Name"); configuration.AddInitialSortCriteria("Name", true); _navigationModel = new VDF.Vault.Forms.Models.ViewVaultNavigationModel(); _navigationModel.AddContent(entities); vaultBrowserControl1.SetDataSource(configuration, _navigationModel); }
public static Dictionary <string, string> PrintProperties(VDF.Vault.Currency.Connections.Connection connection, File selectedFile) { Dictionary <string, string> dict = new Dictionary <string, string>(); try { logit.logger("DesignVisAttmtStatus: " + selectedFile.DesignVisAttmtStatus.ToString()); VDF.Vault.Currency.Entities.FileIteration fileInteration = new FileIteration(connection, selectedFile); var propDefs = connection.PropertyManager.GetPropertyDefinitions(VDF.Vault.Currency.Entities.EntityClassIds.Files, null, VDF.Vault.Currency.Properties.PropertyDefinitionFilter.IncludeAll); foreach (var key in propDefs.Keys) { // Print the Name from the Definition and the Value from the Property object propValue = connection.PropertyManager.GetPropertyValue(fileInteration, propDefs[key], null); dict.Add(key.ToString(), propValue == null ? "" : propValue.ToString()); logit.logger(string.Format("== LIB 1 DICT == >> '{0}' = '{1}'", key.ToString(), propValue == null ? "" : propValue.ToString())); } } catch (SystemException ex) { logit.logger(ex.ToString()); } return(dict); }
public static bool checkifFileExists(VDF.Vault.Currency.Connections.Connection connection, string filePath) { try { boolRes = false; string path = filePath.Replace(System.IO.Path.GetFileName(filePath), ""); File[] files = getFilesfromVaultFolder(connection, path); foreach (File file in files) { if (file.Name == System.IO.Path.GetFileName(filePath)) { boolRes = true; } } connection.WebServiceManager.DocumentService.FindLatestFilesByPaths(filePath.ToSingleArray()).First(); } catch (SystemException ex) { Debug.Write(ex.ToString()); //MessageBox.Show(ex.ToString()); } return(boolRes); }
public PropDef getPropertyDefDetails(VDF.Vault.Currency.Connections.Connection connection, string entityClassIDs, string propertyName) { Dictionary <long, string> props = new Dictionary <long, string>(); try { using (WebServiceManager serviceManager = connection.WebServiceManager) //using will log out after usage { var propDefs = serviceManager.PropertyService.GetPropertyDefinitionsByEntityClassId(entityClassIDs); foreach (var item in propDefs) { if (item.DispName == propertyName) { propinfo = item; } } } } catch (SystemException ex) { } return(propinfo); }
public MainForm(VDF.Vault.Currency.Connections.Connection connection) { // // Required for Windows Form Designer support // InitializeComponent(); m_connection = connection; // set up the grid DataSet dataSet = new DataSet("itemSet"); m_dataTable = new DataTable("itemTable"); m_dataTable.Columns.Add("Item Number"); m_dataTable.Columns.Add("Revision Number"); m_dataTable.Columns.Add("Title"); m_dataTable.Columns.Add("Life Cycle State"); m_dataTable.Columns.Add("Primary File Link"); dataSet.Tables.Add(m_dataTable); m_itemsGrid.SetDataBinding(dataSet, "ItemTable"); m_tableMap = new Dictionary <string, Item>(); m_selectedItem = null; // get all of the life cycle definitions LfCycDef [] definitions = m_connection.WebServiceManager.LifeCycleService.GetAllLifeCycleDefinitions(); m_lifeCycleMap = new Dictionary <long, LfCycDef>(); // put the life cycle definitions into a hashtable for easy lookup foreach (LfCycDef definition in definitions) { m_lifeCycleMap[definition.Id] = definition; } RefreshItemList(); }
public static Dictionary <string, LfCycState> getFolderLifeCycleStates(VDF.Vault.Currency.Connections.Connection connection, string folderPath) { try { Autodesk.Connectivity.WebServices.Folder fld = FolderHelper.gefolderbyfolderPath(connection, folderPath); if (fld.LfCyc != null) { LfCycDef lifeCycleDef = connection.WebServiceManager.LifeCycleService.GetLifeCycleDefinitionsByIds( fld.LfCyc.LfCycDefId.ToSingleArray()).First(); lifeCycleDict = lifeCycleDef.StateArray.ToDictionary(n => n.DispName); } else { return(null); } } catch (SystemException ex) { Debug.Write(ex.ToString()); //MessageBox.Show(ex.ToString()); } return(lifeCycleDict); }
/// <summary> /// Downloads a file from Vault and opens it. The program used to load the file is /// based on the user's OS settings. /// </summary> /// <param name="fileId"></param> public static void Execute(VDF.Vault.Currency.Entities.FileIteration file, VDF.Vault.Currency.Connections.Connection connection) { string filePath = Path.Combine(Application.LocalUserAppDataPath, file.EntityName); //determine if the file already exists if (System.IO.File.Exists(filePath)) { //we'll try to delete the file so we can get the latest copy try { System.IO.File.Delete(filePath); //remove the file from the collection of downloaded files that need to be removed when the application exits if (m_downloadedFiles.Contains(filePath)) { m_downloadedFiles.Remove(filePath); } } catch (System.IO.IOException) { throw new Exception("The file you are attempting to open already exists and can not be overwritten. This file may currently be open, try closing any application you are using to view this file and try opening the file again."); } } downloadFile(connection, file, Path.GetDirectoryName(filePath)); m_downloadedFiles.Add(filePath); //Create a new ProcessStartInfo structure. ProcessStartInfo pInfo = new ProcessStartInfo(); //Set the file name member. pInfo.FileName = filePath; //UseShellExecute is true by default. It is set here for illustration. pInfo.UseShellExecute = true; Process p = Process.Start(pInfo); }
public static string downloadVaultFiles(VDF.Vault.Currency.Connections.Connection connection, string path, List <ISelection> filesColl) { try { //var settings = new VDF.Vault.Settings.AcquireFilesSettings(Global.variables.connection, updateFileReferences: false); //settings.LocalPath = new VDF.Currency.FolderPathAbsolute(Global.variables.fileStore); if (filesColl.Count > 0) { foreach (var file in filesColl) { File selectedFile = null; // Look of the File object. if (file.TypeId == SelectionTypeId.File) { // our ISelection.Id is really a File.MasterId selectedFile = connection.WebServiceManager.DocumentService.GetLatestFileByMasterId(file.Id); } else if (file.TypeId == SelectionTypeId.FileVersion) { // our ISelection.Id is really a File.Id selectedFile = connection.WebServiceManager.DocumentService.GetFileById(file.Id); } if (selectedFile != null) { using (WebServiceManager serviceManager = connection.WebServiceManager) { Autodesk.Connectivity.WebServices.File localFile = serviceManager.DocumentService.GetFileById(selectedFile.Id); var FileDownloadTicket = serviceManager.DocumentService.GetDownloadTicketsByFileIds(new long[] { selectedFile.Id }); FilestoreService fileStoreService = serviceManager.FilestoreService; var fileBytes = fileStoreService.DownloadFilePart(FileDownloadTicket[0].Bytes, 0, localFile.FileSize, false); //MessageBox.Show(path + "\\" + selectedFile.Name); System.IO.File.WriteAllBytes(path + "\\" + selectedFile.Name, fileBytes); //Check if file exist if (!System.IO.File.Exists(path + "\\" + selectedFile.Name)) { //failedFiles.Add(file); statusMess += "\n" + path + "\\" + selectedFile.Name + " - File Check Issue"; } else { statusMess += "\n" + path + "\\" + selectedFile.Name + " - Success"; } } } //MessageBox.Show(String.Format("Hello World! The file {0} size is: {1} bytes", selectedFile.Name, selectedFile.FileSize)); } statusMess = "Success"; } } catch (SystemException ex) { statusMess = null; Debug.Write("\nError: " + ex.ToString()); statusMess = "Error: \n" + ex.ToString(); } return(statusMess); //Autodesk.Connectivity.WebServices.File localFile = serviceManager.DocumentService.GetFileById(file.Id); }
public MdrGridForm(VDF.Vault.Currency.Connections.Connection connection) { InitializeComponent(); m_connection = connection; }
static void Main(string[] args) { Console.WriteLine("Connecting to Vault..."); VDF.Vault.Currency.Connections.Connection connection = VDF.Vault.Forms.Library.Login(null); if (connection == null) { return; } _webSvc = connection.WebServiceManager; OpenDbConnection(sourceCheckerDB); List <dbFile> files = GetAllFilesFromDB(); if (files.Count == 0) { GetAllVaultInventorFiles(); files = GetAllFilesFromDB(); } Console.WriteLine(String.Format("{0} files found in database", files.Count())); string sql = ""; SQLiteCommand command = null; var unprocessedFiles = files.Where(f => !f.Processed).ToList(); long counter = 0; Console.WriteLine(String.Format("({0}) files to check for missing BOMs...", unprocessedFiles.Count)); foreach (var file in unprocessedFiles) { counter++; var f = _webSvc.DocumentService.GetLatestFileByMasterId(long.Parse(file.MasterId)); var bom = _webSvc.DocumentService.GetBOMByFileId(f.Id); string HasBOM = "1"; if (bom == null) { HasBOM = "0"; } sql = String.Format("UPDATE files SET Processed=1, HasBOM={1} WHERE MasterID={0}", file.MasterId, HasBOM); command = new SQLiteCommand(sql, m_dbConnection); command.ExecuteNonQuery(); Console.Write(String.Format("\r[{0}/{1}] {2}={3}", counter, unprocessedFiles.Count, file.Name, HasBOM)); } files = GetAllFilesFromDB(); var toBeQueued = files.Where(f => f.Processed && !f.HasBOM && !f.JobQueued).ToList(); Console.WriteLine(); Console.WriteLine(String.Format("{0} jobs to be queued...", toBeQueued.Count)); counter = 1; foreach (var file in toBeQueued) { Console.WriteLine(String.Format("[{1}/{2}] queueing job for {0}", file.Name, counter++, toBeQueued.Count)); WaitIfTooManyJobs(); try { _webSvc.JobService.AddJob("autodesk.vault.extractbom.inventor", String.Format("BOM Fix for {0}", file.Name), new JobParam[] { new JobParam() { Name = "EntityClassId", Val = "File" }, new JobParam() { Name = "FileMasterId", Val = file.MasterId.ToString() } }, jobPrio); sql = String.Format("UPDATE files SET JobQueued=1 WHERE MasterID={0}", file.MasterId); command = new SQLiteCommand(sql, m_dbConnection); command.ExecuteNonQuery(); } catch { } } CloseDbConnection(); Console.WriteLine("DONE! press a key in order to close this application "); Console.ReadKey(); }
public static string GetVaultCheckOutComment(VDF.Vault.Currency.Entities.FileIteration selectedFile, VDF.Vault.Currency.Connections.Connection connection) { // a list of dictionaries of the vault properties of the associated files List <Dictionary <string, string> > vaultPropDictList = new List <Dictionary <string, string> >(); // function that gets properties requires a list so we'll define a list and add the selected file to it... List <VDF.Vault.Currency.Entities.FileIteration> fileList = new List <VDF.Vault.Currency.Entities.FileIteration>(); fileList.Add(selectedFile); // define a dictionary to hold all the properties pertaining to a vault entity VDF.Vault.Currency.Properties.PropertyDefinitionDictionary allPropDefDict = new VDF.Vault.Currency.Properties.PropertyDefinitionDictionary(); allPropDefDict = connection.PropertyManager.GetPropertyDefinitions(VDF.Vault.Currency.Entities.EntityClassIds.Files, null, VDF.Vault.Currency.Properties.PropertyDefinitionFilter.IncludeAll); // define a list of only the properties that we are concerned about. List <VDF.Vault.Currency.Properties.PropertyDefinition> filteredPropDefList = new List <VDF.Vault.Currency.Properties.PropertyDefinition>(); List <string> propNames = new List <string> { "Comment" }; // copy only definitions in propNames list from allPropDefDict to filteredPropDefList foreach (string s in propNames) { VDF.Vault.Currency.Properties.PropertyDefinition propDefs = new Autodesk.DataManagement.Client.Framework.Vault.Currency.Properties.PropertyDefinition(); propDefs = allPropDefDict[s]; filteredPropDefList.Add(propDefs); } // the following line should return a list of properties VDF.Vault.Currency.Properties.PropertyValues propValues = new Autodesk.DataManagement.Client.Framework.Vault.Currency.Properties.PropertyValues(); propValues = connection.PropertyManager.GetPropertyValues(fileList, filteredPropDefList, null); VDF.Vault.Currency.Properties.PropertyDefinition def = new VDF.Vault.Currency.Properties.PropertyDefinition(propNames[0]); VDF.Vault.Currency.Properties.PropertyValue val; Dictionary <VDF.Vault.Currency.Properties.PropertyDefinition, VDF.Vault.Currency.Properties.PropertyValue> d = propValues.GetValues(selectedFile); d.TryGetValue(def, out val); string key = null; if (def != null) { key = (def.SystemName == null) ? null : def.SystemName; string value = null; if (val != null) { value = (val.Value == null) ? "" : val.Value.ToString(); return(value); } else { value = ""; } } return(null); }
/// <summary> /// This method is called from Program.cs. Entry point to Vault code. /// </summary> public static string DownloadFilestoFolder(VDF.Vault.Currency.Entities.FileIteration fileIter, VDF.Vault.Currency.Connections.Connection connection) { try { string result = createDirectories(); try { string nameOfTopLevelAsm = fileIter.EntityName; downloadFile(connection, fileIter, dwnldfldrpath, nameOfTopLevelAsm); return("Downloaded Successfully!"); } catch (Exception ex) { Console.WriteLine("downloadFile failed:" + ex.Message); return("Directory not found"); } } catch (Exception ex) { Console.WriteLine("createDirectories failed:" + ex.Message); return("Directory not found"); } }
public ChangeLifeCycleForm(long currentLifeCycleDefId, long currentLifeCycleStateId, VDF.Vault.Currency.Connections.Connection connection) { // // Required for Windows Form Designer support // InitializeComponent(); LifeCycleService lifecycleSvc = connection.WebServiceManager.LifeCycleService; // get all of the life cycle definitions LfCycDef[] definitions = lifecycleSvc.GetAllLifeCycleDefinitions(); Dictionary <long, LfCycDef> lifeCycleMap = new Dictionary <long, LfCycDef>(); // put the life cycle definitions into a hashtable for easy lookup foreach (LfCycDef definition in definitions) { lifeCycleMap[definition.Id] = definition; } LfCycDef currentLifeCycleDef = lifeCycleMap[currentLifeCycleDefId]; // list each life cycle that the current Item can move to foreach (LfCycTrans lifeCycleTrans in currentLifeCycleDef.TransArray) { LfCycState state = currentLifeCycleDef.StateArray.FirstOrDefault(lfState => lfState.Id == lifeCycleTrans.ToId); if (state != null) { m_lifeCycleListBox.Items.Add(new ListLifeCycle(state)); } } }
public VDF.Vault.Currency.Connections.Connection getpsVaultConn(string server, string vault, string uName, string pass) { VDF.Vault.Results.LogInResult results = VDF.Vault.Library.ConnectionManager.LogIn(server, vault, uName, pass, VDF.Vault.Currency.Connections.AuthenticationFlags.Standard, null); connection = results.Connection; return(connection); }
public DataTable getCENTCollPropertyValinDataTable(VDF.Vault.Currency.Connections.Connection connection, string entityClassIDs, CustEnt[] custEntscoll, List <string> properties) { DataTable dataTable = new DataTable(); try { dataTable.Clear(); using (WebServiceManager serviceManager = connection.WebServiceManager) //using will log out after usage { var propDefs = connection.PropertyManager.GetPropertyDefinitions(entityClassIDs, null, VDF.Vault.Currency.Properties.PropertyDefinitionFilter.IncludeAll); //set datatable columns Debug.Write(properties.Count); if (properties.Count == 0 || properties == null) { allProps = true; } else { allProps = false; } dataTable = setProptoCol(propDefs, properties); foreach (CustEnt custEnt in custEntscoll) { VDF.Vault.Currency.Entities.CustomObject custObj = new VDF.Vault.Currency.Entities.CustomObject(connection, custEnt); row = dataTable.NewRow(); foreach (var key in propDefs.Keys) { if (allProps) { object propValue = connection.PropertyManager.GetPropertyValue(custObj, propDefs[key], null); //custPropDict.Add(propDefs[key].DisplayName.ToString(), propValue == null ? "" : propValue.ToString()); if (propValue != null) { Debug.Write("\n" + key + " | " + propValue.ToString() + "\n"); row[propDefs[key].DisplayName.ToString()] = propValue; } } else { if (properties.Contains(propDefs[key].DisplayName.ToString())) { object propValue = connection.PropertyManager.GetPropertyValue(custObj, propDefs[key], null); //custPropDict.Add(propDefs[key].DisplayName.ToString(), propValue == null ? "" : propValue.ToString()); if (propValue != null) { Debug.Write("\n" + key + " | " + propValue.ToString() + "\n"); row[propDefs[key].DisplayName.ToString()] = propValue; } } } } dataTable.Rows.Add(row); } } } catch (SystemException ex) { Debug.Write(ex.ToString()); } return(dataTable); }