protected List<AzureSubscription> FetchSubscriptions() { var util = new ManagementUtilities(); var subscriptions = User.Identity.IsAuthenticated ? util.GetSubscriptions(Settings.AccountOrganizationId) : new List<AzureSubscription>(); if (!subscriptions.Any(d => d.DisplayName.Equals("Subscription"))) { subscriptions.Insert(0, new AzureSubscription() { Id = null, DisplayName = "Subscription" }); } return subscriptions; }
protected List<AzureLocation> FetchAvailableDataCenters(int day, string subscriptionId) { // Create defaults var dataCenters = new List<AzureLocation>() { new AzureLocation() { Code = null, Name = day == 1 ? "Day1 Location" : "Day2 Location" } }; if (!string.IsNullOrEmpty(subscriptionId) && User.Identity.IsAuthenticated) { var util = new ManagementUtilities(); dataCenters.AddRange(util.GetLocations(day, subscriptionId)); } return dataCenters; }
private static ProvisioningService Create(int tenantId, bool isAdminInterface) { // Fetch the Tenant var tenantService = new TenantService(); var scheduledTenant = tenantService.FetchByTenantId(tenantId); // Get Day1 Tenant Site Url var tenants = tenantService.FetchByUsername(scheduledTenant.Username); var dayOneTenant = tenants.First(t => t.ProvisioningOptionCode.Equals("S1")); // Get DataCenters var day = scheduledTenant.ProvisioningOptionCode.Equals("S1") ? 1 : 2; var util = new ManagementUtilities(); var dataCenters = util.GetLocations(day, Settings.AccountSubscriptionId); // Build Parameters var provisioningParameters = GetParameters(day, dataCenters, scheduledTenant, dayOneTenant, isAdminInterface); // Create Provisioning Service return new ProvisioningService((int)scheduledTenant.ProvisioningOptionId, provisioningParameters); }