This commit is contained in:
Virtuworks 2015-01-16 10:03:20 -05:00
commit e4611b7744
14 changed files with 352 additions and 59 deletions

View file

@ -2416,6 +2416,12 @@ INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDe
END END
GO GO
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'RDS.Collections')
BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (491, 45, 2, N'RDS.Collections',N'Remote Desktop Servers',2, 0 , NULL)
END
GO
-- RDS Provider -- RDS Provider
IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [DisplayName] = 'Remote Desktop Services Windows 2012') IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [DisplayName] = 'Remote Desktop Services Windows 2012')
@ -5462,6 +5468,29 @@ CREATE TABLE RDSCollections
) )
GO GO
IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'RDSCollections' AND COLUMN_NAME = 'DisplayName')
BEGIN
ALTER TABLE [dbo].[RDSCollections]
ADD DisplayName NVARCHAR(255)
END
GO
UPDATE [dbo].[RDSCollections] SET DisplayName = [Name] WHERE DisplayName IS NULL
ALTER TABLE [dbo].[RDSCollectionUsers]
DROP CONSTRAINT [FK_RDSCollectionUsers_RDSCollectionId]
GO
ALTER TABLE [dbo].[RDSCollectionUsers]
DROP CONSTRAINT [FK_RDSCollectionUsers_UserId]
GO
ALTER TABLE [dbo].[RDSServers]
DROP CONSTRAINT [FK_RDSServers_RDSCollectionId]
GO
ALTER TABLE [dbo].[RDSCollectionUsers] WITH CHECK ADD CONSTRAINT [FK_RDSCollectionUsers_RDSCollectionId] FOREIGN KEY([RDSCollectionId]) ALTER TABLE [dbo].[RDSCollectionUsers] WITH CHECK ADD CONSTRAINT [FK_RDSCollectionUsers_RDSCollectionId] FOREIGN KEY([RDSCollectionId])
REFERENCES [dbo].[RDSCollections] ([ID]) REFERENCES [dbo].[RDSCollections] ([ID])
ON DELETE CASCADE ON DELETE CASCADE
@ -5730,7 +5759,8 @@ SELECT
CR.ID, CR.ID,
CR.ItemID, CR.ItemID,
CR.Name, CR.Name,
CR.Description CR.Description,
CR.DisplayName
FROM @RDSCollections AS C FROM @RDSCollections AS C
INNER JOIN RDSCollections AS CR ON C.RDSCollectionId = CR.ID INNER JOIN RDSCollections AS CR ON C.RDSCollectionId = CR.ID
WHERE C.ItemPosition BETWEEN @StartRow AND @EndRow' WHERE C.ItemPosition BETWEEN @StartRow AND @EndRow'
@ -5763,7 +5793,8 @@ SELECT
Id, Id,
ItemId, ItemId,
Name, Name,
Description Description,
DisplayName
FROM RDSCollections FROM RDSCollections
WHERE ItemID = @ItemID WHERE ItemID = @ItemID
GO GO
@ -5782,9 +5813,10 @@ SELECT TOP 1
Id, Id,
Name, Name,
ItemId, ItemId,
Description Description,
DisplayName
FROM RDSCollections FROM RDSCollections
WHERE Name = @Name WHERE DisplayName = @Name
GO GO
@ -5801,7 +5833,8 @@ SELECT TOP 1
Id, Id,
ItemId, ItemId,
Name, Name,
Description Description,
DisplayName
FROM RDSCollections FROM RDSCollections
WHERE ID = @ID WHERE ID = @ID
GO GO
@ -5815,7 +5848,8 @@ CREATE PROCEDURE [dbo].[AddRDSCollection]
@RDSCollectionID INT OUTPUT, @RDSCollectionID INT OUTPUT,
@ItemID INT, @ItemID INT,
@Name NVARCHAR(255), @Name NVARCHAR(255),
@Description NVARCHAR(255) @Description NVARCHAR(255),
@DisplayName NVARCHAR(255)
) )
AS AS
@ -5823,13 +5857,15 @@ INSERT INTO RDSCollections
( (
ItemID, ItemID,
Name, Name,
Description Description,
DisplayName
) )
VALUES VALUES
( (
@ItemID, @ItemID,
@Name, @Name,
@Description @Description,
@DisplayName
) )
SET @RDSCollectionID = SCOPE_IDENTITY() SET @RDSCollectionID = SCOPE_IDENTITY()
@ -5846,7 +5882,8 @@ CREATE PROCEDURE [dbo].[UpdateRDSCollection]
@ID INT, @ID INT,
@ItemID INT, @ItemID INT,
@Name NVARCHAR(255), @Name NVARCHAR(255),
@Description NVARCHAR(255) @Description NVARCHAR(255),
@DisplayName NVARCHAR(255)
) )
AS AS
@ -5854,7 +5891,8 @@ UPDATE RDSCollections
SET SET
ItemID = @ItemID, ItemID = @ItemID,
Name = @Name, Name = @Name,
Description = @Description Description = @Description,
DisplayName = @DisplayName
WHERE ID = @Id WHERE ID = @Id
GO GO
@ -5970,6 +6008,36 @@ SELECT
RETURN RETURN
GO GO
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetOrganizationRdsCollectionsCount')
DROP PROCEDURE GetOrganizationRdsCollectionsCount
GO
CREATE PROCEDURE [dbo].GetOrganizationRdsCollectionsCount
(
@ItemID INT,
@TotalNumber int OUTPUT
)
AS
SELECT
@TotalNumber = Count([Id])
FROM [dbo].[RDSCollections] WHERE [ItemId] = @ItemId
RETURN
GO
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetOrganizationRdsServersCount')
DROP PROCEDURE GetOrganizationRdsServersCount
GO
CREATE PROCEDURE [dbo].GetOrganizationRdsServersCount
(
@ItemID INT,
@TotalNumber int OUTPUT
)
AS
SELECT
@TotalNumber = Count([Id])
FROM [dbo].[RDSServers] WHERE [ItemId] = @ItemId
RETURN
GO
-- wsp-10269: Changed php extension path in default properties for IIS70 and IIS80 provider -- wsp-10269: Changed php extension path in default properties for IIS70 and IIS80 provider
update ServiceDefaultProperties update ServiceDefaultProperties

