diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs index a2f4045e..35dc110f 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs @@ -160,6 +160,7 @@ order by rg.groupOrder public const string CRM_USERS = "HostedCRM.Users"; public const string CRM_ORGANIZATION = "HostedCRM.Organization"; public const string CRM_LIMITEDUSERS = "HostedCRM.LimitedUsers"; + public const string CRM_ESSUSERS = "HostedCRM.ESSUsers"; public const string CRM_MAXDATABASESIZE = "HostedCRM.MaxDatabaseSize"; public const string VPS_SERVERS_NUMBER = "VPS.ServersNumber"; // Number of VPS diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ServersProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ServersProxy.cs index 0787ef27..52065e46 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ServersProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ServersProxy.cs @@ -52,8 +52,8 @@ using WebsitePanel.Server; using WebsitePanel.Providers.DNS; using WebsitePanel.Providers.ResultObjects; -namespace WebsitePanel.EnterpriseServer { - +namespace WebsitePanel.EnterpriseServer +{ /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.Diagnostics.DebuggerStepThroughAttribute()] @@ -61,6 +61,8 @@ namespace WebsitePanel.EnterpriseServer { [System.Web.Services.WebServiceBindingAttribute(Name="esServersSoap", Namespace="http://smbsaas/websitepanel/enterpriseserver")] public partial class esServers : Microsoft.Web.Services3.WebServicesClientProtocol { + private System.Threading.SendOrPostCallback GetDnsRecordsByServiceOperationCompleted; + private System.Threading.SendOrPostCallback GetDnsRecordsByServerOperationCompleted; private System.Threading.SendOrPostCallback GetDnsRecordsByPackageOperationCompleted; @@ -269,6 +271,8 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback GetPackageIPAddressesOperationCompleted; + private System.Threading.SendOrPostCallback GetPackageIPAddressesCountOperationCompleted; + private System.Threading.SendOrPostCallback GetPackageUnassignedIPAddressesOperationCompleted; private System.Threading.SendOrPostCallback AllocatePackageIPAddressesOperationCompleted; @@ -291,13 +295,14 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback GetRawDnsRecordsByGroupOperationCompleted; - private System.Threading.SendOrPostCallback GetDnsRecordsByServiceOperationCompleted; - /// public esServers() { this.Url = "http://localhost:9002/esServers.asmx"; } + /// + public event GetDnsRecordsByServiceCompletedEventHandler GetDnsRecordsByServiceCompleted; + /// public event GetDnsRecordsByServerCompletedEventHandler GetDnsRecordsByServerCompleted; @@ -610,6 +615,9 @@ namespace WebsitePanel.EnterpriseServer { /// public event GetPackageIPAddressesCompletedEventHandler GetPackageIPAddressesCompleted; + /// + public event GetPackageIPAddressesCountCompletedEventHandler GetPackageIPAddressesCountCompleted; + /// public event GetPackageUnassignedIPAddressesCompletedEventHandler GetPackageUnassignedIPAddressesCompleted; @@ -644,7 +652,45 @@ namespace WebsitePanel.EnterpriseServer { public event GetRawDnsRecordsByGroupCompletedEventHandler GetRawDnsRecordsByGroupCompleted; /// - public event GetDnsRecordsByServiceCompletedEventHandler GetDnsRecordsByServiceCompleted; + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetDnsRecordsByService", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public GlobalDnsRecord[] GetDnsRecordsByService(int serviceId) { + object[] results = this.Invoke("GetDnsRecordsByService", new object[] { + serviceId}); + return ((GlobalDnsRecord[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetDnsRecordsByService(int serviceId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetDnsRecordsByService", new object[] { + serviceId}, callback, asyncState); + } + + /// + public GlobalDnsRecord[] EndGetDnsRecordsByService(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((GlobalDnsRecord[])(results[0])); + } + + /// + public void GetDnsRecordsByServiceAsync(int serviceId) { + this.GetDnsRecordsByServiceAsync(serviceId, null); + } + + /// + public void GetDnsRecordsByServiceAsync(int serviceId, object userState) { + if ((this.GetDnsRecordsByServiceOperationCompleted == null)) { + this.GetDnsRecordsByServiceOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetDnsRecordsByServiceOperationCompleted); + } + this.InvokeAsync("GetDnsRecordsByService", new object[] { + serviceId}, this.GetDnsRecordsByServiceOperationCompleted, userState); + } + + private void OnGetDnsRecordsByServiceOperationCompleted(object arg) { + if ((this.GetDnsRecordsByServiceCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetDnsRecordsByServiceCompleted(this, new GetDnsRecordsByServiceCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetDnsRecordsByServer", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] @@ -5196,6 +5242,53 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetPackageIPAddressesCount", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public int GetPackageIPAddressesCount(int packageId, int orgId, IPAddressPool pool) { + object[] results = this.Invoke("GetPackageIPAddressesCount", new object[] { + packageId, + orgId, + pool}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginGetPackageIPAddressesCount(int packageId, int orgId, IPAddressPool pool, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetPackageIPAddressesCount", new object[] { + packageId, + orgId, + pool}, callback, asyncState); + } + + /// + public int EndGetPackageIPAddressesCount(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void GetPackageIPAddressesCountAsync(int packageId, int orgId, IPAddressPool pool) { + this.GetPackageIPAddressesCountAsync(packageId, orgId, pool, null); + } + + /// + public void GetPackageIPAddressesCountAsync(int packageId, int orgId, IPAddressPool pool, object userState) { + if ((this.GetPackageIPAddressesCountOperationCompleted == null)) { + this.GetPackageIPAddressesCountOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetPackageIPAddressesCountOperationCompleted); + } + this.InvokeAsync("GetPackageIPAddressesCount", new object[] { + packageId, + orgId, + pool}, this.GetPackageIPAddressesCountOperationCompleted, userState); + } + + private void OnGetPackageIPAddressesCountOperationCompleted(object arg) { + if ((this.GetPackageIPAddressesCountCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetPackageIPAddressesCountCompleted(this, new GetPackageIPAddressesCountCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetPackageUnassignedIPAddresses", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public PackageIPAddress[] GetPackageUnassignedIPAddresses(int packageId, int orgId, IPAddressPool pool) { @@ -5677,53 +5770,38 @@ namespace WebsitePanel.EnterpriseServer { } } - /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetDnsRecordsByService", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public GlobalDnsRecord[] GetDnsRecordsByService(int serviceId) { - object[] results = this.Invoke("GetDnsRecordsByService", new object[] { - serviceId}); - return ((GlobalDnsRecord[])(results[0])); - } - - /// - public System.IAsyncResult BeginGetDnsRecordsByService(int serviceId, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("GetDnsRecordsByService", new object[] { - serviceId}, callback, asyncState); - } - - /// - public GlobalDnsRecord[] EndGetDnsRecordsByService(System.IAsyncResult asyncResult) { - object[] results = this.EndInvoke(asyncResult); - return ((GlobalDnsRecord[])(results[0])); - } - - /// - public void GetDnsRecordsByServiceAsync(int serviceId) { - this.GetDnsRecordsByServiceAsync(serviceId, null); - } - - /// - public void GetDnsRecordsByServiceAsync(int serviceId, object userState) { - if ((this.GetDnsRecordsByServiceOperationCompleted == null)) { - this.GetDnsRecordsByServiceOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetDnsRecordsByServiceOperationCompleted); - } - this.InvokeAsync("GetDnsRecordsByService", new object[] { - serviceId}, this.GetDnsRecordsByServiceOperationCompleted, userState); - } - - private void OnGetDnsRecordsByServiceOperationCompleted(object arg) { - if ((this.GetDnsRecordsByServiceCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.GetDnsRecordsByServiceCompleted(this, new GetDnsRecordsByServiceCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - /// public new void CancelAsync(object userState) { base.CancelAsync(userState); } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void GetDnsRecordsByServiceCompletedEventHandler(object sender, GetDnsRecordsByServiceCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetDnsRecordsByServiceCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetDnsRecordsByServiceCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public GlobalDnsRecord[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((GlobalDnsRecord[])(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] public delegate void GetDnsRecordsByServerCompletedEventHandler(object sender, GetDnsRecordsByServerCompletedEventArgs e); @@ -8340,6 +8418,32 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void GetPackageIPAddressesCountCompletedEventHandler(object sender, GetPackageIPAddressesCountCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetPackageIPAddressesCountCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetPackageIPAddressesCountCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] public delegate void GetPackageUnassignedIPAddressesCompletedEventHandler(object sender, GetPackageUnassignedIPAddressesCompletedEventArgs e); @@ -8625,30 +8729,4 @@ namespace WebsitePanel.EnterpriseServer { } } } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] - public delegate void GetDnsRecordsByServiceCompletedEventHandler(object sender, GetDnsRecordsByServiceCompletedEventArgs e); - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - public partial class GetDnsRecordsByServiceCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - - private object[] results; - - internal GetDnsRecordsByServiceCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : - base(exception, cancelled, userState) { - this.results = results; - } - - /// - public GlobalDnsRecord[] Result { - get { - this.RaiseExceptionIfNecessary(); - return ((GlobalDnsRecord[])(this.results[0])); - } - } - } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs index d2caa067..07a052cb 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs @@ -3286,6 +3286,17 @@ namespace WebsitePanel.EnterpriseServer return reader; } + public static int GetPackageIPAddressesCount(int packageId, int orgId, int poolId) + { + object obj = SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, + "GetPackageIPAddressesCount", + new SqlParameter("@PackageID", packageId), + new SqlParameter("@OrgID", orgId), + new SqlParameter("@PoolId", poolId)); + int res = 0; + int.TryParse(obj.ToString(), out res); + return res; + } public static void DeallocatePackageIPAddress(int id) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/CRMController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/CRMController.cs index 956352f8..6ca779d3 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/CRMController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/CRMController.cs @@ -269,7 +269,7 @@ namespace WebsitePanel.EnterpriseServer string rootOU = GetProviderProperty(serviceid, "rootou"); PackageContext cntx = PackageController.GetPackageContext(org.PackageId); - int maxDBSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; + long maxDBSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; if (maxDBSize != -1) maxDBSize = maxDBSize * 1024 * 1024; org.CrmAdministratorId = user.AccountId; @@ -676,7 +676,7 @@ namespace WebsitePanel.EnterpriseServer if (!quotaRes.Value) { - CompleteTask(ret, CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED, null, "CRM user quota has been reached."); + CompleteTask(ret, CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED + CALType.ToString(), null, "CRM user quota has been reached."); return ret; } @@ -971,7 +971,7 @@ namespace WebsitePanel.EnterpriseServer try { CrmUserResult user = GetCrmUser(itemId, accountId); - if (user.Value.CALType == CALType) + if (user.Value.CALType + ((int)user.Value.ClientAccessMode)*10 == CALType) { res.IsSuccess = true; CompleteTask(); @@ -1012,8 +1012,7 @@ namespace WebsitePanel.EnterpriseServer } if (!quotaRes.Value) { - CompleteTask(res, CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED + CALType.ToString(), null, "CRM user quota " + - (CALType==0 ? "(full license)" : "(limited license)") +" has been reached."); + CompleteTask(res, CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED + CALType.ToString(), null, "CRM user quota has been reached."); return res; } @@ -1106,7 +1105,20 @@ namespace WebsitePanel.EnterpriseServer return res; } - string quotaName = CALType == 0 ? Quotas.CRM_USERS : Quotas.CRM_LIMITEDUSERS; + string quotaName = Quotas.CRM_USERS; + + switch (CALType) + { + case 0: + quotaName = Quotas.CRM_USERS; + break; + case 2: + quotaName = Quotas.CRM_LIMITEDUSERS; + break; + case 22: + quotaName = Quotas.CRM_ESSUSERS; + break; + } int allocatedCrmUsers = cntx.Quotas[quotaName].QuotaAllocatedValue; res.Value = allocatedCrmUsers == -1 || allocatedCrmUsers > tmp.Value; @@ -1157,7 +1169,7 @@ namespace WebsitePanel.EnterpriseServer PackageContext cntx = PackageController.GetPackageContext(packageId); - int limitSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; + long limitSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; if (limitSize != -1) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index 3b7225a4..4239f90a 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -934,6 +934,7 @@ namespace WebsitePanel.EnterpriseServer { stats.CreatedCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, 0).Value; stats.CreatedLimitedCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, 2).Value; + stats.CreatedESSCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, 22).Value; stats.UsedCRMDiskSpace = CRMController.GetDBSize(org.Id, org.PackageId); stats.AllocatedCRMDiskSpace = CRMController.GetMaxDBSize(org.Id, org.PackageId); @@ -997,6 +998,7 @@ namespace WebsitePanel.EnterpriseServer { stats.CreatedCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, 0 ).Value; stats.CreatedLimitedCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, 2).Value; + stats.CreatedESSCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, 22).Value; stats.UsedCRMDiskSpace += CRMController.GetDBSize(o.Id, o.PackageId); stats.AllocatedCRMDiskSpace += CRMController.GetMaxDBSize(o.Id, o.PackageId); } @@ -1044,6 +1046,7 @@ namespace WebsitePanel.EnterpriseServer { stats.AllocatedCRMUsers = cntx.Quotas[Quotas.CRM_USERS].QuotaAllocatedValue; stats.AllocatedLimitedCRMUsers = cntx.Quotas[Quotas.CRM_LIMITEDUSERS].QuotaAllocatedValue; + stats.AllocatedESSCRMUsers = cntx.Quotas[Quotas.CRM_ESSUSERS].QuotaAllocatedValue; } if (cntx.Groups.ContainsKey(ResourceGroups.BlackBerry)) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs index 248730f1..b759177c 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs @@ -1186,6 +1186,11 @@ namespace WebsitePanel.EnterpriseServer return result; } + public static int GetPackageIPAddressesCount(int packageId, int orgId, IPAddressPool pool) + { + return DataProvider.GetPackageIPAddressesCount(packageId, orgId, (int)pool); + } + public static List GetUnallottedIPAddresses(int packageId, string groupName, IPAddressPool pool) { // get service ID @@ -1259,6 +1264,9 @@ namespace WebsitePanel.EnterpriseServer int quotaAllocated = cntx.Quotas[quotaName].QuotaAllocatedValue; int quotaUsed = cntx.Quotas[quotaName].QuotaUsedValue; + if (pool == IPAddressPool.PhoneNumbers) + quotaUsed = ServerController.GetPackageIPAddressesCount(packageId, orgId, pool); + // check the maximum allowed number if (quotaAllocated != -1) // check only if not unlimited { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esServers.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esServers.asmx.cs index bde7c636..312a78b8 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esServers.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esServers.asmx.cs @@ -393,6 +393,12 @@ namespace WebsitePanel.EnterpriseServer filterColumn, filterValue, sortColumn, startRow, maximumRows, recursive); } + [WebMethod] + public int GetPackageIPAddressesCount(int packageId, int orgId, IPAddressPool pool) + { + return ServerController.GetPackageIPAddressesCount(packageId, orgId, pool); + } + [WebMethod] public List GetPackageUnassignedIPAddresses(int packageId, int orgId, IPAddressPool pool) { diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/CRMOrganizationStatistics.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/CRMOrganizationStatistics.cs index 1ad2f6e3..736afd47 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/CRMOrganizationStatistics.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/CRMOrganizationStatistics.cs @@ -42,6 +42,7 @@ namespace WebsitePanel.Providers.HostedSolution public string СRMOrganizationName { get; set; } public int CRMUsersFullLicenceCount { get; set; } public int CRMUsersReadOnlyLicenceCount { get; set; } + public int CRMUsersESSLicenceCount { get; set; } public int UsedSpace { get; set; } public string UsageMonth { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs index 583a80e2..b107d59a 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs @@ -64,6 +64,9 @@ namespace WebsitePanel.Providers.HostedSolution private int createdLimitedCRMUsers; private int allocatedLimitedCRMUsers; + private int createdESSCRMUsers; + private int allocatedESSCRMUsers; + private long usedCRMDiskSpace; private long allocatedCRMDiskSpace; @@ -97,7 +100,19 @@ namespace WebsitePanel.Providers.HostedSolution get { return allocatedLimitedCRMUsers; } set { allocatedLimitedCRMUsers = value; } } - + + public int CreatedESSCRMUsers + { + get { return createdESSCRMUsers; } + set { createdESSCRMUsers = value; } + } + + public int AllocatedESSCRMUsers + { + get { return allocatedESSCRMUsers; } + set { allocatedESSCRMUsers = value; } + } + public int AllocatedUsers { get { return allocatedUsers; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2011/CRMProvider2011.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2011/CRMProvider2011.cs index b19143bc..44d03f40 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2011/CRMProvider2011.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2011/CRMProvider2011.cs @@ -951,6 +951,10 @@ namespace WebsitePanel.Providers.HostedSolution // Retrieve the specified security role. Role role = RetrieveRoleByName(serviceProxy, roleStr); + // CALType and AccessMode + int accessmode = CALType / 10; + int caltype = CALType % 10; + //Create a new system user. SystemUser user = new SystemUser { @@ -963,7 +967,8 @@ namespace WebsitePanel.Providers.HostedSolution Name = BusinessUnit.EntityLogicalName, Id = defaultBusinessUnit.Id }, - CALType = new OptionSetValue(CALType) + CALType = new OptionSetValue(caltype), + AccessMode = new OptionSetValue(accessmode) }; userId = serviceProxy.Create(user); @@ -1930,7 +1935,12 @@ namespace WebsitePanel.Providers.HostedSolution SystemUser user = serviceProxy.Retrieve(SystemUser.EntityLogicalName, userId, new Microsoft.Xrm.Sdk.Query.ColumnSet("domainname", "businessunitid", "accessmode", "isdisabled", "caltype")).ToEntity(); - user.CALType = new OptionSetValue(CALType); + // CALType and AccessMode + int accessmode = CALType / 10; + int caltype = CALType % 10; + + user.CALType = new OptionSetValue(caltype); + user.AccessMode = new OptionSetValue(accessmode); serviceProxy.Update(user); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index 94ad568b..f4ec2338 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5374,4 +5374,10 @@ CRM users quota (limited license) has been reached. + + CRM users quota (ESS license) has been reached. + + + ESS licenses per organization + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx.cs index d5da4ddc..f7930b46 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx.cs @@ -42,10 +42,19 @@ namespace WebsitePanel.Portal protected void Page_Load(object sender, EventArgs e) { warningValue.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); - if (!IsPostBack) { - BindValues(); + Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); + if (org.CrmOrganizationId == Guid.Empty) + { + messageBox.ShowErrorMessage("NOT_CRM_ORGANIZATION"); + StorageLimits.Enabled = false; + btnSave.Enabled = false; + } + else + { + BindValues(); + } } } @@ -77,9 +86,9 @@ namespace WebsitePanel.Portal try { PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); - int limitSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; + long limitSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; - int maxSize = maxStorageSettingsValue.QuotaValue; + long maxSize = maxStorageSettingsValue.QuotaValue; if (limitSize != -1) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx index 142dfecc..320d1a7f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx @@ -56,6 +56,7 @@ Full Limited + ESS diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx.cs index 82633cbe..232e18ea 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx.cs @@ -59,12 +59,13 @@ namespace WebsitePanel.Portal.CRM lblEmailAddress.Text = user.PrimaryEmailAddress; lblDomainName.Text = user.DomainUserName; - int cALType = userResult.Value.CALType; + int cALType = userResult.Value.CALType + ((int)userResult.Value.ClientAccessMode) * 10; switch (cALType) { case 0 : case 2 : + case 22: ddlLicenseType.SelectedValue = cALType.ToString(); break; default: diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx index 5c2d27f9..157c4439 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx @@ -97,6 +97,14 @@ + + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx.cs index f5c2df3f..e602141d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx.cs @@ -57,6 +57,10 @@ namespace WebsitePanel.Portal.CRM //if (stats.AllocatedCRMUsers != -1) usersQuota.QuotaAvailable = tenantStats.AllocatedCRMUsers - tenantStats.CreatedCRMUsers; //if (stats.AllocatedLimitedCRMUsers != -1) limitedusersQuota.QuotaAvailable = tenantStats.AllocatedLimitedCRMUsers - tenantStats.CreatedLimitedCRMUsers; + + essusersQuota.QuotaUsedValue = stats.CreatedESSCRMUsers; + essusersQuota.QuotaValue = stats.AllocatedESSCRMUsers; + } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx.designer.cs index 26126601..721c4be0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx.designer.cs @@ -201,5 +201,23 @@ namespace WebsitePanel.Portal.CRM { /// To modify move field declaration from designer file to code-behind file. /// protected global::WebsitePanel.Portal.QuotaViewer limitedusersQuota; + + /// + /// locESSQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locESSQuota; + + /// + /// essusersQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaViewer essusersQuota; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx index 8e4684d6..4943ec9d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx @@ -45,6 +45,7 @@ Full Limited + ESS diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx index e5d262c6..86659c0e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx @@ -224,7 +224,15 @@ - + + + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs index 647cb8e1..bdadf4b7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs @@ -247,6 +247,7 @@ namespace WebsitePanel.Portal.ExchangeServer "SpaceID=" + PanelSecurity.PackageId); lnkLimitedCRMUsers.NavigateUrl = lnkCRMUsers.NavigateUrl; + lnkESSCRMUsers.NavigateUrl = lnkCRMUsers.NavigateUrl; lnkCRMDBSize.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "crm_storage_settings", "SpaceID=" + PanelSecurity.PackageId); @@ -259,7 +260,10 @@ namespace WebsitePanel.Portal.ExchangeServer crmLimitedUsersStats.QuotaUsedValue = stats.CreatedLimitedCRMUsers; crmLimitedUsersStats.QuotaValue = stats.AllocatedLimitedCRMUsers; - crmDBSize.QuotaUsedValue = Convert.ToInt32( stats.UsedCRMDiskSpace>0 ? stats.UsedCRMDiskSpace/(1024*1024) : -1); + crmESSUsersStats.QuotaUsedValue = stats.CreatedESSCRMUsers; + crmESSUsersStats.QuotaValue = stats.AllocatedESSCRMUsers; + + crmDBSize.QuotaUsedValue = Convert.ToInt32(stats.UsedCRMDiskSpace > 0 ? stats.UsedCRMDiskSpace / (1024 * 1024) : -1); crmDBSize.QuotaValue = Convert.ToInt32(stats.AllocatedCRMDiskSpace>0 ? stats.AllocatedCRMDiskSpace/(1024*1024) : -1); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs index 9894c4a6..dd6be843 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs @@ -553,6 +553,24 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::WebsitePanel.Portal.QuotaViewer crmLimitedUsersStats; + /// + /// lnkESSCRMUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink lnkESSCRMUsers; + + /// + /// crmESSUsersStats control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaViewer crmESSUsersStats; + /// /// lnkCRMDBSize control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncPhoneNumbers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncPhoneNumbers.ascx.cs index 4cb22840..2418fa64 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncPhoneNumbers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncPhoneNumbers.ascx.cs @@ -31,6 +31,8 @@ using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; namespace WebsitePanel.Portal.Lync { @@ -38,6 +40,15 @@ namespace WebsitePanel.Portal.Lync { protected void Page_Load(object sender, EventArgs e) { + + } + + protected void Page_PreRender(object sender, EventArgs e) + { + if (!IsPostBack) + { + phoneQuota.Viewer.QuotaUsedValue = ES.Services.Servers.GetPackageIPAddressesCount(PanelSecurity.PackageId, PanelRequest.ItemID, IPAddressPool.PhoneNumbers); + } } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/AllocatePackagePhoneNumbers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/AllocatePackagePhoneNumbers.ascx.cs index 6240c896..b471307a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/AllocatePackagePhoneNumbers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/AllocatePackagePhoneNumbers.ascx.cs @@ -95,7 +95,9 @@ namespace WebsitePanel.Portal.UserControls if (cntx.Quotas.ContainsKey(quotaName)) { int quotaAllocated = cntx.Quotas[quotaName].QuotaAllocatedValue; - int quotaUsed = cntx.Quotas[quotaName].QuotaUsedValue; + //int quotaUsed = cntx.Quotas[quotaName].QuotaUsedValue; + + int quotaUsed = ES.Services.Servers.GetPackageIPAddressesCount(PanelSecurity.PackageId, PanelRequest.ItemID, IPAddressPool.PhoneNumbers); if (quotaAllocated != -1) quotaAllowed = quotaAllocated - quotaUsed; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/Quota.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/Quota.ascx.cs index 0931504d..da96d14a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/Quota.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/Quota.ascx.cs @@ -55,6 +55,11 @@ namespace WebsitePanel.Portal set { quotaViewer.DisplayGauge = value; } } + public QuotaViewer Viewer + { + get { return quotaViewer; } + } + protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack)