From 18cd090671a2d61bbac369e7946693e646a5e7f7 Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Sun, 1 Dec 2013 01:06:32 +0400 Subject: [PATCH] CRM Module update --- WebsitePanel/Database/update_db.sql | 123 +++++- .../Packages/Quotas.cs | 3 + .../CRMProxy.cs | 390 +++++++++++++++--- .../Data/DataProvider.cs | 18 +- .../HostedSolution/CRMController.cs | 266 +++++++++++- .../HostedSolution/OrganizationController.cs | 12 +- .../esCRM.asmx.cs | 32 +- .../HostedSolution/CrmUser.cs | 2 +- .../HostedSolution/ICRM.cs | 15 +- .../HostedSolution/OrganizationStatistics.cs | 30 ++ .../CRMProvider2011.cs | 177 +++++++- ...el.Providers.HostedSolution.Crm2011.csproj | 16 +- .../CRMProvider.cs | 27 +- .../WebsitePanel.Server.Client/CRMProxy.cs | 312 ++++++++++++-- .../Sources/WebsitePanel.Server/CRM.asmx.cs | 29 +- .../App_Data/WebsitePanel_Modules.config | 3 +- .../WebsitePanel_SharedResources.ascx.resx | 8 +- .../CRMStorageSettings.ascx.resx | 151 +++++++ .../CRM/App_LocalResources/CRMUsers.ascx.resx | 2 +- .../WebsitePanel/CRM/CRMStorageSettings.ascx | 74 ++++ .../CRM/CRMStorageSettings.ascx.cs | 110 +++++ .../CRM/CRMStorageSettings.ascx.designer.cs | 169 ++++++++ .../WebsitePanel/CRM/CRMUserRoles.ascx | 11 + .../WebsitePanel/CRM/CRMUserRoles.ascx.cs | 28 +- .../CRM/CRMUserRoles.ascx.designer.cs | 51 ++- .../WebsitePanel/CRM/CRMUsers.ascx | 24 +- .../WebsitePanel/CRM/CRMUsers.ascx.cs | 7 +- .../CRM/CRMUsers.ascx.designer.cs | 43 +- .../WebsitePanel/CRM/CreateCRMUser.ascx | 10 + .../WebsitePanel/CRM/CreateCRMUser.ascx.cs | 7 +- .../CRM/CreateCRMUser.ascx.designer.cs | 51 ++- .../WebsitePanel/Code/Helpers/CRMHelper.cs | 2 +- .../OrganizationHome.ascx.resx | 2 +- .../ExchangeServer/OrganizationHome.ascx | 18 +- .../ExchangeServer/OrganizationHome.ascx.cs | 11 +- .../OrganizationHome.ascx.designer.cs | 36 ++ .../ExchangeServer/UserControls/Menu.ascx.cs | 1 + 37 files changed, 2067 insertions(+), 204 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/App_LocalResources/CRMStorageSettings.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx.designer.cs diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 60c539a0..1d07ff93 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -2604,6 +2604,127 @@ BEGIN END GO --- CRM +-- CRM Provider fix UPDATE Providers SET EditorControl = 'CRM2011' Where ProviderID = 1201; + +-- CRM Quota + +IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'HostedCRM.MaxDatabaseSize') +BEGIN +INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (460, 21, 4, N'HostedCRM.MaxDatabaseSize', N'Max Database Size, MB',3, 0 , NULL) +END +GO + +BEGIN +UPDATE [dbo].[Quotas] SET QuotaDescription = 'Full licenses per organization' WHERE [QuotaName] = 'HostedCRM.Users' +END +GO + +IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'HostedCRM.LimitedUsers') +BEGIN +INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (461, 21, 3, N'HostedCRM.LimitedUsers', N'Limited licenses per organization',3, 0 , NULL) +END +GO + +-- CRM Users + +IF NOT EXISTS(select 1 from sys.columns COLS INNER JOIN sys.objects OBJS ON OBJS.object_id=COLS.object_id and OBJS.type='U' AND OBJS.name='CRMUsers' AND COLS.name='CALType') +BEGIN +ALTER TABLE [dbo].[CRMUsers] ADD + [CALType] [int] NULL; + +UPDATE [dbo].[CRMUsers] + SET + CALType = 0; +END +GO + +ALTER PROCEDURE [dbo].[InsertCRMUser] +( + @ItemID int, + @CrmUserID uniqueidentifier, + @BusinessUnitID uniqueidentifier, + @CALType int +) +AS +BEGIN + SET NOCOUNT ON; + +INSERT INTO + CRMUsers +( + AccountID, + CRMUserGuid, + BusinessUnitID, + CALType +) +VALUES +( + @ItemID, + @CrmUserID, + @BusinessUnitID, + @CALType +) + +END +GO + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateCRMUser') +DROP PROCEDURE UpdateCRMUser +GO + +CREATE PROCEDURE [dbo].[UpdateCRMUser] +( + @ItemID int, + @CALType int +) +AS +BEGIN + SET NOCOUNT ON; + + +UPDATE [dbo].[CRMUsers] + SET + CALType = @CALType + WHERE AccountID = @ItemID + + +END +GO + +ALTER PROCEDURE [dbo].[GetCRMUsersCount] +( + @ItemID int, + @Name nvarchar(400), + @Email nvarchar(400), + @CALType int +) +AS +BEGIN + +IF (@Name IS NULL) +BEGIN + SET @Name = '%' +END + +IF (@Email IS NULL) +BEGIN + SET @Email = '%' +END + +SELECT + COUNT(ea.AccountID) +FROM + ExchangeAccounts ea +INNER JOIN + CRMUsers cu +ON + ea.AccountID = cu.AccountID +WHERE + ea.ItemID = @ItemID AND ea.DisplayName LIKE @Name AND ea.PrimaryEmailAddress LIKE @Email + AND ((cu.CALType = @CALType) OR (@CALType = -1)) +END +GO + + diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs index 8e3abc8f..a2f4045e 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs @@ -156,8 +156,11 @@ order by rg.groupOrder public const string ORGANIZATION_DOMAINS = "HostedSolution.Domains"; public const string ORGANIZATION_ALLOWCHANGEUPN = "HostedSolution.AllowChangeUPN"; public const string ORGANIZATION_SECURITYGROUPMANAGEMENT = "HostedSolution.SecurityGroupManagement"; + 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_MAXDATABASESIZE = "HostedCRM.MaxDatabaseSize"; public const string VPS_SERVERS_NUMBER = "VPS.ServersNumber"; // Number of VPS public const string VPS_MANAGING_ALLOWED = "VPS.ManagingAllowed"; // Allow user to create VPS diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/CRMProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/CRMProxy.cs index bdd6379e..e77c153c 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/CRMProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/CRMProxy.cs @@ -29,7 +29,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.1433 +// Runtime Version:2.0.50727.5466 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -38,19 +38,21 @@ // // This source code was auto-generated by wsdl, Version=2.0.50727.42. -// +// using WebsitePanel.Providers; using WebsitePanel.Providers.Common; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.ResultObjects; - +// +// This source code was auto-generated by wsdl, Version=2.0.50727.42. +// namespace WebsitePanel.EnterpriseServer { - using System.Diagnostics; + using System.Xml.Serialization; using System.Web.Services; using System.ComponentModel; using System.Web.Services.Protocols; using System; - using System.Xml.Serialization; + using System.Diagnostics; /// @@ -81,13 +83,21 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback SetUserRolesOperationCompleted; + private System.Threading.SendOrPostCallback SetUserCALTypeOperationCompleted; + private System.Threading.SendOrPostCallback ChangeUserStateOperationCompleted; private System.Threading.SendOrPostCallback GetCrmUserOperationCompleted; + private System.Threading.SendOrPostCallback SetMaxDBSizeOperationCompleted; + + private System.Threading.SendOrPostCallback GetDBSizeOperationCompleted; + + private System.Threading.SendOrPostCallback GetMaxDBSizeOperationCompleted; + /// public esCRM() { - this.Url = "http://localhost/WebsitePanelEnterpriseServer/esCRM.asmx"; + this.Url = "http://localhost:9002/esCRM.asmx"; } /// @@ -120,12 +130,24 @@ namespace WebsitePanel.EnterpriseServer { /// public event SetUserRolesCompletedEventHandler SetUserRolesCompleted; + /// + public event SetUserCALTypeCompletedEventHandler SetUserCALTypeCompleted; + /// public event ChangeUserStateCompletedEventHandler ChangeUserStateCompleted; /// public event GetCrmUserCompletedEventHandler GetCrmUserCompleted; + /// + public event SetMaxDBSizeCompletedEventHandler SetMaxDBSizeCompleted; + + /// + public event GetDBSizeCompletedEventHandler GetDBSizeCompleted; + + /// + public event GetMaxDBSizeCompletedEventHandler GetMaxDBSizeCompleted; + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/CreateOrganization", 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 OrganizationResult CreateOrganization(int organizationId, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string regionName, int userId, string collation) { @@ -369,20 +391,22 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetCRMUserCount", 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 IntResult GetCRMUserCount(int itemId, string name, string email) { + public IntResult GetCRMUserCount(int itemId, string name, string email, int CALType) { object[] results = this.Invoke("GetCRMUserCount", new object[] { itemId, name, - email}); + email, + CALType}); return ((IntResult)(results[0])); } /// - public System.IAsyncResult BeginGetCRMUserCount(int itemId, string name, string email, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginGetCRMUserCount(int itemId, string name, string email, int CALType, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetCRMUserCount", new object[] { itemId, name, - email}, callback, asyncState); + email, + CALType}, callback, asyncState); } /// @@ -392,19 +416,20 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void GetCRMUserCountAsync(int itemId, string name, string email) { - this.GetCRMUserCountAsync(itemId, name, email, null); + public void GetCRMUserCountAsync(int itemId, string name, string email, int CALType) { + this.GetCRMUserCountAsync(itemId, name, email, CALType, null); } /// - public void GetCRMUserCountAsync(int itemId, string name, string email, object userState) { + public void GetCRMUserCountAsync(int itemId, string name, string email, int CALType, object userState) { if ((this.GetCRMUserCountOperationCompleted == null)) { this.GetCRMUserCountOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCRMUserCountOperationCompleted); } this.InvokeAsync("GetCRMUserCount", new object[] { itemId, name, - email}, this.GetCRMUserCountOperationCompleted, userState); + email, + CALType}, this.GetCRMUserCountOperationCompleted, userState); } private void OnGetCRMUserCountOperationCompleted(object arg) { @@ -416,22 +441,24 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/CreateCRMUser", 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 UserResult CreateCRMUser(OrganizationUser user, int packageId, int itemId, System.Guid businessUnitOrgId) { + public UserResult CreateCRMUser(OrganizationUser user, int packageId, int itemId, System.Guid businessUnitOrgId, int CALType) { object[] results = this.Invoke("CreateCRMUser", new object[] { user, packageId, itemId, - businessUnitOrgId}); + businessUnitOrgId, + CALType}); return ((UserResult)(results[0])); } /// - public System.IAsyncResult BeginCreateCRMUser(OrganizationUser user, int packageId, int itemId, System.Guid businessUnitOrgId, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginCreateCRMUser(OrganizationUser user, int packageId, int itemId, System.Guid businessUnitOrgId, int CALType, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("CreateCRMUser", new object[] { user, packageId, itemId, - businessUnitOrgId}, callback, asyncState); + businessUnitOrgId, + CALType}, callback, asyncState); } /// @@ -441,12 +468,12 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void CreateCRMUserAsync(OrganizationUser user, int packageId, int itemId, System.Guid businessUnitOrgId) { - this.CreateCRMUserAsync(user, packageId, itemId, businessUnitOrgId, null); + public void CreateCRMUserAsync(OrganizationUser user, int packageId, int itemId, System.Guid businessUnitOrgId, int CALType) { + this.CreateCRMUserAsync(user, packageId, itemId, businessUnitOrgId, CALType, null); } /// - public void CreateCRMUserAsync(OrganizationUser user, int packageId, int itemId, System.Guid businessUnitOrgId, object userState) { + public void CreateCRMUserAsync(OrganizationUser user, int packageId, int itemId, System.Guid businessUnitOrgId, int CALType, object userState) { if ((this.CreateCRMUserOperationCompleted == null)) { this.CreateCRMUserOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateCRMUserOperationCompleted); } @@ -454,7 +481,8 @@ namespace WebsitePanel.EnterpriseServer { user, packageId, itemId, - businessUnitOrgId}, this.CreateCRMUserOperationCompleted, userState); + businessUnitOrgId, + CALType}, this.CreateCRMUserOperationCompleted, userState); } private void OnCreateCRMUserOperationCompleted(object arg) { @@ -605,6 +633,56 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetUserCALType", 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 ResultObject SetUserCALType(int itemId, int accountId, int packageId, int CALType) { + object[] results = this.Invoke("SetUserCALType", new object[] { + itemId, + accountId, + packageId, + CALType}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginSetUserCALType(int itemId, int accountId, int packageId, int CALType, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetUserCALType", new object[] { + itemId, + accountId, + packageId, + CALType}, callback, asyncState); + } + + /// + public ResultObject EndSetUserCALType(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void SetUserCALTypeAsync(int itemId, int accountId, int packageId, int CALType) { + this.SetUserCALTypeAsync(itemId, accountId, packageId, CALType, null); + } + + /// + public void SetUserCALTypeAsync(int itemId, int accountId, int packageId, int CALType, object userState) { + if ((this.SetUserCALTypeOperationCompleted == null)) { + this.SetUserCALTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetUserCALTypeOperationCompleted); + } + this.InvokeAsync("SetUserCALType", new object[] { + itemId, + accountId, + packageId, + CALType}, this.SetUserCALTypeOperationCompleted, userState); + } + + private void OnSetUserCALTypeOperationCompleted(object arg) { + if ((this.SetUserCALTypeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetUserCALTypeCompleted(this, new SetUserCALTypeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/ChangeUserState", 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 ResultObject ChangeUserState(int itemId, int accountId, bool disable) { @@ -696,41 +774,147 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetMaxDBSize", 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 ResultObject SetMaxDBSize(int itemId, int packageId, long maxSize) { + object[] results = this.Invoke("SetMaxDBSize", new object[] { + itemId, + packageId, + maxSize}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginSetMaxDBSize(int itemId, int packageId, long maxSize, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetMaxDBSize", new object[] { + itemId, + packageId, + maxSize}, callback, asyncState); + } + + /// + public ResultObject EndSetMaxDBSize(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void SetMaxDBSizeAsync(int itemId, int packageId, long maxSize) { + this.SetMaxDBSizeAsync(itemId, packageId, maxSize, null); + } + + /// + public void SetMaxDBSizeAsync(int itemId, int packageId, long maxSize, object userState) { + if ((this.SetMaxDBSizeOperationCompleted == null)) { + this.SetMaxDBSizeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetMaxDBSizeOperationCompleted); + } + this.InvokeAsync("SetMaxDBSize", new object[] { + itemId, + packageId, + maxSize}, this.SetMaxDBSizeOperationCompleted, userState); + } + + private void OnSetMaxDBSizeOperationCompleted(object arg) { + if ((this.SetMaxDBSizeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetMaxDBSizeCompleted(this, new SetMaxDBSizeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetDBSize", 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 long GetDBSize(int itemId, int packageId) { + object[] results = this.Invoke("GetDBSize", new object[] { + itemId, + packageId}); + return ((long)(results[0])); + } + + /// + public System.IAsyncResult BeginGetDBSize(int itemId, int packageId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetDBSize", new object[] { + itemId, + packageId}, callback, asyncState); + } + + /// + public long EndGetDBSize(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((long)(results[0])); + } + + /// + public void GetDBSizeAsync(int itemId, int packageId) { + this.GetDBSizeAsync(itemId, packageId, null); + } + + /// + public void GetDBSizeAsync(int itemId, int packageId, object userState) { + if ((this.GetDBSizeOperationCompleted == null)) { + this.GetDBSizeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetDBSizeOperationCompleted); + } + this.InvokeAsync("GetDBSize", new object[] { + itemId, + packageId}, this.GetDBSizeOperationCompleted, userState); + } + + private void OnGetDBSizeOperationCompleted(object arg) { + if ((this.GetDBSizeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetDBSizeCompleted(this, new GetDBSizeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetMaxDBSize", 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 long GetMaxDBSize(int itemId, int packageId) { + object[] results = this.Invoke("GetMaxDBSize", new object[] { + itemId, + packageId}); + return ((long)(results[0])); + } + + /// + public System.IAsyncResult BeginGetMaxDBSize(int itemId, int packageId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetMaxDBSize", new object[] { + itemId, + packageId}, callback, asyncState); + } + + /// + public long EndGetMaxDBSize(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((long)(results[0])); + } + + /// + public void GetMaxDBSizeAsync(int itemId, int packageId) { + this.GetMaxDBSizeAsync(itemId, packageId, null); + } + + /// + public void GetMaxDBSizeAsync(int itemId, int packageId, object userState) { + if ((this.GetMaxDBSizeOperationCompleted == null)) { + this.GetMaxDBSizeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetMaxDBSizeOperationCompleted); + } + this.InvokeAsync("GetMaxDBSize", new object[] { + itemId, + packageId}, this.GetMaxDBSizeOperationCompleted, userState); + } + + private void OnGetMaxDBSizeOperationCompleted(object arg) { + if ((this.GetMaxDBSizeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetMaxDBSizeCompleted(this, new GetMaxDBSizeCompletedEventArgs(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 CreateOrganizationCompletedEventHandler(object sender, CreateOrganizationCompletedEventArgs e); @@ -991,6 +1175,32 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void SetUserCALTypeCompletedEventHandler(object sender, SetUserCALTypeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SetUserCALTypeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SetUserCALTypeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ResultObject Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] public delegate void ChangeUserStateCompletedEventHandler(object sender, ChangeUserStateCompletedEventArgs e); @@ -1042,4 +1252,82 @@ namespace WebsitePanel.EnterpriseServer { } } } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void SetMaxDBSizeCompletedEventHandler(object sender, SetMaxDBSizeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SetMaxDBSizeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SetMaxDBSizeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ResultObject Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void GetDBSizeCompletedEventHandler(object sender, GetDBSizeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetDBSizeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetDBSizeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public long Result { + get { + this.RaiseExceptionIfNecessary(); + return ((long)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void GetMaxDBSizeCompletedEventHandler(object sender, GetMaxDBSizeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetMaxDBSizeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetMaxDBSizeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public long Result { + get { + this.RaiseExceptionIfNecessary(); + return ((long)(this.results[0])); + } + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs index 822224b6..d2caa067 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs @@ -3112,13 +3112,14 @@ namespace WebsitePanel.EnterpriseServer #region CRM - public static int GetCRMUsersCount(int itemId, string name, string email) + public static int GetCRMUsersCount(int itemId, string name, string email, int CALType) { SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("@ItemID", itemId), GetFilterSqlParam("@Name", name), GetFilterSqlParam("@Email", email), + new SqlParameter("@CALType", CALType) }; return (int)SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetCRMUsersCount", sqlParams); @@ -3159,18 +3160,29 @@ namespace WebsitePanel.EnterpriseServer new SqlParameter[] { new SqlParameter("@ItemID", itemId) }); } - public static void CreateCRMUser(int itemId, Guid crmId, Guid businessUnitId) + public static void CreateCRMUser(int itemId, Guid crmId, Guid businessUnitId, int CALType) { SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, "InsertCRMUser", new SqlParameter[] { new SqlParameter("@ItemID", itemId), new SqlParameter("@CrmUserID", crmId), - new SqlParameter("@BusinessUnitId", businessUnitId) + new SqlParameter("@BusinessUnitId", businessUnitId), + new SqlParameter("@CALType", CALType) }); } + public static void UpdateCRMUser(int itemId, int CALType) + { + SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, "UpdateCRMUser", + new SqlParameter[] + { + new SqlParameter("@ItemID", itemId), + new SqlParameter("@CALType", CALType) + }); + + } public static IDataReader GetCrmUser(int itemId) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/CRMController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/CRMController.cs index b0a415dd..0e776df7 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/CRMController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/CRMController.cs @@ -265,11 +265,12 @@ namespace WebsitePanel.EnterpriseServer return res; } - - int serviceid = PackageController.GetPackageServiceId(org.PackageId, ResourceGroups.HostedOrganizations); string rootOU = GetProviderProperty(serviceid, "rootou"); + PackageContext cntx = PackageController.GetPackageContext(org.PackageId); + int maxDBSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; + org.CrmAdministratorId = user.AccountId; org.CrmCurrency = string.Join("|", new[] {baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, regionName}); @@ -279,11 +280,10 @@ namespace WebsitePanel.EnterpriseServer OrganizationResult serverRes = crm.CreateOrganization(orgId, org.OrganizationId, org.Name, - org.DefaultDomain, org.OrganizationId + "." + rootOU, baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, user.SamAccountName, user.FirstName, user.LastName, user.PrimaryEmailAddress, - collation); + collation, maxDBSize); if (!serverRes.IsSuccess) { @@ -322,7 +322,7 @@ namespace WebsitePanel.EnterpriseServer { try { - DataProvider.CreateCRMUser(userId, crmUser.Value.CRMUserId, crmUser.Value.BusinessUnitId); + DataProvider.CreateCRMUser(userId, crmUser.Value.CRMUserId, crmUser.Value.BusinessUnitId, 0); } catch (Exception ex) { @@ -568,12 +568,12 @@ namespace WebsitePanel.EnterpriseServer } - public static IntResult GetCRMUsersCount(int itemId, string name, string email) + public static IntResult GetCRMUsersCount(int itemId, string name, string email, int CALType) { IntResult res = StartTask("CRM", "GET_CRM_USERS_COUNT"); try { - res.Value = DataProvider.GetCRMUsersCount(itemId, name, email); + res.Value = DataProvider.GetCRMUsersCount(itemId, name, email, CALType); } catch(Exception ex) { @@ -618,7 +618,7 @@ namespace WebsitePanel.EnterpriseServer return res; } - IntResult intRes = GetCRMUsersCount(itemId, name, email); + IntResult intRes = GetCRMUsersCount(itemId, name, email, -1); res.ErrorCodes.AddRange(intRes.ErrorCodes); if (!intRes.IsSuccess) { @@ -632,7 +632,7 @@ namespace WebsitePanel.EnterpriseServer } - public static UserResult CreateCRMUser(OrganizationUser user, int packageId, int itemId, Guid businessUnitId) + public static UserResult CreateCRMUser(OrganizationUser user, int packageId, int itemId, Guid businessUnitId, int CALType) { UserResult ret = StartTask("CRM", "CREATE_CRM_USER"); @@ -665,8 +665,7 @@ namespace WebsitePanel.EnterpriseServer return ret; } - - BoolResult quotaRes = CheckQuota(packageId, itemId); + BoolResult quotaRes = CheckQuota(packageId, itemId, CALType); ret.ErrorCodes.AddRange(quotaRes.ErrorCodes); if (!quotaRes.IsSuccess) { @@ -695,7 +694,7 @@ namespace WebsitePanel.EnterpriseServer CRM crm = new CRM(); ServiceProviderProxy.Init(crm, serviceId); - UserResult res = crm.CreateCRMUser(user, org.OrganizationId, org.CrmOrganizationId, businessUnitId); + UserResult res = crm.CreateCRMUser(user, org.OrganizationId, org.CrmOrganizationId, businessUnitId, CALType); ret.ErrorCodes.AddRange(res.ErrorCodes); if (!res.IsSuccess) @@ -713,7 +712,7 @@ namespace WebsitePanel.EnterpriseServer try { - DataProvider.CreateCRMUser(user.AccountId, crmId, businessUnitId); + DataProvider.CreateCRMUser(user.AccountId, crmId, businessUnitId, CALType); } catch (Exception ex) { @@ -964,6 +963,80 @@ namespace WebsitePanel.EnterpriseServer } + public static ResultObject SetUserCALType(int itemId, int accountId, int packageId, int CALType) + { + ResultObject res = StartTask("CRM", "SET_CRM_CALTYPE"); + + try + { + CrmUserResult user = GetCrmUser(itemId, accountId); + if (user.Value.CALType == CALType) + { + res.IsSuccess = true; + CompleteTask(); + return res; + } + + int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM); + if (serviceId == 0) + { + CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null, + "CRM is not selected in hosting plan."); + return res; + } + + CRM crm = new CRM(); + ServiceProviderProxy.Init(crm, serviceId); + + Organization org; + + try + { + org = OrganizationController.GetOrganization(itemId); + if (org == null) + throw new ApplicationException("Org is null."); + } + catch (Exception ex) + { + CompleteTask(res, ErrorCodes.CANNOT_GET_ORGANIZATION_BY_ITEM_ID, ex); + return res; + } + + BoolResult quotaRes = CheckQuota(packageId, itemId, CALType); + res.ErrorCodes.AddRange(quotaRes.ErrorCodes); + if (!quotaRes.IsSuccess) + { + CompleteTask(res); + return res; + } + if (!quotaRes.Value) + { + CompleteTask(res, CrmErrorCodes.USER_QUOTA_HAS_BEEN_REACHED, null, "CRM user quota has been reached."); + return res; + } + + Guid crmUserId = GetCrmUserId(accountId); + + ResultObject rolesRes = crm.SetUserCALType(org.Name, crmUserId, CALType); + + DataProvider.UpdateCRMUser(accountId, CALType); + + res.ErrorCodes.AddRange(rolesRes.ErrorCodes); + if (!rolesRes.IsSuccess) + { + CompleteTask(res); + return res; + } + } + catch (Exception ex) + { + CompleteTask(res, CrmErrorCodes.CANNOT_SET_CRM_USER_ROLES_GENERAL_ERROR, ex); + return res; + } + CompleteTask(); + return res; + + } public static ResultObject ChangeUserState(int itemId, int accountId, bool disable) { @@ -1016,24 +1089,25 @@ namespace WebsitePanel.EnterpriseServer } - private static BoolResult CheckQuota(int packageId, int itemId) + private static BoolResult CheckQuota(int packageId, int itemId, int CALType) { BoolResult res = StartTask("CRM", "CHECK_QUOTA"); try { PackageContext cntx = PackageController.GetPackageContext(packageId); - IntResult tmp = GetCRMUsersCount(itemId, string.Empty, string.Empty); + IntResult tmp = GetCRMUsersCount(itemId, string.Empty, string.Empty, CALType); res.ErrorCodes.AddRange(tmp.ErrorCodes); if (!tmp.IsSuccess) { CompleteTask(res); return res; } - - - int allocatedCrmUsers = cntx.Quotas[Quotas.CRM_USERS].QuotaAllocatedValue; - res.Value = allocatedCrmUsers == -1 || allocatedCrmUsers >= tmp.Value; + + string quotaName = CALType == 0 ? Quotas.CRM_USERS : Quotas.CRM_LIMITEDUSERS; + + int allocatedCrmUsers = cntx.Quotas[quotaName].QuotaAllocatedValue; + res.Value = allocatedCrmUsers == -1 || allocatedCrmUsers > tmp.Value; } catch(Exception ex) @@ -1045,6 +1119,158 @@ namespace WebsitePanel.EnterpriseServer CompleteTask(); return res; } - + + + public static ResultObject SetMaxDBSize(int itemId, int packageId, long maxSize) + { + ResultObject res = StartTask("CRM", "SET_CRM_MAXDBSIZE"); + + try + { + + int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM); + if (serviceId == 0) + { + CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null, + "CRM is not selected in hosting plan."); + return res; + } + + CRM crm = new CRM(); + ServiceProviderProxy.Init(crm, serviceId); + + Organization org; + + try + { + org = OrganizationController.GetOrganization(itemId); + if (org == null) + throw new ApplicationException("Org is null."); + } + catch (Exception ex) + { + CompleteTask(res, ErrorCodes.CANNOT_GET_ORGANIZATION_BY_ITEM_ID, ex); + return res; + } + + PackageContext cntx = PackageController.GetPackageContext(packageId); + + int limitSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; + + if (limitSize != -1) + { + if (maxSize == -1) maxSize = limitSize; + if (maxSize > limitSize) maxSize = limitSize; + } + + res = crm.SetMaxDBSize(org.CrmOrganizationId, maxSize); + + res.ErrorCodes.AddRange(res.ErrorCodes); + if (!res.IsSuccess) + { + CompleteTask(res); + return res; + } + } + catch (Exception ex) + { + CompleteTask(res, CrmErrorCodes.CANNOT_CONFIGURE_CRM_ORGANIZATION, ex); + return res; + } + CompleteTask(); + return res; + + } + + public static long GetDBSize(int itemId, int packageId) + { + ResultObject res = StartTask("CRM", "GET_CRM_DBSIZE"); + long size = -1; + + try + { + + int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM); + if (serviceId == 0) + { + CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null, + "CRM is not selected in hosting plan."); + return -1; + } + + CRM crm = new CRM(); + ServiceProviderProxy.Init(crm, serviceId); + + Organization org; + + try + { + org = OrganizationController.GetOrganization(itemId); + if (org == null) + throw new ApplicationException("Org is null."); + } + catch (Exception ex) + { + CompleteTask(res, ErrorCodes.CANNOT_GET_ORGANIZATION_BY_ITEM_ID, ex); + return -1; + } + + size = crm.GetDBSize(org.CrmOrganizationId); + + } + catch (Exception ex) + { + CompleteTask(res, CrmErrorCodes.CANNOT_CONFIGURE_CRM_ORGANIZATION, ex); + return -1; + } + CompleteTask(); + return size; + } + + public static long GetMaxDBSize(int itemId, int packageId) + { + ResultObject res = StartTask("CRM", "GET_CRM_MAXDBSIZE"); + long size = -1; + + try + { + + int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedCRM); + if (serviceId == 0) + { + CompleteTask(res, CrmErrorCodes.CRM_IS_NOT_SELECTED_IN_HOSTING_PLAN, null, + "CRM is not selected in hosting plan."); + return -1; + } + + CRM crm = new CRM(); + ServiceProviderProxy.Init(crm, serviceId); + + Organization org; + + try + { + org = OrganizationController.GetOrganization(itemId); + if (org == null) + throw new ApplicationException("Org is null."); + } + catch (Exception ex) + { + CompleteTask(res, ErrorCodes.CANNOT_GET_ORGANIZATION_BY_ITEM_ID, ex); + return -1; + } + + size = crm.GetMaxDBSize(org.CrmOrganizationId); + + } + catch (Exception ex) + { + CompleteTask(res, CrmErrorCodes.CANNOT_CONFIGURE_CRM_ORGANIZATION, ex); + return -1; + } + CompleteTask(); + return size; + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index 0099c991..0530cfc4 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -932,7 +932,11 @@ namespace WebsitePanel.EnterpriseServer if (cntxTmp.Groups.ContainsKey(ResourceGroups.HostedCRM)) { - stats.CreatedCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty).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.UsedCRMDiskSpace = CRMController.GetDBSize(org.Id, org.PackageId); + stats.AllocatedCRMDiskSpace = CRMController.GetMaxDBSize(org.Id, org.PackageId); + } if (cntxTmp.Groups.ContainsKey(ResourceGroups.BlackBerry)) @@ -991,7 +995,10 @@ namespace WebsitePanel.EnterpriseServer if (cntxTmp.Groups.ContainsKey(ResourceGroups.HostedCRM)) { - stats.CreatedCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty).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.UsedCRMDiskSpace += CRMController.GetDBSize(o.Id, o.PackageId); + stats.AllocatedCRMDiskSpace += CRMController.GetMaxDBSize(o.Id, o.PackageId); } if (cntxTmp.Groups.ContainsKey(ResourceGroups.BlackBerry)) @@ -1036,6 +1043,7 @@ namespace WebsitePanel.EnterpriseServer if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM)) { stats.AllocatedCRMUsers = cntx.Quotas[Quotas.CRM_USERS].QuotaAllocatedValue; + stats.AllocatedLimitedCRMUsers = cntx.Quotas[Quotas.CRM_LIMITEDUSERS].QuotaAllocatedValue; } if (cntx.Groups.ContainsKey(ResourceGroups.BlackBerry)) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esCRM.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esCRM.asmx.cs index ecce8519..e7f3d8de 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esCRM.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esCRM.asmx.cs @@ -81,15 +81,15 @@ namespace WebsitePanel.EnterpriseServer } [WebMethod] - public IntResult GetCRMUserCount(int itemId, string name, string email) + public IntResult GetCRMUserCount(int itemId, string name, string email, int CALType) { - return CRMController.GetCRMUsersCount(itemId, name, email); + return CRMController.GetCRMUsersCount(itemId, name, email, CALType); } [WebMethod] - public UserResult CreateCRMUser(OrganizationUser user, int packageId, int itemId, Guid businessUnitOrgId) + public UserResult CreateCRMUser(OrganizationUser user, int packageId, int itemId, Guid businessUnitOrgId, int CALType) { - return CRMController.CreateCRMUser(user, packageId, itemId, businessUnitOrgId); + return CRMController.CreateCRMUser(user, packageId, itemId, businessUnitOrgId, CALType); } @@ -112,6 +112,12 @@ namespace WebsitePanel.EnterpriseServer return CRMController.SetUserRoles(itemId, accountId, packageId, roles); } + [WebMethod] + public ResultObject SetUserCALType(int itemId, int accountId, int packageId, int CALType) + { + return CRMController.SetUserCALType(itemId, accountId, packageId, CALType); + } + [WebMethod] public ResultObject ChangeUserState(int itemId, int accountId, bool disable) { @@ -125,5 +131,23 @@ namespace WebsitePanel.EnterpriseServer return CRMController.GetCrmUser(itemId, accountId); } + [WebMethod] + public ResultObject SetMaxDBSize(int itemId, int packageId, long maxSize) + { + return CRMController.SetMaxDBSize(itemId, packageId, maxSize); + } + + [WebMethod] + public long GetDBSize(int itemId, int packageId) + { + return CRMController.GetDBSize(itemId, packageId); + } + + [WebMethod] + public long GetMaxDBSize(int itemId, int packageId) + { + return CRMController.GetMaxDBSize(itemId, packageId); + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/CrmUser.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/CrmUser.cs index 55c68ce2..49166787 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/CrmUser.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/CrmUser.cs @@ -36,6 +36,6 @@ namespace WebsitePanel.Providers.HostedSolution public Guid BusinessUnitId { get; set; } public CRMUserAccessMode ClientAccessMode { get; set; } public bool IsDisabled { get; set; } - + public int CALType { get; set; } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ICRM.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ICRM.cs index 930a8081..0808f1b8 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ICRM.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ICRM.cs @@ -35,10 +35,11 @@ namespace WebsitePanel.Providers.HostedSolution public interface ICRM { OrganizationResult CreateOrganization(Guid organizationId, string organizationUniqueName, string organizationFriendlyName, - string organizationDomainName, string ou, + string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, - string organizationCollation); + string organizationCollation, + long maxSize); string[] GetSupportedCollationNames(); @@ -46,7 +47,7 @@ namespace WebsitePanel.Providers.HostedSolution ResultObject DeleteOrganization(Guid orgId); - UserResult CreateCRMUser(OrganizationUser user, string orgName, Guid organizationId, Guid baseUnitId); + UserResult CreateCRMUser(OrganizationUser user, string orgName, Guid organizationId, Guid baseUnitId, int CALType); CRMBusinessUnitsResult GetOrganizationBusinessUnits(Guid organizationId, string orgName); @@ -56,13 +57,19 @@ namespace WebsitePanel.Providers.HostedSolution ResultObject SetUserRoles(string orgName, Guid userId, Guid[] roles); + ResultObject SetUserCALType(string orgName, Guid userId, int CALType); + CrmUserResult GetCrmUserByDomainName(string domainName, string orgName); CrmUserResult GetCrmUserById(Guid crmUserId, string orgName); ResultObject ChangeUserState(bool disable, string orgName, Guid crmUserId); - long GetUsedSpace(Guid organizationId); + long GetDBSize(Guid organizationId); + + long GetMaxDBSize(Guid organizationId); + + ResultObject SetMaxDBSize(Guid organizationId, long maxSize); } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs index 3ccfc542..583a80e2 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs @@ -61,6 +61,12 @@ namespace WebsitePanel.Providers.HostedSolution private int createdCRMUsers; private int allocatedCRMUsers; + private int createdLimitedCRMUsers; + private int allocatedLimitedCRMUsers; + + private long usedCRMDiskSpace; + private long allocatedCRMDiskSpace; + private int createdEnterpriseStorageFolders; private int allocatedEnterpriseStorageFolders; @@ -79,6 +85,18 @@ namespace WebsitePanel.Providers.HostedSolution get { return allocatedCRMUsers; } set { allocatedCRMUsers = value; } } + + public int CreatedLimitedCRMUsers + { + get { return createdLimitedCRMUsers; } + set { createdLimitedCRMUsers = value; } + } + + public int AllocatedLimitedCRMUsers + { + get { return allocatedLimitedCRMUsers; } + set { allocatedLimitedCRMUsers = value; } + } public int AllocatedUsers { @@ -86,6 +104,18 @@ namespace WebsitePanel.Providers.HostedSolution set { allocatedUsers = value; } } + public long UsedCRMDiskSpace + { + get { return usedCRMDiskSpace; } + set { usedCRMDiskSpace = value;} + } + + public long AllocatedCRMDiskSpace + { + get { return allocatedCRMDiskSpace; } + set { allocatedCRMDiskSpace = value; } + } + public int CreatedUsers { get { return createdUsers; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2011/CRMProvider2011.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2011/CRMProvider2011.cs index 6855bfe2..7600cc15 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2011/CRMProvider2011.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2011/CRMProvider2011.cs @@ -179,11 +179,8 @@ namespace WebsitePanel.Providers.HostedSolution return res; } - public long GetUsedSpace(Guid organizationId) + private string GetDataBaseName(Guid organizationId) { - Log.WriteStart("GetUsedSpace"); - long res = 0; - string crmDatabaseName = "MSCRM_CONFIG"; string databasename = ""; @@ -212,6 +209,17 @@ namespace WebsitePanel.Providers.HostedSolution connection.Dispose(); } + return databasename; + } + + public long GetDBSize(Guid organizationId) + { + Log.WriteStart("GetDBSize"); + long res = 0; + + string databasename = GetDataBaseName(organizationId); + + SqlConnection connection = null; try { connection = new SqlConnection(); @@ -221,7 +229,7 @@ namespace WebsitePanel.Providers.HostedSolution connection.Open(); - string commandText = "SELECT ((dbsize + logsize) * 8192 ) size FROM " + + string commandText = "SELECT ((dbsize ) * 8192 ) size FROM " + // + logsize "( " + "SELECT SUM(CONVERT(BIGINT,CASE WHEN status & 64 = 0 THEN size ELSE 0 END)) dbsize " + ", SUM(CONVERT(BIGINT,CASE WHEN status & 64 <> 0 THEN size ELSE 0 END)) logsize " + @@ -243,11 +251,93 @@ namespace WebsitePanel.Providers.HostedSolution } - Log.WriteEnd("GetUsedSpace"); + Log.WriteEnd("GetDBSize"); return res; } + public long GetMaxDBSize(Guid organizationId) + { + Log.WriteStart("GetMaxDBSize"); + long res = 0; + + string databasename = GetDataBaseName(organizationId); + + SqlConnection connection = null; + try + { + connection = new SqlConnection(); + connection.ConnectionString = + string.Format("Server={1};Initial Catalog={0};Integrated Security=SSPI", + databasename, SqlServer); + + connection.Open(); + + string commandText = "SELECT SUM(CONVERT(BIGINT,CASE WHEN status & 64 = 0 THEN maxsize ELSE 0 END)) dbsize FROM dbo.sysfiles"; + + SqlCommand command = new SqlCommand(commandText, connection); + res = (long)command.ExecuteScalar(); + if (res > 0) res = res * 8192; + + } + catch (Exception ex) + { + Log.WriteError(ex); + } + finally + { + if (connection != null) + connection.Dispose(); + + } + + Log.WriteEnd("GetMaxDBSize"); + return res; + + } + + public ResultObject SetMaxDBSize(Guid organizationId, long maxSize) + { + ResultObject res = StartLog("SetMaxDBSize"); + + string databasename = GetDataBaseName(organizationId); + + SqlConnection connection = null; + try + { + connection = new SqlConnection(); + connection.ConnectionString = + string.Format("Server={1};Initial Catalog={0};Integrated Security=SSPI", + databasename, SqlServer); + + connection.Open(); + + string maxSizeStr = maxSize == -1 ? "UNLIMITED" : (maxSize/(1024*1024)).ToString() +" MB"; + + string commandText = "ALTER DATABASE [" + databasename + "] MODIFY FILE ( NAME = N'mscrm', MAXSIZE = " + maxSizeStr + " )"; + + SqlCommand command = new SqlCommand(commandText, connection); + command.ExecuteNonQuery(); + + res.IsSuccess = true; + + } + catch (Exception ex) + { + EndLog("SetMaxDBSize", res, CrmErrorCodes.CANNOT_CHANGE_CRM_ORGANIZATION_STATE, ex); + } + finally + { + if (connection != null) + connection.Dispose(); + + } + + + EndLog("SetMaxDBSize"); + return res; + } + private bool CheckOrganizationUnique(string databaseName, string orgName) { Log.WriteStart("CheckOrganizationUnique"); @@ -393,14 +483,14 @@ namespace WebsitePanel.Providers.HostedSolution return retOrganization; } - public OrganizationResult CreateOrganization(Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string organizationDomainName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation) + public OrganizationResult CreateOrganization(Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation, long maxSize) { - return CreateOrganizationInternal(organizationId, organizationUniqueName, organizationFriendlyName, organizationDomainName, ou , baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, initialUserDomainName, initialUserFirstName, initialUserLastName, initialUserPrimaryEmail, organizationCollation); + return CreateOrganizationInternal(organizationId, organizationUniqueName, organizationFriendlyName, ou , baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, initialUserDomainName, initialUserFirstName, initialUserLastName, initialUserPrimaryEmail, organizationCollation, maxSize); } const string CRMSysAdminRoleStr = "Системный администратор;System Administrator"; - internal OrganizationResult CreateOrganizationInternal(Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string organizationDomainName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation) + internal OrganizationResult CreateOrganizationInternal(Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation, long maxSize) { OrganizationResult ret = StartLog("CreateOrganizationInternal"); @@ -527,6 +617,10 @@ namespace WebsitePanel.Providers.HostedSolution }; Microsoft.Xrm.Sdk.Deployment.UpdateAdvancedSettingsResponse respUpdateSettings = (Microsoft.Xrm.Sdk.Deployment.UpdateAdvancedSettingsResponse) deploymentService.Execute(reqUpdateSettings); + // DB size limit + if (maxSize!=-1) + SetMaxDBSize(organizationId, maxSize); + int tryTimeout = 30000; int tryCount = 10; @@ -544,7 +638,7 @@ namespace WebsitePanel.Providers.HostedSolution string ldap = ""; - Guid SysAdminGuid = RetrieveSystemUser(GetDomainName(initialUserDomainName), initialUserFirstName, initialUserLastName, CRMSysAdminRoleStr, _serviceProxy, ref ldap); + Guid SysAdminGuid = RetrieveSystemUser(GetDomainName(initialUserDomainName), initialUserFirstName, initialUserLastName, CRMSysAdminRoleStr, _serviceProxy, ref ldap, 0); success = true; @@ -774,12 +868,12 @@ namespace WebsitePanel.Providers.HostedSolution return res; } - public UserResult CreateCRMUser(OrganizationUser user, string orgName, Guid organizationId, Guid baseUnitId) + public UserResult CreateCRMUser(OrganizationUser user, string orgName, Guid organizationId, Guid baseUnitId, int CALType) { - return CreateCRMUserInternal(user, orgName, organizationId, baseUnitId); + return CreateCRMUserInternal(user, orgName, organizationId, baseUnitId, CALType); } - internal UserResult CreateCRMUserInternal(OrganizationUser user, string orgName, Guid organizationId, Guid businessUnitId) + internal UserResult CreateCRMUserInternal(OrganizationUser user, string orgName, Guid organizationId, Guid businessUnitId, int CALType) { UserResult res = StartLog("CreateCRMUserInternal"); @@ -803,7 +897,7 @@ namespace WebsitePanel.Providers.HostedSolution string ldap = ""; - Guid guid = RetrieveSystemUser(user.DomainUserName, user.FirstName, user.LastName, CRMSysAdminRoleStr, _serviceProxy, ref ldap); + Guid guid = RetrieveSystemUser(user.DomainUserName, user.FirstName, user.LastName, CRMSysAdminRoleStr, _serviceProxy, ref ldap, CALType); user.CrmUserId = guid; res.Value = user; @@ -828,7 +922,7 @@ namespace WebsitePanel.Providers.HostedSolution private static Guid CreateSystemUser(String userName, String firstName, String lastName, String domain, String roleStr, - OrganizationServiceProxy serviceProxy, ref String ldapPath) + OrganizationServiceProxy serviceProxy, ref String ldapPath, int CALType) { if (serviceProxy.ServiceConfiguration.AuthenticationType == AuthenticationProviderType.LiveId || @@ -868,7 +962,8 @@ namespace WebsitePanel.Providers.HostedSolution LogicalName = BusinessUnit.EntityLogicalName, Name = BusinessUnit.EntityLogicalName, Id = defaultBusinessUnit.Id - } + }, + CALType = new OptionSetValue(CALType) }; userId = serviceProxy.Create(user); @@ -890,7 +985,8 @@ namespace WebsitePanel.Providers.HostedSolution public static Guid RetrieveSystemUser(String userName, String firstName, String lastName, String roleStr, OrganizationServiceProxy serviceProxy, - ref String ldapPath) + ref String ldapPath, + int CALType) { String domain; Guid userId = Guid.Empty; @@ -985,11 +1081,12 @@ namespace WebsitePanel.Providers.HostedSolution }; serviceProxy.Execute(associate); } + } else { userId = CreateSystemUser(userName, firstName, lastName, domain, - roleStr, serviceProxy, ref ldapPath); + roleStr, serviceProxy, ref ldapPath, CALType); } return userId; @@ -1633,7 +1730,7 @@ namespace WebsitePanel.Providers.HostedSolution OrganizationServiceProxy serviceProxy = GetOrganizationProxy(orgName); SystemUser retruveUser = - serviceProxy.Retrieve(SystemUser.EntityLogicalName, crmUserId, new Microsoft.Xrm.Sdk.Query.ColumnSet("domainname", "businessunitid", "accessmode", "isdisabled")).ToEntity(); + serviceProxy.Retrieve(SystemUser.EntityLogicalName, crmUserId, new Microsoft.Xrm.Sdk.Query.ColumnSet("domainname", "businessunitid", "accessmode", "isdisabled", "caltype")).ToEntity(); CrmUser user = null; @@ -1644,6 +1741,7 @@ namespace WebsitePanel.Providers.HostedSolution user.CRMUserId = retruveUser.SystemUserId.Value; user.ClientAccessMode = (CRMUserAccessMode)retruveUser.AccessMode.Value; user.IsDisabled = (bool)retruveUser.IsDisabled; + user.CALType = retruveUser.CALType.Value; ret.Value = user; } @@ -1677,7 +1775,7 @@ namespace WebsitePanel.Providers.HostedSolution Microsoft.Xrm.Sdk.Query.QueryExpression usereQuery = new Microsoft.Xrm.Sdk.Query.QueryExpression { EntityName = SystemUser.EntityLogicalName, - ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet("domainname", "businessunitid", "accessmode", "isdisabled", "systemuserid"), + ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet("domainname", "businessunitid", "accessmode", "isdisabled", "systemuserid", "caltype"), }; EntityCollection users = serviceProxy.RetrieveMultiple(usereQuery); @@ -1694,6 +1792,7 @@ namespace WebsitePanel.Providers.HostedSolution user.CRMUserId = sysuser.SystemUserId.Value; user.ClientAccessMode = (CRMUserAccessMode)sysuser.AccessMode.Value; user.IsDisabled = sysuser.IsDisabled.Value; + user.CALType = sysuser.CALType.Value; ret.Value = user; } } @@ -1801,6 +1900,44 @@ namespace WebsitePanel.Providers.HostedSolution return value.StartsWith("5."); } + public ResultObject SetUserCALType(string orgName, Guid userId, int CALType) + { + return SetUserCALTypeInternal(orgName, userId, CALType); + } + + internal ResultObject SetUserCALTypeInternal(string orgName, Guid userId, int CALType) + { + ResultObject ret = StartLog("SetUserCALTypeInternal"); + + try + { + if (userId == Guid.Empty) + throw new ArgumentNullException("crmUserId"); + + if (string.IsNullOrEmpty(orgName)) + throw new ArgumentNullException("orgName"); + + OrganizationServiceProxy serviceProxy = GetOrganizationProxy(orgName); + + SystemUser user = + serviceProxy.Retrieve(SystemUser.EntityLogicalName, userId, new Microsoft.Xrm.Sdk.Query.ColumnSet("domainname", "businessunitid", "accessmode", "isdisabled", "caltype")).ToEntity(); + + user.CALType = new OptionSetValue(CALType); + + serviceProxy.Update(user); + + } + catch (Exception ex) + { + EndLog("SetUserCALTypeInternal", ret, CrmErrorCodes.CANONT_GET_CRM_USER_BY_ID, ex); + return ret; + } + + EndLog("SetUserCALTypeInternal"); + return ret; + } + + } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2011/WebsitePanel.Providers.HostedSolution.Crm2011.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2011/WebsitePanel.Providers.HostedSolution.Crm2011.csproj index 1dbfb91f..4ce83413 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2011/WebsitePanel.Providers.HostedSolution.Crm2011.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2011/WebsitePanel.Providers.HostedSolution.Crm2011.csproj @@ -33,35 +33,35 @@ ..\..\Lib\References\Microsoft\microsoft.crm.sdk.proxy.dll - False + True ..\..\Lib\References\Microsoft\microsoft.xrm.client.dll - False + True ..\..\Lib\References\Microsoft\microsoft.xrm.client.codegeneration.dll - False + True ..\..\Lib\References\Microsoft\microsoft.xrm.portal.dll - False + True ..\..\Lib\References\Microsoft\microsoft.xrm.portal.files.dll - False + True ..\..\Lib\References\Microsoft\microsoft.xrm.sdk.dll - False + True ..\..\Lib\References\Microsoft\microsoft.xrm.sdk.deployment.dll - False + True ..\..\Lib\References\Microsoft\microsoft.xrm.sdk.workflow.dll - False + True diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/CRMProvider.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/CRMProvider.cs index 7a551525..efd5e460 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/CRMProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/CRMProvider.cs @@ -328,7 +328,7 @@ namespace WebsitePanel.Providers.HostedSolution return retOrganization; } - public OrganizationResult CreateOrganization(Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string organizationDomainName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation) + public OrganizationResult CreateOrganization(Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation, long maxSize) { return CreateOrganizationInternal(organizationId, organizationUniqueName, organizationFriendlyName, baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, initialUserDomainName, initialUserFirstName, initialUserLastName, initialUserPrimaryEmail, organizationCollation); } @@ -872,7 +872,7 @@ namespace WebsitePanel.Providers.HostedSolution return res; } - public UserResult CreateCRMUser(OrganizationUser user, string orgName, Guid organizationId, Guid baseUnitId) + public UserResult CreateCRMUser(OrganizationUser user, string orgName, Guid organizationId, Guid baseUnitId, int CALType) { return CreateCRMUserInternal(user, orgName, organizationId, baseUnitId); } @@ -1550,6 +1550,29 @@ namespace WebsitePanel.Providers.HostedSolution return 0; } + public ResultObject SetUserCALType(string orgName, Guid userId, int CALType) + { + ResultObject ret = new ResultObject(); + ret.IsSuccess = false; + return ret; + } + + public long GetDBSize(Guid organizationId) + { + return -1; + } + + public long GetMaxDBSize(Guid organizationId) + { + return -1; + } + + public ResultObject SetMaxDBSize(Guid organizationId, long maxSize) + { + ResultObject ret = new ResultObject(); + ret.IsSuccess = false; + return ret; + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/CRMProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/CRMProxy.cs index f342c1d6..7c9899af 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/CRMProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/CRMProxy.cs @@ -39,6 +39,7 @@ using WebsitePanel.Providers.Common; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.ResultObjects; + // // This source code was auto-generated by wsdl, Version=2.0.50727.42. // @@ -79,13 +80,19 @@ namespace WebsitePanel.Providers.CRM { private System.Threading.SendOrPostCallback SetUserRolesOperationCompleted; + private System.Threading.SendOrPostCallback SetUserCALTypeOperationCompleted; + private System.Threading.SendOrPostCallback GetCrmUserByDomainNameOperationCompleted; private System.Threading.SendOrPostCallback GetCrmUserByIdOperationCompleted; private System.Threading.SendOrPostCallback ChangeUserStateOperationCompleted; - private System.Threading.SendOrPostCallback GetUsedSpaceOperationCompleted; + private System.Threading.SendOrPostCallback GetDBSizeOperationCompleted; + + private System.Threading.SendOrPostCallback GetMaxDBSizeOperationCompleted; + + private System.Threading.SendOrPostCallback SetMaxDBSizeOperationCompleted; /// public CRM() { @@ -119,6 +126,9 @@ namespace WebsitePanel.Providers.CRM { /// public event SetUserRolesCompletedEventHandler SetUserRolesCompleted; + /// + public event SetUserCALTypeCompletedEventHandler SetUserCALTypeCompleted; + /// public event GetCrmUserByDomainNameCompletedEventHandler GetCrmUserByDomainNameCompleted; @@ -129,17 +139,22 @@ namespace WebsitePanel.Providers.CRM { public event ChangeUserStateCompletedEventHandler ChangeUserStateCompleted; /// - public event GetUsedSpaceCompletedEventHandler GetUsedSpaceCompleted; + public event GetDBSizeCompletedEventHandler GetDBSizeCompleted; + + /// + public event GetMaxDBSizeCompletedEventHandler GetMaxDBSizeCompleted; + + /// + public event SetMaxDBSizeCompletedEventHandler SetMaxDBSizeCompleted; /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CreateOrganization", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public OrganizationResult CreateOrganization(System.Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string organizationDomainName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation) { + public OrganizationResult CreateOrganization(System.Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation, long maxSize) { object[] results = this.Invoke("CreateOrganization", new object[] { organizationId, organizationUniqueName, organizationFriendlyName, - organizationDomainName, ou, baseCurrencyCode, baseCurrencyName, @@ -148,17 +163,17 @@ namespace WebsitePanel.Providers.CRM { initialUserFirstName, initialUserLastName, initialUserPrimaryEmail, - organizationCollation}); + organizationCollation, + maxSize}); return ((OrganizationResult)(results[0])); } /// - public System.IAsyncResult BeginCreateOrganization(System.Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string organizationDomainName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginCreateOrganization(System.Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation, long maxSize, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("CreateOrganization", new object[] { organizationId, organizationUniqueName, organizationFriendlyName, - organizationDomainName, ou, baseCurrencyCode, baseCurrencyName, @@ -167,7 +182,8 @@ namespace WebsitePanel.Providers.CRM { initialUserFirstName, initialUserLastName, initialUserPrimaryEmail, - organizationCollation}, callback, asyncState); + organizationCollation, + maxSize}, callback, asyncState); } /// @@ -177,12 +193,12 @@ namespace WebsitePanel.Providers.CRM { } /// - public void CreateOrganizationAsync(System.Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string organizationDomainName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation) { - this.CreateOrganizationAsync(organizationId, organizationUniqueName, organizationFriendlyName, organizationDomainName, ou, baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, initialUserDomainName, initialUserFirstName, initialUserLastName, initialUserPrimaryEmail, organizationCollation, null); + public void CreateOrganizationAsync(System.Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation, long maxSize) { + this.CreateOrganizationAsync(organizationId, organizationUniqueName, organizationFriendlyName, ou, baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, initialUserDomainName, initialUserFirstName, initialUserLastName, initialUserPrimaryEmail, organizationCollation, maxSize, null); } /// - public void CreateOrganizationAsync(System.Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string organizationDomainName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation, object userState) { + public void CreateOrganizationAsync(System.Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation, long maxSize, object userState) { if ((this.CreateOrganizationOperationCompleted == null)) { this.CreateOrganizationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateOrganizationOperationCompleted); } @@ -190,7 +206,6 @@ namespace WebsitePanel.Providers.CRM { organizationId, organizationUniqueName, organizationFriendlyName, - organizationDomainName, ou, baseCurrencyCode, baseCurrencyName, @@ -199,7 +214,8 @@ namespace WebsitePanel.Providers.CRM { initialUserFirstName, initialUserLastName, initialUserPrimaryEmail, - organizationCollation}, this.CreateOrganizationOperationCompleted, userState); + organizationCollation, + maxSize}, this.CreateOrganizationOperationCompleted, userState); } private void OnCreateOrganizationOperationCompleted(object arg) { @@ -332,22 +348,24 @@ namespace WebsitePanel.Providers.CRM { /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CreateCRMUser", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public UserResult CreateCRMUser(OrganizationUser user, string orgName, System.Guid organizationId, System.Guid baseUnitId) { + public UserResult CreateCRMUser(OrganizationUser user, string orgName, System.Guid organizationId, System.Guid baseUnitId, int CALType) { object[] results = this.Invoke("CreateCRMUser", new object[] { user, orgName, organizationId, - baseUnitId}); + baseUnitId, + CALType}); return ((UserResult)(results[0])); } /// - public System.IAsyncResult BeginCreateCRMUser(OrganizationUser user, string orgName, System.Guid organizationId, System.Guid baseUnitId, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginCreateCRMUser(OrganizationUser user, string orgName, System.Guid organizationId, System.Guid baseUnitId, int CALType, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("CreateCRMUser", new object[] { user, orgName, organizationId, - baseUnitId}, callback, asyncState); + baseUnitId, + CALType}, callback, asyncState); } /// @@ -357,12 +375,12 @@ namespace WebsitePanel.Providers.CRM { } /// - public void CreateCRMUserAsync(OrganizationUser user, string orgName, System.Guid organizationId, System.Guid baseUnitId) { - this.CreateCRMUserAsync(user, orgName, organizationId, baseUnitId, null); + public void CreateCRMUserAsync(OrganizationUser user, string orgName, System.Guid organizationId, System.Guid baseUnitId, int CALType) { + this.CreateCRMUserAsync(user, orgName, organizationId, baseUnitId, CALType, null); } /// - public void CreateCRMUserAsync(OrganizationUser user, string orgName, System.Guid organizationId, System.Guid baseUnitId, object userState) { + public void CreateCRMUserAsync(OrganizationUser user, string orgName, System.Guid organizationId, System.Guid baseUnitId, int CALType, object userState) { if ((this.CreateCRMUserOperationCompleted == null)) { this.CreateCRMUserOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateCRMUserOperationCompleted); } @@ -370,7 +388,8 @@ namespace WebsitePanel.Providers.CRM { user, orgName, organizationId, - baseUnitId}, this.CreateCRMUserOperationCompleted, userState); + baseUnitId, + CALType}, this.CreateCRMUserOperationCompleted, userState); } private void OnCreateCRMUserOperationCompleted(object arg) { @@ -563,6 +582,54 @@ namespace WebsitePanel.Providers.CRM { } } + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/SetUserCALType", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject SetUserCALType(string orgName, System.Guid userId, int CALType) { + object[] results = this.Invoke("SetUserCALType", new object[] { + orgName, + userId, + CALType}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginSetUserCALType(string orgName, System.Guid userId, int CALType, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetUserCALType", new object[] { + orgName, + userId, + CALType}, callback, asyncState); + } + + /// + public ResultObject EndSetUserCALType(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void SetUserCALTypeAsync(string orgName, System.Guid userId, int CALType) { + this.SetUserCALTypeAsync(orgName, userId, CALType, null); + } + + /// + public void SetUserCALTypeAsync(string orgName, System.Guid userId, int CALType, object userState) { + if ((this.SetUserCALTypeOperationCompleted == null)) { + this.SetUserCALTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetUserCALTypeOperationCompleted); + } + this.InvokeAsync("SetUserCALType", new object[] { + orgName, + userId, + CALType}, this.SetUserCALTypeOperationCompleted, userState); + } + + private void OnSetUserCALTypeOperationCompleted(object arg) { + if ((this.SetUserCALTypeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetUserCALTypeCompleted(this, new SetUserCALTypeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetCrmUserByDomainName", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] @@ -703,43 +770,130 @@ namespace WebsitePanel.Providers.CRM { /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetUsedSpace", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public long GetUsedSpace(System.Guid organizationId) { - object[] results = this.Invoke("GetUsedSpace", new object[] { + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetDBSize", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public long GetDBSize(System.Guid organizationId) { + object[] results = this.Invoke("GetDBSize", new object[] { organizationId}); return ((long)(results[0])); } /// - public System.IAsyncResult BeginGetUsedSpace(System.Guid organizationId, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("GetUsedSpace", new object[] { + public System.IAsyncResult BeginGetDBSize(System.Guid organizationId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetDBSize", new object[] { organizationId}, callback, asyncState); } /// - public long EndGetUsedSpace(System.IAsyncResult asyncResult) { + public long EndGetDBSize(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((long)(results[0])); } /// - public void GetUsedSpaceAsync(System.Guid organizationId) { - this.GetUsedSpaceAsync(organizationId, null); + public void GetDBSizeAsync(System.Guid organizationId) { + this.GetDBSizeAsync(organizationId, null); } /// - public void GetUsedSpaceAsync(System.Guid organizationId, object userState) { - if ((this.GetUsedSpaceOperationCompleted == null)) { - this.GetUsedSpaceOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetUsedSpaceOperationCompleted); + public void GetDBSizeAsync(System.Guid organizationId, object userState) { + if ((this.GetDBSizeOperationCompleted == null)) { + this.GetDBSizeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetDBSizeOperationCompleted); } - this.InvokeAsync("GetUsedSpace", new object[] { - organizationId}, this.GetUsedSpaceOperationCompleted, userState); + this.InvokeAsync("GetDBSize", new object[] { + organizationId}, this.GetDBSizeOperationCompleted, userState); } - private void OnGetUsedSpaceOperationCompleted(object arg) { - if ((this.GetUsedSpaceCompleted != null)) { + private void OnGetDBSizeOperationCompleted(object arg) { + if ((this.GetDBSizeCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.GetUsedSpaceCompleted(this, new GetUsedSpaceCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + this.GetDBSizeCompleted(this, new GetDBSizeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetMaxDBSize", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public long GetMaxDBSize(System.Guid organizationId) { + object[] results = this.Invoke("GetMaxDBSize", new object[] { + organizationId}); + return ((long)(results[0])); + } + + /// + public System.IAsyncResult BeginGetMaxDBSize(System.Guid organizationId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetMaxDBSize", new object[] { + organizationId}, callback, asyncState); + } + + /// + public long EndGetMaxDBSize(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((long)(results[0])); + } + + /// + public void GetMaxDBSizeAsync(System.Guid organizationId) { + this.GetMaxDBSizeAsync(organizationId, null); + } + + /// + public void GetMaxDBSizeAsync(System.Guid organizationId, object userState) { + if ((this.GetMaxDBSizeOperationCompleted == null)) { + this.GetMaxDBSizeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetMaxDBSizeOperationCompleted); + } + this.InvokeAsync("GetMaxDBSize", new object[] { + organizationId}, this.GetMaxDBSizeOperationCompleted, userState); + } + + private void OnGetMaxDBSizeOperationCompleted(object arg) { + if ((this.GetMaxDBSizeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetMaxDBSizeCompleted(this, new GetMaxDBSizeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/SetMaxDBSize", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject SetMaxDBSize(System.Guid organizationId, long maxSize) { + object[] results = this.Invoke("SetMaxDBSize", new object[] { + organizationId, + maxSize}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginSetMaxDBSize(System.Guid organizationId, long maxSize, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetMaxDBSize", new object[] { + organizationId, + maxSize}, callback, asyncState); + } + + /// + public ResultObject EndSetMaxDBSize(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void SetMaxDBSizeAsync(System.Guid organizationId, long maxSize) { + this.SetMaxDBSizeAsync(organizationId, maxSize, null); + } + + /// + public void SetMaxDBSizeAsync(System.Guid organizationId, long maxSize, object userState) { + if ((this.SetMaxDBSizeOperationCompleted == null)) { + this.SetMaxDBSizeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetMaxDBSizeOperationCompleted); + } + this.InvokeAsync("SetMaxDBSize", new object[] { + organizationId, + maxSize}, this.SetMaxDBSizeOperationCompleted, userState); + } + + private void OnSetMaxDBSizeOperationCompleted(object arg) { + if ((this.SetMaxDBSizeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetMaxDBSizeCompleted(this, new SetMaxDBSizeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } @@ -983,6 +1137,32 @@ namespace WebsitePanel.Providers.CRM { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void SetUserCALTypeCompletedEventHandler(object sender, SetUserCALTypeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SetUserCALTypeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SetUserCALTypeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ResultObject Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] public delegate void GetCrmUserByDomainNameCompletedEventHandler(object sender, GetCrmUserByDomainNameCompletedEventArgs e); @@ -1063,17 +1243,17 @@ namespace WebsitePanel.Providers.CRM { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] - public delegate void GetUsedSpaceCompletedEventHandler(object sender, GetUsedSpaceCompletedEventArgs e); + public delegate void GetDBSizeCompletedEventHandler(object sender, GetDBSizeCompletedEventArgs e); /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] - public partial class GetUsedSpaceCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + public partial class GetDBSizeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object[] results; - internal GetUsedSpaceCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + internal GetDBSizeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; } @@ -1086,4 +1266,56 @@ namespace WebsitePanel.Providers.CRM { } } } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void GetMaxDBSizeCompletedEventHandler(object sender, GetMaxDBSizeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetMaxDBSizeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetMaxDBSizeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public long Result { + get { + this.RaiseExceptionIfNecessary(); + return ((long)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void SetMaxDBSizeCompletedEventHandler(object sender, SetMaxDBSizeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SetMaxDBSizeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SetMaxDBSizeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ResultObject Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.Server/CRM.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/CRM.asmx.cs index eba10cc1..75888938 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/CRM.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/CRM.asmx.cs @@ -55,9 +55,9 @@ namespace WebsitePanel.Server [WebMethod, SoapHeader("settings")] - public OrganizationResult CreateOrganization(Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string organizationDomainName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation) + public OrganizationResult CreateOrganization(Guid organizationId, string organizationUniqueName, string organizationFriendlyName, string ou, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string initialUserDomainName, string initialUserFirstName, string initialUserLastName, string initialUserPrimaryEmail, string organizationCollation, long maxSize) { - return CrmProvider.CreateOrganization(organizationId, organizationUniqueName, organizationFriendlyName, organizationDomainName, ou, baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, initialUserDomainName, initialUserFirstName, initialUserLastName, initialUserPrimaryEmail, organizationCollation); + return CrmProvider.CreateOrganization(organizationId, organizationUniqueName, organizationFriendlyName, ou, baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, initialUserDomainName, initialUserFirstName, initialUserLastName, initialUserPrimaryEmail, organizationCollation, maxSize); } [WebMethod, SoapHeader("settings")] @@ -79,9 +79,9 @@ namespace WebsitePanel.Server } [WebMethod, SoapHeader("settings")] - public UserResult CreateCRMUser(OrganizationUser user, string orgName, Guid organizationId, Guid baseUnitId) + public UserResult CreateCRMUser(OrganizationUser user, string orgName, Guid organizationId, Guid baseUnitId, int CALType) { - return CrmProvider.CreateCRMUser(user, orgName, organizationId, baseUnitId); + return CrmProvider.CreateCRMUser(user, orgName, organizationId, baseUnitId, CALType); } [WebMethod, SoapHeader("settings")] @@ -107,6 +107,12 @@ namespace WebsitePanel.Server { return CrmProvider.SetUserRoles(orgName, userId, roles); } + + [WebMethod, SoapHeader("settings")] + public ResultObject SetUserCALType(string orgName, Guid userId, int CALType) + { + return CrmProvider.SetUserCALType(orgName, userId, CALType); + } [WebMethod, SoapHeader("settings")] public CrmUserResult GetCrmUserByDomainName(string domainName, string orgName) @@ -128,11 +134,22 @@ namespace WebsitePanel.Server } [WebMethod, SoapHeader("settings")] - public long GetUsedSpace(Guid organizationId) + public long GetDBSize(Guid organizationId) { - return CrmProvider.GetUsedSpace( organizationId); + return CrmProvider.GetDBSize(organizationId); } + [WebMethod, SoapHeader("settings")] + public long GetMaxDBSize(Guid organizationId) + { + return CrmProvider.GetMaxDBSize(organizationId); + } + + [WebMethod, SoapHeader("settings")] + public ResultObject SetMaxDBSize(Guid organizationId, long maxSize) + { + return CrmProvider.SetMaxDBSize(organizationId, maxSize); + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config index c9da1da8..ef870227 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config @@ -518,9 +518,10 @@ + - + 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 f17ec7ec..75af90cf 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -3326,7 +3326,7 @@ Max site storage, MB - CRM users per organization + Full licenses per organization CRM Organization @@ -5365,4 +5365,10 @@ Enterprise storage folder settings have been successfully updated. + + Limited licenses per organization + + + Max Database Size, MB + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/App_LocalResources/CRMStorageSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/App_LocalResources/CRMStorageSettings.ascx.resx new file mode 100644 index 00000000..9586cb73 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/App_LocalResources/CRMStorageSettings.ascx.resx @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Save + + + <p>Storage settings are used to limit the amount of storage available on a SharePoint site collection, and they are used to send e-mail alerts to the site administrator when a specified value of space is used.</p> + +<p>These settings will be applied to the new site collections only. By clicking "Save and Apply to All Site Collections" button you can override these settings for all existing site collections.</p> + +<p>Please note, that you cannot specify storage settings higher than defined in the space hosting plan.</p> + + + Reassign storage space (MB): + + + Send warning E-mail when site storage reaches (MB): + + + Storage Settings + + + Storage Settings + + + Storage Settings + + + Don't use + + + Do not send + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/App_LocalResources/CRMUsers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/App_LocalResources/CRMUsers.ascx.resx index a8bdd7d4..c0870120 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/App_LocalResources/CRMUsers.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/App_LocalResources/CRMUsers.ascx.resx @@ -130,7 +130,7 @@ There are no CRM users - Total users created + Full licenses : CRM Users diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx new file mode 100644 index 00000000..368d337a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx @@ -0,0 +1,74 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CRMStorageSettings.ascx.cs" Inherits="WebsitePanel.Portal.CRMStorageSettings" %> +<%@ Register Src="../ExchangeServer/UserControls/Breadcrumb.ascx" TagName="Breadcrumb" + TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" + TagPrefix="wsp" %> +<%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" + TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" + TagPrefix="wsp" %> + +<%@ Register Src="../ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> +<%@ Register src="../UserControls/QuotaEditor.ascx" tagname="QuotaEditor" tagprefix="uc1" %> + + + +
+
+
+ +
+
+ +
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + +
Current usage (MB): + of +
Reassign storage space (MB): + +
+
+
+ +
+ + +
+ +
+
+
+
+
\ 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 new file mode 100644 index 00000000..10ed1eb6 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx.cs @@ -0,0 +1,110 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal +{ + public partial class CRMStorageSettings : WebsitePanelModuleBase + { + public string SizeValueToString(long val) + { + return (val == -1) ? GetSharedLocalizedString("Text.Unlimited") : val.ToString(); + } + + protected void Page_Load(object sender, EventArgs e) + { + warningValue.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); + + if (!IsPostBack) + { + BindValues(); + } + } + + private void BindValues() + { + Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); + PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + + maxStorageSettingsValue.ParentQuotaValue = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; + + long maxDBSize = ES.Services.CRM.GetMaxDBSize(PanelRequest.ItemID, PanelSecurity.PackageId); + long DBSize = ES.Services.CRM.GetDBSize(PanelRequest.ItemID, PanelSecurity.PackageId); + + DBSize = DBSize > 0 ? DBSize = DBSize / (1024 * 1024) : DBSize; + maxDBSize = maxDBSize > 0 ? maxDBSize = maxDBSize / (1024 * 1024) : maxDBSize; + + maxStorageSettingsValue.QuotaValue = Convert.ToInt32(maxDBSize); + + lblDBSize.Text = SizeValueToString(DBSize); + lblMAXDBSize.Text = SizeValueToString(maxDBSize); + } + + private void Save() + { + try + { + PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + int limitSize = cntx.Quotas[Quotas.CRM_MAXDATABASESIZE].QuotaAllocatedValue; + + int maxSize = maxStorageSettingsValue.QuotaValue; + + if (limitSize != -1) + { + if (maxSize == -1) maxSize = limitSize; + if (maxSize > limitSize) maxSize = limitSize; + } + + if (maxSize > 0) + { + maxSize = maxSize * 1024 * 1024; + } + + ES.Services.CRM.SetMaxDBSize(PanelRequest.ItemID, PanelSecurity.PackageId, maxSize); + + messageBox.ShowSuccessMessage("HOSTED_SHAREPOINT_UPDATE_QUOTAS"); + + BindValues(); + } + catch (Exception) + { + messageBox.ShowErrorMessage("HOSTED_SHAREPOINT_UPDATE_QUOTAS"); + } + + } + + protected void btnSave_Click(object sender, EventArgs e) + { + Save(); + } + + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx.designer.cs new file mode 100644 index 00000000..f2b11cbd --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMStorageSettings.ascx.designer.cs @@ -0,0 +1,169 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class CRMStorageSettings { + + /// + /// breadcrumb control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb; + + /// + /// menu control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// secStorageLimits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secStorageLimits; + + /// + /// StorageLimits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel StorageLimits; + + /// + /// lblDBSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDBSize; + + /// + /// lblMAXDBSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMAXDBSize; + + /// + /// locMaxStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMaxStorage; + + /// + /// maxStorageSettingsValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor maxStorageSettingsValue; + + /// + /// locWarningStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locWarningStorage; + + /// + /// warningValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor warningValue; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx index cf976167..142dfecc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx @@ -49,6 +49,17 @@ onclick="btnActive_Click" meta:resourcekey="btnActivate" /> + + + + + + Full + Limited + + + +
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 4abc4a86..f4fae16d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx.cs @@ -58,6 +58,19 @@ namespace WebsitePanel.Portal.CRM lblDisplayName.Text = user.DisplayName; lblEmailAddress.Text = user.PrimaryEmailAddress; lblDomainName.Text = user.DomainUserName; + + int cALType = userResult.Value.CALType; + + switch (cALType) + { + case 0 : + case 2 : + ddlLicenseType.SelectedValue = cALType.ToString(); + break; + default: + ddlLicenseType.SelectedIndex = 0; + break; + } } else { @@ -103,7 +116,20 @@ namespace WebsitePanel.Portal.CRM ES.Services.CRM.SetUserRoles(PanelRequest.ItemID, PanelRequest.AccountID, PanelSecurity.PackageId, roles.ToArray()); - messageBox.ShowMessage(res, "UPDATE_CRM_USER_ROLES", "HostedCRM"); + + int CALType = 0; + int.TryParse(ddlLicenseType.SelectedValue, out CALType); + + ResultObject res2 = + ES.Services.CRM.SetUserCALType(PanelRequest.ItemID, PanelRequest.AccountID, PanelSecurity.PackageId, + CALType); + + if (!res2.IsSuccess) + messageBox.ShowErrorMessage("UPDATE_CRM_USER_ROLES"); + else if (!res.IsSuccess) + messageBox.ShowErrorMessage("UPDATE_CRM_USER_ROLES"); + else + messageBox.ShowMessage(res, "UPDATE_CRM_USER_ROLES", "HostedCRM"); } catch(Exception ex) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx.designer.cs index e8dd4ffe..d47d05f6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUserRoles.ascx.designer.cs @@ -1,10 +1,37 @@ -//------------------------------------------------------------------------------ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -166,6 +193,15 @@ namespace WebsitePanel.Portal.CRM { ///
protected global::System.Web.UI.WebControls.Button btnDeactivate; + /// + /// ddlLicenseType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlLicenseType; + /// /// gvRoles control. /// @@ -183,14 +219,5 @@ namespace WebsitePanel.Portal.CRM { /// To modify move field declaration from designer file to code-behind file. ///
protected global::System.Web.UI.WebControls.Button btnUpdate; - - /// - /// FormComments control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize FormComments; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx index 1c1c6874..5c2d27f9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx @@ -67,7 +67,6 @@
- -     - + + + + + + + + + + + +
+ + + +
+ + + +
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 76a0cafc..f5c2df3f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CRMUsers.ascx.cs @@ -48,10 +48,15 @@ namespace WebsitePanel.Portal.CRM OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID); int allocatedCrmUsers = stats.AllocatedCRMUsers; int usedUsers = stats.CreatedCRMUsers; + usersQuota.QuotaUsedValue = usedUsers; usersQuota.QuotaValue = allocatedCrmUsers; - if (stats.AllocatedCRMUsers != -1) usersQuota.QuotaAvailable = tenantStats.AllocatedCRMUsers - tenantStats.CreatedCRMUsers; + limitedusersQuota.QuotaUsedValue = stats.CreatedLimitedCRMUsers; + limitedusersQuota.QuotaValue = stats.AllocatedLimitedCRMUsers; + + //if (stats.AllocatedCRMUsers != -1) usersQuota.QuotaAvailable = tenantStats.AllocatedCRMUsers - tenantStats.CreatedCRMUsers; + //if (stats.AllocatedLimitedCRMUsers != -1) limitedusersQuota.QuotaAvailable = tenantStats.AllocatedLimitedCRMUsers - tenantStats.CreatedLimitedCRMUsers; } } 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 cf61fa51..26126601 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 @@ -1,4 +1,32 @@ -//------------------------------------------------------------------------------ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // @@ -157,12 +185,21 @@ namespace WebsitePanel.Portal.CRM { protected global::WebsitePanel.Portal.QuotaViewer usersQuota; /// - /// FormComments control. + /// locLimitedQuota control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Localize FormComments; + protected global::System.Web.UI.WebControls.Localize locLimitedQuota; + + /// + /// limitedusersQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaViewer limitedusersQuota; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx index f30119f1..8e4684d6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx @@ -38,6 +38,16 @@ + + + + + + Full + Limited + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx.cs index adf87b9d..08ce5473 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx.cs @@ -68,9 +68,12 @@ namespace WebsitePanel.Portal.CRM try { OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, accountId); - user.AccountId = accountId; + user.AccountId = accountId; - res = ES.Services.CRM.CreateCRMUser(user, PanelSecurity.PackageId, PanelRequest.ItemID, new Guid(ddlBusinessUnits.SelectedValue)); + int cALType = 0; + int.TryParse(ddlLicenseType.SelectedValue, out cALType); + + res = ES.Services.CRM.CreateCRMUser(user, PanelSecurity.PackageId, PanelRequest.ItemID, new Guid(ddlBusinessUnits.SelectedValue), cALType); if (res.IsSuccess) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx.designer.cs index 78fa45ac..96150de5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/CRM/CreateCRMUser.ascx.designer.cs @@ -1,10 +1,37 @@ -//------------------------------------------------------------------------------ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.1873 // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -94,6 +121,15 @@ namespace WebsitePanel.Portal.CRM { ///
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.UserSelector userSelector; + /// + /// ddlLicenseType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlLicenseType; + /// /// Localize2 control. /// @@ -129,14 +165,5 @@ namespace WebsitePanel.Portal.CRM { /// To modify move field declaration from designer file to code-behind file. ///
protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1; - - /// - /// FormComments control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize FormComments; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/CRMHelper.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/CRMHelper.cs index 7c8e1b8b..4cac8d0a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/CRMHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/CRMHelper.cs @@ -76,7 +76,7 @@ namespace WebsitePanel.Portal else email = filterValue; - IntResult res = ES.Services.CRM.GetCRMUserCount(itemId, name, email); + IntResult res = ES.Services.CRM.GetCRMUserCount(itemId, name, email, -1); return res.Value; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx index 721b1b58..0fa1a42f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx @@ -145,7 +145,7 @@ Contacts: - CRM Users: + Full licenses : Domain Names: diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx index e185d6c9..5f2977a1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx @@ -208,12 +208,28 @@ - + + + + + + + + + + + + + + + + + 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 c278ceff..3a9baf6e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs @@ -246,9 +246,18 @@ namespace WebsitePanel.Portal.ExchangeServer lnkCRMUsers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "crmusers", "SpaceID=" + PanelSecurity.PackageId); + lnkLimitedCRMUsers.NavigateUrl = lnkCRMUsers.NavigateUrl; + crmUsersStats.QuotaUsedValue = stats.CreatedCRMUsers; crmUsersStats.QuotaValue = stats.AllocatedCRMUsers; - if (stats.AllocatedCRMUsers != -1) crmUsersStats.QuotaAvailable = tenantStats.AllocatedCRMUsers - tenantStats.CreatedCRMUsers; + + //if (stats.AllocatedCRMUsers != -1) crmUsersStats.QuotaAvailable = tenantStats.AllocatedCRMUsers - tenantStats.CreatedCRMUsers; + + crmLimitedUsersStats.QuotaUsedValue = stats.CreatedLimitedCRMUsers; + crmLimitedUsersStats.QuotaValue = stats.AllocatedLimitedCRMUsers; + + crmDBSize.QuotaUsedValue = Convert.ToInt32( stats.UsedCRMDiskSpace>0 ? stats.UsedCRMDiskSpace/(1024*1024) : -1); + crmDBSize.QuotaValue = Convert.ToInt32(stats.AllocatedCRMDiskSpace>0 ? stats.AllocatedCRMDiskSpace/(1024*1024) : -1); } private void BindOCSStats(OrganizationStatistics stats, OrganizationStatistics tenantStats) 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 d0499904..9e60be2f 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 @@ -535,6 +535,42 @@ namespace WebsitePanel.Portal.ExchangeServer { ///
protected global::WebsitePanel.Portal.QuotaViewer crmUsersStats; + /// + /// lnkLimitedCRMUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink lnkLimitedCRMUsers; + + /// + /// crmLimitedUsersStats control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaViewer crmLimitedUsersStats; + + /// + /// locCRMDBSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCRMDBSize; + + /// + /// crmDBSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaViewer crmDBSize; + /// /// enterpriseStorageStatsPanel control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs index 5a724a8b..8c908a40 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs @@ -193,6 +193,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls crmGroup.MenuItems.Add(CreateMenuItem("CRMOrganization", "CRMOrganizationDetails")); crmGroup.MenuItems.Add(CreateMenuItem("CRMUsers", "CRMUsers")); + crmGroup.MenuItems.Add(CreateMenuItem("StorageLimits", "crm_storage_settings")); if (crmGroup.MenuItems.Count > 0) groups.Add(crmGroup);