diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs index 1b6dcf55..a64f9834 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs @@ -56,7 +56,6 @@ namespace WebsitePanel.EnterpriseServer [System.Xml.Serialization.XmlIncludeAttribute(typeof(ServiceProviderItem))] public partial class esEnterpriseStorage : Microsoft.Web.Services3.WebServicesClientProtocol { - private System.Threading.SendOrPostCallback CheckFileServicesInstallationOperationCompleted; private System.Threading.SendOrPostCallback GetEnterpriseFoldersOperationCompleted; @@ -89,6 +88,10 @@ namespace WebsitePanel.EnterpriseServer private System.Threading.SendOrPostCallback SetEnterpriseFolderSettingsOperationCompleted; + private System.Threading.SendOrPostCallback GetStatisticsOperationCompleted; + + private System.Threading.SendOrPostCallback GetStatisticsByOrganizationOperationCompleted; + /// public esEnterpriseStorage() { @@ -143,6 +146,12 @@ namespace WebsitePanel.EnterpriseServer /// public event SetEnterpriseFolderSettingsCompletedEventHandler SetEnterpriseFolderSettingsCompleted; + /// + public event GetStatisticsCompletedEventHandler GetStatisticsCompleted; + + /// + public event GetStatisticsByOrganizationCompletedEventHandler GetStatisticsByOrganizationCompleted; + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/CheckFileServicesInstallation", 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 bool CheckFileServicesInstallation(int serviceId) @@ -999,6 +1008,104 @@ namespace WebsitePanel.EnterpriseServer } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetStatistics", 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 OrganizationStatistics GetStatistics(int itemId) + { + object[] results = this.Invoke("GetStatistics", new object[] { + itemId}); + return ((OrganizationStatistics)(results[0])); + } + + /// + public System.IAsyncResult BeginGetStatistics(int itemId, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetStatistics", new object[] { + itemId}, callback, asyncState); + } + + /// + public OrganizationStatistics EndGetStatistics(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((OrganizationStatistics)(results[0])); + } + + /// + public void GetStatisticsAsync(int itemId) + { + this.GetStatisticsAsync(itemId, null); + } + + /// + public void GetStatisticsAsync(int itemId, object userState) + { + if ((this.GetStatisticsOperationCompleted == null)) + { + this.GetStatisticsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetStatisticsOperationCompleted); + } + this.InvokeAsync("GetStatistics", new object[] { + itemId}, this.GetStatisticsOperationCompleted, userState); + } + + private void OnGetStatisticsOperationCompleted(object arg) + { + if ((this.GetStatisticsCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetStatisticsCompleted(this, new GetStatisticsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetStatisticsByOrganization", 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 OrganizationStatistics GetStatisticsByOrganization(int itemId) + { + object[] results = this.Invoke("GetStatisticsByOrganization", new object[] { + itemId}); + return ((OrganizationStatistics)(results[0])); + } + + /// + public System.IAsyncResult BeginGetStatisticsByOrganization(int itemId, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetStatisticsByOrganization", new object[] { + itemId}, callback, asyncState); + } + + /// + public OrganizationStatistics EndGetStatisticsByOrganization(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((OrganizationStatistics)(results[0])); + } + + /// + public void GetStatisticsByOrganizationAsync(int itemId) + { + this.GetStatisticsByOrganizationAsync(itemId, null); + } + + /// + public void GetStatisticsByOrganizationAsync(int itemId, object userState) + { + if ((this.GetStatisticsByOrganizationOperationCompleted == null)) + { + this.GetStatisticsByOrganizationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetStatisticsByOrganizationOperationCompleted); + } + this.InvokeAsync("GetStatisticsByOrganization", new object[] { + itemId}, this.GetStatisticsByOrganizationOperationCompleted, userState); + } + + private void OnGetStatisticsByOrganizationOperationCompleted(object arg) + { + if ((this.GetStatisticsByOrganizationCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetStatisticsByOrganizationCompleted(this, new GetStatisticsByOrganizationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// public new void CancelAsync(object userState) { @@ -1007,11 +1114,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void CheckFileServicesInstallationCompletedEventHandler(object sender, CheckFileServicesInstallationCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class CheckFileServicesInstallationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1037,11 +1144,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void GetEnterpriseFoldersCompletedEventHandler(object sender, GetEnterpriseFoldersCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetEnterpriseFoldersCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1067,11 +1174,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void GetEnterpriseFolderCompletedEventHandler(object sender, GetEnterpriseFolderCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetEnterpriseFolderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1097,11 +1204,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void CreateEnterpriseFolderCompletedEventHandler(object sender, CreateEnterpriseFolderCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class CreateEnterpriseFolderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1127,11 +1234,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void DeleteEnterpriseFolderCompletedEventHandler(object sender, DeleteEnterpriseFolderCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class DeleteEnterpriseFolderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1157,11 +1264,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void GetEnterpriseFolderPermissionsCompletedEventHandler(object sender, GetEnterpriseFolderPermissionsCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetEnterpriseFolderPermissionsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1187,11 +1294,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void SetEnterpriseFolderPermissionsCompletedEventHandler(object sender, SetEnterpriseFolderPermissionsCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class SetEnterpriseFolderPermissionsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1217,11 +1324,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void SearchESAccountsCompletedEventHandler(object sender, SearchESAccountsCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class SearchESAccountsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1247,11 +1354,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void GetEnterpriseFoldersPagedCompletedEventHandler(object sender, GetEnterpriseFoldersPagedCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetEnterpriseFoldersPagedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1277,11 +1384,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void RenameEnterpriseFolderCompletedEventHandler(object sender, RenameEnterpriseFolderCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class RenameEnterpriseFolderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1307,11 +1414,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void CreateEnterpriseStorageCompletedEventHandler(object sender, CreateEnterpriseStorageCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class CreateEnterpriseStorageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1337,11 +1444,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void CheckEnterpriseStorageInitializationCompletedEventHandler(object sender, CheckEnterpriseStorageInitializationCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class CheckEnterpriseStorageInitializationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1367,11 +1474,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void CheckUsersDomainExistsCompletedEventHandler(object sender, CheckUsersDomainExistsCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class CheckUsersDomainExistsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1397,11 +1504,11 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void GetDirectoryBrowseEnabledCompletedEventHandler(object sender, GetDirectoryBrowseEnabledCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetDirectoryBrowseEnabledCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs @@ -1427,10 +1534,70 @@ namespace WebsitePanel.EnterpriseServer } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void SetDirectoryBrowseEnabledCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] public delegate void SetEnterpriseFolderSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] + public delegate void GetStatisticsCompletedEventHandler(object sender, GetStatisticsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetStatisticsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetStatisticsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public OrganizationStatistics Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((OrganizationStatistics)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] + public delegate void GetStatisticsByOrganizationCompletedEventHandler(object sender, GetStatisticsByOrganizationCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetStatisticsByOrganizationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetStatisticsByOrganizationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public OrganizationStatistics Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((OrganizationStatistics)(this.results[0])); + } + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs index ad9ed437..bc333377 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs @@ -1040,5 +1040,85 @@ namespace WebsitePanel.EnterpriseServer return null; } + + #region Statistics + + public static OrganizationStatistics GetStatistics(int itemId) + { + return GetStatisticsInternal(itemId, false); + } + + public static OrganizationStatistics GetStatisticsByOrganization(int itemId) + { + return GetStatisticsInternal(itemId, true); + } + + private static OrganizationStatistics GetStatisticsInternal(int itemId, bool byOrganization) + { + // place log record + TaskManager.StartTask("ENTERPRISE_STORAGE", "GET_ORG_STATS", itemId); + + try + { + Organization org = (Organization)PackageController.GetPackageItem(itemId); + if (org == null) + return null; + + OrganizationStatistics stats = new OrganizationStatistics(); + + if (byOrganization) + { + SystemFile[] folders = GetFolders(itemId); + + stats.CreatedEnterpriseStorageFolders = folders.Count(); + + stats.UsedEnterpriseStorageSpace = folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB); + } + else + { + UserInfo user = ObjectUtils.FillObjectFromDataReader(DataProvider.GetUserByExchangeOrganizationIdInternally(org.Id)); + List Packages = PackageController.GetPackages(user.UserId); + + if ((Packages != null) & (Packages.Count > 0)) + { + foreach (PackageInfo Package in Packages) + { + List orgs = null; + + orgs = ExchangeServerController.GetExchangeOrganizations(Package.PackageId, false); + + if ((orgs != null) & (orgs.Count > 0)) + { + foreach (Organization o in orgs) + { + SystemFile[] folders = GetFolders(o.Id); + + stats.CreatedEnterpriseStorageFolders += folders.Count(); + + stats.UsedEnterpriseStorageSpace += folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB); + } + } + } + } + } + + // allocated quotas + PackageContext cntx = PackageController.GetPackageContext(org.PackageId); + stats.AllocatedEnterpriseStorageSpace = cntx.Quotas[Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE].QuotaAllocatedValue; + stats.AllocatedEnterpriseStorageFolders = cntx.Quotas[Quotas.ENTERPRISESTORAGE_FOLDERS].QuotaAllocatedValue; + + return stats; + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + } + + #endregion } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs index e89987b6..bfa15387 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs @@ -158,5 +158,21 @@ namespace WebsitePanel.EnterpriseServer } #endregion + + #region Statistics + + [WebMethod] + public OrganizationStatistics GetStatistics(int itemId) + { + return EnterpriseStorageController.GetStatistics(itemId); + } + + [WebMethod] + public OrganizationStatistics GetStatisticsByOrganization(int itemId) + { + return EnterpriseStorageController.GetStatisticsByOrganization(itemId); + } + + #endregion } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolders.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolders.ascx.cs index 0d5b1a75..fa4e1e50 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolders.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolders.ascx.cs @@ -76,8 +76,8 @@ namespace WebsitePanel.Portal.ExchangeServer { btnAddFolder.Enabled = true; - OrganizationStatistics organizationStats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID); - OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID); + OrganizationStatistics organizationStats = ES.Services.EnterpriseStorage.GetStatisticsByOrganization/*ES.Services.Organizations.GetOrganizationStatisticsByOrganization*/(PanelRequest.ItemID); + OrganizationStatistics tenantStats = ES.Services.EnterpriseStorage.GetStatistics/*ES.Services.Organizations.GetOrganizationStatistics*/(PanelRequest.ItemID); foldersQuota.QuotaUsedValue = organizationStats.CreatedEnterpriseStorageFolders; foldersQuota.QuotaValue = organizationStats.AllocatedEnterpriseStorageFolders;