This commit is contained in:
Virtuworks 2013-12-10 16:50:22 -05:00
commit 0e8e3adaee
24 changed files with 331 additions and 90 deletions

View file

@ -160,6 +160,7 @@ order by rg.groupOrder
public const string CRM_USERS = "HostedCRM.Users"; public const string CRM_USERS = "HostedCRM.Users";
public const string CRM_ORGANIZATION = "HostedCRM.Organization"; public const string CRM_ORGANIZATION = "HostedCRM.Organization";
public const string CRM_LIMITEDUSERS = "HostedCRM.LimitedUsers"; public const string CRM_LIMITEDUSERS = "HostedCRM.LimitedUsers";
public const string CRM_ESSUSERS = "HostedCRM.ESSUsers";
public const string CRM_MAXDATABASESIZE = "HostedCRM.MaxDatabaseSize"; public const string CRM_MAXDATABASESIZE = "HostedCRM.MaxDatabaseSize";
public const string VPS_SERVERS_NUMBER = "VPS.ServersNumber"; // Number of VPS public const string VPS_SERVERS_NUMBER = "VPS.ServersNumber"; // Number of VPS

View file

@ -52,8 +52,8 @@ using WebsitePanel.Server;
using WebsitePanel.Providers.DNS; using WebsitePanel.Providers.DNS;
using WebsitePanel.Providers.ResultObjects; using WebsitePanel.Providers.ResultObjects;
namespace WebsitePanel.EnterpriseServer { namespace WebsitePanel.EnterpriseServer
{
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
@ -61,6 +61,8 @@ namespace WebsitePanel.EnterpriseServer {
[System.Web.Services.WebServiceBindingAttribute(Name="esServersSoap", Namespace="http://smbsaas/websitepanel/enterpriseserver")] [System.Web.Services.WebServiceBindingAttribute(Name="esServersSoap", Namespace="http://smbsaas/websitepanel/enterpriseserver")]
public partial class esServers : Microsoft.Web.Services3.WebServicesClientProtocol { public partial class esServers : Microsoft.Web.Services3.WebServicesClientProtocol {
private System.Threading.SendOrPostCallback GetDnsRecordsByServiceOperationCompleted;
private System.Threading.SendOrPostCallback GetDnsRecordsByServerOperationCompleted; private System.Threading.SendOrPostCallback GetDnsRecordsByServerOperationCompleted;
private System.Threading.SendOrPostCallback GetDnsRecordsByPackageOperationCompleted; private System.Threading.SendOrPostCallback GetDnsRecordsByPackageOperationCompleted;
@ -269,6 +271,8 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback GetPackageIPAddressesOperationCompleted; private System.Threading.SendOrPostCallback GetPackageIPAddressesOperationCompleted;
private System.Threading.SendOrPostCallback GetPackageIPAddressesCountOperationCompleted;
private System.Threading.SendOrPostCallback GetPackageUnassignedIPAddressesOperationCompleted; private System.Threading.SendOrPostCallback GetPackageUnassignedIPAddressesOperationCompleted;
private System.Threading.SendOrPostCallback AllocatePackageIPAddressesOperationCompleted; private System.Threading.SendOrPostCallback AllocatePackageIPAddressesOperationCompleted;
@ -291,13 +295,14 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback GetRawDnsRecordsByGroupOperationCompleted; private System.Threading.SendOrPostCallback GetRawDnsRecordsByGroupOperationCompleted;
private System.Threading.SendOrPostCallback GetDnsRecordsByServiceOperationCompleted;
/// <remarks/> /// <remarks/>
public esServers() { public esServers() {
this.Url = "http://localhost:9002/esServers.asmx"; this.Url = "http://localhost:9002/esServers.asmx";
} }
/// <remarks/>
public event GetDnsRecordsByServiceCompletedEventHandler GetDnsRecordsByServiceCompleted;
/// <remarks/> /// <remarks/>
public event GetDnsRecordsByServerCompletedEventHandler GetDnsRecordsByServerCompleted; public event GetDnsRecordsByServerCompletedEventHandler GetDnsRecordsByServerCompleted;
@ -610,6 +615,9 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/> /// <remarks/>
public event GetPackageIPAddressesCompletedEventHandler GetPackageIPAddressesCompleted; public event GetPackageIPAddressesCompletedEventHandler GetPackageIPAddressesCompleted;
/// <remarks/>
public event GetPackageIPAddressesCountCompletedEventHandler GetPackageIPAddressesCountCompleted;
/// <remarks/> /// <remarks/>
public event GetPackageUnassignedIPAddressesCompletedEventHandler GetPackageUnassignedIPAddressesCompleted; public event GetPackageUnassignedIPAddressesCompletedEventHandler GetPackageUnassignedIPAddressesCompleted;
@ -644,7 +652,45 @@ namespace WebsitePanel.EnterpriseServer {
public event GetRawDnsRecordsByGroupCompletedEventHandler GetRawDnsRecordsByGroupCompleted; public event GetRawDnsRecordsByGroupCompletedEventHandler GetRawDnsRecordsByGroupCompleted;
/// <remarks/> /// <remarks/>
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]));
}
/// <remarks/>
public System.IAsyncResult BeginGetDnsRecordsByService(int serviceId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetDnsRecordsByService", new object[] {
serviceId}, callback, asyncState);
}
/// <remarks/>
public GlobalDnsRecord[] EndGetDnsRecordsByService(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((GlobalDnsRecord[])(results[0]));
}
/// <remarks/>
public void GetDnsRecordsByServiceAsync(int serviceId) {
this.GetDnsRecordsByServiceAsync(serviceId, null);
}
/// <remarks/>
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));
}
}
/// <remarks/> /// <remarks/>
[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)] [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 {
} }
} }
/// <remarks/>
[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]));
}
/// <remarks/>
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);
}
/// <remarks/>
public int EndGetPackageIPAddressesCount(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
/// <remarks/>
public void GetPackageIPAddressesCountAsync(int packageId, int orgId, IPAddressPool pool) {
this.GetPackageIPAddressesCountAsync(packageId, orgId, pool, null);
}
/// <remarks/>
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));
}
}
/// <remarks/> /// <remarks/>
[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)] [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) { public PackageIPAddress[] GetPackageUnassignedIPAddresses(int packageId, int orgId, IPAddressPool pool) {
@ -5677,53 +5770,38 @@ namespace WebsitePanel.EnterpriseServer {
} }
} }
/// <remarks/>
[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]));
}
/// <remarks/>
public System.IAsyncResult BeginGetDnsRecordsByService(int serviceId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetDnsRecordsByService", new object[] {
serviceId}, callback, asyncState);
}
/// <remarks/>
public GlobalDnsRecord[] EndGetDnsRecordsByService(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((GlobalDnsRecord[])(results[0]));
}
/// <remarks/>
public void GetDnsRecordsByServiceAsync(int serviceId) {
this.GetDnsRecordsByServiceAsync(serviceId, null);
}
/// <remarks/>
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));
}
}
/// <remarks/> /// <remarks/>
public new void CancelAsync(object userState) { public new void CancelAsync(object userState) {
base.CancelAsync(userState); base.CancelAsync(userState);
} }
} }
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetDnsRecordsByServiceCompletedEventHandler(object sender, GetDnsRecordsByServiceCompletedEventArgs e);
/// <remarks/>
[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;
}
/// <remarks/>
public GlobalDnsRecord[] Result {
get {
this.RaiseExceptionIfNecessary();
return ((GlobalDnsRecord[])(this.results[0]));
}
}
}
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetDnsRecordsByServerCompletedEventHandler(object sender, GetDnsRecordsByServerCompletedEventArgs e); public delegate void GetDnsRecordsByServerCompletedEventHandler(object sender, GetDnsRecordsByServerCompletedEventArgs e);
@ -8340,6 +8418,32 @@ namespace WebsitePanel.EnterpriseServer {
} }
} }
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetPackageIPAddressesCountCompletedEventHandler(object sender, GetPackageIPAddressesCountCompletedEventArgs e);
/// <remarks/>
[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;
}
/// <remarks/>
public int Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
}
}
}
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetPackageUnassignedIPAddressesCompletedEventHandler(object sender, GetPackageUnassignedIPAddressesCompletedEventArgs e); public delegate void GetPackageUnassignedIPAddressesCompletedEventHandler(object sender, GetPackageUnassignedIPAddressesCompletedEventArgs e);
@ -8625,30 +8729,4 @@ namespace WebsitePanel.EnterpriseServer {
} }
} }
} }
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetDnsRecordsByServiceCompletedEventHandler(object sender, GetDnsRecordsByServiceCompletedEventArgs e);
/// <remarks/>
[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;
}
/// <remarks/>
public GlobalDnsRecord[] Result {
get {
this.RaiseExceptionIfNecessary();
return ((GlobalDnsRecord[])(this.results[0]));
}
}
}
} }

