diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/ServiceLevelQuotaValueInfo.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/ServiceLevelQuotaValueInfo.cs new file mode 100644 index 00000000..02ef703a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/ServiceLevelQuotaValueInfo.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2014, 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 System.Collections.Generic; +using System.Text; + +namespace WebsitePanel.EnterpriseServer +{ + public class ServiceLevelQuotaValueInfo + { + public int QuotaValue { get; set; } + public string QuotaDescription { get; set; } + public string QuotaName { get; set; } + public int QuotaTypeId { get; set; } + public int QuotaUsedValue { get; set; } + public int QuotaAvailable { get; set; } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj index 7ce9ade3..c4c1bc7a 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj @@ -121,6 +121,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin index 0559387a..a6c5e672 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin @@ -36,6 +36,7 @@ Default skin template. The following skins are provided as examples only. + <%-- Exchange Icons --%> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx index 225d2f8d..77f97218 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx @@ -21,6 +21,8 @@ - + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs index 3559990d..d79d614f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs @@ -172,6 +172,17 @@ namespace WebsitePanel.Portal.ExchangeServer archivingQuotaViewer.QuotaValue = ArchivingMaxSize; rowArchiving.Visible = chkEnableArchiving.Checked; + if (account.LevelId > 0 && Cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) + { + WebsitePanel.EnterpriseServer.Base.HostedSolution.ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(account.LevelId); + + litServiceLevel.Visible = true; + litServiceLevel.Text = serviceLevel.LevelName; + litServiceLevel.ToolTip = serviceLevel.LevelDescription; + + } + imgVipUser.Visible = account.IsVIP && Cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels); + } catch (Exception ex) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs index d1b0530d..9f3029a2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs @@ -39,6 +39,24 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::System.Web.UI.WebControls.Literal litDisplayName; + /// + /// imgVipUser control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgVipUser; + + /// + /// litServiceLevel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label litServiceLevel; + /// /// tabs control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx index ee7a1c81..bbeb8e4f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx @@ -112,10 +112,26 @@
- -     - - +
+ +     + +
+ + + +
+
+ +     + +
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs index b3fa7da7..1874f821 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs @@ -32,6 +32,7 @@ using System.Web.UI.WebControls; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.EnterpriseServer; using WebsitePanel.EnterpriseServer.Base.HostedSolution; +using System.Collections.Generic; namespace WebsitePanel.Portal.ExchangeServer { @@ -55,6 +56,8 @@ namespace WebsitePanel.Portal.ExchangeServer btnCreateMailbox.Visible = !ArchivingBoxes; + cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + if (!IsPostBack) { BindStats(); @@ -62,7 +65,7 @@ namespace WebsitePanel.Portal.ExchangeServer BindServiceLevels(); - cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER)) { if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) @@ -87,6 +90,35 @@ namespace WebsitePanel.Portal.ExchangeServer mailboxesQuota.QuotaUsedValue = stats.CreatedMailboxes; mailboxesQuota.QuotaValue = stats.AllocatedMailboxes; if (stats.AllocatedMailboxes != -1) mailboxesQuota.QuotaAvailable = tenantStats.AllocatedMailboxes - tenantStats.CreatedMailboxes; + + if (cntx != null && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) BindServiceLevelsStats(); + } + + private void BindServiceLevelsStats() + { + ServiceLevels = ES.Services.Organizations.GetSupportServiceLevels(); + OrganizationUser[] accounts = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID, "", "", "", true); + + List serviceLevelQuotas = new List(); + foreach (var quota in Array.FindAll( + cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS))) + { + int levelId = ServiceLevels.Where(x => x.LevelName == quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "")).FirstOrDefault().LevelId; + int usedInOrgCount = accounts.Where(x => x.LevelId == levelId).Count(); + + serviceLevelQuotas.Add(new ServiceLevelQuotaValueInfo + { + QuotaName = quota.QuotaName, + QuotaDescription = quota.QuotaDescription + " in this Organization:", + QuotaTypeId = quota.QuotaTypeId, + QuotaValue = quota.QuotaAllocatedValue, + QuotaUsedValue = usedInOrgCount, + //QuotaUsedValue = quota.QuotaUsedValue, + QuotaAvailable = quota.QuotaAllocatedValue - quota.QuotaUsedValue + }); + } + dlServiceLevelQuotas.DataSource = serviceLevelQuotas; + dlServiceLevelQuotas.DataBind(); } protected void btnCreateMailbox_Click(object sender, EventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.designer.cs index e9cf4b0a..6e9b50b4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.designer.cs @@ -137,5 +137,14 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::WebsitePanel.Portal.QuotaViewer mailboxesQuota; + + /// + /// dlServiceLevelQuotas control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Repeater dlServiceLevelQuotas; } } 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 fdbf2648..1bc84bc7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs @@ -27,6 +27,7 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Linq; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using WebsitePanel.EnterpriseServer; @@ -391,6 +392,9 @@ namespace WebsitePanel.Portal.ExchangeServer private void BindServiceLevelsStats(PackageContext cntx) { + WebsitePanel.EnterpriseServer.Base.HostedSolution.ServiceLevel[] serviceLevels = ES.Services.Organizations.GetSupportServiceLevels(); + OrganizationUser[] accounts = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID, "", "", "", true); + foreach (var quota in Array.FindAll( cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS))) { @@ -401,17 +405,21 @@ namespace WebsitePanel.Portal.ExchangeServer col1.Attributes["nowrap"] = "nowrap"; HyperLink link = new HyperLink(); link.ID = "lnk_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim(); - link.Text = quota.QuotaDescription; + link.Text = quota.QuotaDescription.Replace(", users", " (users):"); col1.Controls.Add(link); + int levelId = serviceLevels.Where(x => x.LevelName == quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "")).FirstOrDefault().LevelId; + int usedInOrgCount = accounts.Where(x => x.LevelId == levelId).Count(); + HtmlTableCell col2 = new HtmlTableCell(); QuotaViewer quotaControl = (QuotaViewer)LoadControl("../UserControls/QuotaViewer.ascx"); quotaControl.ID = quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim() + "Stats"; quotaControl.QuotaTypeId = quota.QuotaTypeId; quotaControl.DisplayGauge = true; quotaControl.QuotaValue = quota.QuotaAllocatedValue; - quotaControl.QuotaUsedValue = quota.QuotaUsedValue; + quotaControl.QuotaUsedValue = usedInOrgCount; + //quotaControl.QuotaUsedValue = quota.QuotaUsedValue; if (quota.QuotaAllocatedValue != -1) quotaControl.QuotaAvailable = quota.QuotaAllocatedValue - quota.QuotaUsedValue; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx index 626b45c7..cd770aea 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx @@ -28,6 +28,8 @@ - + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs index ffc955e2..865e8665 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs @@ -132,6 +132,10 @@ namespace WebsitePanel.Portal.HostedSolution ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(user.LevelId); + litServiceLevel.Visible = true; + litServiceLevel.Text = serviceLevel.LevelName; + litServiceLevel.ToolTip = serviceLevel.LevelDescription; + bool addLevel = ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()) == null; addLevel = addLevel && cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName); @@ -152,6 +156,7 @@ namespace WebsitePanel.Portal.HostedSolution } } chkVIP.Checked = user.IsVIP && secServiceLevels.Visible; + imgVipUser.Visible = user.IsVIP && secServiceLevels.Visible; if (cntx.Quotas.ContainsKey(Quotas.ORGANIZATION_ALLOWCHANGEUPN)) @@ -242,7 +247,7 @@ namespace WebsitePanel.Portal.HostedSolution { foreach (var serviceLevel in ES.Services.Organizations.GetSupportServiceLevels()) { - if (quota.Key.Replace(Quotas.SERVICE_LEVELS, "") == serviceLevel.LevelName && CheckServiceLevelQuota(quota.Value, serviceLevel.LevelId)) + if (quota.Key.Replace(Quotas.SERVICE_LEVELS, "") == serviceLevel.LevelName && CheckServiceLevelQuota(quota.Value)) { enabledServiceLevels.Add(serviceLevel); } @@ -263,9 +268,8 @@ namespace WebsitePanel.Portal.HostedSolution } - private bool CheckServiceLevelQuota(QuotaValueInfo quota, int levelID) + private bool CheckServiceLevelQuota(QuotaValueInfo quota) { - quota.QuotaUsedValue = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID, "", "", "", true).Where(x => x.LevelId == levelID).Count(); if (quota.QuotaAllocatedValue != -1) { @@ -329,6 +333,18 @@ namespace WebsitePanel.Portal.HostedSolution if (!chkLocked.Checked) chkLocked.Enabled = false; + litServiceLevel.Visible = !string.IsNullOrEmpty(ddlServiceLevels.SelectedValue) && secServiceLevels.Visible; + if (litServiceLevel.Visible) + { + ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(int.Parse(ddlServiceLevels.SelectedValue)); + + litServiceLevel.Text = serviceLevel.LevelName; + litServiceLevel.ToolTip = serviceLevel.LevelDescription; + } + + imgVipUser.Visible = chkVIP.Checked && secServiceLevels.Visible; + + messageBox.ShowSuccessMessage("ORGANIZATION_UPDATE_USER_SETTINGS"); } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.designer.cs index a68bb55e..fef1a739 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.designer.cs @@ -48,6 +48,24 @@ namespace WebsitePanel.Portal.HostedSolution { /// protected global::System.Web.UI.WebControls.Literal litDisplayName; + /// + /// imgVipUser control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgVipUser; + + /// + /// litServiceLevel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label litServiceLevel; + /// /// UserTabsId control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx index 6b8ba886..db8ee8fa 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx @@ -109,9 +109,26 @@
- -     - +
+ +     + +
+ + +
+
+ +     + +
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs index 1d9941bb..6c15a98a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs @@ -43,6 +43,8 @@ namespace WebsitePanel.Portal.HostedSolution protected void Page_Load(object sender, EventArgs e) { + cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + if (!IsPostBack) { BindStats(); @@ -50,7 +52,6 @@ namespace WebsitePanel.Portal.HostedSolution BindServiceLevels(); - cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER)) { if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) @@ -74,6 +75,32 @@ namespace WebsitePanel.Portal.HostedSolution usersQuota.QuotaUsedValue = stats.CreatedUsers; usersQuota.QuotaValue = stats.AllocatedUsers; if (stats.AllocatedUsers != -1) usersQuota.QuotaAvailable = tenantStats.AllocatedUsers - tenantStats.CreatedUsers; + + if(cntx != null && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) BindServiceLevelsStats(); + } + + private void BindServiceLevelsStats() + { + ServiceLevels = ES.Services.Organizations.GetSupportServiceLevels(); + OrganizationUser[] accounts = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID, "", "", "", true); + + List serviceLevelQuotas = new List(); + foreach (var quota in Array.FindAll( + cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS))) + { + int levelId = ServiceLevels.Where(x => x.LevelName == quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "")).FirstOrDefault().LevelId; + int usedInOrgCount = accounts.Where(x => x.LevelId == levelId).Count(); + + serviceLevelQuotas.Add(new ServiceLevelQuotaValueInfo { QuotaName = quota.QuotaName, + QuotaDescription = quota.QuotaDescription + " in this Organization:", + QuotaTypeId = quota.QuotaTypeId, + QuotaValue = quota.QuotaAllocatedValue, + QuotaUsedValue = usedInOrgCount, + //QuotaUsedValue = quota.QuotaUsedValue, + QuotaAvailable = quota.QuotaAllocatedValue - quota.QuotaUsedValue }); + } + dlServiceLevelQuotas.DataSource = serviceLevelQuotas; + dlServiceLevelQuotas.DataBind(); } protected void btnCreateUser_Click(object sender, EventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.designer.cs index d23d75f5..e894471a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.designer.cs @@ -137,5 +137,14 @@ namespace WebsitePanel.Portal.HostedSolution { /// To modify move field declaration from designer file to code-behind file. /// protected global::WebsitePanel.Portal.QuotaViewer usersQuota; + + /// + /// dlServiceLevelQuotas control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Repeater dlServiceLevelQuotas; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx index 03bc7e38..0a26c445 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx @@ -19,6 +19,8 @@ - + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.cs index 33301c5f..31730a93 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.cs @@ -118,6 +118,22 @@ namespace WebsitePanel.Portal.Lync lyncUserSettings.sipAddress = lyncUser.SipAddress; Utils.SelectListItem(ddlPhoneNumber, lyncUser.LineUri); + + PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + + OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, + PanelRequest.AccountID); + + if (user.LevelId > 0 && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) + { + WebsitePanel.EnterpriseServer.Base.HostedSolution.ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(user.LevelId); + + litServiceLevel.Visible = true; + litServiceLevel.Text = serviceLevel.LevelName; + litServiceLevel.ToolTip = serviceLevel.LevelDescription; + + } + imgVipUser.Visible = user.IsVIP && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels); } protected bool SaveSettings() diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs index b693419b..d267ff41 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs @@ -1,32 +1,4 @@ -// Copyright (c) 2014, 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. // @@ -76,6 +48,24 @@ namespace WebsitePanel.Portal.Lync { /// protected global::System.Web.UI.WebControls.Literal litDisplayName; + /// + /// imgVipUser control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgVipUser; + + /// + /// litServiceLevel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label litServiceLevel; + /// /// messageBox control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs index c6a1b520..c2e0dc9e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs @@ -178,46 +178,6 @@ namespace WebsitePanel.Portal } } - //private void AddServiceLevelsQuotas() - //{ - // foreach(var quota in Array.FindAll( - // cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS))) - // { - // HtmlGenericControl tr = new HtmlGenericControl(); - // tr.ID = "pnl_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, ""); - // tr.TagName = "tr"; - - // HtmlGenericControl col1 = new HtmlGenericControl(); - // col1.TagName = "td"; - // col1.Attributes["class"] = "SubHead"; - // col1.Attributes["nowrap"] = "nowrap"; - // Label lbl = new Label(); - // lbl.ID = "lbl_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, ""); - // lbl.Text = quota.QuotaDescription; - // col1.Controls.Add(lbl); - - // HtmlGenericControl col2 = new HtmlGenericControl(); - // col2.TagName = "td"; - // col2.Attributes["class"] = "Normal"; - // //Quota quotaControl = new Quota(); - // // quotaControl.ID = "quota_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, ""); - // // quotaControl.QuotaName = quota.QuotaName; - // // quotaControl.Viewer = new QuotaViewer(); - // // quotaControl.DisplayGauge = true; - // col2.InnerHtml = string.Format( - // "", - // "quota_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, ""), - // quota.QuotaName); - // //col2.Controls.Add(quotaControl); - - // tr.Controls.Add(col1); - // tr.Controls.Add(col2); - // tblQuotas.Controls.Add((Control)tr); - - // Control c1 = new Control(); - // } - //} - private void AddServiceLevelsQuotas() { foreach (var quota in Array.FindAll(