public static void UpdatePWEnvVars(int lProjectNo, int lDocumentNo) { if (1 == PWWrapper.aaApi_SelectDocument(lProjectNo, lDocumentNo)) { Bentley.DgnPlatformNET.ConfigurationVariableLevel level = Bentley.DgnPlatformNET.ConfigurationVariableLevel.Application; Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_VAULTID", $"{lProjectNo}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_DOCID", $"{lDocumentNo}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_ORIGINALNO", $"{PWWrapper.aaApi_GetDocumentNumericProperty(PWWrapper.DocumentProperty.OriginalNumber, 0)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_DOCNAME", $"{PWWrapper.aaApi_GetDocumentStringProperty(PWWrapper.DocumentProperty.Name, 0)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_FILENAME", $"{PWWrapper.aaApi_GetDocumentStringProperty(PWWrapper.DocumentProperty.FileName, 0)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_DOCDESC", $"{PWWrapper.aaApi_GetDocumentStringProperty(PWWrapper.DocumentProperty.Desc, 0)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_DOCVERSION", $"{PWWrapper.aaApi_GetDocumentStringProperty(PWWrapper.DocumentProperty.Version, 0)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_DOCCREATETIME", $"{PWWrapper.aaApi_GetDocumentStringProperty(PWWrapper.DocumentProperty.CreateTime, 0)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_DOCUPDATETIME", $"{PWWrapper.aaApi_GetDocumentStringProperty(PWWrapper.DocumentProperty.UpdateTime, 0)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_DOCFILEUPDATETIME", $"{PWWrapper.aaApi_GetDocumentStringProperty(PWWrapper.DocumentProperty.FileUpdateTime, 0)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_DOCLASTRTLOCKTIME", $"{PWWrapper.aaApi_GetDocumentStringProperty(PWWrapper.DocumentProperty.LastRtLockTime, 0)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_DOCWORKFLOW", $"{PWWrapper.GetWorkflowName(PWWrapper.aaApi_GetDocumentNumericProperty(PWWrapper.DocumentProperty.WorkFlowID, 0))}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_DOCWORKFLOWSTATE", $"{PWWrapper.GetStateName(PWWrapper.aaApi_GetDocumentNumericProperty(PWWrapper.DocumentProperty.StateID, 0))}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_VAULTPATHNAME", $"{PWWrapper.GetProjectNamePath2(lProjectNo)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_FULLFILEPATHNAME", $"{PWWrapper.GetDocumentNamePath(lProjectNo, lDocumentNo)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_DOCGUID", $"{PWWrapper.GetGuidStringFromIds(lProjectNo, lDocumentNo)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_DOCLINK", $"{PWWrapper.GetDocumentURL(lProjectNo, lDocumentNo)}", level); if (1 == PWWrapper.aaApi_SelectProject(lProjectNo)) { Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_VAULTNAME", $"{PWWrapper.aaApi_GetProjectStringProperty(PWWrapper.ProjectProperty.Name, 0)}", level); Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable("PWVAR_VAULTDESC", $"{PWWrapper.aaApi_GetProjectStringProperty(PWWrapper.ProjectProperty.Desc, 0)}", level); } System.Collections.Generic.SortedList <string, string> slProps = PWWrapper.GetProjectPropertyValuesInList(lProjectNo); foreach (System.Collections.Generic.KeyValuePair <string, string> kvp in slProps) { Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable($"PWVAR_PROJPROP_{kvp.Key.ToUpper().Replace(" ", "_")}", kvp.Value, level); } System.Collections.Generic.SortedList <string, string> slAttrs = PWWrapper.GetAllAttributeColumnValuesInList(lProjectNo, lDocumentNo); foreach (System.Collections.Generic.KeyValuePair <string, string> kvp in slAttrs) { Bentley.DgnPlatformNET.ConfigurationManager.DefineVariable($"PWVAR_ATTR_{kvp.Key.ToUpper().Replace(" ", "_")}", kvp.Value, level); } } // document selected else { BPSUtilities.WriteLog("Could not select document."); } }
public static void Place(string unparsed) { if (string.IsNullOrEmpty(unparsed)) { string sFileName = Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnFile().GetFileName(); BPSUtilities.WriteLog($"Filename is '{sFileName}'"); int iProjectNo = 0, iDocumentNo = 0; PWWrapper.aaApi_Initialize(0); if (mcmMain_GetDocumentIdByFilePath(sFileName, 1, ref iProjectNo, ref iDocumentNo)) { BPSUtilities.WriteLog($"IDs: {iProjectNo}, {iDocumentNo}"); if (iProjectNo > 0 && iDocumentNo > 0) { int GMAIL_PROJECTWISE_WEB_VIEW_SETTING = -5250; string sWebViewURL = PWWrapper.GetPWStringSetting(GMAIL_PROJECTWISE_WEB_VIEW_SETTING); string sProjectGUIDString = PWWrapper.GetProjectGuidStringFromId(iProjectNo); string sDocumentGUIDString = PWWrapper.GetGuidStringFromIds(iProjectNo, iDocumentNo); if (!string.IsNullOrEmpty(sWebViewURL)) { unparsed = $"{sWebViewURL}?project={sProjectGUIDString}&item={sDocumentGUIDString}"; } else { BPSUtilities.WriteLog("No web view link address set."); } } else { BPSUtilities.WriteLog("No integrated session of ProjectWise."); } } else { BPSUtilities.WriteLog("No integrated session of ProjectWise."); } if (string.IsNullOrEmpty(unparsed)) { unparsed = "www.bentley.com"; } BPSUtilities.WriteLog($"Make code for this: {unparsed}"); PlaceQRCode.InstallNewInstance(unparsed); } else { BPSUtilities.WriteLog($"Make code for this: {unparsed}"); PlaceQRCode.InstallNewInstance(unparsed); } }