View file

@ -3286,6 +3286,17 @@ namespace WebsitePanel.EnterpriseServer
return reader; 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) public static void DeallocatePackageIPAddress(int id)
{ {

View file

@ -269,7 +269,7 @@ namespace WebsitePanel.EnterpriseServer
string rootOU = GetProviderProperty(serviceid, "rootou"); string rootOU = GetProviderProperty(serviceid, "rootou");
PackageContext cntx = PackageController.GetPackageContext(org.PackageId); 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; if (maxDBSize != -1) maxDBSize = maxDBSize * 1024 * 1024;
org.CrmAdministratorId = user.AccountId; org.CrmAdministratorId = user.AccountId;
@ -676,7 +676,7 @@ namespace WebsitePanel.EnterpriseServer
if (!quotaRes.Value) 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; return ret;
} }
@ -971,7 +971,7 @@ namespace WebsitePanel.EnterpriseServer
try try
{ {
CrmUserResult user = GetCrmUser(itemId, accountId); CrmUserResult user = GetCrmUser(itemId, accountId);
if (user.Value.CALType == CALType) if (user.Value.CALType + ((int)user.Value.ClientAccessMode)*10 == CALType)
{ {
res.IsSuccess = true; res.IsSuccess = true;
CompleteTask(); CompleteTask();
@ -1012,8 +1012,7 @@ namespace WebsitePanel.EnterpriseServer
} }
if (!quotaRes.Value) if (!quotaRes.Value)
{ {
CompleteTask(res, CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED + CALType.ToString(), null, "CRM user quota " + CompleteTask(res, CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED + CALType.ToString(), null, "CRM user quota has been reached.");
(CALType==0 ? "(full license)" : "(limited license)") +" has been reached.");
return res; return res;
} }
@ -1106,7 +1105,20 @@ namespace WebsitePanel.EnterpriseServer
return res; 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; int allocatedCrmUsers = cntx.Quotas[quotaName].QuotaAllocatedValue;
res.Value = allocatedCrmUsers == -1 || allocatedCrmUsers > tmp.Value; res.Value = allocatedCrmUsers == -1 || allocatedCrmUsers > tmp.Value;
@ -1157,7 +1169,7 @@ namespace WebsitePanel.EnterpriseServer
PackageContext cntx = PackageController.GetPackageContext(packageId); PackageContext cntx = PackageController.GetPackageContext(packageId);
int limitSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; long limitSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue;
if (limitSize != -1) if (limitSize != -1)
{ {

View file

@ -934,6 +934,7 @@ namespace WebsitePanel.EnterpriseServer
{ {
stats.CreatedCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, 0).Value; 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.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.UsedCRMDiskSpace = CRMController.GetDBSize(org.Id, org.PackageId);
stats.AllocatedCRMDiskSpace = CRMController.GetMaxDBSize(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.CreatedCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, 0 ).Value;
stats.CreatedLimitedCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, 2).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.UsedCRMDiskSpace += CRMController.GetDBSize(o.Id, o.PackageId);
stats.AllocatedCRMDiskSpace += CRMController.GetMaxDBSize(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.AllocatedCRMUsers = cntx.Quotas[Quotas.CRM_USERS].QuotaAllocatedValue;
stats.AllocatedLimitedCRMUsers = cntx.Quotas[Quotas.CRM_LIMITEDUSERS].QuotaAllocatedValue; stats.AllocatedLimitedCRMUsers = cntx.Quotas[Quotas.CRM_LIMITEDUSERS].QuotaAllocatedValue;
stats.AllocatedESSCRMUsers = cntx.Quotas[Quotas.CRM_ESSUSERS].QuotaAllocatedValue;
} }
if (cntx.Groups.ContainsKey(ResourceGroups.BlackBerry)) if (cntx.Groups.ContainsKey(ResourceGroups.BlackBerry))

View file

@ -1186,6 +1186,11 @@ namespace WebsitePanel.EnterpriseServer
return result; return result;
} }
public static int GetPackageIPAddressesCount(int packageId, int orgId, IPAddressPool pool)
{
return DataProvider.GetPackageIPAddressesCount(packageId, orgId, (int)pool);
}
public static List<IPAddressInfo> GetUnallottedIPAddresses(int packageId, string groupName, IPAddressPool pool) public static List<IPAddressInfo> GetUnallottedIPAddresses(int packageId, string groupName, IPAddressPool pool)
{ {
// get service ID // get service ID
@ -1259,6 +1264,9 @@ namespace WebsitePanel.EnterpriseServer
int quotaAllocated = cntx.Quotas[quotaName].QuotaAllocatedValue; int quotaAllocated = cntx.Quotas[quotaName].QuotaAllocatedValue;
int quotaUsed = cntx.Quotas[quotaName].QuotaUsedValue; int quotaUsed = cntx.Quotas[quotaName].QuotaUsedValue;
if (pool == IPAddressPool.PhoneNumbers)
quotaUsed = ServerController.GetPackageIPAddressesCount(packageId, orgId, pool);
// check the maximum allowed number // check the maximum allowed number
if (quotaAllocated != -1) // check only if not unlimited if (quotaAllocated != -1) // check only if not unlimited
{ {

View file

@ -393,6 +393,12 @@ namespace WebsitePanel.EnterpriseServer
filterColumn, filterValue, sortColumn, startRow, maximumRows, recursive); filterColumn, filterValue, sortColumn, startRow, maximumRows, recursive);
} }
[WebMethod]
public int GetPackageIPAddressesCount(int packageId, int orgId, IPAddressPool pool)
{
return ServerController.GetPackageIPAddressesCount(packageId, orgId, pool);
}
[WebMethod] [WebMethod]
public List<PackageIPAddress> GetPackageUnassignedIPAddresses(int packageId, int orgId, IPAddressPool pool) public List<PackageIPAddress> GetPackageUnassignedIPAddresses(int packageId, int orgId, IPAddressPool pool)
{ {

View file

@ -42,6 +42,7 @@ namespace WebsitePanel.Providers.HostedSolution
public string СRMOrganizationName { get; set; } public string СRMOrganizationName { get; set; }
public int CRMUsersFullLicenceCount { get; set; } public int CRMUsersFullLicenceCount { get; set; }
public int CRMUsersReadOnlyLicenceCount { get; set; } public int CRMUsersReadOnlyLicenceCount { get; set; }
public int CRMUsersESSLicenceCount { get; set; }
public int UsedSpace { get; set; } public int UsedSpace { get; set; }
public string UsageMonth { get; set; } public string UsageMonth { get; set; }

View file

@ -64,6 +64,9 @@ namespace WebsitePanel.Providers.HostedSolution
private int createdLimitedCRMUsers; private int createdLimitedCRMUsers;
private int allocatedLimitedCRMUsers; private int allocatedLimitedCRMUsers;
private int createdESSCRMUsers;
private int allocatedESSCRMUsers;
private long usedCRMDiskSpace; private long usedCRMDiskSpace;
private long allocatedCRMDiskSpace; private long allocatedCRMDiskSpace;
@ -98,6 +101,18 @@ namespace WebsitePanel.Providers.HostedSolution
set { allocatedLimitedCRMUsers = value; } set { allocatedLimitedCRMUsers = value; }
} }
public int CreatedESSCRMUsers
{
get { return createdESSCRMUsers; }
set { createdESSCRMUsers = value; }
}
public int AllocatedESSCRMUsers
{
get { return allocatedESSCRMUsers; }
set { allocatedESSCRMUsers = value; }
}
public int AllocatedUsers public int AllocatedUsers
{ {
get { return allocatedUsers; } get { return allocatedUsers; }

View file

@ -951,6 +951,10 @@ namespace WebsitePanel.Providers.HostedSolution
// Retrieve the specified security role. // Retrieve the specified security role.
Role role = RetrieveRoleByName(serviceProxy, roleStr); Role role = RetrieveRoleByName(serviceProxy, roleStr);
// CALType and AccessMode
int accessmode = CALType / 10;
int caltype = CALType % 10;
//Create a new system user. //Create a new system user.
SystemUser user = new SystemUser SystemUser user = new SystemUser
{ {
@ -963,7 +967,8 @@ namespace WebsitePanel.Providers.HostedSolution
Name = BusinessUnit.EntityLogicalName, Name = BusinessUnit.EntityLogicalName,
Id = defaultBusinessUnit.Id Id = defaultBusinessUnit.Id
}, },
CALType = new OptionSetValue(CALType) CALType = new OptionSetValue(caltype),
AccessMode = new OptionSetValue(accessmode)
}; };
userId = serviceProxy.Create(user); userId = serviceProxy.Create(user);
@ -1930,7 +1935,12 @@ namespace WebsitePanel.Providers.HostedSolution
SystemUser user = SystemUser user =
serviceProxy.Retrieve(SystemUser.EntityLogicalName, userId, new Microsoft.Xrm.Sdk.Query.ColumnSet("domainname", "businessunitid", "accessmode", "isdisabled", "caltype")).ToEntity<SystemUser>(); serviceProxy.Retrieve(SystemUser.EntityLogicalName, userId, new Microsoft.Xrm.Sdk.Query.ColumnSet("domainname", "businessunitid", "accessmode", "isdisabled", "caltype")).ToEntity<SystemUser>();
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); serviceProxy.Update(user);