View file

@ -262,5 +262,6 @@ order by rg.groupOrder
public const string RDS_USERS = "RDS.Users"; public const string RDS_USERS = "RDS.Users";
public const string RDS_SERVERS = "RDS.Servers"; public const string RDS_SERVERS = "RDS.Servers";
public const string RDS_COLLECTIONS = "RDS.Collections";
} }
} }

View file

@ -4595,6 +4595,34 @@ namespace WebsitePanel.EnterpriseServer
return Convert.ToInt32(count.Value); 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) public static void UpdateRDSCollection(RdsCollection collection)
{ {
UpdateRDSCollection(collection.Id, collection.ItemId, collection.Name, collection.Description, collection.DisplayName); 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); 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 else
{ {
@ -1066,6 +1073,13 @@ namespace WebsitePanel.EnterpriseServer
stats.UsedEnterpriseStorageSpace += folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB); 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; 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; return stats;
} }
catch (Exception ex) catch (Exception ex)

View file

@ -203,6 +203,16 @@ namespace WebsitePanel.EnterpriseServer
return GetOrganizationRdsUsersCountInternal(itemId); 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) public static List<string> GetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp)
{ {
return GetApplicationUsersInternal(itemId, collectionId, remoteApp); return GetApplicationUsersInternal(itemId, collectionId, remoteApp);
@ -591,6 +601,15 @@ namespace WebsitePanel.EnterpriseServer
return DataProvider.GetOrganizationRdsUsersCount(itemId); 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) private static List<RdsServer> GetCollectionRdsServersInternal(int collectionId)
{ {

View file

@ -236,6 +236,18 @@ namespace WebsitePanel.EnterpriseServer
return RemoteDesktopServicesController.GetOrganizationRdsUsersCount(itemId); return RemoteDesktopServicesController.GetOrganizationRdsUsersCount(itemId);
} }
[WebMethod]
public int GetOrganizationRdsServersCount(int itemId)
{
return RemoteDesktopServicesController.GetOrganizationRdsServersCount(itemId);
}
[WebMethod]
public int GetOrganizationRdsCollectionsCount(int itemId)
{
return RemoteDesktopServicesController.GetOrganizationRdsCollectionsCount(itemId);
}
[WebMethod] [WebMethod]
public List<string> GetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp) public List<string> GetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp)
{ {

View file

@ -370,7 +370,12 @@ namespace WebsitePanel.Providers.HostedSolution
set { createdResourceMailboxes = value; } set { createdResourceMailboxes = value; }
} }
public int CreatedRdsServers { get; set; }
public int CreatedRdsCollections { get; set; }
public int CreatedRdsUsers { get; set; }
public int AllocatedRdsServers { get; set; }
public int AllocatedRdsCollections { get; set; }
public int AllocatedRdsUsers { get; set; }
} }
} }

