CRM Module fixes

This commit is contained in:
dev_amdtel 2013-12-03 15:13:43 +04:00
parent 18cd090671
commit 6738c1611a
10 changed files with 46 additions and 11 deletions

View file

@ -270,6 +270,7 @@ namespace WebsitePanel.EnterpriseServer
PackageContext cntx = PackageController.GetPackageContext(org.PackageId); PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
int maxDBSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; int maxDBSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue;
if (maxDBSize != -1) maxDBSize = maxDBSize * 1024 * 1024;
org.CrmAdministratorId = user.AccountId; org.CrmAdministratorId = user.AccountId;
org.CrmCurrency = org.CrmCurrency =
@ -1011,7 +1012,8 @@ namespace WebsitePanel.EnterpriseServer
} }
if (!quotaRes.Value) if (!quotaRes.Value)
{ {
CompleteTask(res, CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED, null, "CRM user quota has been reached."); CompleteTask(res, CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED + CALType.ToString(), null, "CRM user quota " +
(CALType==0 ? "(full license)" : "(limited license)") +" has been reached.");
return res; return res;
} }
@ -1159,6 +1161,7 @@ namespace WebsitePanel.EnterpriseServer
if (limitSize != -1) if (limitSize != -1)
{ {
limitSize = limitSize * 1024 * 1024;
if (maxSize == -1) maxSize = limitSize; if (maxSize == -1) maxSize = limitSize;
if (maxSize > limitSize) maxSize = limitSize; if (maxSize > limitSize) maxSize = limitSize;
} }

View file

@ -1520,6 +1520,8 @@ namespace WebsitePanel.Providers.HostedSolution
return res; return res;
} }
static string excludedRolesStr = ";пользователь поддержки;support user;";
private static List<CrmRole> FillCrmRoles(EntityCollection entities, bool isUserRole, Guid businessUnitId) private static List<CrmRole> FillCrmRoles(EntityCollection entities, bool isUserRole, Guid businessUnitId)
{ {
List<CrmRole> res = new List<CrmRole>(); List<CrmRole> res = new List<CrmRole>();
@ -1536,10 +1538,16 @@ namespace WebsitePanel.Providers.HostedSolution
continue; continue;
} }
string roleName = role.Name;
if (roleName!=null)
if (excludedRolesStr.IndexOf(";" + roleName.ToLower() + ";") != -1)
continue;
CrmRole crmRole = new CrmRole(); CrmRole crmRole = new CrmRole();
crmRole.IsCurrentUserRole = isUserRole; crmRole.IsCurrentUserRole = isUserRole;
crmRole.RoleId = (Guid)role.RoleId; crmRole.RoleId = (Guid)role.RoleId;
crmRole.RoleName = role.Name; crmRole.RoleName = roleName;
res.Add(crmRole); res.Add(crmRole);
} }

View file

@ -3643,8 +3643,8 @@
<data name="HostedCRM.CANONT_GET_CRM_USER_GENERAL_ERROR" xml:space="preserve"> <data name="HostedCRM.CANONT_GET_CRM_USER_GENERAL_ERROR" xml:space="preserve">
<value>General error has been occurred while getting crm user.</value> <value>General error has been occurred while getting crm user.</value>
</data> </data>
<data name="HostedCRM.USER_QUOTA_HAS_BEEN_REACHED" xml:space="preserve"> <data name="HostedCRM.USER_QUOTA_HAS_BEEN_REACHED0" xml:space="preserve">
<value>CRM users quota has been reached.</value> <value>CRM users quota (full license) has been reached.</value>
</data> </data>
<data name="HostedCRM.CANNOT_ADD_ORGANIZATION_OWNER_TO_ORGANIZATIO_USER" xml:space="preserve"> <data name="HostedCRM.CANNOT_ADD_ORGANIZATION_OWNER_TO_ORGANIZATIO_USER" xml:space="preserve">
<value>Unable to add organization owner to organization users.</value> <value>Unable to add organization owner to organization users.</value>
@ -5371,4 +5371,7 @@
<data name="Quota.HostedCRM.MaxDatabaseSize" xml:space="preserve"> <data name="Quota.HostedCRM.MaxDatabaseSize" xml:space="preserve">
<value>Max Database Size, MB</value> <value>Max Database Size, MB</value>
</data> </data>
<data name="HostedCRM.USER_QUOTA_HAS_BEEN_REACHED2" xml:space="preserve">
<value>CRM users quota (limited license) has been reached.</value>
</data>
</root> </root>

View file