View file

@ -5374,4 +5374,10 @@
<data name="HostedCRM.USER_QUOTA_HAS_BEEN_REACHED2" xml:space="preserve"> <data name="HostedCRM.USER_QUOTA_HAS_BEEN_REACHED2" xml:space="preserve">
<value>CRM users quota (limited license) has been reached.</value> <value>CRM users quota (limited license) has been reached.</value>
</data> </data>
<data name="HostedCRM.USER_QUOTA_HAS_BEEN_REACHED22" xml:space="preserve">
<value>CRM users quota (ESS license) has been reached.</value>
</data>
<data name="Quota.HostedCRM.ESSUsers" xml:space="preserve">
<value>ESS licenses per organization</value>
</data>
</root> </root>

View file

@ -42,12 +42,21 @@ namespace WebsitePanel.Portal
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
warningValue.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); warningValue.UnlimitedText = GetLocalizedString("WarningUnlimitedValue");
if (!IsPostBack) if (!IsPostBack)
{
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(); BindValues();
} }
} }
}
private void BindValues() private void BindValues()
{ {
@ -77,9 +86,9 @@ namespace WebsitePanel.Portal
try try
{ {
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); 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) if (limitSize != -1)
{ {

View file

@ -56,6 +56,7 @@
<asp:DropDownList ID="ddlLicenseType" runat="server" CssClass="NormalTextBox" AutoPostBack="false"> <asp:DropDownList ID="ddlLicenseType" runat="server" CssClass="NormalTextBox" AutoPostBack="false">
<asp:ListItem Value="0" meta:resourcekey="ddlLicenseTypeFull">Full</asp:ListItem> <asp:ListItem Value="0" meta:resourcekey="ddlLicenseTypeFull">Full</asp:ListItem>
<asp:ListItem Value="2" meta:resourcekey="ddlLicenseTypeLimited">Limited</asp:ListItem> <asp:ListItem Value="2" meta:resourcekey="ddlLicenseTypeLimited">Limited</asp:ListItem>
<asp:ListItem Value="22" meta:resourcekey="ddlLicenseTypeESS">ESS</asp:ListItem>
</asp:DropDownList> </asp:DropDownList>
</td> </td>
</tr> </tr>

View file

@ -59,12 +59,13 @@ namespace WebsitePanel.Portal.CRM
lblEmailAddress.Text = user.PrimaryEmailAddress; lblEmailAddress.Text = user.PrimaryEmailAddress;
lblDomainName.Text = user.DomainUserName; lblDomainName.Text = user.DomainUserName;
int cALType = userResult.Value.CALType; int cALType = userResult.Value.CALType + ((int)userResult.Value.ClientAccessMode) * 10;
switch (cALType) switch (cALType)
{ {
case 0 : case 0 :
case 2 : case 2 :
case 22:
ddlLicenseType.SelectedValue = cALType.ToString(); ddlLicenseType.SelectedValue = cALType.ToString();
break; break;
default: default:

View file

@ -97,6 +97,14 @@
<wsp:QuotaViewer ID="limitedusersQuota" runat="server" QuotaTypeId="2" /> <wsp:QuotaViewer ID="limitedusersQuota" runat="server" QuotaTypeId="2" />
</td> </td>
</tr> </tr>
<tr>
<td align="right" nowrap>
<asp:Localize ID="locESSQuota" runat="server" meta:resourcekey="locESSQuota" Text="ESS licenses :"></asp:Localize>
</td>
<td>
<wsp:QuotaViewer ID="essusersQuota" runat="server" QuotaTypeId="2" />
</td>
</tr>
</table> </table>
</div> </div>

View file

@ -57,6 +57,10 @@ namespace WebsitePanel.Portal.CRM
//if (stats.AllocatedCRMUsers != -1) usersQuota.QuotaAvailable = tenantStats.AllocatedCRMUsers - tenantStats.CreatedCRMUsers; //if (stats.AllocatedCRMUsers != -1) usersQuota.QuotaAvailable = tenantStats.AllocatedCRMUsers - tenantStats.CreatedCRMUsers;
//if (stats.AllocatedLimitedCRMUsers != -1) limitedusersQuota.QuotaAvailable = tenantStats.AllocatedLimitedCRMUsers - tenantStats.CreatedLimitedCRMUsers; //if (stats.AllocatedLimitedCRMUsers != -1) limitedusersQuota.QuotaAvailable = tenantStats.AllocatedLimitedCRMUsers - tenantStats.CreatedLimitedCRMUsers;
essusersQuota.QuotaUsedValue = stats.CreatedESSCRMUsers;
essusersQuota.QuotaValue = stats.AllocatedESSCRMUsers;
} }
} }

View file

@ -201,5 +201,23 @@ namespace WebsitePanel.Portal.CRM {
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer limitedusersQuota; protected global::WebsitePanel.Portal.QuotaViewer limitedusersQuota;
/// <summary>
/// locESSQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locESSQuota;
/// <summary>
/// essusersQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer essusersQuota;
} }
} }

