• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IPAddressPool类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: UpdateIPAddress

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


示例17: GetIPAddresses

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


示例18: GetUnallottedIPAddresses

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


示例19: GetIPAddressesPaged

        public static IPAddressesPaged GetIPAddressesPaged(IPAddressPool pool, int serverId,
            string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
        {
            IPAddressesPaged result = new IPAddressesPaged();

            // get reader
            IDataReader reader = DataProvider.GetIPAddressesPaged(SecurityContext.User.UserId, (int)pool, serverId, filterColumn, filterValue, sortColumn, startRow, maximumRows);

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

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

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


示例20: GetPackageIPAddressesCount

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IPConnection类代码示例发布时间:2022-05-24
下一篇:
C# IPAddress类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap