CRM Module update

This commit is contained in:
dev_amdtel 2013-12-10 22:34:39 +04:00
parent 4f6d1f2c50
commit f500906c68
18 changed files with 150 additions and 17 deletions

View file

@ -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)
{

View file

@ -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))