Esempio n. 1
0
        public List <string> GetLicenseServers(string accountNumber)
        {
            var respLicenseServers = new List <string>();
            var fnoWs = new v1ManageDeviceService();

            fnoWs.Url = EndPointUrl + "ManageDeviceService";

            fnoWs.PreAuthenticate = true;
            CredentialCache   credCache = new System.Net.CredentialCache();
            NetworkCredential netCred   = new NetworkCredential(UserName, Password);

            credCache.Add(new Uri(fnoWs.Url), "Basic", netCred);
            fnoWs.Credentials = credCache;
            var getDeviceRq = new getDevicesRequestType();

            getDeviceRq.batchSize            = "100";
            getDeviceRq.pageNumber           = "1";
            getDeviceRq.deviceResponseConfig = new deviceResponseConfigRequestType {
                soldTo          = true,
                soldToSpecified = true,
            };
            getDeviceRq.queryParams = new getDevicesParametersType {
                isServer             = true,
                isServerSpecified    = true,
                organizationUnitName = new Devices.PartnerTierQueryType
                {
                    partnerTier = "bo.constants.partnertiernames.endcustomer",
                    searchType  = Devices.simpleSearchType.EQUALS,
                    value       = accountNumber
                }
            };
            var resp = fnoWs.getDevicesQuery(getDeviceRq);

            if (resp.statusInfo.status == OpsEmbeddedStatusType.SUCCESS)
            {
                foreach (var device in resp.responseData)
                {
                    if (device.soldTo != null)
                    {
                        if (device.soldTo.id == accountNumber)
                        {
                            respLicenseServers.Add(device.deviceIdentifier.deviceId);
                        }
                    }
                }
            }

            return(respLicenseServers);
        }
Esempio n. 2
0
        public string GetLicenseServerAccountNumber(string deviceId)
        {
            var accountNumber = string.Empty;
            var fnoWs         = new v1ManageDeviceService();

            fnoWs.Url = EndPointUrl + "ManageDeviceService";

            fnoWs.PreAuthenticate = true;
            CredentialCache   credCache = new System.Net.CredentialCache();
            NetworkCredential netCred   = new NetworkCredential(UserName, Password);

            credCache.Add(new Uri(fnoWs.Url), "Basic", netCred);
            fnoWs.Credentials = credCache;
            var getDeviceRq = new getDevicesRequestType();

            getDeviceRq.batchSize            = "1";
            getDeviceRq.pageNumber           = "1";
            getDeviceRq.deviceResponseConfig = new deviceResponseConfigRequestType
            {
                soldTo          = true,
                soldToSpecified = true,
            };
            getDeviceRq.queryParams = new getDevicesParametersType
            {
                deviceId = new Devices.SimpleQueryType
                {
                    searchType = Devices.simpleSearchType.EQUALS,
                    value      = deviceId
                },
            };
            var resp = fnoWs.getDevicesQuery(getDeviceRq);

            if (resp.statusInfo.status == OpsEmbeddedStatusType.SUCCESS)
            {
                accountNumber = resp.responseData[0].soldTo.id;
            }

            return(accountNumber);
        }