Beispiel #1
0
		public List<LicenseActivation> GetAllServiceLicenseActivations(Service service)
		{
			string mgmtToken = _packingService.PackToken(service.GetManagementToken());

			GetAllLicenseActivationsResult result = _reportingProvider.GetAllServiceLicenseActivations(service.ManagementUrl, mgmtToken,
																														 GetManagementStandardEncryptionInfo(service),
																														 service.GetManagementServiceKeyPair());

			if (IsResultValid(result))
				return result.LicenseActivations;

			return new List<LicenseActivation>();
		}
Beispiel #2
0
        public bool AddLicenseKeysToService(LicenseSet licenseSet, Service service, List<string> keys)
        {
            string mgmtToken = _packingService.PackToken(service.GetManagementToken());

            AddLicenseKeysForProductData data = new AddLicenseKeysForProductData();
            data.LicenseSetId = licenseSet.LicenseSetId;
            data.Keys = keys;

            AddLicenseKeysForProductResult result = _productsProvider.AddLicenseKeysForLicenseSet(service.ManagementUrl, mgmtToken,
                                                                                                                         GetManagementStandardEncryptionInfo(service),
                                                                                                                         service.GetManagementServiceKeyPair(), data);

            if (IsResultValid(result))
                return true;

            return false;
        }
Beispiel #3
0
        public bool AddProductToService(License license, List<LicenseSet> licenseSets, Service service)
        {
            ServiceProduct sp = new ServiceProduct();
            sp.LicenseId = license.LicenseId;
            sp.LicenseName = license.Name;
            sp.LicenseSets = new List<ServiceLicenseSet>();

            foreach (var ls in licenseSets)
            {
                ServiceLicenseSet set = new ServiceLicenseSet();
                set.LicenseId = license.LicenseId;
                set.LicenseSetId = ls.LicenseSetId;
                set.LicenseSetName = ls.Name;
                set.LicenseType = ls.SupportedLicenseTypes;
                set.MaxUsers = ls.MaxUsers;

                sp.LicenseSets.Add(set);
            }

            string mgmtToken = _packingService.PackToken(service.GetManagementToken());

            AddProductResult result = _productsProvider.AddProduct(service.ManagementUrl, mgmtToken,
                                                                                                                         GetManagementStandardEncryptionInfo(service),
                                                                                                                         service.GetManagementServiceKeyPair(), sp);

            if (IsResultValid(result))
                return true;

            return false;
        }
Beispiel #4
0
        public Dictionary<License, List<LicenseSet>> GetServiceLicenses(Service service)
        {
            Dictionary<License, List<LicenseSet>> data = new Dictionary<License, List<LicenseSet>>();
            string mgmtToken = _packingService.PackToken(service.GetManagementToken());

            QueryActiveServiceProductsResult result = _serviceStatusProvider.GetActiveServiceProducts(service.ManagementUrl, mgmtToken,
                                                                                                        GetManagementStandardEncryptionInfo(service), service.GetManagementServiceKeyPair());

            if (IsResultValid(result))
            {
                foreach (var v in result.ProductsAndLicenseSets)
                {
                    License l = _licenseService.GetLicenseById(v.Id);

                    List<LicenseSet> sets = new List<LicenseSet>();

                    foreach (int i in v.SetIds)
                    {
                        sets.Add(_licenseSetService.GetLiceseSetById(i));
                    }

                    data.Add(l, sets);
                }
            }

            return data;
        }
Beispiel #5
0
        public List<string> GetServiceLicenseKeysForSet(LicenseSet licenseSet, Service service)
        {
            string mgmtToken = _packingService.PackToken(service.GetManagementToken());

            GetLicenseKeysForProductData data = new GetLicenseKeysForProductData();
            data.LicenseSetId = licenseSet.LicenseSetId;

            GetLicenseKeysForProductResult result = _productsProvider.GetLicenseKeysForLicenseSet(service.ManagementUrl, mgmtToken,
                                                                                                                         GetManagementStandardEncryptionInfo(service),
                                                                                                                         service.GetManagementServiceKeyPair(), data);

            if (IsResultValid(result))
                return result.LicenseKeys;

            return new List<string>();
        }