This commit is contained in:
Virtuworks 2014-04-22 00:01:31 -04:00
commit 7ef077a0ba
12 changed files with 266 additions and 35 deletions

View file

@ -158,7 +158,8 @@ order by rg.groupOrder
public const string ORGANIZATION_USERS = "HostedSolution.Users";
public const string ORGANIZATION_DOMAINS = "HostedSolution.Domains";
public const string ORGANIZATION_ALLOWCHANGEUPN = "HostedSolution.AllowChangeUPN";
public const string ORGANIZATION_SECURITYGROUPMANAGEMENT = "HostedSolution.SecurityGroupManagement";
//public const string ORGANIZATION_SECURITYGROUPMANAGEMENT = "HostedSolution.SecurityGroupManagement";
public const string ORGANIZATION_SECURITYGROUPS = "HostedSolution.SecurityGroups";
public const string CRM_USERS = "HostedCRM.Users";
public const string CRM_ORGANIZATION = "HostedCRM.Organization";

View file

@ -921,16 +921,10 @@ namespace WebsitePanel.EnterpriseServer
stats.CreatedUsers = tempStats.CreatedUsers;
stats.CreatedDomains = tempStats.CreatedDomains;
stats.CreatedGroups = tempStats.CreatedGroups;
PackageContext cntxTmp = PackageController.GetPackageContext(org.PackageId);
if (cntxTmp.Quotas.ContainsKey(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT) &&
(cntxTmp.Quotas[Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT].QuotaAllocatedValue == 1 &&
cntxTmp.Quotas[Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT].QuotaTypeId == 1))
{
stats.CreatedGroups = GetOrganizationSecurityGroupsPaged(org.Id, string.Empty, string.Empty, string.Empty, 0, int.MaxValue).RecordsCount;
}
if (cntxTmp.Groups.ContainsKey(ResourceGroups.HostedSharePoint))
{
SharePointSiteCollectionListPaged sharePointStats = HostedSharePointServerController.GetSiteCollectionsPaged(org.PackageId, org.Id, string.Empty, string.Empty, string.Empty, 0, 0);
@ -1001,16 +995,10 @@ namespace WebsitePanel.EnterpriseServer
stats.CreatedUsers += tempStats.CreatedUsers;
stats.CreatedDomains += tempStats.CreatedDomains;
stats.CreatedGroups += tempStats.CreatedGroups;
PackageContext cntxTmp = PackageController.GetPackageContext(org.PackageId);
if (cntxTmp.Quotas.ContainsKey(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT) &&
(cntxTmp.Quotas[Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT].QuotaAllocatedValue == 1 &&
cntxTmp.Quotas[Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT].QuotaTypeId == 1))
{
stats.CreatedGroups = GetOrganizationSecurityGroupsPaged(org.Id, string.Empty, string.Empty, string.Empty, 0, int.MaxValue).RecordsCount;
}
if (cntxTmp.Groups.ContainsKey(ResourceGroups.HostedSharePoint))
{
SharePointSiteCollectionListPaged sharePointStats = HostedSharePointServerController.GetSiteCollectionsPaged(org.PackageId, o.Id, string.Empty, string.Empty, string.Empty, 0, 0);
@ -1069,13 +1057,7 @@ namespace WebsitePanel.EnterpriseServer
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
stats.AllocatedUsers = cntx.Quotas[Quotas.ORGANIZATION_USERS].QuotaAllocatedValue;
stats.AllocatedDomains = cntx.Quotas[Quotas.ORGANIZATION_DOMAINS].QuotaAllocatedValue;
if (cntx.Quotas.ContainsKey(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT) &&
(cntx.Quotas[Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT].QuotaAllocatedValue == 1 &&
cntx.Quotas[Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT].QuotaTypeId == 1))
{
stats.AllocatedGroups = -1;
}
stats.AllocatedGroups = cntx.Quotas[Quotas.ORGANIZATION_SECURITYGROUPS].QuotaAllocatedValue;
if (cntx.Groups.ContainsKey(ResourceGroups.HostedSharePoint))
{

View file

@ -3310,8 +3310,8 @@
<data name="Quota.HostedSolution.Domains" xml:space="preserve">
<value>Domains per Organization</value>
</data>
<data name="Quota.HostedSolution.SecurityGroupManagement" xml:space="preserve">
<value>Allow Security Group Management</value>
<data name="Quota.HostedSolution.SecurityGroups" xml:space="preserve">
<value>Security Groups per Organization</value>
</data>
<data name="ResourceGroup.Hosted SharePoint" xml:space="preserve">
<value>Hosted SharePoint</value>

View file

@ -153,4 +153,7 @@
<data name="gvGroupsNotes.Header" xml:space="preserve">
<value>Notes</value>
</data>
<data name="locQuota.Text" xml:space="preserve">
<value>Total Groups Created:</value>
</data>
</root>

View file

@ -53,15 +53,24 @@ namespace WebsitePanel.Portal.ExchangeServer
}
OrganizationStatistics organizationStats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);
if (organizationStats.AllocatedEnterpriseStorageSpace != -1)
{
OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);
rangeFolderSize.MaximumValue = Math.Round((tenantStats.AllocatedEnterpriseStorageSpace - (decimal)tenantStats.UsedEnterpriseStorageSpace) / OneGb
+ Utils.ParseDecimal(txtFolderSize.Text, 0), 2).ToString();
rangeFolderSize.ErrorMessage = string.Format("The quota youve entered exceeds the available quota for tenant ({0}Gb)", rangeFolderSize.MaximumValue);
}
if (organizationStats.AllocatedGroups != -1)
{
int groupsAvailable = tenantStats.AllocatedGroups - tenantStats.CreatedGroups;
if (groupsAvailable <= 0)
{
chkAddDefaultGroup.Enabled = false;
}
}
}
}

