Esempio n. 1
0
        public void AddEntitlementLineItemToLicenseServer(EntitlementLineItemResponse lineItem,
                                                          string serverName)
        {
            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 lineItemRq = new linkAddonLineItemDataType[1];

            lineItemRq[0] = new linkAddonLineItemDataType();
            lineItemRq[0].deviceIdentifier = GetLicenseServer(serverName);

            var linkLineItems = new linkLineItemDataType[1];

            linkLineItems[0] = new linkLineItemDataType();
            linkLineItems[0].lineItemIdentifier = new linkLineItemIdentifier
            {
                activationId = lineItem.ActivationCode,

                count = lineItem.TotalQty.ToString()
            };


            lineItemRq[0].lineItem = linkLineItems;
            var resp = fnoWs.linkAddonLineItems(lineItemRq);
        }
Esempio n. 2
0
        public List <string> CreateLicenseServer(string id, string companyName, string productLine, int qty = 1, int currentDeviceCount = 0)
        {
            var devices = 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 deviceRq = new deviceDataType[qty];

            for (int i = 0; i < qty; i++)
            {
                deviceRq[i] = new deviceDataType();
                deviceRq[i].deviceIdentifier = new createDeviceIdentifier
                {
                    deviceType            = WSDeviceType.SERVER,
                    publisherName         = "oncenter",
                    deviceIdType          = deviceIdTypeType.STRING,
                    deviceId              = companyName + "-" + productLine + "-CLM-0" + (currentDeviceCount + 1).ToString(),
                    deviceIdTypeSpecified = true,
                };
                deviceRq[i].deployment          = deployment.CLOUD;
                deviceRq[i].deploymentSpecified = true;
                deviceRq[i].channelPartners     = new Devices.channelPartnerDataType[1];
                deviceRq[i].channelPartners[0]  = new Devices.channelPartnerDataType();
                deviceRq[i].channelPartners[0].organizationUnit                  = new Devices.organizationIdentifierType();
                deviceRq[i].channelPartners[0].organizationUnit.primaryKeys      = new Devices.organizationPKType();
                deviceRq[i].channelPartners[0].organizationUnit.primaryKeys.name = id;
                deviceRq[i].channelPartners[0].currentOwner          = true;
                deviceRq[i].channelPartners[0].currentOwnerSpecified = true;
                deviceRq[i].channelPartners[0].tierName = "bo.constants.partnertiernames.endcustomer";
                deviceRq[i].publisherIdName             = new publisherIdentifier
                {
                    name = "OnCenter"
                };
            }
            var resp = fnoWs.createDevice(deviceRq);

            if (resp.statusInfo.status == OpsEmbeddedStatusType.SUCCESS)
            {
                foreach (var d in resp.responseData)
                {
                    devices.Add(d.deviceId);
                }
            }
            else
            {
                throw new Exception(resp.failedData[0].reason);
            }

            return(devices);
        }
Esempio n. 3
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. 4
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);
        }