diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs index 63e6d81b..72ba9403 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs @@ -345,7 +345,14 @@ namespace WebsitePanel.EnterpriseServer return new SystemFile[0]; } - EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId)); + int serviceId = GetEnterpriseStorageServiceID(org.PackageId); + + if (serviceId == 0) + { + return new SystemFile[0]; + } + + EnterpriseStorage es = GetEnterpriseStorage(serviceId); return es.GetFolders(org.OrganizationId); } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index 4239f90a..5f256df8 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -960,7 +960,10 @@ namespace WebsitePanel.EnterpriseServer SystemFile[] folders = EnterpriseStorageController.GetFolders(itemId); stats.CreatedEnterpriseStorageFolders = folders.Count(); + stats.UsedEnterpriseStorageSpace = (int)folders.Sum(x => x.Size); + + stats.AllocatedEnterpriseStorageSpace = folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB); } } else @@ -1020,10 +1023,13 @@ namespace WebsitePanel.EnterpriseServer if (cntxTmp.Groups.ContainsKey(ResourceGroups.EnterpriseStorage)) { - SystemFile[] folders = EnterpriseStorageController.GetFolders(itemId); + SystemFile[] folders = EnterpriseStorageController.GetFolders(o.Id); - stats.CreatedEnterpriseStorageFolders = folders.Count(); - stats.UsedEnterpriseStorageSpace = (int)folders.Sum(x => x.Size); + stats.CreatedEnterpriseStorageFolders += folders.Count(); + + stats.UsedEnterpriseStorageSpace += (int)folders.Sum(x => x.Size); + + stats.AllocatedEnterpriseStorageSpace += folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB); } } } @@ -1069,12 +1075,6 @@ namespace WebsitePanel.EnterpriseServer stats.AllocatedEnterpriseStorageFolders = cntx.Quotas[Quotas.ENTERPRISESTORAGE_FOLDERS].QuotaAllocatedValue; } - - if (cntx.Groups.ContainsKey(ResourceGroups.EnterpriseStorage)) - { - stats.AllocatedEnterpriseStorageSpace = cntx.Quotas[Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE].QuotaAllocatedValue; - } - return stats; } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs index 20278f65..15661b8d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs @@ -238,6 +238,18 @@ namespace WebsitePanel.Providers.OS return result; } + public int ConvertBytesToGB(long bytes) + { + int OneKb = 1024; + int OneMb = OneKb * 1024; + int OneGb = OneMb * 1024; + + if (bytes == 0) + return 0; + + return (int)(bytes / OneGb); + } + public int ConvertBytesToMB(long bytes) { int OneKb = 1024; @@ -246,7 +258,7 @@ namespace WebsitePanel.Providers.OS if (bytes == 0) return 0; - return (int)bytes / OneMb; + return (int)(bytes / OneMb); } public void RemoveOldQuotaOnFolder(Runspace runSpace, string path) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx index 677983cb..51c7df40 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx @@ -148,7 +148,7 @@ Folder Url: - Folder Limit Size (Mb): + Folder Limit Size (Gb): * diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolders.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolders.ascx.resx index 0dd3e88c..10ddae15 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolders.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolders.ascx.resx @@ -135,7 +135,7 @@ - + Total Folders Allocated: @@ -153,4 +153,7 @@ Url + + Total Space Allocated (Mb): + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx index b161524d..2c40cb7f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx @@ -36,7 +36,7 @@ - +
- +     +
+
+ + +     + 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 6695ba5b..155965b4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolders.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolders.ascx.cs @@ -80,6 +80,10 @@ namespace WebsitePanel.Portal.ExchangeServer btnAddFolder.Enabled = false; } } + + spaceQuota.QuotaUsedValue = organizationStats.UsedEnterpriseStorageSpace; + + spaceQuota.QuotaValue = organizationStats.AllocatedEnterpriseStorageSpace; } protected void btnAddFolder_Click(object sender, EventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolders.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolders.ascx.designer.cs index 841ed74b..1c51165e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolders.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolders.ascx.designer.cs @@ -1,31 +1,3 @@ -// 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. @@ -167,13 +139,13 @@ namespace WebsitePanel.Portal.ExchangeServer { protected global::System.Web.UI.WebControls.ObjectDataSource odsEnterpriseFoldersPaged; /// - /// locQuota control. + /// locQuotaFolders control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Localize locQuota; + protected global::System.Web.UI.WebControls.Localize locQuotaFolders; /// /// foldersQuota control. @@ -183,5 +155,23 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::WebsitePanel.Portal.QuotaViewer foldersQuota; + + /// + /// locQuotaSpace control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locQuotaSpace; + + /// + /// spaceQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaViewer spaceQuota; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx index 2f524d94..86659c0e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx @@ -251,7 +251,7 @@ - + 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 68aa14f4..91f8422f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs @@ -150,7 +150,6 @@ namespace WebsitePanel.Portal.ExchangeServer if (!hideItems) { - domainStats.QuotaUsedValue = orgStats.CreatedDomains; domainStats.QuotaValue = orgStats.AllocatedDomains; if (orgStats.AllocatedDomains != -1) domainStats.QuotaAvailable = tenantStats.AllocatedDomains - tenantStats.CreatedDomains; @@ -170,9 +169,6 @@ namespace WebsitePanel.Portal.ExchangeServer else organizationStatsPanel.Visible = false; - - - if (cntx.Groups.ContainsKey(ResourceGroups.Exchange)) { @@ -300,14 +296,18 @@ namespace WebsitePanel.Portal.ExchangeServer private void BindEnterpriseStorageStats(OrganizationStatistics stats, OrganizationStatistics tenantStats) { - enterpriseStorageSpaceStats.QuotaValue = stats.UsedEnterpriseStorageSpace; + enterpriseStorageSpaceStats.QuotaValue = stats.AllocatedEnterpriseStorageSpace; + enterpriseStorageSpaceStats.QuotaUsedValue = stats.UsedEnterpriseStorageSpace; lnkBESUsers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "enterprisestorage_folders", "SpaceID=" + PanelSecurity.PackageId.ToString()); enterpriseStorageFoldersStats.QuotaValue = stats.AllocatedEnterpriseStorageFolders; enterpriseStorageFoldersStats.QuotaUsedValue = stats.CreatedEnterpriseStorageFolders; - if (stats.AllocatedEnterpriseStorageFolders != -1) enterpriseStorageFoldersStats.QuotaAvailable = tenantStats.AllocatedEnterpriseStorageFolders - tenantStats.CreatedEnterpriseStorageFolders; + if (stats.AllocatedEnterpriseStorageFolders != -1) + { + enterpriseStorageFoldersStats.QuotaAvailable = tenantStats.AllocatedEnterpriseStorageFolders - tenantStats.CreatedEnterpriseStorageFolders; + } lnkBESUsers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "enterprisestorage_folders", "SpaceID=" + PanelSecurity.PackageId.ToString());