View file

@ -45,6 +45,7 @@
<asp:DropDownList ID="ddlLicenseType" runat="server" CssClass="NormalTextBox" AutoPostBack="false"> <asp:DropDownList ID="ddlLicenseType" runat="server" CssClass="NormalTextBox" AutoPostBack="false">
<asp:ListItem Value="0" meta:resourcekey="ddlLicenseTypeFull">Full</asp:ListItem> <asp:ListItem Value="0" meta:resourcekey="ddlLicenseTypeFull">Full</asp:ListItem>
<asp:ListItem Value="2" meta:resourcekey="ddlLicenseTypeLimited">Limited</asp:ListItem> <asp:ListItem Value="2" meta:resourcekey="ddlLicenseTypeLimited">Limited</asp:ListItem>
<asp:ListItem Value="22" meta:resourcekey="ddlLicenseTypeESS">ESS</asp:ListItem>
</asp:DropDownList> </asp:DropDownList>
</td> </td>
</tr> </tr>

View file

@ -224,7 +224,15 @@
</tr> </tr>
<tr class="OrgStatsRow"> <tr class="OrgStatsRow">
<td align="right" nowrap> <td align="right" nowrap>
<asp:HyperLink ID="lnkCRMDBSize" runat="server" meta:resourcekey="lnkCRMDBSize" Text="Storage size (ÌÂ):"></asp:HyperLink> <asp:HyperLink ID="lnkESSCRMUsers" runat="server" meta:resourcekey="lnkESSCRMUsers" Text="ESS licenses :"></asp:HyperLink>
</td>
<td>
<wsp:QuotaViewer ID="crmESSUsersStats" QuotaTypeId="2" runat="server" DisplayGauge="true" />
</td>
</tr>
<tr class="OrgStatsRow">
<td align="right" nowrap>
<asp:HyperLink ID="lnkCRMDBSize" runat="server" meta:resourcekey="lnkCRMDBSize" Text="Storage size (MB):"></asp:HyperLink>
</td> </td>
<td> <td>
<wsp:QuotaViewer ID="crmDBSize" runat="server" QuotaTypeId="2" DisplayGauge="true" /> <wsp:QuotaViewer ID="crmDBSize" runat="server" QuotaTypeId="2" DisplayGauge="true" />

