Add service levels quota view to space stats & org stats pages. Change quota type.

Expand collapsible panel when user have level id on user settings page.
This commit is contained in:
vfedosevich 2014-09-23 18:15:36 +03:00
parent 243c065ebb
commit b5444f10ec
10 changed files with 334 additions and 60 deletions

View file

@ -219,4 +219,7 @@
<data name="locEnterpriseStorage.Text" xml:space="preserve">
<value>Enterprise Storage</value>
</data>
<data name="locServiceLevels.Text" xml:space="preserve">
<value>Service Levels</value>
</data>
</root>

View file

@ -315,6 +315,14 @@
</td>
</tr>
</asp:Panel>
<asp:Panel runat="server" ID="serviceLevelsStatsPanel">
<tr>
<td class="OrgStatsGroup" width="100%" colspan="2">
<asp:Localize ID="locServiceLevels" runat="server" meta:resourcekey="locServiceLevels" ></asp:Localize>
</td>
</tr>
</asp:Panel>
</table>
</div>

View file

@ -27,6 +27,8 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution;
@ -279,6 +281,14 @@ namespace WebsitePanel.Portal.ExchangeServer
}
else
enterpriseStorageStatsPanel.Visible = false;
if (cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels))
{
serviceLevelsStatsPanel.Visible = true;
BindServiceLevelsStats(cntx);
}
else
serviceLevelsStatsPanel.Visible = false;
}
private void BindCRMStats(OrganizationStatistics stats, OrganizationStatistics tenantStats)
@ -379,5 +389,40 @@ namespace WebsitePanel.Portal.ExchangeServer
"SpaceID=" + PanelSecurity.PackageId.ToString());
}
private void BindServiceLevelsStats(PackageContext cntx)
{
foreach (var quota in Array.FindAll<QuotaValueInfo>(
cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS)))
{
HtmlTableRow tr = new HtmlTableRow();
tr.Attributes["class"] = "OrgStatsRow";
HtmlTableCell col1 = new HtmlTableCell();
col1.Attributes["class"] = "OrgStatsQuota";
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;
col1.Controls.Add(link);
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;
if (quota.QuotaAllocatedValue != -1)
quotaControl.QuotaAvailable = quota.QuotaAllocatedValue - quota.QuotaUsedValue;
col2.Controls.Add(quotaControl);
tr.Controls.Add(col1);
tr.Controls.Add(col2);
serviceLevelsStatsPanel.Controls.Add(tr);
}
}
}
}

View file

@ -740,5 +740,23 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer enterpriseStorageFoldersStats;
/// <summary>
/// serviceLevelsStatsPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel serviceLevelsStatsPanel;
/// <summary>
/// locServiceLevels control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locServiceLevels;
}
}

View file

@ -128,6 +128,8 @@ namespace WebsitePanel.Portal.HostedSolution
if (user.LevelId > 0 && secServiceLevels.Visible)
{
secServiceLevels.IsCollapsed = false;
ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(user.LevelId);
bool addLevel = ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()) == null;