当前位置: 首页>>代码示例>>C#>>正文


C# IPAddressPool类代码示例

本文整理汇总了C#中IPAddressPool的典型用法代码示例。如果您正苦于以下问题:C# IPAddressPool类的具体用法?C# IPAddressPool怎么用?C# IPAddressPool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IPAddressPool类属于命名空间,在下文中一共展示了IPAddressPool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BeginAllocateMaximumPackageIPAddresses

 /// <remarks/>
 public System.IAsyncResult BeginAllocateMaximumPackageIPAddresses(int packageId, string groupName, IPAddressPool pool, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("AllocateMaximumPackageIPAddresses", new object[] {
                 packageId,
                 groupName,
                 pool}, callback, asyncState);
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:7,代码来源:ServersProxy.cs

示例2: GetIPAddressesPagedCount

 public int GetIPAddressesPagedCount(IPAddressPool pool, int serverId, string filterColumn, string filterValue)
 {
     return ips.Count;
 }
开发者ID:jordan49,项目名称:websitepanel,代码行数:4,代码来源:IPAddressesHelper.cs

示例3: GetPackageIPAddressesCount

 public int GetPackageIPAddressesCount(int packageId, IPAddressPool pool, string filterColumn, string filterValue)
 {
     return packageAddresses.Count;
 }
开发者ID:jordan49,项目名称:websitepanel,代码行数:4,代码来源:VirtualMachinesForPCHelper.cs

示例4: GetPackageUnassignedIPAddresses

 public List<PackageIPAddress> GetPackageUnassignedIPAddresses(int packageId, int orgId, IPAddressPool pool)
 {
     return ServerController.GetPackageUnassignedIPAddresses(packageId, orgId, pool);
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:4,代码来源:esServers.asmx.cs

示例5: AllocateMaximumPackageIPAddresses

 public ResultObject AllocateMaximumPackageIPAddresses(int packageId, string groupName, IPAddressPool pool)
 {
     return ServerController.AllocateMaximumPackageIPAddresses(packageId, groupName, pool);
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:4,代码来源:esServers.asmx.cs

示例6: UpdateIPAddresses

 public ResultObject UpdateIPAddresses(int[] addresses, IPAddressPool pool, int serverId,
     string subnetMask, string defaultGateway, string comments)
 {
     return ServerController.UpdateIPAddresses(addresses, pool, serverId, subnetMask, defaultGateway, comments);
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:5,代码来源:esServers.asmx.cs

示例7: GetPackageIPAddresses

 public PackageIPAddressesPaged GetPackageIPAddresses(int packageId, int orgId, IPAddressPool pool,
     string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, bool recursive)
 {
     return ServerController.GetPackageIPAddresses(packageId, orgId, pool,
         filterColumn, filterValue, sortColumn, startRow, maximumRows, recursive);
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:6,代码来源:esServers.asmx.cs

示例8: AllocatePackageIPAddresses

        public static ResultObject AllocatePackageIPAddresses(int packageId, string groupName, IPAddressPool pool, bool allocateRandom, int addressesNumber, int[] addressId)
        {
            #region Check account and space statuses
            // create result object
            ResultObject res = new ResultObject();

            // check account
            if (!SecurityContext.CheckAccount(res, DemandAccount.NotDemo | DemandAccount.IsActive))
                return res;

            // check package
            if (!SecurityContext.CheckPackage(res, packageId, DemandPackage.IsActive))
                return res;
            #endregion

            // get total number of addresses requested
            if (!allocateRandom && addressId != null)
                addressesNumber = addressId.Length;

            if (addressesNumber <= 0)
            {
                res.IsSuccess = true;
                return res; // just exit
            }

            // check quotas
            string quotaName = GetIPAddressesQuotaByResourceGroup(groupName);

            // get maximum server IPs
            List<IPAddressInfo> ips = ServerController.GetUnallottedIPAddresses(packageId, groupName, pool);
            int maxAvailableIPs = ips.Count;

            if (maxAvailableIPs == 0)
            {
                res.ErrorCodes.Add("IP_ADDRESSES_POOL_IS_EMPTY");
                return res;
            }

            // get hosting plan IP limits
            PackageContext cntx = PackageController.GetPackageContext(packageId);
            int quotaAllocated = cntx.Quotas[quotaName].QuotaAllocatedValue;
            int quotaUsed = cntx.Quotas[quotaName].QuotaUsedValue;

            // check the maximum allowed number
            if (quotaAllocated != -1 &&
                (addressesNumber > (quotaAllocated - quotaUsed)))
            {
                res.ErrorCodes.Add("IP_ADDRESSES_QUOTA_LIMIT_REACHED");
                return res;
            }

            // check if requested more than available
            if (addressesNumber > maxAvailableIPs)
                addressesNumber = maxAvailableIPs;

            res = TaskManager.StartResultTask<ResultObject>("IP_ADDRESS", "ALLOCATE_PACKAGE_IP");
            TaskManager.PackageId = packageId;

            try
            {
                if (allocateRandom)
                {
                    int[] ids = new int[addressesNumber];
                    for (int i = 0; i < addressesNumber; i++)
                        ids[i] = ips[i].AddressId;

                    addressId = ids;
                }

                // prepare XML document
                string xml = PrepareIPsXML(addressId);

                // save to database
                try
                {
                    DataProvider.AllocatePackageIPAddresses(packageId, xml);
                }
                catch (Exception ex)
                {
                    TaskManager.CompleteResultTask(res, VirtualizationErrorCodes.CANNOT_ADD_IP_ADDRESSES_TO_DATABASE, ex);
                    return res;
                }
            }
            catch (Exception ex)
            {
                TaskManager.CompleteResultTask(res, VirtualizationErrorCodes.ALLOCATE_EXTERNAL_ADDRESSES_GENERAL_ERROR, ex);
                return res;
            }

            TaskManager.CompleteResultTask();
            return res;
        }
开发者ID:jordan49,项目名称:websitepanel,代码行数:92,代码来源:ServerController.cs

示例9: AllocateMaximumPackageIPAddresses

        public static ResultObject AllocateMaximumPackageIPAddresses(int packageId, string groupName, IPAddressPool pool)
        {
            // get maximum server IPs
            int maxAvailableIPs = GetUnallottedIPAddresses(packageId, groupName, pool).Count;

            // get quota name
            string quotaName = GetIPAddressesQuotaByResourceGroup(groupName);

            // get hosting plan IPs
            int number = 0;

            PackageContext cntx = PackageController.GetPackageContext(packageId);
            if (cntx.Quotas.ContainsKey(quotaName))
            {
                number = cntx.Quotas[quotaName].QuotaAllocatedValue;
                if (number == -1)
                {
                    // unlimited
                    if (number > maxAvailableIPs) // requested more than available
                        number = maxAvailableIPs; // assign max available server IPs
                }
                else
                {
                    // quota
                    number = number - cntx.Quotas[quotaName].QuotaUsedValue;
                }
            }

            // allocate
            return AllocatePackageIPAddresses(packageId, groupName, pool,
                true, number, new int[0]);
        }
开发者ID:jordan49,项目名称:websitepanel,代码行数:32,代码来源:ServerController.cs

示例10: GetPackageIPAddresses

        public static PackageIPAddressesPaged GetPackageIPAddresses(int packageId, IPAddressPool pool,
            string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, bool recursive)
        {
            PackageIPAddressesPaged result = new PackageIPAddressesPaged();

            // get reader
            IDataReader reader = DataProvider.GetPackageIPAddresses(packageId, (int)pool, filterColumn, filterValue, sortColumn, startRow, maximumRows, recursive);

            // number of items = first data reader
            reader.Read();
            result.Count = (int)reader[0];

            // items = second data reader
            reader.NextResult();
            result.Items = ObjectUtils.CreateListFromDataReader<PackageIPAddress>(reader).ToArray();

            return result;
        }
开发者ID:jordan49,项目名称:websitepanel,代码行数:18,代码来源:ServerController.cs

示例11: GetUnallottedIPAddresses

        public static List<IPAddressInfo> GetUnallottedIPAddresses(int packageId, string groupName, IPAddressPool pool)
        {
            // get service ID
            int serviceId = PackageController.GetPackageServiceId(packageId, groupName);

            // get unallotted addresses
            return ObjectUtils.CreateListFromDataReader<IPAddressInfo>(
                DataProvider.GetUnallottedIPAddresses(packageId, serviceId, (int)pool));
        }
开发者ID:jordan49,项目名称:websitepanel,代码行数:9,代码来源:ServerController.cs

示例12: UpdateIPAddresses

        public static ResultObject UpdateIPAddresses(int[] addresses, IPAddressPool pool, int serverId,
            string subnetMask, string defaultGateway, string comments)
        {
            ResultObject res = new ResultObject();

            #region Check account statuses
            // check account
            if (!SecurityContext.CheckAccount(res, DemandAccount.NotDemo | DemandAccount.IsAdmin | DemandAccount.IsActive))
                return res;
            #endregion

            // start task
            res = TaskManager.StartResultTask<ResultObject>("IP_ADDRESS", "UPDATE_RANGE");

            try
            {
                string xmlIds = PrepareIPsXML(addresses);
                DataProvider.UpdateIPAddresses(xmlIds, (int)pool, serverId, subnetMask, defaultGateway, comments);
            }
            catch (Exception ex)
            {
                TaskManager.CompleteResultTask(res, "IP_ADDRESSES_UPDATE_ERROR", ex);
                return res;
            }

            TaskManager.CompleteResultTask();
            return res;
        }
开发者ID:jordan49,项目名称:websitepanel,代码行数:28,代码来源:ServerController.cs

示例13: AllocateMaximumPackageIPAddressesAsync

 /// <remarks/>
 public void AllocateMaximumPackageIPAddressesAsync(int packageId, string groupName, IPAddressPool pool, object userState) {
     if ((this.AllocateMaximumPackageIPAddressesOperationCompleted == null)) {
         this.AllocateMaximumPackageIPAddressesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAllocateMaximumPackageIPAddressesOperationCompleted);
     }
     this.InvokeAsync("AllocateMaximumPackageIPAddresses", new object[] {
                 packageId,
                 groupName,
                 pool}, this.AllocateMaximumPackageIPAddressesOperationCompleted, userState);
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:10,代码来源:ServersProxy.cs

示例14: AddIPAddressesRange

 public ResultObject AddIPAddressesRange(IPAddressPool pool, int serverId,
     string externalIP, string endIP, string internalIP, string subnetMask, string defaultGateway, string comments)
 {
     return ServerController.AddIPAddressesRange(pool, serverId, externalIP, endIP, internalIP, subnetMask, defaultGateway, comments);
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:5,代码来源:esServers.asmx.cs

示例15: GetItemIPAddresses

 public static List<PackageIPAddress> GetItemIPAddresses(int itemId, IPAddressPool pool)
 {
     return ObjectUtils.CreateListFromDataReader<PackageIPAddress>(
         DataProvider.GetItemIPAddresses(SecurityContext.User.UserId, itemId, (int)pool));
 }
开发者ID:jordan49,项目名称:websitepanel,代码行数:5,代码来源:ServerController.cs


注:本文中的IPAddressPool类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。