View file

@ -247,6 +247,7 @@ namespace WebsitePanel.Portal.ExchangeServer
"SpaceID=" + PanelSecurity.PackageId); "SpaceID=" + PanelSecurity.PackageId);
lnkLimitedCRMUsers.NavigateUrl = lnkCRMUsers.NavigateUrl; lnkLimitedCRMUsers.NavigateUrl = lnkCRMUsers.NavigateUrl;
lnkESSCRMUsers.NavigateUrl = lnkCRMUsers.NavigateUrl;
lnkCRMDBSize.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "crm_storage_settings", lnkCRMDBSize.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "crm_storage_settings",
"SpaceID=" + PanelSecurity.PackageId); "SpaceID=" + PanelSecurity.PackageId);
@ -259,6 +260,9 @@ namespace WebsitePanel.Portal.ExchangeServer
crmLimitedUsersStats.QuotaUsedValue = stats.CreatedLimitedCRMUsers; crmLimitedUsersStats.QuotaUsedValue = stats.CreatedLimitedCRMUsers;
crmLimitedUsersStats.QuotaValue = stats.AllocatedLimitedCRMUsers; crmLimitedUsersStats.QuotaValue = stats.AllocatedLimitedCRMUsers;
crmESSUsersStats.QuotaUsedValue = stats.CreatedESSCRMUsers;
crmESSUsersStats.QuotaValue = stats.AllocatedESSCRMUsers;
crmDBSize.QuotaUsedValue = Convert.ToInt32(stats.UsedCRMDiskSpace > 0 ? stats.UsedCRMDiskSpace / (1024 * 1024) : -1); crmDBSize.QuotaUsedValue = Convert.ToInt32(stats.UsedCRMDiskSpace > 0 ? stats.UsedCRMDiskSpace / (1024 * 1024) : -1);
crmDBSize.QuotaValue = Convert.ToInt32(stats.AllocatedCRMDiskSpace>0 ? stats.AllocatedCRMDiskSpace/(1024*1024) : -1); crmDBSize.QuotaValue = Convert.ToInt32(stats.AllocatedCRMDiskSpace>0 ? stats.AllocatedCRMDiskSpace/(1024*1024) : -1);
} }

