private void rolebind() { if (roleid > 0) { Model.RoleInfo rinfo = BLL.RolesBLL.GetModel(roleid); if (rinfo != null) { ltrRoles.Text = "<span style='color:red;'>" + rinfo.RoleName + "</span>"; //try { rblDataPermissionType.SelectedValue = rinfo.DataPermissionType.ToString(); } //catch { } rpTabslistbind(); } } }
internal string AddAzureNodeWorkerRoleProcess(string workerRoleName, int instances, string rootPath, out RoleInfo workerRole) { string result; AzureService service = new AzureService(rootPath, null); workerRole = service.AddWorkerRole(Resources.NodeScaffolding, workerRoleName, instances); try { service.ChangeRolePermissions(workerRole); } catch (UnauthorizedAccessException) { SafeWriteObject(Resources.AddRoleMessageInsufficientPermissions); SafeWriteObject(Environment.NewLine); } result = string.Format(Resources.AddRoleMessageCreate, rootPath, workerRole.Name); return result; }
protected override void OnProcessing(RoleInfo roleInfo) { var interpPath = FindPythonInterpreterPath(); if (interpPath != null) { string stdOut, stdErr; string originalDir = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(Path.Combine(RootPath, roleInfo.Name)); try { ProcessHelper.StartAndWaitForProcess( new ProcessStartInfo( Path.Combine(interpPath, PythonInterpreterExe), String.Format(DjangoStartProjectCommand, roleInfo.Name) ), out stdOut, out stdErr); } finally { Directory.SetCurrentDirectory(originalDir); } if (!string.IsNullOrEmpty(stdErr)) { WriteWarning(String.Format(Resources.UnableToCreateDjangoApp, stdErr)); WriteWarning(Resources.UnableToCreateDjangoAppFix); } } else { WriteWarning(Resources.MissingPythonPreReq); } }
/// <summary> /// Configure the worker role for caching by: /// * Add caching module to the role imports. /// * Enable caching Diagnostic store. /// * Remove input endpoints. /// * Add caching configuration settings. /// </summary> /// <param name="rootPath"></param> /// <param name="cacheRoleInfo"></param> /// <returns></returns> private AzureService Version180Configuration(string rootPath, RoleInfo cacheRoleInfo) { // Fetch cache role information from service definition and service configuration files. AzureService azureService = new AzureService(rootPath, null); WorkerRole cacheWorkerRole = azureService.Components.GetWorkerRole(cacheRoleInfo.Name); RoleSettings cacheRoleSettings = azureService.Components.GetCloudConfigRole(cacheRoleInfo.Name); // Add caching module to the role imports cacheWorkerRole.Imports = CloudServiceUtilities.ExtendArray<Import>(cacheWorkerRole.Imports, new Import { moduleName = Resources.CachingModuleName }); // Enable caching Diagnostic store. LocalStore diagnosticStore = new LocalStore { name = Resources.CacheDiagnosticStoreName, cleanOnRoleRecycle = false }; cacheWorkerRole.LocalResources = CloudServiceUtilities.InitializeIfNull<LocalResources>(cacheWorkerRole.LocalResources); cacheWorkerRole.LocalResources.LocalStorage = CloudServiceUtilities.ExtendArray<LocalStore>(cacheWorkerRole.LocalResources.LocalStorage, diagnosticStore); // Remove input endpoints. cacheWorkerRole.Endpoints.InputEndpoint = null; // Add caching configuration settings AddCacheConfiguration(azureService.Components.GetCloudConfigRole(cacheRoleInfo.Name)); AddCacheConfiguration(azureService.Components.GetLocalConfigRole(cacheRoleInfo.Name), Resources.EmulatorConnectionString); return azureService; }
private AzureService CachingConfigurationFactoryMethod(string rootPath, RoleInfo cacheWorkerRole, string sdkVersion) { switch (sdkVersion) { case SDKVersion.Version180: return Version180Configuration(rootPath, cacheWorkerRole); default: throw new Exception(string.Format(Resources.AzureSdkVersionNotSupported, Resources.MinSupportAzureSdkVersion, Resources.MaxSupportAzureSdkVersion)); } }
/// <summary> /// Configure the worker role for caching by: /// * Add caching module to the role imports. /// * Enable caching Diagnostic store. /// * Remove input endpoints. /// * Add caching configuration settings. /// </summary> /// <param name="rootPath"></param> /// <param name="nodeWorkerRole"></param> /// <returns></returns> private AzureService Version180Configuration(string rootPath, RoleInfo nodeWorkerRole) { // Fetch cache role information from service definition and service configuration files. AzureService azureService = new AzureService(rootPath, null); WorkerRole cacheWorkerRole = azureService.Components.GetWorkerRole(nodeWorkerRole.Name); RoleSettings cacheRoleSettings = azureService.Components.GetCloudConfigRole(nodeWorkerRole.Name); // Add caching module to the role imports cacheWorkerRole.Imports = General.ExtendArray<Import>(cacheWorkerRole.Imports, new Import { moduleName = Resources.CachingModuleName }); // Enable caching Diagnostic store. LocalStore diagnosticStore = new LocalStore { name = Resources.CacheDiagnosticStoreName, cleanOnRoleRecycle = false }; cacheWorkerRole.LocalResources = General.InitializeIfNull<LocalResources>(cacheWorkerRole.LocalResources); cacheWorkerRole.LocalResources.LocalStorage = General.ExtendArray<LocalStore>(cacheWorkerRole.LocalResources.LocalStorage, diagnosticStore); // Remove input endpoints. cacheWorkerRole.Endpoints.InputEndpoint = null; // Add caching configuration settings List<ConfigConfigurationSetting> cachingConfigSettings = new List<ConfigConfigurationSetting>(); cachingConfigSettings.Add(new ConfigConfigurationSetting { name = Resources.NamedCacheSettingName, value = Resources.NamedCacheSettingValue }); cachingConfigSettings.Add(new ConfigConfigurationSetting { name = Resources.DiagnosticLevelName, value = Resources.DiagnosticLevelValue}); cachingConfigSettings.Add(new ConfigConfigurationSetting { name = Resources.CachingCacheSizePercentageSettingName, value = string.Empty }); cachingConfigSettings.Add(new ConfigConfigurationSetting { name = Resources.CachingConfigStoreConnectionStringSettingName, value = string.Empty }); cacheRoleSettings.ConfigurationSettings = General.ExtendArray<ConfigConfigurationSetting>(cacheRoleSettings.ConfigurationSettings, cachingConfigSettings); return azureService; }