@ -41,11 +41,16 @@
<td class="FormLabel200" align="right"><asp:Localize runat="server" meta:resourcekey="locUsageStorage" >Current usage (MB):</asp:Localize></td> <td class="FormLabel200" align="right"><asp:Localize runat="server" meta:resourcekey="locUsageStorage" >Current usage (MB):</asp:Localize></td>
<td> <td>
<asp:Label ID="lblDBSize" runat="server" Text="0" /> of <asp:Label ID="lblMAXDBSize" runat="server" Text="0" /> <asp:Label ID="lblDBSize" runat="server" Text="0" /> of <asp:Label ID="lblMAXDBSize" runat="server" Text="0" />
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize runat="server" meta:resourcekey="locLimitStorage" >Maximum allowed (MB):</asp:Localize></td>
<td>
<asp:Label ID="lblLimitDBSize" runat="server" Text="0" />
</tr> </tr>
<tr> <tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locMaxStorage" runat="server" meta:resourcekey="locMaxStorage" >Reassign storage space (MB):</asp:Localize></td> <td class="FormLabel200" align="right"><asp:Localize ID="locMaxStorage" runat="server" meta:resourcekey="locMaxStorage" >Reassign storage space (MB):</asp:Localize></td>
<td> <td>
<uc1:QuotaEditor QuotaTypeId="2" ID="maxStorageSettingsValue" runat="server" /> <uc1:QuotaEditor QuotaTypeId="2" ID="maxStorageSettingsValue" runat="server"/>
</td> </td>
</tr> </tr>
<!-- <!--

View file

@ -54,7 +54,9 @@ namespace WebsitePanel.Portal
Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID);
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
maxStorageSettingsValue.ParentQuotaValue = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; int limitDBSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue;
//maxStorageSettingsValue.ParentQuotaValue = limitDBSize;
maxStorageSettingsValue.ParentQuotaValue = -1;
long maxDBSize = ES.Services.CRM.GetMaxDBSize(PanelRequest.ItemID, PanelSecurity.PackageId); long maxDBSize = ES.Services.CRM.GetMaxDBSize(PanelRequest.ItemID, PanelSecurity.PackageId);
long DBSize = ES.Services.CRM.GetDBSize(PanelRequest.ItemID, PanelSecurity.PackageId); long DBSize = ES.Services.CRM.GetDBSize(PanelRequest.ItemID, PanelSecurity.PackageId);
@ -66,6 +68,8 @@ namespace WebsitePanel.Portal
lblDBSize.Text = SizeValueToString(DBSize); lblDBSize.Text = SizeValueToString(DBSize);
lblMAXDBSize.Text = SizeValueToString(maxDBSize); lblMAXDBSize.Text = SizeValueToString(maxDBSize);
lblLimitDBSize.Text = SizeValueToString(limitDBSize);
} }
private void Save() private void Save()

View file

@ -121,6 +121,15 @@ namespace WebsitePanel.Portal {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Label lblMAXDBSize; protected global::System.Web.UI.WebControls.Label lblMAXDBSize;
/// <summary>
/// lblLimitDBSize 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.Label lblLimitDBSize;
/// <summary> /// <summary>
/// locMaxStorage control. /// locMaxStorage control.
/// </summary> /// </summary>

View file

@ -125,9 +125,9 @@ namespace WebsitePanel.Portal.CRM
CALType); CALType);
if (!res2.IsSuccess) if (!res2.IsSuccess)
messageBox.ShowErrorMessage("UPDATE_CRM_USER_ROLES"); messageBox.ShowMessage(res2, "UPDATE_CRM_USER_ROLES", "HostedCRM");
else if (!res.IsSuccess) else if (!res.IsSuccess)
messageBox.ShowErrorMessage("UPDATE_CRM_USER_ROLES"); messageBox.ShowMessage(res, "UPDATE_CRM_USER_ROLES", "HostedCRM");
else else
messageBox.ShowMessage(res, "UPDATE_CRM_USER_ROLES", "HostedCRM"); messageBox.ShowMessage(res, "UPDATE_CRM_USER_ROLES", "HostedCRM");
} }

View file

@ -224,7 +224,7 @@
</tr> </tr>
<tr class="OrgStatsRow"> <tr class="OrgStatsRow">
<td align="right" nowrap> <td align="right" nowrap>
<asp:Localize ID="locCRMDBSize" runat="server" meta:resourcekey="locCRMDBSize" Text="Storage size (ÌÂ):"></asp:Localize> <asp:HyperLink ID="lnkCRMDBSize" runat="server" meta:resourcekey="lnkCRMDBSize" Text="Storage size (ÌÂ):"></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

@ -248,6 +248,9 @@ namespace WebsitePanel.Portal.ExchangeServer
lnkLimitedCRMUsers.NavigateUrl = lnkCRMUsers.NavigateUrl; lnkLimitedCRMUsers.NavigateUrl = lnkCRMUsers.NavigateUrl;
lnkCRMDBSize.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "crm_storage_settings",
"SpaceID=" + PanelSecurity.PackageId);
crmUsersStats.QuotaUsedValue = stats.CreatedCRMUsers; crmUsersStats.QuotaUsedValue = stats.CreatedCRMUsers;
crmUsersStats.QuotaValue = stats.AllocatedCRMUsers; crmUsersStats.QuotaValue = stats.AllocatedCRMUsers;

View file

@ -554,13 +554,13 @@ namespace WebsitePanel.Portal.ExchangeServer {
protected global::WebsitePanel.Portal.QuotaViewer crmLimitedUsersStats; protected global::WebsitePanel.Portal.QuotaViewer crmLimitedUsersStats;
/// <summary> /// <summary>
/// locCRMDBSize control. /// lnkCRMDBSize control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// 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::System.Web.UI.WebControls.Localize locCRMDBSize; protected global::System.Web.UI.WebControls.HyperLink lnkCRMDBSize;
/// <summary> /// <summary>
/// crmDBSize control. /// crmDBSize control.