View file

@ -553,6 +553,24 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks> /// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer crmLimitedUsersStats; protected global::WebsitePanel.Portal.QuotaViewer crmLimitedUsersStats;
/// <summary>
/// lnkESSCRMUsers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink lnkESSCRMUsers;
/// <summary>
/// crmESSUsersStats control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer crmESSUsersStats;
/// <summary> /// <summary>
/// lnkCRMDBSize control. /// lnkCRMDBSize control.
/// </summary> /// </summary>

View file

@ -31,6 +31,8 @@ using System.Collections.Generic;
using System.Web; using System.Web;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.Common;
namespace WebsitePanel.Portal.Lync namespace WebsitePanel.Portal.Lync
{ {
@ -38,6 +40,15 @@ namespace WebsitePanel.Portal.Lync
{ {
protected void Page_Load(object sender, EventArgs e) 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);
}
} }
} }
} }

View file

@ -95,7 +95,9 @@ namespace WebsitePanel.Portal.UserControls
if (cntx.Quotas.ContainsKey(quotaName)) if (cntx.Quotas.ContainsKey(quotaName))
{ {
int quotaAllocated = cntx.Quotas[quotaName].QuotaAllocatedValue; 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) if (quotaAllocated != -1)
quotaAllowed = quotaAllocated - quotaUsed; quotaAllowed = quotaAllocated - quotaUsed;

View file

@ -55,6 +55,11 @@ namespace WebsitePanel.Portal
set { quotaViewer.DisplayGauge = value; } set { quotaViewer.DisplayGauge = value; }
} }
public QuotaViewer Viewer
{
get { return quotaViewer; }
}
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
if (!IsPostBack) if (!IsPostBack)