This commit is contained in:
Virtuworks 2014-09-25 07:52:18 -04:00
commit 2f07f48623
20 changed files with 282 additions and 83 deletions

View file

@ -21,6 +21,8 @@
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Edit Mailbox"></asp:Localize>
-
<asp:Literal ID="litDisplayName" runat="server" Text="John Smith" />
<asp:Image ID="imgVipUser" SkinID="VipUser16" runat="server" tooltip="VIP user" Visible="false"/>
<asp:Label ID="litServiceLevel" runat="server" style="float:right;padding-right:8px;" Visible="false"></asp:Label>
</div>
<div class="FormBody">
<wsp:MailboxTabs id="tabs" runat="server" SelectedTab="mailbox_settings" />

View file

@ -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)
{

View file

@ -39,6 +39,24 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litDisplayName;
/// <summary>
/// imgVipUser 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.Image imgVipUser;
/// <summary>
/// litServiceLevel 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.Label litServiceLevel;
/// <summary>
/// tabs control.
/// </summary>

View file

@ -112,10 +112,26 @@
</SelectParameters>
</asp:ObjectDataSource>
<br />
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Total Mailboxes Created:"></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="mailboxesQuota" runat="server" QuotaTypeId="2" />
<div>
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Total Mailboxes Created:"></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="mailboxesQuota" runat="server" QuotaTypeId="2" />
</div>
<asp:Repeater ID="dlServiceLevelQuotas" runat="server" EnableViewState="false">
<ItemTemplate>
<br />
<div>
<asp:Localize ID="locServiceLevelQuota" runat="server" Text='<%# Eval("QuotaDescription") %>'></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="serviceLevelQuota" runat="server"
QuotaTypeId='<%# Eval("QuotaTypeId") %>'
QuotaUsedValue='<%# Eval("QuotaUsedValue") %>'
QuotaValue='<%# Eval("QuotaValue") %>'
QuotaAvailable='<%# Eval("QuotaAvailable")%>'/>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</div>

View file

@ -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<ServiceLevelQuotaValueInfo> serviceLevelQuotas = new List<ServiceLevelQuotaValueInfo>();
foreach (var quota in Array.FindAll<QuotaValueInfo>(
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)

View file

@ -137,5 +137,14 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer mailboxesQuota;
/// <summary>
/// dlServiceLevelQuotas 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.Repeater dlServiceLevelQuotas;
}
}

View file

@ -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<QuotaValueInfo>(
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;

View file

@ -28,6 +28,8 @@
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Edit User"></asp:Localize>
-
<asp:Literal ID="litDisplayName" runat="server" Text="John Smith" />
<asp:Image ID="imgVipUser" SkinID="VipUser16" runat="server" tooltip="VIP user" Visible="false"/>
<asp:Label ID="litServiceLevel" runat="server" style="float:right;padding-right:8px;" Visible="false"></asp:Label>
</div>
<div class="FormBody">

View file

@ -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)

View file

@ -48,6 +48,24 @@ namespace WebsitePanel.Portal.HostedSolution {
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litDisplayName;
/// <summary>
/// imgVipUser 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.Image imgVipUser;
/// <summary>
/// litServiceLevel 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.Label litServiceLevel;
/// <summary>
/// UserTabsId control.
/// </summary>

View file

@ -109,9 +109,26 @@
</SelectParameters>
</asp:ObjectDataSource>
<br />
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Total Users Created:"></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="usersQuota" runat="server" QuotaTypeId="2" />
<div>
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Total Users Created:"></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="usersQuota" runat="server" QuotaTypeId="2" />
</div>
<asp:Repeater ID="dlServiceLevelQuotas" runat="server" EnableViewState="false">
<ItemTemplate>
<br />
<div>
<asp:Localize ID="locServiceLevelQuota" runat="server" Text='<%# Eval("QuotaDescription") %>'></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="serviceLevelQuota" runat="server"
QuotaTypeId='<%# Eval("QuotaTypeId") %>'
QuotaUsedValue='<%# Eval("QuotaUsedValue") %>'
QuotaValue='<%# Eval("QuotaValue") %>'
QuotaAvailable='<%# Eval("QuotaAvailable")%>'/>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
</div>

View file

@ -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<ServiceLevelQuotaValueInfo> serviceLevelQuotas = new List<ServiceLevelQuotaValueInfo>();
foreach (var quota in Array.FindAll<QuotaValueInfo>(
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)

View file

@ -137,5 +137,14 @@ namespace WebsitePanel.Portal.HostedSolution {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer usersQuota;
/// <summary>
/// dlServiceLevelQuotas 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.Repeater dlServiceLevelQuotas;
}
}