View file

@ -6,6 +6,7 @@
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<div id="ExchangeContainer">
<div class="Module">
<div class="Left">
</div>
<div class="Content">

View file

@ -164,13 +164,13 @@ namespace WebsitePanel.Portal.ExchangeServer
lnkUsers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "users",
"SpaceID=" + PanelSecurity.PackageId);
if (Utils.CheckQouta(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT, cntx))
if (Utils.CheckQouta(Quotas.ORGANIZATION_SECURITYGROUPS, cntx))
{
securGroupsStat.Visible = true;
groupStats.QuotaUsedValue = orgStats.CreatedGroups;
groupStats.QuotaValue = orgStats.AllocatedGroups;
if (orgStats.AllocatedUsers != -1) groupStats.QuotaAvailable = tenantStats.AllocatedGroups - tenantStats.CreatedGroups;
if (orgStats.AllocatedGroups != -1) groupStats.QuotaAvailable = tenantStats.AllocatedGroups - tenantStats.CreatedGroups;
lnkGroups.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "secur_groups",
"SpaceID=" + PanelSecurity.PackageId);

View file

@ -1,6 +1,7 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrganizationSecurityGroups.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.OrganizationSecurityGroups" %>
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
@ -78,6 +79,10 @@
<asp:ControlParameter Name="filterValue" ControlID="txtSearchValue" PropertyName="Text" />
</SelectParameters>
</asp:ObjectDataSource>
<br/>
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Total Groups Created:"></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="groupsQuota" runat="server" QuotaTypeId="2" />
</div>
</div>
</div>

View file

@ -48,7 +48,29 @@ namespace WebsitePanel.Portal.ExchangeServer
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindStats();
}
}
private void BindStats()
{
// quota values
OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);
groupsQuota.QuotaUsedValue = stats.CreatedGroups;
groupsQuota.QuotaValue = stats.AllocatedGroups;
if (stats.AllocatedGroups != -1)
{
int groupsAvailable = groupsQuota.QuotaAvailable = tenantStats.AllocatedGroups - tenantStats.CreatedGroups;
if (groupsAvailable <= 0)
{
btnCreateGroup.Enabled = false;
}
}
}
protected void btnCreateGroup_Click(object sender, EventArgs e)
@ -96,6 +118,9 @@ namespace WebsitePanel.Portal.ExchangeServer
// rebind grid
gvGroups.DataBind();
// bind stats
BindStats();
}
catch (Exception ex)
{
@ -117,7 +142,10 @@ namespace WebsitePanel.Portal.ExchangeServer
gvGroups.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue);
// rebind grid
gvGroups.DataBind();
gvGroups.DataBind();
// bind stats
BindStats();
}
}

View file

@ -156,5 +156,23 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsSecurityGroupsPaged;
/// <summary>
/// locQuota 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 locQuota;
/// <summary>
/// groupsQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer groupsQuota;
}
}

View file

@ -142,7 +142,7 @@ namespace WebsitePanel.Portal
if (Utils.CheckQouta(Quotas.ORGANIZATION_USERS, cntx))
items.Add(CreateMenuItem("Users", "users"));
if (Utils.CheckQouta(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT, cntx))
if (Utils.CheckQouta(Quotas.ORGANIZATION_SECURITYGROUPS, cntx))
items.Add(CreateMenuItem("SecurityGroups", "secur_groups"));
}