RDS quotas

This commit is contained in:
vfedosevich 2015-01-16 02:47:54 -08:00
parent 69e4f8db27
commit b1af779c18
14 changed files with 310 additions and 49 deletions

View file

@ -4543,6 +4543,34 @@ namespace WebsitePanel.EnterpriseServer
return Convert.ToInt32(count.Value);
}
public static int GetOrganizationRdsCollectionsCount(int itemId)
{
SqlParameter count = new SqlParameter("@TotalNumber", SqlDbType.Int);
count.Direction = ParameterDirection.Output;
DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "GetOrganizationRdsCollectionsCount",
count,
new SqlParameter("@ItemId", itemId));
// read identity
return Convert.ToInt32(count.Value);
}
public static int GetOrganizationRdsServersCount(int itemId)
{
SqlParameter count = new SqlParameter("@TotalNumber", SqlDbType.Int);
count.Direction = ParameterDirection.Output;
DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "GetOrganizationRdsServersCount",
count,
new SqlParameter("@ItemId", itemId));
// read identity
return Convert.ToInt32(count.Value);
}
public static void UpdateRDSCollection(RdsCollection collection)
{
UpdateRDSCollection(collection.Id, collection.ItemId, collection.Name, collection.Description, collection.DisplayName);

View file

@ -992,6 +992,13 @@ namespace WebsitePanel.EnterpriseServer
stats.UsedEnterpriseStorageSpace = folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB);
}
if (cntxTmp.Groups.ContainsKey(ResourceGroups.RDS))
{
stats.CreatedRdsUsers = RemoteDesktopServicesController.GetOrganizationRdsUsersCount(org.Id);
stats.CreatedRdsCollections = RemoteDesktopServicesController.GetOrganizationRdsCollectionsCount(org.Id);
stats.CreatedRdsServers = RemoteDesktopServicesController.GetOrganizationRdsServersCount(org.Id);
}
}
else
{
@ -1066,6 +1073,13 @@ namespace WebsitePanel.EnterpriseServer
stats.UsedEnterpriseStorageSpace += folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB);
}
if (cntxTmp.Groups.ContainsKey(ResourceGroups.RDS))
{
stats.CreatedRdsUsers += RemoteDesktopServicesController.GetOrganizationRdsUsersCount(o.Id);
stats.CreatedRdsCollections += RemoteDesktopServicesController.GetOrganizationRdsCollectionsCount(o.Id);
stats.CreatedRdsServers += RemoteDesktopServicesController.GetOrganizationRdsServersCount(o.Id);
}
}
}
}
@ -1119,6 +1133,13 @@ namespace WebsitePanel.EnterpriseServer
stats.AllocatedEnterpriseStorageSpace = cntx.Quotas[Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE].QuotaAllocatedValue;
}
if (cntx.Groups.ContainsKey(ResourceGroups.RDS))
{
stats.AllocatedRdsServers = cntx.Quotas[Quotas.RDS_SERVERS].QuotaAllocatedValue;
stats.AllocatedRdsCollections = cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue;
stats.AllocatedRdsUsers = cntx.Quotas[Quotas.RDS_USERS].QuotaAllocatedValue;
}
return stats;
}
catch (Exception ex)

View file

@ -203,6 +203,16 @@ namespace WebsitePanel.EnterpriseServer
return GetOrganizationRdsUsersCountInternal(itemId);
}
public static int GetOrganizationRdsServersCount(int itemId)
{
return GetOrganizationRdsServersCountInternal(itemId);
}
public static int GetOrganizationRdsCollectionsCount(int itemId)
{
return GetOrganizationRdsCollectionsCountInternal(itemId);
}
public static List<string> GetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp)
{
return GetApplicationUsersInternal(itemId, collectionId, remoteApp);
@ -591,6 +601,15 @@ namespace WebsitePanel.EnterpriseServer
return DataProvider.GetOrganizationRdsUsersCount(itemId);
}
private static int GetOrganizationRdsServersCountInternal(int itemId)
{
return DataProvider.GetOrganizationRdsServersCount(itemId);
}
private static int GetOrganizationRdsCollectionsCountInternal(int itemId)
{
return DataProvider.GetOrganizationRdsCollectionsCount(itemId);
}
private static List<RdsServer> GetCollectionRdsServersInternal(int collectionId)
{