public void GlobalAppProgramParametersRecursivelyReadTest() { WfGlobalParameters defaultSettings = WfGlobalParameters.LoadProperties("Default"); defaultSettings.Properties.SetValue("AppName", "SinoOcean"); defaultSettings.Properties.SetValue("ProgName", "DefaultProg"); defaultSettings.Update(); WfGlobalParameters appSettings = WfGlobalParameters.LoadProperties("ADMINISTRATION", "CONTRACT"); appSettings.Properties.SetValue("AppName", string.Empty); appSettings.Properties.SetValue("ProgName", "ContractProg"); appSettings.Update(); Thread.Sleep(500); string pvApp = WfGlobalParameters.GetValueRecursively("ADMINISTRATION", "CONTRACT", "AppName", "DefaultValue"); Assert.AreEqual("SinoOcean", pvApp); string pvProg = WfGlobalParameters.GetValueRecursively("ADMINISTRATION", "CONTRACT", "ProgName", "DefaultValue"); Assert.AreEqual("ContractProg", pvProg); }
/// <summary> /// 是否超出了最大流程主环节的限制 /// </summary> /// <param name="currentMSActivitiesCount"></param> /// <returns></returns> private bool IsExceedMaximizeMainStreamActivityCount(int currentMSActivitiesCount) { bool result = false; int acitivitiesLimit = CurrentProcess.Descriptor.Properties.GetValue("MaximizeMainStreamActivityCount", -1); if (acitivitiesLimit == -1) { acitivitiesLimit = WfGlobalParameters.GetValueRecursively( CurrentProcess.Descriptor.ApplicationName, CurrentProcess.Descriptor.ProgramName, "MaximizeMainStreamActivityCount", -1); } if (acitivitiesLimit >= 0) { result = currentMSActivitiesCount > acitivitiesLimit; } return(result); }
/// <summary> /// 计算绝对路径的Url。如果url不是绝对路径,那么先根据配置文件resourceUriSettings的userTaskRoot项设置。 /// 如果根路径还是空,则使用WfGlobalParameters的FormBaseUrl /// </summary> /// <param name="appCodeName"></param> /// <param name="progCodeName"></param> /// <param name="url"></param> /// <returns></returns> public static string GetNormalizedUrl(string appCodeName, string progCodeName, string url) { string result = url; Uri uri = new Uri(url, UriKind.RelativeOrAbsolute); if (uri.IsAbsoluteUri == false) { ResourceUriSettings settings = ResourceUriSettings.GetConfig(); string rootPath = string.Empty; if (settings.Paths.ContainsKey("userTaskRoot")) { rootPath = settings.Paths["userTaskRoot"].Uri.OriginalString; } else { if (appCodeName.IsNotEmpty() && progCodeName.IsNotEmpty()) { rootPath = WfGlobalParameters.GetValueRecursively(appCodeName, progCodeName, "FormBaseUrl", string.Empty); } else { rootPath = WfGlobalParameters.Default.Properties.GetValue("FormBaseUrl", string.Empty); } } if (rootPath.IsNotEmpty()) { result = UriHelper.CombinePath(rootPath, url); } } return(result); }