View file

@ -1,4 +1,4 @@
// Copyright (c) 2015, Outercurve Foundation. // Copyright (c) 2015, Outercurve Foundation.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
@ -220,20 +220,20 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
try try
{ {
runSpace = OpenRunspace(); runSpace = OpenRunspace();
var existingServers = GetServersExistingInCollections(runSpace); var existingServers = GetServersExistingInCollections(runSpace);
existingServers = existingServers.Select(x => x.ToUpper()).Intersect(collection.Servers.Select(x => x.FqdName.ToUpper())).ToList(); existingServers = existingServers.Select(x => x.ToUpper()).Intersect(collection.Servers.Select(x => x.FqdName.ToUpper())).ToList();
if (existingServers.Any()) if (existingServers.Any())
{ {
throw new Exception(string.Format("Server{0} {1} already added to another collection", existingServers.Count == 1 ? "" : "s", string.Join(" ,", existingServers.ToArray()))); throw new Exception(string.Format("Server{0} {1} already added to another collection", existingServers.Count == 1 ? "" : "s", string.Join(" ,", existingServers.ToArray())));
} }
foreach (var server in collection.Servers) foreach (var server in collection.Servers)
{ {
//If server will restart it will not be added to collection //If server will restart it will not be added to collection
//Do not install feature here //Do not install feature here
if (!ExistRdsServerInDeployment(runSpace, server)) if (!ExistRdsServerInDeployment(runSpace, server))
{ {
@ -786,7 +786,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
} }
internal void CreateRdRapForce(Runspace runSpace, string gatewayHost, string policyName, string collectionName, List<string> groups) internal void CreateRdRapForce(Runspace runSpace, string gatewayHost, string policyName, string collectionName, List<string> groups)
{ {
//New-Item -Path "RDS:\GatewayServer\RAP" -Name "Allow Connections To Everywhere" -UserGroups "Administrators@." -ComputerGroupType 1 //New-Item -Path "RDS:\GatewayServer\RAP" -Name "Allow Connections To Everywhere" -UserGroups "Administrators@." -ComputerGroupType 1
//Set-Item -Path "RDS:\GatewayServer\RAP\Allow Connections To Everywhere\PortNumbers" -Value 3389,3390 //Set-Item -Path "RDS:\GatewayServer\RAP\Allow Connections To Everywhere\PortNumbers" -Value 3389,3390
@ -795,6 +795,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
RemoveRdRap(runSpace, gatewayHost, policyName); RemoveRdRap(runSpace, gatewayHost, policyName);
} }
Log.WriteWarning(gatewayHost);
var userGroupParametr = string.Format("@({0})", string.Join(",", groups.Select(x => string.Format("\"{0}@{1}\"", x, RootDomain)).ToArray())); var userGroupParametr = string.Format("@({0})", string.Join(",", groups.Select(x => string.Format("\"{0}@{1}\"", x, RootDomain)).ToArray()));
var computerGroupParametr = string.Format("\"{0}@{1}\"", GetComputersGroupName(collectionName), RootDomain); var computerGroupParametr = string.Format("\"{0}@{1}\"", GetComputersGroupName(collectionName), RootDomain);
@ -804,8 +805,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
rdRapCommand.Parameters.Add("UserGroups", userGroupParametr); rdRapCommand.Parameters.Add("UserGroups", userGroupParametr);
rdRapCommand.Parameters.Add("ComputerGroupType", 1); rdRapCommand.Parameters.Add("ComputerGroupType", 1);
rdRapCommand.Parameters.Add("ComputerGroup", computerGroupParametr); rdRapCommand.Parameters.Add("ComputerGroup", computerGroupParametr);
Log.WriteWarning("User Group:" + userGroupParametr);
Log.WriteWarning("Computer Group:" + computerGroupParametr);
ExecuteRemoteShellCommand(runSpace, gatewayHost, rdRapCommand, RdsModuleName); ExecuteRemoteShellCommand(runSpace, gatewayHost, rdRapCommand, RdsModuleName);
Log.WriteWarning("RD RAP Added");
} }
internal void RemoveRdRap(Runspace runSpace, string gatewayHost, string name) internal void RemoveRdRap(Runspace runSpace, string gatewayHost, string name)
@ -1595,22 +1598,22 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
internal List<string> GetServersExistingInCollections(Runspace runSpace) internal List<string> GetServersExistingInCollections(Runspace runSpace)
{ {
var existingHosts = new List<string>(); var existingHosts = new List<string>();
var scripts = new List<string>(); //var scripts = new List<string>();
scripts.Add(string.Format("$sessions = Get-RDSessionCollection -ConnectionBroker {0}", ConnectionBroker)); //scripts.Add(string.Format("$sessions = Get-RDSessionCollection -ConnectionBroker {0}", ConnectionBroker));
scripts.Add(string.Format("foreach($session in $sessions){{Get-RDSessionHost $session.CollectionName -ConnectionBroker {0}|Select SessionHost}}", ConnectionBroker)); //scripts.Add(string.Format("foreach($session in $sessions){{Get-RDSessionHost $session.CollectionName -ConnectionBroker {0}|Select SessionHost}}", ConnectionBroker));
object[] errors; //object[] errors;
var sessionHosts = ExecuteShellCommand(runSpace, scripts, out errors); //var sessionHosts = ExecuteShellCommand(runSpace, scripts, out errors);
foreach(var host in sessionHosts) //foreach(var host in sessionHosts)
{ //{
var sessionHost = GetPSObjectProperty(host, "SessionHost"); // var sessionHost = GetPSObjectProperty(host, "SessionHost");
if (sessionHost != null) // if (sessionHost != null)
{ // {
existingHosts.Add(sessionHost.ToString()); // existingHosts.Add(sessionHost.ToString());
} // }
} //}
return existingHosts; return existingHosts;
} }

View file

@ -5590,6 +5590,9 @@
<data name="Quota.RDS.Users" xml:space="preserve"> <data name="Quota.RDS.Users" xml:space="preserve">
<value>Remote Desktop Users</value> <value>Remote Desktop Users</value>
</data> </data>
<data name="Quota.RDS.Collections" xml:space="preserve">
<value>Remote Desktop Collections</value>
</data>
<data name="Error.RDS_CREATE_COLLECTION_RDSSERVER_REQUAIRED" xml:space="preserve"> <data name="Error.RDS_CREATE_COLLECTION_RDSSERVER_REQUAIRED" xml:space="preserve">
<value>Error creating rds collection. You need to add at least 1 rds server to collection</value> <value>Error creating rds collection. You need to add at least 1 rds server to collection</value>
</data> </data>

View file

@ -222,4 +222,16 @@
<data name="locServiceLevels.Text" xml:space="preserve"> <data name="locServiceLevels.Text" xml:space="preserve">
<value>Service Levels</value> <value>Service Levels</value>
</data> </data>
<data name="locRemoteDesktop.Text" xml:space="preserve">
<value>Remote Desktop</value>
</data>
<data name="lnkRdsServers.Text" xml:space="preserve">
<value>RDS Servers</value>
</data>
<data name="lnkRdsCollections.Text" xml:space="preserve">
<value>RDS Collections</value>
</data>
<data name="lnkRdsUsers.Text" xml:space="preserve">
<value>RDS Users</value>
</data>
</root> </root>

View file

@ -341,6 +341,38 @@
</td> </td>
</tr> </tr>
</asp:Panel> </asp:Panel>
<asp:Panel runat="server" ID="remoteDesktopStatsPanel">
<tr>
<td class="OrgStatsGroup" width="100%" colspan="2">
<asp:Localize ID="locRemoteDesktop" runat="server" meta:resourcekey="locRemoteDesktop" ></asp:Localize>
</td>
</tr>
<tr class="OrgStatsRow">
<td class="OrgStatsQuota" nowrap>
<asp:HyperLink ID="lnkRdsServers" runat="server" meta:resourcekey="lnkRdsServers" />
</td>
<td>
<wsp:QuotaViewer ID="rdsServers" QuotaTypeId="2" runat="server" DisplayGauge="true" />
</td>
</tr>
<tr class="OrgStatsRow">
<td class="OrgStatsQuota" nowrap>
<asp:HyperLink ID="lnkRdsCollections" runat="server" meta:resourcekey="lnkRdsCollections" />
</td>
<td>
<wsp:QuotaViewer ID="rdsCollections" QuotaTypeId="2" runat="server" DisplayGauge="true" />
</td>
</tr>
<tr class="OrgStatsRow">
<td class="OrgStatsQuota" nowrap>
<asp:HyperLink ID="lnkRdsUsers" runat="server" meta:resourcekey="lnkRdsUsers" />
</td>
<td>
<wsp:QuotaViewer ID="rdsUsers" QuotaTypeId="2" runat="server" DisplayGauge="true" />
</td>
</tr>
</asp:Panel>
</table> </table>
</div> </div>

View file

@ -305,6 +305,16 @@ namespace WebsitePanel.Portal.ExchangeServer
} }
else else
serviceLevelsStatsPanel.Visible = false; serviceLevelsStatsPanel.Visible = false;
if (cntx.Groups.ContainsKey(ResourceGroups.RDS))
{
remoteDesktopStatsPanel.Visible = true;
BindRemoteDesktopStats(orgStats, tenantStats);
}
else
{
remoteDesktopStatsPanel.Visible = false;
}
} }
private void BindCRMStats(OrganizationStatistics stats, OrganizationStatistics tenantStats) private void BindCRMStats(OrganizationStatistics stats, OrganizationStatistics tenantStats)
@ -447,5 +457,34 @@ namespace WebsitePanel.Portal.ExchangeServer
} }
} }
private void BindRemoteDesktopStats(OrganizationStatistics stats, OrganizationStatistics tenantStats)
{
rdsServers.QuotaValue = stats.AllocatedRdsServers;
rdsServers.QuotaUsedValue = stats.CreatedRdsServers;
if (stats.AllocatedRdsServers != -1)
{
rdsServers.QuotaAvailable = tenantStats.AllocatedRdsServers - tenantStats.CreatedRdsServers;
}
rdsCollections.QuotaValue = stats.AllocatedRdsCollections;
rdsCollections.QuotaUsedValue = stats.CreatedRdsCollections;
if (stats.AllocatedRdsCollections != -1)
{
rdsCollections.QuotaAvailable = tenantStats.AllocatedRdsCollections - tenantStats.CreatedRdsCollections;
}
rdsUsers.QuotaValue = stats.AllocatedRdsUsers;
rdsUsers.QuotaUsedValue = stats.CreatedRdsUsers;
if (stats.AllocatedRdsCollections != -1)
{
rdsUsers.QuotaAvailable = tenantStats.AllocatedRdsUsers - tenantStats.CreatedRdsUsers;
}
lnkRdsServers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId);
lnkRdsCollections.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId);
lnkRdsUsers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId);
}
} }
} }

View file

@ -1,31 +1,3 @@
// Copyright (c) 2015, 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.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -822,5 +794,77 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Localize locServiceLevels; protected global::System.Web.UI.WebControls.Localize locServiceLevels;
/// <summary>
/// remoteDesktopStatsPanel 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 remoteDesktopStatsPanel;
/// <summary>
/// locRemoteDesktop 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 locRemoteDesktop;
/// <summary>
/// lnkRdsServers 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.HyperLink lnkRdsServers;
/// <summary>
/// rdsServers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer rdsServers;
/// <summary>
/// lnkRdsCollections 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.HyperLink lnkRdsCollections;
/// <summary>
/// rdsCollections control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer rdsCollections;
/// <summary>
/// lnkRdsUsers 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.HyperLink lnkRdsUsers;
/// <summary>
/// rdsUsers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer rdsUsers;
} }
} }

View file

@ -45,6 +45,12 @@ namespace WebsitePanel.Portal.RDS
if (!IsPostBack) if (!IsPostBack)
{ {
} }
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.RDS_COLLECTIONS))
{
btnAddCollection.Enabled = (!(cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue <= gvRDSCollections.Rows.Count) || (cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue == -1));
}
} }
public string GetServerName(string collectionId) public string GetServerName(string collectionId)