diff --git a/WebsitePanel/Database/install_db.sql b/WebsitePanel/Database/install_db.sql index d18ecb79..47bb884f 100644 --- a/WebsitePanel/Database/install_db.sql +++ b/WebsitePanel/Database/install_db.sql @@ -42964,11 +42964,11 @@ INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [Property GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'PerlPath', N'%SYSTEMDRIVE%\Perl\bin\PerlEx30.dll') GO -INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'Php4Path', N'%PROGRAMFILES%\PHP\php.exe') +INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'Php4Path', N'%PROGRAMFILES(x86)%\PHP\php.exe') GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'PhpMode', N'FastCGI') GO -INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'PhpPath', N'%PROGRAMFILES%\PHP\php-cgi.exe') +INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'PhpPath', N'%PROGRAMFILES(x86)%\PHP\php-cgi.exe') GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'ProtectedGroupsFile', N'.htgroup') GO @@ -43014,11 +43014,11 @@ INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [Property GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'PerlPath', N'%SYSTEMDRIVE%\Perl\bin\PerlEx30.dll') GO -INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'Php4Path', N'%PROGRAMFILES%\PHP\php.exe') +INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'Php4Path', N'%PROGRAMFILES(x86)%\PHP\php.exe') GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'PhpMode', N'FastCGI') GO -INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'PhpPath', N'%PROGRAMFILES%\PHP\php-cgi.exe') +INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'PhpPath', N'%PROGRAMFILES(x86)%\PHP\php-cgi.exe') GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'ProtectedGroupsFile', N'.htgroup') GO diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index f3c9b329..ed3b4c52 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -2403,7 +2403,7 @@ INSERT [dbo].[ResourceGroups] ([GroupID], [GroupName], [GroupOrder], [GroupContr END GO --- RDS Quota +-- RDS Quotas IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'RDS.Users') BEGIN @@ -2411,6 +2411,12 @@ INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDe END GO +IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'RDS.Servers') +BEGIN +INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (451, 45, 2, N'RDS.Servers',N'Remote Desktop Servers',2, 0 , NULL) +END +GO + -- RDS Provider IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [DisplayName] = 'Remote Desktop Services Windows 2012') @@ -5418,9 +5424,668 @@ deallocate c GO + + +/*Remote Desktop Services*/ + +/*Remote Desktop Services Tables*/ +IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollectionUsers') +DROP TABLE RDSCollectionUsers +GO +CREATE TABLE RDSCollectionUsers +( + ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY, + RDSCollectionId INT NOT NULL, + AccountID INT NOT NULL +) +GO + + +IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSServers') +DROP TABLE RDSServers +GO +CREATE TABLE RDSServers +( + ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY, + ItemID INT, + Name NVARCHAR(255), + FqdName NVARCHAR(255), + Description NVARCHAR(255), + RDSCollectionId INT/* FOREIGN KEY REFERENCES RDSCollection (ID)*/ +) +GO + + +IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollections') +DROP TABLE RDSCollections +GO +CREATE TABLE RDSCollections +( + ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY, + ItemID INT NOT NULL, + Name NVARCHAR(255), + Description NVARCHAR(255) +) +GO + +ALTER TABLE [dbo].[RDSCollectionUsers] WITH CHECK ADD CONSTRAINT [FK_RDSCollectionUsers_RDSCollectionId] FOREIGN KEY([RDSCollectionId]) +REFERENCES [dbo].[RDSCollections] ([ID]) +ON DELETE CASCADE +GO + + +ALTER TABLE [dbo].[RDSCollectionUsers] WITH CHECK ADD CONSTRAINT [FK_RDSCollectionUsers_UserId] FOREIGN KEY([AccountID]) +REFERENCES [dbo].[ExchangeAccounts] ([AccountID]) +ON DELETE CASCADE +GO + +ALTER TABLE [dbo].[RDSServers] WITH CHECK ADD CONSTRAINT [FK_RDSServers_RDSCollectionId] FOREIGN KEY([RDSCollectionId]) +REFERENCES [dbo].[RDSCollections] ([ID]) +GO + +/*Remote Desktop Services Procedures*/ + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddRDSServer') +DROP PROCEDURE AddRDSServer +GO +CREATE PROCEDURE [dbo].[AddRDSServer] +( + @RDSServerID INT OUTPUT, + @Name NVARCHAR(255), + @FqdName NVARCHAR(255), + @Description NVARCHAR(255) +) +AS +INSERT INTO RDSServers +( + Name, + FqdName, + Description +) +VALUES +( + @Name, + @FqdName, + @Description +) + +SET @RDSServerID = SCOPE_IDENTITY() + +RETURN +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteRDSServer') +DROP PROCEDURE DeleteRDSServer +GO +CREATE PROCEDURE [dbo].[DeleteRDSServer] +( + @Id int +) +AS +DELETE FROM RDSServers +WHERE Id = @Id +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateRDSServer') +DROP PROCEDURE UpdateRDSServer +GO +CREATE PROCEDURE [dbo].[UpdateRDSServer] +( + @Id INT, + @ItemID INT, + @Name NVARCHAR(255), + @FqdName NVARCHAR(255), + @Description NVARCHAR(255), + @RDSCollectionId INT +) +AS + +UPDATE RDSServers +SET + ItemID = @ItemID, + Name = @Name, + FqdName = @FqdName, + Description = @Description, + RDSCollectionId = @RDSCollectionId +WHERE ID = @Id +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddRDSServerToOrganization') +DROP PROCEDURE AddRDSServerToOrganization +GO +CREATE PROCEDURE [dbo].[AddRDSServerToOrganization] +( + @Id INT, + @ItemID INT +) +AS + +UPDATE RDSServers +SET + ItemID = @ItemID +WHERE ID = @Id +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'RemoveRDSServerFromOrganization') +DROP PROCEDURE RemoveRDSServerFromOrganization +GO +CREATE PROCEDURE [dbo].[RemoveRDSServerFromOrganization] +( + @Id INT +) +AS + +UPDATE RDSServers +SET + ItemID = NULL +WHERE ID = @Id +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddRDSServerToCollection') +DROP PROCEDURE AddRDSServerToCollection +GO +CREATE PROCEDURE [dbo].[AddRDSServerToCollection] +( + @Id INT, + @RDSCollectionId INT +) +AS + +UPDATE RDSServers +SET + RDSCollectionId = @RDSCollectionId +WHERE ID = @Id +GO + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'RemoveRDSServerFromCollection') +DROP PROCEDURE RemoveRDSServerFromCollection +GO +CREATE PROCEDURE [dbo].[RemoveRDSServerFromCollection] +( + @Id INT +) +AS + +UPDATE RDSServers +SET + RDSCollectionId = NULL +WHERE ID = @Id +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSServersByItemId') +DROP PROCEDURE GetRDSServersByItemId +GO +CREATE PROCEDURE [dbo].[GetRDSServersByItemId] +( + @ItemID INT +) +AS +SELECT + RS.Id, + RS.ItemID, + RS.Name, + RS.FqdName, + RS.Description, + RS.RdsCollectionId, + SI.ItemName + FROM RDSServers AS RS + LEFT OUTER JOIN ServiceItems AS SI ON SI.ItemId = RS.ItemId + WHERE RS.ItemID = @ItemID +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSServers') +DROP PROCEDURE GetRDSServers +GO +CREATE PROCEDURE [dbo].[GetRDSServers] +AS +SELECT + RS.Id, + RS.ItemID, + RS.Name, + RS.FqdName, + RS.Description, + RS.RdsCollectionId, + SI.ItemName + FROM RDSServers AS RS + LEFT OUTER JOIN ServiceItems AS SI ON SI.ItemId = RS.ItemId +GO + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSServerById') +DROP PROCEDURE GetRDSServerById +GO +CREATE PROCEDURE [dbo].[GetRDSServerById] +( + @ID INT +) +AS +SELECT TOP 1 + RS.Id, + RS.ItemID, + RS.Name, + RS.FqdName, + RS.Description, + RS.RdsCollectionId, + SI.ItemName + FROM RDSServers AS RS + LEFT OUTER JOIN ServiceItems AS SI ON SI.ItemId = RS.ItemId + WHERE Id = @Id +GO + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSServersByCollectionId') +DROP PROCEDURE GetRDSServersByCollectionId +GO +CREATE PROCEDURE [dbo].[GetRDSServersByCollectionId] +( + @RdsCollectionId INT +) +AS +SELECT + RS.Id, + RS.ItemID, + RS.Name, + RS.FqdName, + RS.Description, + RS.RdsCollectionId, + SI.ItemName + FROM RDSServers AS RS + LEFT OUTER JOIN ServiceItems AS SI ON SI.ItemId = RS.ItemId + WHERE RdsCollectionId = @RdsCollectionId +GO + + + + + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSServersPaged') +DROP PROCEDURE GetRDSServersPaged +GO +CREATE PROCEDURE [dbo].[GetRDSServersPaged] +( + @FilterColumn nvarchar(50) = '', + @FilterValue nvarchar(50) = '', + @ItemID int, + @IgnoreItemId bit, + @RdsCollectionId int, + @IgnoreRdsCollectionId bit, + @SortColumn nvarchar(50), + @StartRow int, + @MaximumRows int +) +AS +-- build query and run it to the temporary table +DECLARE @sql nvarchar(2000) + +SET @sql = ' + +DECLARE @EndRow int +SET @EndRow = @StartRow + @MaximumRows + +DECLARE @RDSServer TABLE +( + ItemPosition int IDENTITY(0,1), + RDSServerId int +) +INSERT INTO @RDSServer (RDSServerId) +SELECT + S.ID +FROM RDSServers AS S +WHERE + ((((@ItemID is Null AND S.ItemID is null) or @IgnoreItemId = 1) + or (@ItemID is not Null AND S.ItemID = @ItemID)) + and + (((@RdsCollectionId is Null AND S.RDSCollectionId is null) or @IgnoreRdsCollectionId = 1) + or (@RdsCollectionId is not Null AND S.RDSCollectionId = @RdsCollectionId)))' + +IF @FilterColumn <> '' AND @FilterValue <> '' +SET @sql = @sql + ' AND ' + @FilterColumn + ' LIKE @FilterValue ' + +IF @SortColumn <> '' AND @SortColumn IS NOT NULL +SET @sql = @sql + ' ORDER BY ' + @SortColumn + ' ' + +SET @sql = @sql + ' SELECT COUNT(RDSServerId) FROM @RDSServer; +SELECT + ST.ID, + ST.ItemID, + ST.Name, + ST.FqdName, + ST.Description, + ST.RdsCollectionId, + SI.ItemName +FROM @RDSServer AS S +INNER JOIN RDSServers AS ST ON S.RDSServerId = ST.ID +LEFT OUTER JOIN ServiceItems AS SI ON SI.ItemId = ST.ItemId +WHERE S.ItemPosition BETWEEN @StartRow AND @EndRow' + +exec sp_executesql @sql, N'@StartRow int, @MaximumRows int, @FilterValue nvarchar(50), @ItemID int, @RdsCollectionId int, @IgnoreItemId bit, @IgnoreRdsCollectionId bit', +@StartRow, @MaximumRows, @FilterValue, @ItemID, @RdsCollectionId, @IgnoreItemId , @IgnoreRdsCollectionId + + +RETURN + +GO +SET ANSI_NULLS ON +GO +SET QUOTED_IDENTIFIER ON +GO + + + + + + + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSCollectionsPaged') +DROP PROCEDURE GetRDSCollectionsPaged +GO +CREATE PROCEDURE [dbo].[GetRDSCollectionsPaged] +( + @FilterColumn nvarchar(50) = '', + @FilterValue nvarchar(50) = '', + @ItemID int, + @SortColumn nvarchar(50), + @StartRow int, + @MaximumRows int +) +AS +-- build query and run it to the temporary table +DECLARE @sql nvarchar(2000) + +SET @sql = ' + +DECLARE @EndRow int +SET @EndRow = @StartRow + @MaximumRows +DECLARE @RDSCollections TABLE +( + ItemPosition int IDENTITY(0,1), + RDSCollectionId int +) +INSERT INTO @RDSCollections (RDSCollectionId) +SELECT + S.ID +FROM RDSCollections AS S +WHERE + ((@ItemID is Null AND S.ItemID is null) + or (@ItemID is not Null AND S.ItemID = @ItemID))' + +IF @FilterColumn <> '' AND @FilterValue <> '' +SET @sql = @sql + ' AND ' + @FilterColumn + ' LIKE @FilterValue ' + +IF @SortColumn <> '' AND @SortColumn IS NOT NULL +SET @sql = @sql + ' ORDER BY ' + @SortColumn + ' ' + +SET @sql = @sql + ' SELECT COUNT(RDSCollectionId) FROM @RDSCollections; +SELECT + CR.ID, + CR.ItemID, + CR.Name, + CR.Description +FROM @RDSCollections AS C +INNER JOIN RDSCollections AS CR ON C.RDSCollectionId = CR.ID +WHERE C.ItemPosition BETWEEN @StartRow AND @EndRow' + +exec sp_executesql @sql, N'@StartRow int, @MaximumRows int, @FilterValue nvarchar(50), @ItemID int', +@StartRow, @MaximumRows, @FilterValue, @ItemID + + +RETURN + +GO +SET ANSI_NULLS ON +GO +SET QUOTED_IDENTIFIER ON +GO + + + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSCollectionsByItemId') +DROP PROCEDURE GetRDSCollectionsByItemId +GO +CREATE PROCEDURE [dbo].[GetRDSCollectionsByItemId] +( + @ItemID INT +) +AS +SELECT + Id, + ItemId, + Name, + Description + FROM RDSCollections + WHERE ItemID = @ItemID +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSCollectionByName') +DROP PROCEDURE GetRDSCollectionByName +GO +CREATE PROCEDURE [dbo].[GetRDSCollectionByName] +( + @Name NVARCHAR(255) +) +AS + +SELECT TOP 1 + Id, + Name, + ItemId, + Description + FROM RDSCollections + WHERE Name = @Name +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSCollectionById') +DROP PROCEDURE GetRDSCollectionById +GO +CREATE PROCEDURE [dbo].[GetRDSCollectionById] +( + @ID INT +) +AS + +SELECT TOP 1 + Id, + ItemId, + Name, + Description + FROM RDSCollections + WHERE ID = @ID +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddRDSCollection') +DROP PROCEDURE AddRDSCollection +GO +CREATE PROCEDURE [dbo].[AddRDSCollection] +( + @RDSCollectionID INT OUTPUT, + @ItemID INT, + @Name NVARCHAR(255), + @Description NVARCHAR(255) +) +AS + +INSERT INTO RDSCollections +( + ItemID, + Name, + Description +) +VALUES +( + @ItemID, + @Name, + @Description +) + +SET @RDSCollectionID = SCOPE_IDENTITY() + +RETURN +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateRDSCollection') +DROP PROCEDURE UpdateRDSCollection +GO +CREATE PROCEDURE [dbo].[UpdateRDSCollection] +( + @ID INT, + @ItemID INT, + @Name NVARCHAR(255), + @Description NVARCHAR(255) +) +AS + +UPDATE RDSCollections +SET + ItemID = @ItemID, + Name = @Name, + Description = @Description +WHERE ID = @Id +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteRDSCollection') +DROP PROCEDURE DeleteRDSCollection +GO +CREATE PROCEDURE [dbo].[DeleteRDSCollection] +( + @Id int +) +AS + +UPDATE RDSServers +SET + RDSCollectionId = Null +WHERE RDSCollectionId = @Id + +DELETE FROM RDSCollections +WHERE Id = @Id +GO + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSCollectionUsersByRDSCollectionId') +DROP PROCEDURE GetRDSCollectionUsersByRDSCollectionId +GO +CREATE PROCEDURE [dbo].[GetRDSCollectionUsersByRDSCollectionId] +( + @ID INT +) +AS +SELECT + [AccountID], + [ItemID], + [AccountType], + [AccountName], + [DisplayName], + [PrimaryEmailAddress], + [MailEnabledPublicFolder], + [MailboxManagerActions], + [SamAccountName], + [AccountPassword], + [CreatedDate], + [MailboxPlanId], + [SubscriberNumber], + [UserPrincipalName], + [ExchangeDisclaimerId], + [ArchivingMailboxPlanId], + [EnableArchiving], + [LevelID], + [IsVIP] + FROM ExchangeAccounts + WHERE AccountID IN (Select AccountId from RDSCollectionUsers where RDSCollectionId = @Id) +GO + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddUserToRDSCollection') +DROP PROCEDURE AddUserToRDSCollection +GO +CREATE PROCEDURE [dbo].[AddUserToRDSCollection] +( + @RDSCollectionID INT, + @AccountId INT +) +AS + +INSERT INTO RDSCollectionUsers +( + RDSCollectionId, + AccountID +) +VALUES +( + @RDSCollectionID, + @AccountId +) +GO + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'RemoveRDSUserFromRDSCollection') +DROP PROCEDURE RemoveRDSUserFromRDSCollection +GO +CREATE PROCEDURE [dbo].[RemoveRDSUserFromRDSCollection] +( + @AccountId INT, + @RDSCollectionId INT +) +AS + + +DELETE FROM RDSCollectionUsers +WHERE AccountId = @AccountId AND RDSCollectionId = @RDSCollectionId +GO + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetOrganizationRdsUsersCount') +DROP PROCEDURE GetOrganizationRdsUsersCount +GO +CREATE PROCEDURE [dbo].GetOrganizationRdsUsersCount +( + @ItemID INT, + @TotalNumber int OUTPUT +) +AS +SELECT + @TotalNumber = Count([RDSCollectionId]) + FROM [dbo].[RDSCollectionUsers] + WHERE [RDSCollectionId] in (SELECT [ID] FROM [RDSCollections] where [ItemId] = @ItemId ) +RETURN +GO + + +-- wsp-10269: Changed php extension path in default properties for IIS70 and IIS80 provider +update ServiceDefaultProperties +set PhpPath='%PROGRAMFILES(x86)%\PHP\php-cgi.exe' +where ProviderId in(101, 105) + +update ServiceDefaultProperties +set Php4Path='%PROGRAMFILES(x86)%\PHP\ph.exe' +where ProviderId in(101, 105) + +GO + -- Hyper-V 2012 R2 -IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [ProviderName] = 'HyperV2012R2') +IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [ProviderName] = 'Microsoft Hyper-V 2012 R2') BEGIN INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (350, 30, N'HyperV2012R2', N'Microsoft Hyper-V 2012 R2', N'WebsitePanel.Providers.Virtualization.HyperV2012R2, WebsitePanel.Providers.Virtualization.HyperV2012R2', N'HyperV', 1) END -GO \ No newline at end of file +G diff --git a/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox.sln b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox.sln new file mode 100644 index 00000000..ae0144f5 --- /dev/null +++ b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30723.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.FixDefaultPublicFolderMailbox", "WebsitePanel.FixDefaultPublicFolderMailbox\WebsitePanel.FixDefaultPublicFolderMailbox.csproj", "{07678C66-5671-4836-B8C4-5F214105E189}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {07678C66-5671-4836-B8C4-5F214105E189}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07678C66-5671-4836-B8C4-5F214105E189}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07678C66-5671-4836-B8C4-5F214105E189}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07678C66-5671-4836-B8C4-5F214105E189}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/ES.cs b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/ES.cs new file mode 100644 index 00000000..92baa093 --- /dev/null +++ b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/ES.cs @@ -0,0 +1,211 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Microsoft.Web.Services3; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.EnterpriseServer.HostedSolution; + + +namespace WebsitePanel.FixDefaultPublicFolderMailbox +{ + /// + /// ES Proxy class + /// + public class ES + { + private static ServerContext serverContext = null; + + public static void InitializeServices(ServerContext context) + { + serverContext = context; + } + + public static ES Services + { + get + { + return new ES(); + } + } + + public esSystem System + { + get { return GetCachedProxy(); } + } + + public esApplicationsInstaller ApplicationsInstaller + { + get { return GetCachedProxy(); } + } + + public esAuditLog AuditLog + { + get { return GetCachedProxy(); } + } + + public esAuthentication Authentication + { + get { return GetCachedProxy(false); } + } + + public esComments Comments + { + get { return GetCachedProxy(); } + } + + public esDatabaseServers DatabaseServers + { + get { return GetCachedProxy(); } + } + + public esFiles Files + { + get { return GetCachedProxy(); } + } + + public esFtpServers FtpServers + { + get { return GetCachedProxy(); } + } + + public esMailServers MailServers + { + get { return GetCachedProxy(); } + } + + public esOperatingSystems OperatingSystems + { + get { return GetCachedProxy(); } + } + + public esPackages Packages + { + get { return GetCachedProxy(); } + } + + public esScheduler Scheduler + { + get { return GetCachedProxy(); } + } + + public esTasks Tasks + { + get { return GetCachedProxy(); } + } + + public esServers Servers + { + get { return GetCachedProxy(); } + } + + public esStatisticsServers StatisticsServers + { + get { return GetCachedProxy(); } + } + + public esUsers Users + { + get { return GetCachedProxy(); } + } + + public esWebServers WebServers + { + get { return GetCachedProxy(); } + } + + public esSharePointServers SharePointServers + { + get { return GetCachedProxy(); } + } + + public esImport Import + { + get { return GetCachedProxy(); } + } + + public esBackup Backup + { + get { return GetCachedProxy(); } + } + + + public esExchangeServer ExchangeServer + { + get { return GetCachedProxy(); } + } + + public esOrganizations Organizations + { + get + { + return GetCachedProxy(); + } + } + + protected ES() + { + } + + protected virtual T GetCachedProxy() + { + return GetCachedProxy(true); + } + + protected virtual T GetCachedProxy(bool secureCalls) + { + if (serverContext == null) + { + throw new Exception("Server context is not specified"); + } + + Type t = typeof(T); + string key = t.FullName + ".ServiceProxy"; + T proxy = (T)Activator.CreateInstance(t); + + object p = proxy; + + // configure proxy + EnterpriseServerProxyConfigurator cnfg = new EnterpriseServerProxyConfigurator(); + cnfg.EnterpriseServerUrl = serverContext.Server; + if (secureCalls) + { + cnfg.Username = serverContext.Username; + cnfg.Password = serverContext.Password; + } + + cnfg.Configure((WebServicesClientProtocol)p); + + return proxy; + } + } +} diff --git a/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/Fix.cs b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/Fix.cs new file mode 100644 index 00000000..ddd66ca5 --- /dev/null +++ b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/Fix.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Configuration; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.FixDefaultPublicFolderMailbox +{ + class Fix + { + static private ServerContext serverContext; + + public const int ERROR_USER_WRONG_PASSWORD = -110; + public const int ERROR_USER_WRONG_USERNAME = -109; + public const int ERROR_USER_ACCOUNT_CANCELLED = -105; + public const int ERROR_USER_ACCOUNT_PENDING = -103; + + private static bool Connect(string server, string username, string password) + { + bool ret = true; + serverContext = new ServerContext(); + serverContext.Server = server; + serverContext.Username = username; + serverContext.Password = password; + + ES.InitializeServices(serverContext); + int status = -1; + try + { + status = ES.Services.Authentication.AuthenticateUser(serverContext.Username, serverContext.Password, null); + } + catch (Exception ex) + { + Log.WriteError("Authentication error", ex); + return false; + } + + string errorMessage = "Check your internet connection or server URL."; + if (status != 0) + { + switch (status) + { + case ERROR_USER_WRONG_USERNAME: + errorMessage = "Wrong username."; + break; + case ERROR_USER_WRONG_PASSWORD: + errorMessage = "Wrong password."; + break; + case ERROR_USER_ACCOUNT_CANCELLED: + errorMessage = "Account cancelled."; + break; + case ERROR_USER_ACCOUNT_PENDING: + errorMessage = "Account pending."; + break; + } + Log.WriteError( + string.Format("Cannot connect to the remote server. {0}", errorMessage)); + ret = false; + } + return ret; + } + + public static void Start(string organizationId) + { + + //Authenticates user + if (!Connect( + ConfigurationManager.AppSettings["ES.WebService"], + ConfigurationManager.AppSettings["ES.Username"], + ConfigurationManager.AppSettings["ES.Password"])) + return; + + Organization[] orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, true); + + foreach (Organization org in orgs) + { + if (organizationId == null) + FixOrganization(org); + else if (org.OrganizationId == organizationId) + FixOrganization(org); + } + + } + + public static void FixOrganization(Organization organization) + { + if (String.IsNullOrEmpty(organization.OrganizationId)) + return; + + Log.WriteLine("Organization " + organization.OrganizationId); + + string res = ""; + + try + { + res = ES.Services.ExchangeServer.SetDefaultPublicFolderMailbox(organization.Id); + } + catch(Exception ex) + { + Log.WriteError(ex.ToString()); + } + + Log.WriteLine(res); + + } + + } +} diff --git a/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/Log.cs b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/Log.cs new file mode 100644 index 00000000..41bebd1f --- /dev/null +++ b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/Log.cs @@ -0,0 +1,204 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Configuration; +using System.Diagnostics; +using System.IO; + +namespace WebsitePanel.FixDefaultPublicFolderMailbox +{ + /// + /// Simple log + /// + public sealed class Log + { + /// + /// Initializes a new instance of the class. + /// + private Log() + { + } + + private static string logFile = "WebsitePanel.FixDefaultPublicFolderMailbox.log"; + + /// + /// Initializes trace listeners. + /// + public static void Initialize(string fileName) + { + logFile = fileName; + FileStream fileLog = new FileStream(logFile, FileMode.Append); + TextWriterTraceListener fileListener = new TextWriterTraceListener(fileLog); + fileListener.TraceOutputOptions = TraceOptions.DateTime; + Trace.UseGlobalLock = true; + Trace.Listeners.Clear(); + Trace.Listeners.Add(fileListener); + TextWriterTraceListener consoleListener = new TextWriterTraceListener(System.Console.Out); + Trace.Listeners.Add(consoleListener); + Trace.AutoFlush = true; + } + + /// + /// Write error to the log. + /// + /// Error message. + /// Exception. + internal static void WriteError(string message, Exception ex) + { + try + { + string line = string.Format("[{0:G}] ERROR: {1}", DateTime.Now, message); + Trace.WriteLine(line); + Trace.WriteLine(ex); + } + catch { } + } + + /// + /// Write error to the log. + /// + /// Error message. + internal static void WriteError(string message) + { + try + { + string line = string.Format("[{0:G}] ERROR: {1}", DateTime.Now, message); + Trace.WriteLine(line); + } + catch { } + } + + /// + /// Write to log + /// + /// + internal static void Write(string message) + { + try + { + string line = string.Format("[{0:G}] {1}", DateTime.Now, message); + Trace.Write(line); + } + catch { } + } + + + /// + /// Write line to log + /// + /// + internal static void WriteLine(string message) + { + try + { + string line = string.Format("[{0:G}] {1}", DateTime.Now, message); + Trace.WriteLine(line); + } + catch { } + } + + /// + /// Write info message to log + /// + /// + internal static void WriteInfo(string message) + { + try + { + string line = string.Format("[{0:G}] INFO: {1}", DateTime.Now, message); + Trace.WriteLine(line); + } + catch { } + } + + /// + /// Write start message to log + /// + /// + internal static void WriteStart(string message) + { + try + { + string line = string.Format("[{0:G}] START: {1}", DateTime.Now, message); + Trace.WriteLine(line); + } + catch { } + } + + /// + /// Write end message to log + /// + /// + internal static void WriteEnd(string message) + { + try + { + string line = string.Format("[{0:G}] END: {1}", DateTime.Now, message); + Trace.WriteLine(line); + } + catch { } + } + + internal static void WriteApplicationStart() + { + try + { + string name = typeof(Log).Assembly.GetName().Name; + string version = typeof(Log).Assembly.GetName().Version.ToString(3); + string line = string.Format("[{0:G}] ***** {1} {2} Started *****", DateTime.Now, name, version); + Trace.WriteLine(line); + } + catch { } + } + + internal static void WriteApplicationEnd() + { + try + { + string name = typeof(Log).Assembly.GetName().Name; + string line = string.Format("[{0:G}] ***** {1} Ended *****", DateTime.Now, name); + Trace.WriteLine(line); + } + catch { } + } + + /// + /// Opens notepad to view log file. + /// + public static void ShowLogFile() + { + try + { + string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, logFile); + Process.Start("notepad.exe", path); + } + catch { } + } + } +} diff --git a/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/Program.cs b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/Program.cs new file mode 100644 index 00000000..f7fbb46e --- /dev/null +++ b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/Program.cs @@ -0,0 +1,81 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Configuration; + +namespace WebsitePanel.FixDefaultPublicFolderMailbox +{ + class Program + { + static void Main(string[] args) + { + Log.Initialize(ConfigurationManager.AppSettings["LogFile"]); + + bool showHelp = false; + string param = null; + + if (args.Length==0) + { + showHelp = true; + } + else + { + param = args[0]; + + if ((param == "/?") || (param.ToLower() == "/h")) + showHelp = true; + } + + if (showHelp) + { + string name = typeof(Log).Assembly.GetName().Name; + string version = typeof(Log).Assembly.GetName().Version.ToString(3); + + Console.WriteLine("WebsitePanel Fix default public folder mailbox. " + version); + Console.WriteLine("Usage :"); + Console.WriteLine(name + " [/All]"); + Console.WriteLine("or"); + Console.WriteLine(name + " [OrganizationId]"); + return; + } + + Log.WriteApplicationStart(); + + if (param.ToLower() == "/all") + param = null; + + Fix.Start(param); + + Log.WriteApplicationEnd(); + } + } +} diff --git a/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/Properties/AssemblyInfo.cs b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..98c60f6e --- /dev/null +++ b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WebsitePanel.FixDefaultPublicFolderMailbox")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebsitePanel.FixDefaultPublicFolderMailbox")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a329d7ea-f908-4be7-b85e-af9d5116534f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/ServerContext.cs b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/ServerContext.cs new file mode 100644 index 00000000..4c06d2b3 --- /dev/null +++ b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/ServerContext.cs @@ -0,0 +1,62 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WebsitePanel.FixDefaultPublicFolderMailbox +{ + public class ServerContext + { + private string serverName; + + public string Server + { + get { return serverName; } + set { serverName = value; } + } + + private string userName; + + public string Username + { + get { return userName; } + set { userName = value; } + } + + private string password; + + public string Password + { + get { return password; } + set { password = value; } + } + } +} diff --git a/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/WebsitePanel.FixDefaultPublicFolderMailbox.csproj b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/WebsitePanel.FixDefaultPublicFolderMailbox.csproj new file mode 100644 index 00000000..d9e74e5c --- /dev/null +++ b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/WebsitePanel.FixDefaultPublicFolderMailbox.csproj @@ -0,0 +1,76 @@ + + + + + Debug + AnyCPU + {07678C66-5671-4836-B8C4-5F214105E189} + Exe + Properties + WebsitePanel.FixDefaultPublicFolderMailbox + WebsitePanel.FixDefaultPublicFolderMailbox + v4.0 + 512 + + + + AnyCPU + true + full + false + bin\Debug\ + TRACE;DEBUG + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\..\Lib\Microsoft.Web.Services3.dll + + + + + + + + + + ..\..\..\Bin\WebsitePanel.EnterpriseServer.Base.dll + + + ..\..\..\Bin\WebsitePanel.EnterpriseServer.Client.dll + + + ..\..\..\Bin\WebsitePanel.Providers.Base.dll + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/app.config b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/app.config new file mode 100644 index 00000000..543667d4 --- /dev/null +++ b/WebsitePanel/Sources/Tools/WebsitePanel.FixDefaultPublicFolderMailbox/app.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs index e6a2d6d9..1d2702c2 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs @@ -256,5 +256,8 @@ order by rg.groupOrder public const string ENTERPRICESTORAGE_DRIVEMAPS = "EnterpriseStorage.DriveMaps"; public const string SERVICE_LEVELS = "ServiceLevel."; + + public const string RDS_USERS = "RDS.Users"; + public const string RDS_SERVERS = "RDS.Servers"; } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/ResourceGroups.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/ResourceGroups.cs index 9494443f..624a885d 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/ResourceGroups.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/ResourceGroups.cs @@ -56,5 +56,6 @@ namespace WebsitePanel.EnterpriseServer public const string Lync = "Lync"; public const string EnterpriseStorage = "EnterpriseStorage"; public const string ServiceLevels = "Service Levels"; + public const string RDS = "RDS"; } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs index bc5a1571..452ebd88 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs @@ -125,6 +125,8 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback DeletePublicFolderEmailAddressesOperationCompleted; + private System.Threading.SendOrPostCallback SetDefaultPublicFolderMailboxOperationCompleted; + private System.Threading.SendOrPostCallback AddExchangeDisclaimerOperationCompleted; private System.Threading.SendOrPostCallback UpdateExchangeDisclaimerOperationCompleted; @@ -362,6 +364,9 @@ namespace WebsitePanel.EnterpriseServer { /// public event DeletePublicFolderEmailAddressesCompletedEventHandler DeletePublicFolderEmailAddressesCompleted; + /// + public event SetDefaultPublicFolderMailboxCompletedEventHandler SetDefaultPublicFolderMailboxCompleted; + /// public event AddExchangeDisclaimerCompletedEventHandler AddExchangeDisclaimerCompleted; @@ -1933,6 +1938,47 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetDefaultPublicFolderMailbox", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string SetDefaultPublicFolderMailbox(int itemId) { + object[] results = this.Invoke("SetDefaultPublicFolderMailbox", new object[] { + itemId}); + return ((string)(results[0])); + } + + /// + public System.IAsyncResult BeginSetDefaultPublicFolderMailbox(int itemId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetDefaultPublicFolderMailbox", new object[] { + itemId}, callback, asyncState); + } + + /// + public string EndSetDefaultPublicFolderMailbox(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// + public void SetDefaultPublicFolderMailboxAsync(int itemId) { + this.SetDefaultPublicFolderMailboxAsync(itemId, null); + } + + /// + public void SetDefaultPublicFolderMailboxAsync(int itemId, object userState) { + if ((this.SetDefaultPublicFolderMailboxOperationCompleted == null)) { + this.SetDefaultPublicFolderMailboxOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetDefaultPublicFolderMailboxOperationCompleted); + } + this.InvokeAsync("SetDefaultPublicFolderMailbox", new object[] { + itemId}, this.SetDefaultPublicFolderMailboxOperationCompleted, userState); + } + + private void OnSetDefaultPublicFolderMailboxOperationCompleted(object arg) { + if ((this.SetDefaultPublicFolderMailboxCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetDefaultPublicFolderMailboxCompleted(this, new SetDefaultPublicFolderMailboxCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddExchangeDisclaimer", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public int AddExchangeDisclaimer(int itemId, ExchangeDisclaimer disclaimer) { @@ -6309,6 +6355,32 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void SetDefaultPublicFolderMailboxCompletedEventHandler(object sender, SetDefaultPublicFolderMailboxCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SetDefaultPublicFolderMailboxCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SetDefaultPublicFolderMailboxCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] public delegate void AddExchangeDisclaimerCompletedEventHandler(object sender, AddExchangeDisclaimerCompletedEventArgs e); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs index 5367eaf5..d2deb586 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs @@ -39,26 +39,2428 @@ // // This source code was auto-generated by wsdl, Version=2.0.50727.3038. // + +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.RemoteDesktopServices; + namespace WebsitePanel.EnterpriseServer { - using System.Xml.Serialization; - using System.Web.Services; - using System.ComponentModel; - using System.Web.Services.Protocols; using System; + using System.ComponentModel; using System.Diagnostics; - - + using System.Web.Services; + using System.Web.Services.Protocols; + using System.Xml.Serialization; + /// - // CODEGEN: No methods were found in the WSDL for this protocol. [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Web.Services.WebServiceBindingAttribute(Name="esRemoteDesktopServicesSoap", Namespace="http://smbsaas/websitepanel/enterpriseserver")] - public partial class esRemoteDesktopServices : Microsoft.Web.Services3.WebServicesClientProtocol { - + [System.Web.Services.WebServiceBindingAttribute(Name = "esRemoteDesktopServicesSoap", Namespace = "http://smbsaas/websitepanel/enterpriseserver")] + public partial class esRemoteDesktopServices : Microsoft.Web.Services3.WebServicesClientProtocol + { + + private System.Threading.SendOrPostCallback GetRdsCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback GetOrganizationRdsCollectionsOperationCompleted; + + private System.Threading.SendOrPostCallback AddRdsCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback GetRdsCollectionsPagedOperationCompleted; + + private System.Threading.SendOrPostCallback RemoveRdsCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback GetRdsServersPagedOperationCompleted; + + private System.Threading.SendOrPostCallback GetFreeRdsServersPagedOperationCompleted; + + private System.Threading.SendOrPostCallback GetOrganizationRdsServersPagedOperationCompleted; + + private System.Threading.SendOrPostCallback GetOrganizationFreeRdsServersPagedOperationCompleted; + + private System.Threading.SendOrPostCallback GetRdsServerOperationCompleted; + + private System.Threading.SendOrPostCallback GetCollectionRdsServersOperationCompleted; + + private System.Threading.SendOrPostCallback GetOrganizationRdsServersOperationCompleted; + + private System.Threading.SendOrPostCallback AddRdsServerOperationCompleted; + + private System.Threading.SendOrPostCallback AddRdsServerToCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback AddRdsServerToOrganizationOperationCompleted; + + private System.Threading.SendOrPostCallback RemoveRdsServerOperationCompleted; + + private System.Threading.SendOrPostCallback RemoveRdsServerFromCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback RemoveRdsServerFromOrganizationOperationCompleted; + + private System.Threading.SendOrPostCallback UpdateRdsServerOperationCompleted; + + private System.Threading.SendOrPostCallback GetRdsCollectionUsersOperationCompleted; + + private System.Threading.SendOrPostCallback SetUsersToRdsCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback GetCollectionRemoteApplicationsOperationCompleted; + + private System.Threading.SendOrPostCallback GetAvailableRemoteApplicationsOperationCompleted; + + private System.Threading.SendOrPostCallback AddRemoteApplicationToCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback RemoveRemoteApplicationFromCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback SetRemoteApplicationsToRdsCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback GetOrganizationRdsUsersCountOperationCompleted; + /// - public esRemoteDesktopServices() { + public esRemoteDesktopServices() + { this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx"; } + + /// + public event GetRdsCollectionCompletedEventHandler GetRdsCollectionCompleted; + + /// + public event GetOrganizationRdsCollectionsCompletedEventHandler GetOrganizationRdsCollectionsCompleted; + + /// + public event AddRdsCollectionCompletedEventHandler AddRdsCollectionCompleted; + + /// + public event GetRdsCollectionsPagedCompletedEventHandler GetRdsCollectionsPagedCompleted; + + /// + public event RemoveRdsCollectionCompletedEventHandler RemoveRdsCollectionCompleted; + + /// + public event GetRdsServersPagedCompletedEventHandler GetRdsServersPagedCompleted; + + /// + public event GetFreeRdsServersPagedCompletedEventHandler GetFreeRdsServersPagedCompleted; + + /// + public event GetOrganizationRdsServersPagedCompletedEventHandler GetOrganizationRdsServersPagedCompleted; + + /// + public event GetOrganizationFreeRdsServersPagedCompletedEventHandler GetOrganizationFreeRdsServersPagedCompleted; + + /// + public event GetRdsServerCompletedEventHandler GetRdsServerCompleted; + + /// + public event GetCollectionRdsServersCompletedEventHandler GetCollectionRdsServersCompleted; + + /// + public event GetOrganizationRdsServersCompletedEventHandler GetOrganizationRdsServersCompleted; + + /// + public event AddRdsServerCompletedEventHandler AddRdsServerCompleted; + + /// + public event AddRdsServerToCollectionCompletedEventHandler AddRdsServerToCollectionCompleted; + + /// + public event AddRdsServerToOrganizationCompletedEventHandler AddRdsServerToOrganizationCompleted; + + /// + public event RemoveRdsServerCompletedEventHandler RemoveRdsServerCompleted; + + /// + public event RemoveRdsServerFromCollectionCompletedEventHandler RemoveRdsServerFromCollectionCompleted; + + /// + public event RemoveRdsServerFromOrganizationCompletedEventHandler RemoveRdsServerFromOrganizationCompleted; + + /// + public event UpdateRdsServerCompletedEventHandler UpdateRdsServerCompleted; + + /// + public event GetRdsCollectionUsersCompletedEventHandler GetRdsCollectionUsersCompleted; + + /// + public event SetUsersToRdsCollectionCompletedEventHandler SetUsersToRdsCollectionCompleted; + + /// + public event GetCollectionRemoteApplicationsCompletedEventHandler GetCollectionRemoteApplicationsCompleted; + + /// + public event GetAvailableRemoteApplicationsCompletedEventHandler GetAvailableRemoteApplicationsCompleted; + + /// + public event AddRemoteApplicationToCollectionCompletedEventHandler AddRemoteApplicationToCollectionCompleted; + + /// + public event RemoveRemoteApplicationFromCollectionCompletedEventHandler RemoveRemoteApplicationFromCollectionCompleted; + + /// + public event SetRemoteApplicationsToRdsCollectionCompletedEventHandler SetRemoteApplicationsToRdsCollectionCompleted; + + /// + public event GetOrganizationRdsUsersCountCompletedEventHandler GetOrganizationRdsUsersCountCompleted; + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCollection", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RdsCollection GetRdsCollection(int collectionId) + { + object[] results = this.Invoke("GetRdsCollection", new object[] { + collectionId}); + return ((RdsCollection)(results[0])); + } + + /// + public System.IAsyncResult BeginGetRdsCollection(int collectionId, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetRdsCollection", new object[] { + collectionId}, callback, asyncState); + } + + /// + public RdsCollection EndGetRdsCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RdsCollection)(results[0])); + } + + /// + public void GetRdsCollectionAsync(int collectionId) + { + this.GetRdsCollectionAsync(collectionId, null); + } + + /// + public void GetRdsCollectionAsync(int collectionId, object userState) + { + if ((this.GetRdsCollectionOperationCompleted == null)) + { + this.GetRdsCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsCollectionOperationCompleted); + } + this.InvokeAsync("GetRdsCollection", new object[] { + collectionId}, this.GetRdsCollectionOperationCompleted, userState); + } + + private void OnGetRdsCollectionOperationCompleted(object arg) + { + if ((this.GetRdsCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetRdsCollectionCompleted(this, new GetRdsCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetOrganizationRdsCollections", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RdsCollection[] GetOrganizationRdsCollections(int itemId) + { + object[] results = this.Invoke("GetOrganizationRdsCollections", new object[] { + itemId}); + return ((RdsCollection[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetOrganizationRdsCollections(int itemId, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetOrganizationRdsCollections", new object[] { + itemId}, callback, asyncState); + } + + /// + public RdsCollection[] EndGetOrganizationRdsCollections(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RdsCollection[])(results[0])); + } + + /// + public void GetOrganizationRdsCollectionsAsync(int itemId) + { + this.GetOrganizationRdsCollectionsAsync(itemId, null); + } + + /// + public void GetOrganizationRdsCollectionsAsync(int itemId, object userState) + { + if ((this.GetOrganizationRdsCollectionsOperationCompleted == null)) + { + this.GetOrganizationRdsCollectionsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationRdsCollectionsOperationCompleted); + } + this.InvokeAsync("GetOrganizationRdsCollections", new object[] { + itemId}, this.GetOrganizationRdsCollectionsOperationCompleted, userState); + } + + private void OnGetOrganizationRdsCollectionsOperationCompleted(object arg) + { + if ((this.GetOrganizationRdsCollectionsCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetOrganizationRdsCollectionsCompleted(this, new GetOrganizationRdsCollectionsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddRdsCollection", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject AddRdsCollection(int itemId, RdsCollection collection) + { + object[] results = this.Invoke("AddRdsCollection", new object[] { + itemId, + collection}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginAddRdsCollection(int itemId, RdsCollection collection, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("AddRdsCollection", new object[] { + itemId, + collection}, callback, asyncState); + } + + /// + public ResultObject EndAddRdsCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void AddRdsCollectionAsync(int itemId, RdsCollection collection) + { + this.AddRdsCollectionAsync(itemId, collection, null); + } + + /// + public void AddRdsCollectionAsync(int itemId, RdsCollection collection, object userState) + { + if ((this.AddRdsCollectionOperationCompleted == null)) + { + this.AddRdsCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRdsCollectionOperationCompleted); + } + this.InvokeAsync("AddRdsCollection", new object[] { + itemId, + collection}, this.AddRdsCollectionOperationCompleted, userState); + } + + private void OnAddRdsCollectionOperationCompleted(object arg) + { + if ((this.AddRdsCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddRdsCollectionCompleted(this, new AddRdsCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCollectionsPaged", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RdsCollectionPaged GetRdsCollectionsPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + object[] results = this.Invoke("GetRdsCollectionsPaged", new object[] { + itemId, + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}); + return ((RdsCollectionPaged)(results[0])); + } + + /// + public System.IAsyncResult BeginGetRdsCollectionsPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetRdsCollectionsPaged", new object[] { + itemId, + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}, callback, asyncState); + } + + /// + public RdsCollectionPaged EndGetRdsCollectionsPaged(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RdsCollectionPaged)(results[0])); + } + + /// + public void GetRdsCollectionsPagedAsync(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + this.GetRdsCollectionsPagedAsync(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows, null); + } + + /// + public void GetRdsCollectionsPagedAsync(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) + { + if ((this.GetRdsCollectionsPagedOperationCompleted == null)) + { + this.GetRdsCollectionsPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsCollectionsPagedOperationCompleted); + } + this.InvokeAsync("GetRdsCollectionsPaged", new object[] { + itemId, + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}, this.GetRdsCollectionsPagedOperationCompleted, userState); + } + + private void OnGetRdsCollectionsPagedOperationCompleted(object arg) + { + if ((this.GetRdsCollectionsPagedCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetRdsCollectionsPagedCompleted(this, new GetRdsCollectionsPagedCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/RemoveRdsCollection", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject RemoveRdsCollection(int itemId, RdsCollection collection) + { + object[] results = this.Invoke("RemoveRdsCollection", new object[] { + itemId, + collection}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginRemoveRdsCollection(int itemId, RdsCollection collection, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("RemoveRdsCollection", new object[] { + itemId, + collection}, callback, asyncState); + } + + /// + public ResultObject EndRemoveRdsCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void RemoveRdsCollectionAsync(int itemId, RdsCollection collection) + { + this.RemoveRdsCollectionAsync(itemId, collection, null); + } + + /// + public void RemoveRdsCollectionAsync(int itemId, RdsCollection collection, object userState) + { + if ((this.RemoveRdsCollectionOperationCompleted == null)) + { + this.RemoveRdsCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveRdsCollectionOperationCompleted); + } + this.InvokeAsync("RemoveRdsCollection", new object[] { + itemId, + collection}, this.RemoveRdsCollectionOperationCompleted, userState); + } + + private void OnRemoveRdsCollectionOperationCompleted(object arg) + { + if ((this.RemoveRdsCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.RemoveRdsCollectionCompleted(this, new RemoveRdsCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsServersPaged", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RdsServersPaged GetRdsServersPaged(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + object[] results = this.Invoke("GetRdsServersPaged", new object[] { + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}); + return ((RdsServersPaged)(results[0])); + } + + /// + public System.IAsyncResult BeginGetRdsServersPaged(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetRdsServersPaged", new object[] { + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}, callback, asyncState); + } + + /// + public RdsServersPaged EndGetRdsServersPaged(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RdsServersPaged)(results[0])); + } + + /// + public void GetRdsServersPagedAsync(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + this.GetRdsServersPagedAsync(filterColumn, filterValue, sortColumn, startRow, maximumRows, null); + } + + /// + public void GetRdsServersPagedAsync(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) + { + if ((this.GetRdsServersPagedOperationCompleted == null)) + { + this.GetRdsServersPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsServersPagedOperationCompleted); + } + this.InvokeAsync("GetRdsServersPaged", new object[] { + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}, this.GetRdsServersPagedOperationCompleted, userState); + } + + private void OnGetRdsServersPagedOperationCompleted(object arg) + { + if ((this.GetRdsServersPagedCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetRdsServersPagedCompleted(this, new GetRdsServersPagedCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetFreeRdsServersPaged", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RdsServersPaged GetFreeRdsServersPaged(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + object[] results = this.Invoke("GetFreeRdsServersPaged", new object[] { + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}); + return ((RdsServersPaged)(results[0])); + } + + /// + public System.IAsyncResult BeginGetFreeRdsServersPaged(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetFreeRdsServersPaged", new object[] { + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}, callback, asyncState); + } + + /// + public RdsServersPaged EndGetFreeRdsServersPaged(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RdsServersPaged)(results[0])); + } + + /// + public void GetFreeRdsServersPagedAsync(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + this.GetFreeRdsServersPagedAsync(filterColumn, filterValue, sortColumn, startRow, maximumRows, null); + } + + /// + public void GetFreeRdsServersPagedAsync(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) + { + if ((this.GetFreeRdsServersPagedOperationCompleted == null)) + { + this.GetFreeRdsServersPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFreeRdsServersPagedOperationCompleted); + } + this.InvokeAsync("GetFreeRdsServersPaged", new object[] { + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}, this.GetFreeRdsServersPagedOperationCompleted, userState); + } + + private void OnGetFreeRdsServersPagedOperationCompleted(object arg) + { + if ((this.GetFreeRdsServersPagedCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetFreeRdsServersPagedCompleted(this, new GetFreeRdsServersPagedCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetOrganizationRdsServersPaged", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RdsServersPaged GetOrganizationRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + object[] results = this.Invoke("GetOrganizationRdsServersPaged", new object[] { + itemId, + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}); + return ((RdsServersPaged)(results[0])); + } + + /// + public System.IAsyncResult BeginGetOrganizationRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetOrganizationRdsServersPaged", new object[] { + itemId, + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}, callback, asyncState); + } + + /// + public RdsServersPaged EndGetOrganizationRdsServersPaged(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RdsServersPaged)(results[0])); + } + + /// + public void GetOrganizationRdsServersPagedAsync(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + this.GetOrganizationRdsServersPagedAsync(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows, null); + } + + /// + public void GetOrganizationRdsServersPagedAsync(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) + { + if ((this.GetOrganizationRdsServersPagedOperationCompleted == null)) + { + this.GetOrganizationRdsServersPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationRdsServersPagedOperationCompleted); + } + this.InvokeAsync("GetOrganizationRdsServersPaged", new object[] { + itemId, + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}, this.GetOrganizationRdsServersPagedOperationCompleted, userState); + } + + private void OnGetOrganizationRdsServersPagedOperationCompleted(object arg) + { + if ((this.GetOrganizationRdsServersPagedCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetOrganizationRdsServersPagedCompleted(this, new GetOrganizationRdsServersPagedCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetOrganizationFreeRdsServersPaged", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RdsServersPaged GetOrganizationFreeRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + object[] results = this.Invoke("GetOrganizationFreeRdsServersPaged", new object[] { + itemId, + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}); + return ((RdsServersPaged)(results[0])); + } + + /// + public System.IAsyncResult BeginGetOrganizationFreeRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetOrganizationFreeRdsServersPaged", new object[] { + itemId, + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}, callback, asyncState); + } + + /// + public RdsServersPaged EndGetOrganizationFreeRdsServersPaged(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RdsServersPaged)(results[0])); + } + + /// + public void GetOrganizationFreeRdsServersPagedAsync(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + this.GetOrganizationFreeRdsServersPagedAsync(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows, null); + } + + /// + public void GetOrganizationFreeRdsServersPagedAsync(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) + { + if ((this.GetOrganizationFreeRdsServersPagedOperationCompleted == null)) + { + this.GetOrganizationFreeRdsServersPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationFreeRdsServersPagedOperationCompleted); + } + this.InvokeAsync("GetOrganizationFreeRdsServersPaged", new object[] { + itemId, + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}, this.GetOrganizationFreeRdsServersPagedOperationCompleted, userState); + } + + private void OnGetOrganizationFreeRdsServersPagedOperationCompleted(object arg) + { + if ((this.GetOrganizationFreeRdsServersPagedCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetOrganizationFreeRdsServersPagedCompleted(this, new GetOrganizationFreeRdsServersPagedCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsServer", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RdsServer GetRdsServer(int rdsSeverId) + { + object[] results = this.Invoke("GetRdsServer", new object[] { + rdsSeverId}); + return ((RdsServer)(results[0])); + } + + /// + public System.IAsyncResult BeginGetRdsServer(int rdsSeverId, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetRdsServer", new object[] { + rdsSeverId}, callback, asyncState); + } + + /// + public RdsServer EndGetRdsServer(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RdsServer)(results[0])); + } + + /// + public void GetRdsServerAsync(int rdsSeverId) + { + this.GetRdsServerAsync(rdsSeverId, null); + } + + /// + public void GetRdsServerAsync(int rdsSeverId, object userState) + { + if ((this.GetRdsServerOperationCompleted == null)) + { + this.GetRdsServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsServerOperationCompleted); + } + this.InvokeAsync("GetRdsServer", new object[] { + rdsSeverId}, this.GetRdsServerOperationCompleted, userState); + } + + private void OnGetRdsServerOperationCompleted(object arg) + { + if ((this.GetRdsServerCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetRdsServerCompleted(this, new GetRdsServerCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetCollectionRdsServers", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RdsServer[] GetCollectionRdsServers(int collectionId) + { + object[] results = this.Invoke("GetCollectionRdsServers", new object[] { + collectionId}); + return ((RdsServer[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetCollectionRdsServers(int collectionId, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetCollectionRdsServers", new object[] { + collectionId}, callback, asyncState); + } + + /// + public RdsServer[] EndGetCollectionRdsServers(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RdsServer[])(results[0])); + } + + /// + public void GetCollectionRdsServersAsync(int collectionId) + { + this.GetCollectionRdsServersAsync(collectionId, null); + } + + /// + public void GetCollectionRdsServersAsync(int collectionId, object userState) + { + if ((this.GetCollectionRdsServersOperationCompleted == null)) + { + this.GetCollectionRdsServersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCollectionRdsServersOperationCompleted); + } + this.InvokeAsync("GetCollectionRdsServers", new object[] { + collectionId}, this.GetCollectionRdsServersOperationCompleted, userState); + } + + private void OnGetCollectionRdsServersOperationCompleted(object arg) + { + if ((this.GetCollectionRdsServersCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetCollectionRdsServersCompleted(this, new GetCollectionRdsServersCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetOrganizationRdsServers", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RdsServer[] GetOrganizationRdsServers(int itemId) + { + object[] results = this.Invoke("GetOrganizationRdsServers", new object[] { + itemId}); + return ((RdsServer[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetOrganizationRdsServers(int itemId, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetOrganizationRdsServers", new object[] { + itemId}, callback, asyncState); + } + + /// + public RdsServer[] EndGetOrganizationRdsServers(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RdsServer[])(results[0])); + } + + /// + public void GetOrganizationRdsServersAsync(int itemId) + { + this.GetOrganizationRdsServersAsync(itemId, null); + } + + /// + public void GetOrganizationRdsServersAsync(int itemId, object userState) + { + if ((this.GetOrganizationRdsServersOperationCompleted == null)) + { + this.GetOrganizationRdsServersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationRdsServersOperationCompleted); + } + this.InvokeAsync("GetOrganizationRdsServers", new object[] { + itemId}, this.GetOrganizationRdsServersOperationCompleted, userState); + } + + private void OnGetOrganizationRdsServersOperationCompleted(object arg) + { + if ((this.GetOrganizationRdsServersCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetOrganizationRdsServersCompleted(this, new GetOrganizationRdsServersCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddRdsServer", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject AddRdsServer(RdsServer rdsServer) + { + object[] results = this.Invoke("AddRdsServer", new object[] { + rdsServer}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginAddRdsServer(RdsServer rdsServer, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("AddRdsServer", new object[] { + rdsServer}, callback, asyncState); + } + + /// + public ResultObject EndAddRdsServer(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void AddRdsServerAsync(RdsServer rdsServer) + { + this.AddRdsServerAsync(rdsServer, null); + } + + /// + public void AddRdsServerAsync(RdsServer rdsServer, object userState) + { + if ((this.AddRdsServerOperationCompleted == null)) + { + this.AddRdsServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRdsServerOperationCompleted); + } + this.InvokeAsync("AddRdsServer", new object[] { + rdsServer}, this.AddRdsServerOperationCompleted, userState); + } + + private void OnAddRdsServerOperationCompleted(object arg) + { + if ((this.AddRdsServerCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddRdsServerCompleted(this, new AddRdsServerCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddRdsServerToCollection", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject AddRdsServerToCollection(int itemId, RdsServer rdsServer, RdsCollection rdsCollection) + { + object[] results = this.Invoke("AddRdsServerToCollection", new object[] { + itemId, + rdsServer, + rdsCollection}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginAddRdsServerToCollection(int itemId, RdsServer rdsServer, RdsCollection rdsCollection, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("AddRdsServerToCollection", new object[] { + itemId, + rdsServer, + rdsCollection}, callback, asyncState); + } + + /// + public ResultObject EndAddRdsServerToCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void AddRdsServerToCollectionAsync(int itemId, RdsServer rdsServer, RdsCollection rdsCollection) + { + this.AddRdsServerToCollectionAsync(itemId, rdsServer, rdsCollection, null); + } + + /// + public void AddRdsServerToCollectionAsync(int itemId, RdsServer rdsServer, RdsCollection rdsCollection, object userState) + { + if ((this.AddRdsServerToCollectionOperationCompleted == null)) + { + this.AddRdsServerToCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRdsServerToCollectionOperationCompleted); + } + this.InvokeAsync("AddRdsServerToCollection", new object[] { + itemId, + rdsServer, + rdsCollection}, this.AddRdsServerToCollectionOperationCompleted, userState); + } + + private void OnAddRdsServerToCollectionOperationCompleted(object arg) + { + if ((this.AddRdsServerToCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddRdsServerToCollectionCompleted(this, new AddRdsServerToCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddRdsServerToOrganization", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject AddRdsServerToOrganization(int itemId, int serverId) + { + object[] results = this.Invoke("AddRdsServerToOrganization", new object[] { + itemId, + serverId}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginAddRdsServerToOrganization(int itemId, int serverId, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("AddRdsServerToOrganization", new object[] { + itemId, + serverId}, callback, asyncState); + } + + /// + public ResultObject EndAddRdsServerToOrganization(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void AddRdsServerToOrganizationAsync(int itemId, int serverId) + { + this.AddRdsServerToOrganizationAsync(itemId, serverId, null); + } + + /// + public void AddRdsServerToOrganizationAsync(int itemId, int serverId, object userState) + { + if ((this.AddRdsServerToOrganizationOperationCompleted == null)) + { + this.AddRdsServerToOrganizationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRdsServerToOrganizationOperationCompleted); + } + this.InvokeAsync("AddRdsServerToOrganization", new object[] { + itemId, + serverId}, this.AddRdsServerToOrganizationOperationCompleted, userState); + } + + private void OnAddRdsServerToOrganizationOperationCompleted(object arg) + { + if ((this.AddRdsServerToOrganizationCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddRdsServerToOrganizationCompleted(this, new AddRdsServerToOrganizationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/RemoveRdsServer", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject RemoveRdsServer(int rdsServerId) + { + object[] results = this.Invoke("RemoveRdsServer", new object[] { + rdsServerId}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginRemoveRdsServer(int rdsServerId, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("RemoveRdsServer", new object[] { + rdsServerId}, callback, asyncState); + } + + /// + public ResultObject EndRemoveRdsServer(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void RemoveRdsServerAsync(int rdsServerId) + { + this.RemoveRdsServerAsync(rdsServerId, null); + } + + /// + public void RemoveRdsServerAsync(int rdsServerId, object userState) + { + if ((this.RemoveRdsServerOperationCompleted == null)) + { + this.RemoveRdsServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveRdsServerOperationCompleted); + } + this.InvokeAsync("RemoveRdsServer", new object[] { + rdsServerId}, this.RemoveRdsServerOperationCompleted, userState); + } + + private void OnRemoveRdsServerOperationCompleted(object arg) + { + if ((this.RemoveRdsServerCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.RemoveRdsServerCompleted(this, new RemoveRdsServerCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/RemoveRdsServerFromCollection", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject RemoveRdsServerFromCollection(int itemId, RdsServer rdsServer, RdsCollection rdsCollection) + { + object[] results = this.Invoke("RemoveRdsServerFromCollection", new object[] { + itemId, + rdsServer, + rdsCollection}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginRemoveRdsServerFromCollection(int itemId, RdsServer rdsServer, RdsCollection rdsCollection, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("RemoveRdsServerFromCollection", new object[] { + itemId, + rdsServer, + rdsCollection}, callback, asyncState); + } + + /// + public ResultObject EndRemoveRdsServerFromCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void RemoveRdsServerFromCollectionAsync(int itemId, RdsServer rdsServer, RdsCollection rdsCollection) + { + this.RemoveRdsServerFromCollectionAsync(itemId, rdsServer, rdsCollection, null); + } + + /// + public void RemoveRdsServerFromCollectionAsync(int itemId, RdsServer rdsServer, RdsCollection rdsCollection, object userState) + { + if ((this.RemoveRdsServerFromCollectionOperationCompleted == null)) + { + this.RemoveRdsServerFromCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveRdsServerFromCollectionOperationCompleted); + } + this.InvokeAsync("RemoveRdsServerFromCollection", new object[] { + itemId, + rdsServer, + rdsCollection}, this.RemoveRdsServerFromCollectionOperationCompleted, userState); + } + + private void OnRemoveRdsServerFromCollectionOperationCompleted(object arg) + { + if ((this.RemoveRdsServerFromCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.RemoveRdsServerFromCollectionCompleted(this, new RemoveRdsServerFromCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/RemoveRdsServerFromOrganization", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject RemoveRdsServerFromOrganization(int rdsServerId) + { + object[] results = this.Invoke("RemoveRdsServerFromOrganization", new object[] { + rdsServerId}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginRemoveRdsServerFromOrganization(int rdsServerId, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("RemoveRdsServerFromOrganization", new object[] { + rdsServerId}, callback, asyncState); + } + + /// + public ResultObject EndRemoveRdsServerFromOrganization(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void RemoveRdsServerFromOrganizationAsync(int rdsServerId) + { + this.RemoveRdsServerFromOrganizationAsync(rdsServerId, null); + } + + /// + public void RemoveRdsServerFromOrganizationAsync(int rdsServerId, object userState) + { + if ((this.RemoveRdsServerFromOrganizationOperationCompleted == null)) + { + this.RemoveRdsServerFromOrganizationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveRdsServerFromOrganizationOperationCompleted); + } + this.InvokeAsync("RemoveRdsServerFromOrganization", new object[] { + rdsServerId}, this.RemoveRdsServerFromOrganizationOperationCompleted, userState); + } + + private void OnRemoveRdsServerFromOrganizationOperationCompleted(object arg) + { + if ((this.RemoveRdsServerFromOrganizationCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.RemoveRdsServerFromOrganizationCompleted(this, new RemoveRdsServerFromOrganizationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/UpdateRdsServer", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject UpdateRdsServer(RdsServer rdsServer) + { + object[] results = this.Invoke("UpdateRdsServer", new object[] { + rdsServer}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginUpdateRdsServer(RdsServer rdsServer, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("UpdateRdsServer", new object[] { + rdsServer}, callback, asyncState); + } + + /// + public ResultObject EndUpdateRdsServer(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void UpdateRdsServerAsync(RdsServer rdsServer) + { + this.UpdateRdsServerAsync(rdsServer, null); + } + + /// + public void UpdateRdsServerAsync(RdsServer rdsServer, object userState) + { + if ((this.UpdateRdsServerOperationCompleted == null)) + { + this.UpdateRdsServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateRdsServerOperationCompleted); + } + this.InvokeAsync("UpdateRdsServer", new object[] { + rdsServer}, this.UpdateRdsServerOperationCompleted, userState); + } + + private void OnUpdateRdsServerOperationCompleted(object arg) + { + if ((this.UpdateRdsServerCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.UpdateRdsServerCompleted(this, new UpdateRdsServerCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCollectionUsers", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public OrganizationUser[] GetRdsCollectionUsers(int collectionId) + { + object[] results = this.Invoke("GetRdsCollectionUsers", new object[] { + collectionId}); + return ((OrganizationUser[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetRdsCollectionUsers(int collectionId, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetRdsCollectionUsers", new object[] { + collectionId}, callback, asyncState); + } + + /// + public OrganizationUser[] EndGetRdsCollectionUsers(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((OrganizationUser[])(results[0])); + } + + /// + public void GetRdsCollectionUsersAsync(int collectionId) + { + this.GetRdsCollectionUsersAsync(collectionId, null); + } + + /// + public void GetRdsCollectionUsersAsync(int collectionId, object userState) + { + if ((this.GetRdsCollectionUsersOperationCompleted == null)) + { + this.GetRdsCollectionUsersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsCollectionUsersOperationCompleted); + } + this.InvokeAsync("GetRdsCollectionUsers", new object[] { + collectionId}, this.GetRdsCollectionUsersOperationCompleted, userState); + } + + private void OnGetRdsCollectionUsersOperationCompleted(object arg) + { + if ((this.GetRdsCollectionUsersCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetRdsCollectionUsersCompleted(this, new GetRdsCollectionUsersCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetUsersToRdsCollection", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject SetUsersToRdsCollection(int itemId, int collectionId, OrganizationUser[] users) + { + object[] results = this.Invoke("SetUsersToRdsCollection", new object[] { + itemId, + collectionId, + users}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginSetUsersToRdsCollection(int itemId, int collectionId, OrganizationUser[] users, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("SetUsersToRdsCollection", new object[] { + itemId, + collectionId, + users}, callback, asyncState); + } + + /// + public ResultObject EndSetUsersToRdsCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void SetUsersToRdsCollectionAsync(int itemId, int collectionId, OrganizationUser[] users) + { + this.SetUsersToRdsCollectionAsync(itemId, collectionId, users, null); + } + + /// + public void SetUsersToRdsCollectionAsync(int itemId, int collectionId, OrganizationUser[] users, object userState) + { + if ((this.SetUsersToRdsCollectionOperationCompleted == null)) + { + this.SetUsersToRdsCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetUsersToRdsCollectionOperationCompleted); + } + this.InvokeAsync("SetUsersToRdsCollection", new object[] { + itemId, + collectionId, + users}, this.SetUsersToRdsCollectionOperationCompleted, userState); + } + + private void OnSetUsersToRdsCollectionOperationCompleted(object arg) + { + if ((this.SetUsersToRdsCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetUsersToRdsCollectionCompleted(this, new SetUsersToRdsCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetCollectionRemoteApplications", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RemoteApplication[] GetCollectionRemoteApplications(int itemId, string collectionName) + { + object[] results = this.Invoke("GetCollectionRemoteApplications", new object[] { + itemId, + collectionName}); + return ((RemoteApplication[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetCollectionRemoteApplications(int itemId, string collectionName, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetCollectionRemoteApplications", new object[] { + itemId, + collectionName}, callback, asyncState); + } + + /// + public RemoteApplication[] EndGetCollectionRemoteApplications(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RemoteApplication[])(results[0])); + } + + /// + public void GetCollectionRemoteApplicationsAsync(int itemId, string collectionName) + { + this.GetCollectionRemoteApplicationsAsync(itemId, collectionName, null); + } + + /// + public void GetCollectionRemoteApplicationsAsync(int itemId, string collectionName, object userState) + { + if ((this.GetCollectionRemoteApplicationsOperationCompleted == null)) + { + this.GetCollectionRemoteApplicationsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCollectionRemoteApplicationsOperationCompleted); + } + this.InvokeAsync("GetCollectionRemoteApplications", new object[] { + itemId, + collectionName}, this.GetCollectionRemoteApplicationsOperationCompleted, userState); + } + + private void OnGetCollectionRemoteApplicationsOperationCompleted(object arg) + { + if ((this.GetCollectionRemoteApplicationsCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetCollectionRemoteApplicationsCompleted(this, new GetCollectionRemoteApplicationsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetAvailableRemoteApplications", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public StartMenuApp[] GetAvailableRemoteApplications(int itemId, string collectionName) + { + object[] results = this.Invoke("GetAvailableRemoteApplications", new object[] { + itemId, + collectionName}); + return ((StartMenuApp[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetAvailableRemoteApplications(int itemId, string collectionName, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetAvailableRemoteApplications", new object[] { + itemId, + collectionName}, callback, asyncState); + } + + /// + public StartMenuApp[] EndGetAvailableRemoteApplications(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((StartMenuApp[])(results[0])); + } + + /// + public void GetAvailableRemoteApplicationsAsync(int itemId, string collectionName) + { + this.GetAvailableRemoteApplicationsAsync(itemId, collectionName, null); + } + + /// + public void GetAvailableRemoteApplicationsAsync(int itemId, string collectionName, object userState) + { + if ((this.GetAvailableRemoteApplicationsOperationCompleted == null)) + { + this.GetAvailableRemoteApplicationsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetAvailableRemoteApplicationsOperationCompleted); + } + this.InvokeAsync("GetAvailableRemoteApplications", new object[] { + itemId, + collectionName}, this.GetAvailableRemoteApplicationsOperationCompleted, userState); + } + + private void OnGetAvailableRemoteApplicationsOperationCompleted(object arg) + { + if ((this.GetAvailableRemoteApplicationsCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetAvailableRemoteApplicationsCompleted(this, new GetAvailableRemoteApplicationsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddRemoteApplicationToCollection", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject AddRemoteApplicationToCollection(int itemId, RdsCollection collection, RemoteApplication application) + { + object[] results = this.Invoke("AddRemoteApplicationToCollection", new object[] { + itemId, + collection, + application}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginAddRemoteApplicationToCollection(int itemId, RdsCollection collection, RemoteApplication application, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("AddRemoteApplicationToCollection", new object[] { + itemId, + collection, + application}, callback, asyncState); + } + + /// + public ResultObject EndAddRemoteApplicationToCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void AddRemoteApplicationToCollectionAsync(int itemId, RdsCollection collection, RemoteApplication application) + { + this.AddRemoteApplicationToCollectionAsync(itemId, collection, application, null); + } + + /// + public void AddRemoteApplicationToCollectionAsync(int itemId, RdsCollection collection, RemoteApplication application, object userState) + { + if ((this.AddRemoteApplicationToCollectionOperationCompleted == null)) + { + this.AddRemoteApplicationToCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRemoteApplicationToCollectionOperationCompleted); + } + this.InvokeAsync("AddRemoteApplicationToCollection", new object[] { + itemId, + collection, + application}, this.AddRemoteApplicationToCollectionOperationCompleted, userState); + } + + private void OnAddRemoteApplicationToCollectionOperationCompleted(object arg) + { + if ((this.AddRemoteApplicationToCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddRemoteApplicationToCollectionCompleted(this, new AddRemoteApplicationToCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/RemoveRemoteApplicationFromCollectio" + + "n", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject RemoveRemoteApplicationFromCollection(int itemId, RdsCollection collection, RemoteApplication application) + { + object[] results = this.Invoke("RemoveRemoteApplicationFromCollection", new object[] { + itemId, + collection, + application}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginRemoveRemoteApplicationFromCollection(int itemId, RdsCollection collection, RemoteApplication application, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("RemoveRemoteApplicationFromCollection", new object[] { + itemId, + collection, + application}, callback, asyncState); + } + + /// + public ResultObject EndRemoveRemoteApplicationFromCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void RemoveRemoteApplicationFromCollectionAsync(int itemId, RdsCollection collection, RemoteApplication application) + { + this.RemoveRemoteApplicationFromCollectionAsync(itemId, collection, application, null); + } + + /// + public void RemoveRemoteApplicationFromCollectionAsync(int itemId, RdsCollection collection, RemoteApplication application, object userState) + { + if ((this.RemoveRemoteApplicationFromCollectionOperationCompleted == null)) + { + this.RemoveRemoteApplicationFromCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveRemoteApplicationFromCollectionOperationCompleted); + } + this.InvokeAsync("RemoveRemoteApplicationFromCollection", new object[] { + itemId, + collection, + application}, this.RemoveRemoteApplicationFromCollectionOperationCompleted, userState); + } + + private void OnRemoveRemoteApplicationFromCollectionOperationCompleted(object arg) + { + if ((this.RemoveRemoteApplicationFromCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.RemoveRemoteApplicationFromCollectionCompleted(this, new RemoveRemoteApplicationFromCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetRemoteApplicationsToRdsCollection" + + "", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject SetRemoteApplicationsToRdsCollection(int itemId, int collectionId, RemoteApplication[] remoteApps) + { + object[] results = this.Invoke("SetRemoteApplicationsToRdsCollection", new object[] { + itemId, + collectionId, + remoteApps}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginSetRemoteApplicationsToRdsCollection(int itemId, int collectionId, RemoteApplication[] remoteApps, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("SetRemoteApplicationsToRdsCollection", new object[] { + itemId, + collectionId, + remoteApps}, callback, asyncState); + } + + /// + public ResultObject EndSetRemoteApplicationsToRdsCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void SetRemoteApplicationsToRdsCollectionAsync(int itemId, int collectionId, RemoteApplication[] remoteApps) + { + this.SetRemoteApplicationsToRdsCollectionAsync(itemId, collectionId, remoteApps, null); + } + + /// + public void SetRemoteApplicationsToRdsCollectionAsync(int itemId, int collectionId, RemoteApplication[] remoteApps, object userState) + { + if ((this.SetRemoteApplicationsToRdsCollectionOperationCompleted == null)) + { + this.SetRemoteApplicationsToRdsCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetRemoteApplicationsToRdsCollectionOperationCompleted); + } + this.InvokeAsync("SetRemoteApplicationsToRdsCollection", new object[] { + itemId, + collectionId, + remoteApps}, this.SetRemoteApplicationsToRdsCollectionOperationCompleted, userState); + } + + private void OnSetRemoteApplicationsToRdsCollectionOperationCompleted(object arg) + { + if ((this.SetRemoteApplicationsToRdsCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetRemoteApplicationsToRdsCollectionCompleted(this, new SetRemoteApplicationsToRdsCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetOrganizationRdsUsersCount", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public int GetOrganizationRdsUsersCount(int itemId) + { + object[] results = this.Invoke("GetOrganizationRdsUsersCount", new object[] { + itemId}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginGetOrganizationRdsUsersCount(int itemId, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetOrganizationRdsUsersCount", new object[] { + itemId}, callback, asyncState); + } + + /// + public int EndGetOrganizationRdsUsersCount(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void GetOrganizationRdsUsersCountAsync(int itemId) + { + this.GetOrganizationRdsUsersCountAsync(itemId, null); + } + + /// + public void GetOrganizationRdsUsersCountAsync(int itemId, object userState) + { + if ((this.GetOrganizationRdsUsersCountOperationCompleted == null)) + { + this.GetOrganizationRdsUsersCountOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationRdsUsersCountOperationCompleted); + } + this.InvokeAsync("GetOrganizationRdsUsersCount", new object[] { + itemId}, this.GetOrganizationRdsUsersCountOperationCompleted, userState); + } + + private void OnGetOrganizationRdsUsersCountOperationCompleted(object arg) + { + if ((this.GetOrganizationRdsUsersCountCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetOrganizationRdsUsersCountCompleted(this, new GetOrganizationRdsUsersCountCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + public new void CancelAsync(object userState) + { + base.CancelAsync(userState); + } } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetRdsCollectionCompletedEventHandler(object sender, GetRdsCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetRdsCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetRdsCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RdsCollection Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RdsCollection)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetOrganizationRdsCollectionsCompletedEventHandler(object sender, GetOrganizationRdsCollectionsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetOrganizationRdsCollectionsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetOrganizationRdsCollectionsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RdsCollection[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RdsCollection[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddRdsCollectionCompletedEventHandler(object sender, AddRdsCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddRdsCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal AddRdsCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetRdsCollectionsPagedCompletedEventHandler(object sender, GetRdsCollectionsPagedCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetRdsCollectionsPagedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetRdsCollectionsPagedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RdsCollectionPaged Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RdsCollectionPaged)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void RemoveRdsCollectionCompletedEventHandler(object sender, RemoveRdsCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class RemoveRdsCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal RemoveRdsCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetRdsServersPagedCompletedEventHandler(object sender, GetRdsServersPagedCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetRdsServersPagedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetRdsServersPagedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RdsServersPaged Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RdsServersPaged)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetFreeRdsServersPagedCompletedEventHandler(object sender, GetFreeRdsServersPagedCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetFreeRdsServersPagedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetFreeRdsServersPagedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RdsServersPaged Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RdsServersPaged)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetOrganizationRdsServersPagedCompletedEventHandler(object sender, GetOrganizationRdsServersPagedCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetOrganizationRdsServersPagedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetOrganizationRdsServersPagedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RdsServersPaged Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RdsServersPaged)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetOrganizationFreeRdsServersPagedCompletedEventHandler(object sender, GetOrganizationFreeRdsServersPagedCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetOrganizationFreeRdsServersPagedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetOrganizationFreeRdsServersPagedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RdsServersPaged Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RdsServersPaged)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetRdsServerCompletedEventHandler(object sender, GetRdsServerCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetRdsServerCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetRdsServerCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RdsServer Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RdsServer)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetCollectionRdsServersCompletedEventHandler(object sender, GetCollectionRdsServersCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetCollectionRdsServersCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetCollectionRdsServersCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RdsServer[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RdsServer[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetOrganizationRdsServersCompletedEventHandler(object sender, GetOrganizationRdsServersCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetOrganizationRdsServersCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetOrganizationRdsServersCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RdsServer[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RdsServer[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddRdsServerCompletedEventHandler(object sender, AddRdsServerCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddRdsServerCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal AddRdsServerCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddRdsServerToCollectionCompletedEventHandler(object sender, AddRdsServerToCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddRdsServerToCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal AddRdsServerToCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddRdsServerToOrganizationCompletedEventHandler(object sender, AddRdsServerToOrganizationCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddRdsServerToOrganizationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal AddRdsServerToOrganizationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void RemoveRdsServerCompletedEventHandler(object sender, RemoveRdsServerCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class RemoveRdsServerCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal RemoveRdsServerCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void RemoveRdsServerFromCollectionCompletedEventHandler(object sender, RemoveRdsServerFromCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class RemoveRdsServerFromCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal RemoveRdsServerFromCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void RemoveRdsServerFromOrganizationCompletedEventHandler(object sender, RemoveRdsServerFromOrganizationCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class RemoveRdsServerFromOrganizationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal RemoveRdsServerFromOrganizationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void UpdateRdsServerCompletedEventHandler(object sender, UpdateRdsServerCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class UpdateRdsServerCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal UpdateRdsServerCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetRdsCollectionUsersCompletedEventHandler(object sender, GetRdsCollectionUsersCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetRdsCollectionUsersCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetRdsCollectionUsersCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public OrganizationUser[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((OrganizationUser[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SetUsersToRdsCollectionCompletedEventHandler(object sender, SetUsersToRdsCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SetUsersToRdsCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal SetUsersToRdsCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetCollectionRemoteApplicationsCompletedEventHandler(object sender, GetCollectionRemoteApplicationsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetCollectionRemoteApplicationsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetCollectionRemoteApplicationsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RemoteApplication[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RemoteApplication[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetAvailableRemoteApplicationsCompletedEventHandler(object sender, GetAvailableRemoteApplicationsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetAvailableRemoteApplicationsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetAvailableRemoteApplicationsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public StartMenuApp[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((StartMenuApp[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddRemoteApplicationToCollectionCompletedEventHandler(object sender, AddRemoteApplicationToCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddRemoteApplicationToCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal AddRemoteApplicationToCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void RemoveRemoteApplicationFromCollectionCompletedEventHandler(object sender, RemoveRemoteApplicationFromCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class RemoveRemoteApplicationFromCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal RemoveRemoteApplicationFromCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SetRemoteApplicationsToRdsCollectionCompletedEventHandler(object sender, SetRemoteApplicationsToRdsCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SetRemoteApplicationsToRdsCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal SetRemoteApplicationsToRdsCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetOrganizationRdsUsersCountCompletedEventHandler(object sender, GetOrganizationRdsUsersCountCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetOrganizationRdsUsersCountCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetOrganizationRdsUsersCountCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public int Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs index 7619168e..62f9905f 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs @@ -35,6 +35,7 @@ using WebsitePanel.Providers.HostedSolution; using Microsoft.ApplicationBlocks.Data; using System.Collections.Generic; using Microsoft.Win32; +using WebsitePanel.Providers.RemoteDesktopServices; namespace WebsitePanel.EnterpriseServer { @@ -4435,5 +4436,287 @@ namespace WebsitePanel.EnterpriseServer } #endregion + + #region RDS + + public static IDataReader GetRDSCollectionsByItemId(int itemId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetRDSCollectionsByItemId", + new SqlParameter("@ItemID", itemId) + ); + } + + public static IDataReader GetRDSCollectionByName(string name) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetRDSCollectionByName", + new SqlParameter("@Name", name) + ); + } + + public static IDataReader GetRDSCollectionById(int id) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetRDSCollectionById", + new SqlParameter("@ID", id) + ); + } + + public static DataSet GetRDSCollectionsPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + return SqlHelper.ExecuteDataset( + ConnectionString, + CommandType.StoredProcedure, + "GetRDSCollectionsPaged", + new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), + new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), + new SqlParameter("@itemId", itemId), + new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), + new SqlParameter("@startRow", startRow), + new SqlParameter("@maximumRows", maximumRows) + ); + } + + public static int AddRDSCollection(int itemId, string name, string description) + { + SqlParameter rdsCollectionId = new SqlParameter("@RDSCollectionID", SqlDbType.Int); + rdsCollectionId.Direction = ParameterDirection.Output; + + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "AddRDSCollection", + rdsCollectionId, + new SqlParameter("@ItemID", itemId), + new SqlParameter("@Name", name), + new SqlParameter("@Description", description) + ); + + // read identity + return Convert.ToInt32(rdsCollectionId.Value); + } + + public static int GetOrganizationRdsUsersCount(int itemId) + { + SqlParameter count = new SqlParameter("@TotalNumber", SqlDbType.Int); + count.Direction = ParameterDirection.Output; + + DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, + ObjectQualifier + "GetOrganizationRdsUsersCount", + 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); + } + + public static void UpdateRDSCollection(int id, int itemId, string name, string description) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "UpdateRDSCollection", + new SqlParameter("@Id", id), + new SqlParameter("@ItemID", itemId), + new SqlParameter("@Name", name), + new SqlParameter("@Description", description) + ); + } + + public static void DeleteRDSCollection(int id) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "DeleteRDSCollection", + new SqlParameter("@Id", id) + ); + } + + public static int AddRDSServer(string name, string fqdName, string description) + { + SqlParameter rdsServerId = new SqlParameter("@RDSServerID", SqlDbType.Int); + rdsServerId.Direction = ParameterDirection.Output; + + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "AddRDSServer", + rdsServerId, + new SqlParameter("@FqdName", fqdName), + new SqlParameter("@Name", name), + new SqlParameter("@Description", description) + ); + + // read identity + return Convert.ToInt32(rdsServerId.Value); + } + + public static IDataReader GetRDSServersByItemId(int itemId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetRDSServersByItemId", + new SqlParameter("@ItemID", itemId) + ); + } + + public static DataSet GetRDSServersPaged(int? itemId, int? collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, bool ignoreItemId = false, bool ignoreRdsCollectionId = false) + { + return SqlHelper.ExecuteDataset( + ConnectionString, + CommandType.StoredProcedure, + "GetRDSServersPaged", + new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), + new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), + new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), + new SqlParameter("@startRow", startRow), + new SqlParameter("@ItemID", itemId), + new SqlParameter("@RdsCollectionId", collectionId), + new SqlParameter("@IgnoreItemId", ignoreItemId), + new SqlParameter("@IgnoreRdsCollectionId", ignoreRdsCollectionId), + new SqlParameter("@maximumRows", maximumRows) + ); + } + + public static IDataReader GetRDSServerById(int id) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetRDSServerById", + new SqlParameter("@ID", id) + ); + } + + public static IDataReader GetRDSServersByCollectionId(int collectionId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetRDSServersByCollectionId", + new SqlParameter("@RdsCollectionId", collectionId) + ); + } + + public static void DeleteRDSServer(int id) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "DeleteRDSServer", + new SqlParameter("@Id", id) + ); + } + + public static void UpdateRDSServer(RdsServer server) + { + UpdateRDSServer(server.Id, server.ItemId, server.Name, server.FqdName, server.Description, + server.RdsCollectionId); + } + + public static void UpdateRDSServer(int id, int? itemId, string name, string fqdName, string description, int? rdsCollectionId) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "UpdateRDSServer", + new SqlParameter("@Id", id), + new SqlParameter("@ItemID", itemId), + new SqlParameter("@Name", name), + new SqlParameter("@FqdName", fqdName), + new SqlParameter("@Description", description), + new SqlParameter("@RDSCollectionId", rdsCollectionId) + ); + } + + public static void AddRDSServerToCollection(int serverId, int rdsCollectionId) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "AddRDSServerToCollection", + new SqlParameter("@Id", serverId), + new SqlParameter("@RDSCollectionId", rdsCollectionId) + ); + } + + public static void AddRDSServerToOrganization(int itemId, int serverId) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "AddRDSServerToOrganization", + new SqlParameter("@Id", serverId), + new SqlParameter("@ItemID", itemId) + ); + } + + public static void RemoveRDSServerFromOrganization(int serverId) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "RemoveRDSServerFromOrganization", + new SqlParameter("@Id", serverId) + ); + } + + public static void RemoveRDSServerFromCollection(int serverId) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "RemoveRDSServerFromCollection", + new SqlParameter("@Id", serverId) + ); + } + + public static IDataReader GetRDSCollectionUsersByRDSCollectionId(int id) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetRDSCollectionUsersByRDSCollectionId", + new SqlParameter("@id", id) + ); + } + + public static void AddRDSUserToRDSCollection(int rdsCollectionId, int accountId) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "AddUserToRDSCollection", + new SqlParameter("@RDSCollectionId", rdsCollectionId), + new SqlParameter("@AccountID", accountId) + ); + } + + public static void RemoveRDSUserFromRDSCollection(int rdsCollectionId, int accountId) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "RemoveRDSUserFromRDSCollection", + new SqlParameter("@RDSCollectionId", rdsCollectionId), + new SqlParameter("@AccountID", accountId) + ); + } + + #endregion } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs index 2b3fef03..d0e48fee 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2012, Outercurve Foundation. +// Copyright (c) 2014, Outercurve Foundation. // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, @@ -589,6 +589,15 @@ namespace WebsitePanel.EnterpriseServer ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); + // delete public folders + List folders = GetAccounts(itemId, ExchangeAccountType.PublicFolder); + folders.Sort(delegate(ExchangeAccount f1, ExchangeAccount f2) { return f2.AccountId.CompareTo(f1.AccountId); }); + + foreach (ExchangeAccount folder in folders) + DeletePublicFolder(itemId, folder.AccountId); + + exchange.DeletePublicFolder(org.OrganizationId, "\\" + org.OrganizationId); + bool successful = exchange.DeleteOrganization( org.OrganizationId, org.DistinguishedName, @@ -600,19 +609,6 @@ namespace WebsitePanel.EnterpriseServer org.AddressBookPolicy, acceptedDomains.ToArray()); - // delete public folders - if (successful) - { - List folders = GetAccounts(itemId, ExchangeAccountType.PublicFolder); - folders.Sort(delegate(ExchangeAccount f1, ExchangeAccount f2) { return f2.AccountId.CompareTo(f1.AccountId);}); - - foreach(ExchangeAccount folder in folders) - DeletePublicFolder(itemId, folder.AccountId); - - exchange.DeletePublicFolder(org.OrganizationId, "\\" + org.OrganizationId); - } - - return successful ? 0 : BusinessErrorCodes.ERROR_EXCHANGE_DELETE_SOME_PROBLEMS; } catch (Exception ex) @@ -5380,6 +5376,61 @@ namespace WebsitePanel.EnterpriseServer return res; } + public static string SetDefaultPublicFolderMailbox(int itemId) + { + string res = ""; + + try + { + Organization org = GetOrganization(itemId); + if (org == null) + return null; + + int exchangeServiceId = GetExchangeServiceID(org.PackageId); + + if (exchangeServiceId <= 0) + return null; + + ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); + + if (exchange == null) + return null; + + //Create Exchange Organization + if (string.IsNullOrEmpty(org.GlobalAddressList)) + { + ExtendToExchangeOrganization(ref org); + + PackageController.UpdatePackageItem(org); + } + + res += "OrgPublicFolderMailbox = " + exchange.CreateOrganizationRootPublicFolder(org.OrganizationId, org.DistinguishedName, org.SecurityGroup, org.DefaultDomain) + Environment.NewLine; + + List mailboxes = GetExchangeMailboxes(itemId); + + foreach(ExchangeAccount mailbox in mailboxes) + { + string id = mailbox.PrimaryEmailAddress; + string[] defaultPublicFoldes = exchange.SetDefaultPublicFolderMailbox(id, org.OrganizationId, org.DistinguishedName); + + if (defaultPublicFoldes.Length==1) + res += id + " has a value \"" + defaultPublicFoldes[0] + "\"" + Environment.NewLine; + + if (defaultPublicFoldes.Length == 2) + res += id + " changed from \"" + defaultPublicFoldes[0] + "\" to \"" + defaultPublicFoldes[1] + "\"" + Environment.NewLine; + + } + + } + catch (Exception ex) + { + res += " Error " + ex.ToString(); + } + + return res; + + } + #endregion #region Private Helpers @@ -5873,5 +5924,6 @@ namespace WebsitePanel.EnterpriseServer } #endregion + } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/CRMController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/CRMController.cs index f986fbce..c24c2173 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/CRMController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/CRMController.cs @@ -35,6 +35,7 @@ using WebsitePanel.Providers.CRM; using WebsitePanel.Providers.DNS; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.ResultObjects; +using System.Text.RegularExpressions; namespace WebsitePanel.EnterpriseServer { @@ -237,6 +238,12 @@ namespace WebsitePanel.EnterpriseServer return value; } + public static string GetOrganizationCRMUniqueName(string orgName) + { + return Regex.Replace(orgName, @"[^\dA-Za-z]", "-", RegexOptions.Compiled); + } + + public static OrganizationResult CreateOrganization(int organizationId, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string regionName, int userId, string collation, int baseLanguageCode) { OrganizationResult res = StartTask("CRM", "CREATE_ORGANIZATION"); @@ -329,7 +336,7 @@ namespace WebsitePanel.EnterpriseServer if (port != string.Empty) port = ":" + port; - string strDomainName = string.Format("{0}.{1}", org.OrganizationId, + string strDomainName = string.Format("{0}.{1}", GetOrganizationCRMUniqueName(org.OrganizationId), serviceSettings[Constants.IFDWebApplicationRootDomain]); org.CrmUrl = string.Format("{0}://{1}{2}", schema, strDomainName, port); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index 2b8341ab..616b1098 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -726,6 +726,13 @@ namespace WebsitePanel.EnterpriseServer successful = false; } + //Cleanup RDS + + if (RemoteDesktopServicesController.DeleteRemoteDesktopService(itemId).IsSuccess == false) + { + successful = false; + } + //Cleanup Exchange try { @@ -1657,6 +1664,11 @@ namespace WebsitePanel.EnterpriseServer int maxLen = 19 - orgId.Length; + if (!string.IsNullOrEmpty(orgId)) + { + orgId = orgId.TrimEnd(' ', '.'); + } + // try to choose name int i = 0; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs index 1db609d9..f2a3ca42 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs @@ -27,20 +27,1039 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Net.NetworkInformation; +using System.Runtime.CompilerServices; using System.Xml; using System.Data; using System.Collections.Specialized; using System.Collections.Generic; using System.Text; +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.EnterpriseStorage; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.OS; +using WebsitePanel.Providers.RemoteDesktopServices; +using WebsitePanel.Providers.Web; namespace WebsitePanel.EnterpriseServer { - public class RemoteDesktopServicesController - { + public class RemoteDesktopServicesController + { private RemoteDesktopServicesController() - { - } + { - - } + } + + public static RdsCollection GetRdsCollection(int collectionId) + { + return GetRdsCollectionInternal(collectionId); + } + + public static List GetOrganizationRdsCollections(int itemId) + { + return GetOrganizationRdsCollectionsInternal(itemId); + } + + public static ResultObject AddRdsCollection(int itemId, RdsCollection collection) + { + return AddRdsCollectionInternal(itemId, collection); + } + + public static RdsCollectionPaged GetRdsCollectionsPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + return GetRdsCollectionsPagedInternal(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows); + } + + public static ResultObject RemoveRdsCollection(int itemId, RdsCollection collection) + { + return RemoveRdsCollectionInternal(itemId, collection); + } + + public static List GetAvailableRemoteApplications(int itemId, string collectionName) + { + return GetAvailableRemoteApplicationsInternal(itemId, collectionName); + } + + public static RdsServersPaged GetRdsServersPaged(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + return GetRdsServersPagedInternal(filterColumn, filterValue, sortColumn, startRow, maximumRows); + } + + public static RdsServersPaged GetFreeRdsServersPaged(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + return GetFreeRdsServersPagedInternal(filterColumn, filterValue, sortColumn, startRow, maximumRows); + } + + public static RdsServersPaged GetOrganizationRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + return GetOrganizationRdsServersPagedInternal(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows); + } + + public static RdsServersPaged GetOrganizationFreeRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + return GetOrganizationFreeRdsServersPagedInternal(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows); + } + + public static RdsServer GetRdsServer(int rdsSeverId) + { + return GetRdsServerInternal(rdsSeverId); + } + + public static List GetCollectionRdsServers(int collectionId) + { + return GetCollectionRdsServersInternal(collectionId); + } + + public static List GetOrganizationRdsServers(int itemId) + { + return GetOrganizationRdsServersInternal(itemId); + } + + public static ResultObject AddRdsServer(RdsServer rdsServer) + { + return AddRdsServerInternal(rdsServer); + } + + public static ResultObject AddRdsServerToCollection(int itemId, RdsServer rdsServer, RdsCollection rdsCollection) + { + return AddRdsServerToCollectionInternal(itemId, rdsServer, rdsCollection); + } + + public static ResultObject AddRdsServerToOrganization(int itemId, int serverId) + { + return AddRdsServerToOrganizationInternal(itemId, serverId); + } + + public static ResultObject RemoveRdsServer(int rdsServerId) + { + return RemoveRdsServerInternal(rdsServerId); + } + + public static ResultObject RemoveRdsServerFromCollection(int itemId, RdsServer rdsServer, RdsCollection rdsCollection) + { + return RemoveRdsServerFromCollectionInternal(itemId, rdsServer, rdsCollection); + } + + public static ResultObject RemoveRdsServerFromOrganization(int rdsServerId) + { + return RemoveRdsServerFromOrganizationInternal(rdsServerId); + } + + public static ResultObject UpdateRdsServer(RdsServer rdsServer) + { + return UpdateRdsServerInternal(rdsServer); + } + + public static List GetRdsCollectionUsers(int collectionId) + { + return GetRdsCollectionUsersInternal(collectionId); + } + + public static ResultObject SetUsersToRdsCollection(int itemId, int collectionId, List users) + { + return SetUsersToRdsCollectionInternal(itemId, collectionId, users); + } + + public static ResultObject AddRemoteApplicationToCollection(int itemId, RdsCollection collection, RemoteApplication application) + { + return AddRemoteApplicationToCollectionInternal(itemId, collection, application); + } + + public static List GetCollectionRemoteApplications(int itemId, string collectionName) + { + return GetCollectionRemoteApplicationsInternal(itemId, collectionName); + } + + public static ResultObject RemoveRemoteApplicationFromCollection(int itemId, RdsCollection collection, RemoteApplication application) + { + return RemoveRemoteApplicationFromCollectionInternal(itemId, collection, application); + } + + public static ResultObject SetRemoteApplicationsToRdsCollection(int itemId, int collectionId, List remoteApps) + { + return SetRemoteApplicationsToRdsCollectionInternal(itemId, collectionId, remoteApps); + } + + public static ResultObject DeleteRemoteDesktopService(int itemId) + { + return DeleteRemoteDesktopServiceInternal(itemId); + } + + public static int GetOrganizationRdsUsersCount(int itemId) + { + return GetOrganizationRdsUsersCountInternal(itemId); + } + + private static RdsCollection GetRdsCollectionInternal(int collectionId) + { + var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(collectionId)); + + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "ADD_RDS_COLLECTION"); + + try + { + // load organization + Organization org = OrganizationController.GetOrganization(4115); + if (org == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Organization not found")); + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + rds.GetCollection(collection.Name); + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_COLLECTION", ex); + } + + FillRdsCollection(collection); + + return collection; + } + + private static List GetOrganizationRdsCollectionsInternal(int itemId) + { + var collections = ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSCollectionsByItemId(itemId)); + + foreach (var rdsCollection in collections) + { + FillRdsCollection(rdsCollection); + } + + return collections; + } + + private static ResultObject AddRdsCollectionInternal(int itemId, RdsCollection collection) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "ADD_RDS_COLLECTION"); + + try + { + // load organization + Organization org = OrganizationController.GetOrganization(itemId); + if (org == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Organization not found")); + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + rds.CreateCollection(org.OrganizationId, collection); + + collection.Id = DataProvider.AddRDSCollection(itemId, collection.Name, collection.Description); + + foreach (var server in collection.Servers) + { + DataProvider.AddRDSServerToCollection(server.Id, collection.Id); + } + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_COLLECTION", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static RdsCollectionPaged GetRdsCollectionsPagedInternal(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + DataSet ds = DataProvider.GetRDSCollectionsPaged(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows); + + var result = new RdsCollectionPaged + { + RecordsCount = (int)ds.Tables[0].Rows[0][0] + }; + + List tmpCollections = new List(); + + ObjectUtils.FillCollectionFromDataView(tmpCollections, ds.Tables[1].DefaultView); + + foreach (var collection in tmpCollections) + { + collection.Servers = GetCollectionRdsServersInternal(collection.Id); + } + + result.Collections = tmpCollections.ToArray(); + + return result; + } + + private static ResultObject RemoveRdsCollectionInternal(int itemId, RdsCollection collection) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "REMOVE_RDS_COLLECTION"); + + try + { + // load organization + Organization org = OrganizationController.GetOrganization(itemId); + if (org == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Organization not found")); + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + rds.RemoveCollection(org.OrganizationId, collection.Name); + + DataProvider.DeleteRDSCollection(collection.Id); + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_REMOVE_RDS_COLLECTION", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static List GetAvailableRemoteApplicationsInternal(int itemId, string collectionName) + { + var result = new List(); + + var taskResult = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", + "GET_AVAILABLE_REMOTE_APPLICATIOBNS"); + + try + { + // load organization + Organization org = OrganizationController.GetOrganization(itemId); + + if (org == null) + { + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + result.AddRange(rds.GetAvailableRemoteApplications(collectionName)); + } + catch (Exception ex) + { + taskResult.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_COLLECTION", ex); + } + finally + { + if (!taskResult.IsSuccess) + { + TaskManager.CompleteResultTask(taskResult); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static RdsServersPaged GetRdsServersPagedInternal(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + DataSet ds = DataProvider.GetRDSServersPaged(null, null, filterColumn, filterValue, sortColumn, startRow, maximumRows, true, true); + + RdsServersPaged result = new RdsServersPaged(); + result.RecordsCount = (int)ds.Tables[0].Rows[0][0]; + + List tmpServers = new List(); + + ObjectUtils.FillCollectionFromDataView(tmpServers, ds.Tables[1].DefaultView); + + foreach (var tmpServer in tmpServers) + { + FillRdsServerData(tmpServer); + } + + result.Servers = tmpServers.ToArray(); + + return result; + } + + private static RdsServersPaged GetFreeRdsServersPagedInternal(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + DataSet ds = DataProvider.GetRDSServersPaged(null, null, filterColumn, filterValue, sortColumn, startRow, maximumRows); + + RdsServersPaged result = new RdsServersPaged(); + result.RecordsCount = (int)ds.Tables[0].Rows[0][0]; + + List tmpServers = new List(); + + ObjectUtils.FillCollectionFromDataView(tmpServers, ds.Tables[1].DefaultView); + + result.Servers = tmpServers.ToArray(); + + return result; + } + + private static RdsServersPaged GetOrganizationRdsServersPagedInternal(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + DataSet ds = DataProvider.GetRDSServersPaged(itemId, null, filterColumn, filterValue, sortColumn, startRow, maximumRows, ignoreRdsCollectionId: true); + + RdsServersPaged result = new RdsServersPaged(); + result.RecordsCount = (int)ds.Tables[0].Rows[0][0]; + + List tmpServers = new List(); + + ObjectUtils.FillCollectionFromDataView(tmpServers, ds.Tables[1].DefaultView); + + result.Servers = tmpServers.ToArray(); + + return result; + } + + private static RdsServersPaged GetOrganizationFreeRdsServersPagedInternal(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + DataSet ds = DataProvider.GetRDSServersPaged(itemId, null, filterColumn, filterValue, sortColumn, startRow, maximumRows); + + RdsServersPaged result = new RdsServersPaged(); + result.RecordsCount = (int)ds.Tables[0].Rows[0][0]; + + List tmpServers = new List(); + + ObjectUtils.FillCollectionFromDataView(tmpServers, ds.Tables[1].DefaultView); + + result.Servers = tmpServers.ToArray(); + + return result; + } + + private static RdsServer GetRdsServerInternal(int rdsSeverId) + { + return ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSServerById(rdsSeverId)); + } + + private static int GetOrganizationRdsUsersCountInternal(int itemId) + { + return DataProvider.GetOrganizationRdsUsersCount(itemId); + } + + + private static List GetCollectionRdsServersInternal(int collectionId) + { + return ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByCollectionId(collectionId)).ToList(); + } + + private static List GetOrganizationRdsServersInternal(int itemId) + { + return ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByItemId(itemId)).ToList(); + } + + private static ResultObject AddRdsServerInternal(RdsServer rdsServer) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "ADD_RDS_SERVER"); + + try + { + if (1 == 1)//(CheckRDSServerAvaliable(rdsServer.FqdName)) + { + rdsServer.Id = DataProvider.AddRDSServer(rdsServer.Name, rdsServer.FqdName, rdsServer.Description); + } + else + { + result.AddError("", new Exception("The server that you are adding, is not available")); + return result; + } + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_SERVER", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static ResultObject AddRdsServerToCollectionInternal(int itemId, RdsServer rdsServer, RdsCollection rdsCollection) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "ADD_RDS_SERVER_TO_COLLECTION"); + + try + { + // load organization + Organization org = OrganizationController.GetOrganization(itemId); + if (org == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Organization not found")); + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + if (!rds.CheckSessionHostFeatureInstallation(rdsServer.FqdName)) + { + rds.AddSessionHostFeatureToServer(rdsServer.FqdName); + } + + rds.AddSessionHostServerToCollection(org.OrganizationId, rdsCollection.Name, rdsServer); + + DataProvider.AddRDSServerToCollection(rdsServer.Id, rdsCollection.Id); + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_SERVER_TO_COLLECTION", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static ResultObject RemoveRdsServerFromCollectionInternal(int itemId, RdsServer rdsServer, RdsCollection rdsCollection) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "REMOVE_RDS_SERVER_FROM_COLLECTION"); + + try + { + // load organization + Organization org = OrganizationController.GetOrganization(itemId); + if (org == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Organization not found")); + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + rds.RemoveSessionHostServerFromCollection(org.OrganizationId, rdsCollection.Name, rdsServer); + + DataProvider.RemoveRDSServerFromCollection(rdsServer.Id); + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_REMOVE_RDS_SERVER_FROM_COLLECTION", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static ResultObject UpdateRdsServerInternal(RdsServer rdsServer) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "UPDATE_RDS_SERVER"); + + try + { + DataProvider.UpdateRDSServer(rdsServer); + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_UPDATE_RDS_SERVER", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static ResultObject AddRdsServerToOrganizationInternal(int itemId, int serverId) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "ADD_RDS_SERVER_TO_ORGANIZATION"); + + try + { + // load organization + Organization org = OrganizationController.GetOrganization(itemId); + if (org == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Organization not found")); + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + RdsServer rdsServer = GetRdsServer(serverId); + + if (!rds.CheckSessionHostFeatureInstallation(rdsServer.FqdName)) + { + rds.AddSessionHostFeatureToServer(rdsServer.FqdName); + } + + DataProvider.AddRDSServerToOrganization(itemId, serverId); + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_SERVER_TO_ORGANIZATION", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static ResultObject RemoveRdsServerFromOrganizationInternal(int rdsServerId) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "REMOVE_RDS_SERVER_FROM_ORGANIZATION"); + + try + { + DataProvider.RemoveRDSServerFromOrganization(rdsServerId); + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_REMOVE_RDS_SERVER_FROM_ORGANIZATION", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static ResultObject RemoveRdsServerInternal(int rdsServerId) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "REMOVE_RDS_SERVER"); + + try + { + DataProvider.DeleteRDSServer(rdsServerId); + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_REMOVE_RDS_SERVER", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static List GetRdsCollectionUsersInternal(int collectionId) + { + return ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSCollectionUsersByRDSCollectionId(collectionId)); + } + + private static ResultObject SetUsersToRdsCollectionInternal(int itemId, int collectionId, List users) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "ADD_USER_TO_RDS_COLLECTION"); + + try + { + // load organization + Organization org = OrganizationController.GetOrganization(itemId); + if (org == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Organization not found")); + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + var collection = GetRdsCollection(collectionId); + + if (collection == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Collection not found")); + return result; + } + + foreach(var user in users) + { + var account = OrganizationController.GetAccountByAccountName(itemId, user.AccountName); + + user.AccountId = account.AccountId; + } + + var usersInDb = GetRdsCollectionUsers(collectionId); + + var usersAccountNames = users.Select(x => x.AccountName).ToList(); + + //Set on server + rds.SetUsersInCollection(org.OrganizationId, collection.Name, users.Select(x => x.AccountName).ToArray()); + + //Remove from db + foreach (var userInDb in usersInDb) + { + if (!usersAccountNames.Contains(userInDb.AccountName)) + { + DataProvider.RemoveRDSUserFromRDSCollection(collectionId, userInDb.AccountId); + } + } + + //Add to db + foreach (var user in users) + { + if (!usersInDb.Select(x => x.AccountName).Contains(user.AccountName)) + { + DataProvider.AddRDSUserToRDSCollection(collectionId, user.AccountId); + } + } + + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_ADD_USER_TO_RDS_COLLECTION", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static ResultObject AddRemoteApplicationToCollectionInternal(int itemId, RdsCollection collection, RemoteApplication remoteApp) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "ADD_REMOTE_APP_TO_COLLECTION"); + + try + { + // load organization + Organization org = OrganizationController.GetOrganization(itemId); + if (org == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Organization not found")); + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + if (!string.IsNullOrEmpty(remoteApp.Alias)) + { + remoteApp.Alias = remoteApp.DisplayName; + } + + remoteApp.ShowInWebAccess = true; + + rds.AddRemoteApplication(collection.Name, remoteApp); + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_ADD_REMOTE_APP_TO_COLLECTION", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static List GetCollectionRemoteApplicationsInternal(int itemId, string collectionName) + { + var result = new List(); + + // load organization + Organization org = OrganizationController.GetOrganization(itemId); + + if (org == null) + { + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + result.AddRange(rds.GetCollectionRemoteApplications(collectionName)); + + return result; + } + + private static ResultObject RemoveRemoteApplicationFromCollectionInternal(int itemId, RdsCollection collection, RemoteApplication application) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "REMOVE_REMOTE_APP_FROM_COLLECTION"); + + try + { + // load organization + Organization org = OrganizationController.GetOrganization(itemId); + if (org == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Organization not found")); + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + rds.RemoveRemoteApplication(collection.Name, application); + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_REMOVE_REMOTE_APP_FROM_COLLECTION", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static ResultObject SetRemoteApplicationsToRdsCollectionInternal(int itemId, int collectionId, List remoteApps) + { + ResultObject result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "SET_APPS_TO_RDS_COLLECTION"); ; + try + { + // load organization + Organization org = OrganizationController.GetOrganization(itemId); + if (org == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Organization not found")); + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + var collection = GetRdsCollection(collectionId); + + if (collection == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Collection not found")); + return result; + } + + List existingCollectionApps = GetCollectionRemoteApplications(itemId, collection.Name); + List remoteAppsToAdd = remoteApps.Where(x => !existingCollectionApps.Select(p => p.DisplayName).Contains(x.DisplayName)).ToList(); + foreach (var app in remoteAppsToAdd) + { + AddRemoteApplicationToCollection(itemId, collection, app); + } + + List remoteAppsToRemove = existingCollectionApps.Where(x => !remoteApps.Select(p => p.DisplayName).Contains(x.DisplayName)).ToList(); + foreach (var app in remoteAppsToRemove) + { + RemoveRemoteApplicationFromCollection(itemId, collection, app); + } + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_SET_APPS_TO_RDS_COLLECTION", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static RdsCollection FillRdsCollection(RdsCollection collection) + { + collection.Servers = GetCollectionRdsServers(collection.Id) ?? new List(); + + return collection; + } + + private static RdsServer FillRdsServerData(RdsServer server) + { + server.Address = GetServerIp(server.FqdName).ToString(); + + return server; + } + + private static System.Net.IPAddress GetServerIp(string hostname, AddressFamily addressFamily = AddressFamily.InterNetwork) + { + var address = GetServerIps(hostname); + + return address.FirstOrDefault(x => x.AddressFamily == addressFamily); + } + + private static IEnumerable GetServerIps(string hostname) + { + var address = Dns.GetHostAddresses(hostname); + + return address; + } + + private static bool CheckRDSServerAvaliable(string hostname) + { + bool result = false; + + try + { + var ping = new Ping(); + var reply = ping.Send(hostname, 1000); // 1 second time out (in ms) + + if (reply.Status == IPStatus.Success) + result = true; + } + catch (Exception) + { + result = false; + } + + return result; + } + + + private static ResultObject DeleteRemoteDesktopServiceInternal(int itemId) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "CLEANUP"); + + try + { + var collections = GetOrganizationRdsCollections(itemId); + + foreach (var collection in collections) + { + RemoveRdsCollection(itemId, collection); + } + + var servers = GetOrganizationRdsServers(itemId); + + foreach (var server in servers) + { + RemoveRdsServerFromOrganization(server.Id); + } + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_CLEANUP", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + + private static int GetRemoteDesktopServiceID(int packageId) + { + return PackageController.GetPackageServiceId(packageId, ResourceGroups.RDS); + } + + private static RemoteDesktopServices GetRemoteDesktopServices(int serviceId) + { + var rds = new RemoteDesktopServices(); + ServiceProviderProxy.Init(rds, serviceId); + + return rds; + } + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs index 8295d09d..87a4e2c5 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs @@ -703,6 +703,14 @@ namespace WebsitePanel.EnterpriseServer { return ExchangeServerController.DeletePublicFolderEmailAddresses(itemId, accountId, emailAddresses); } + + [WebMethod] + public string SetDefaultPublicFolderMailbox(int itemId) + { + return ExchangeServerController.SetDefaultPublicFolderMailbox(itemId); + } + + #endregion #region Disclaimers diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs index a31cb925..48005ae8 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs @@ -36,7 +36,8 @@ using System.Web.Services.Protocols; using System.ComponentModel; using Microsoft.Web.Services3; - +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.RemoteDesktopServices; namespace WebsitePanel.EnterpriseServer @@ -50,14 +51,178 @@ namespace WebsitePanel.EnterpriseServer [ToolboxItem(false)] public class esRemoteDesktopServices : System.Web.Services.WebService { - /* + [WebMethod] - public DataSet GetRawOdbcSourcesPaged(int packageId, - string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + public RdsCollection GetRdsCollection(int collectionId) { - return OperatingSystemController.GetRawOdbcSourcesPaged(packageId, filterColumn, - filterValue, sortColumn, startRow, maximumRows); + return RemoteDesktopServicesController.GetRdsCollection(collectionId); } - */ + + [WebMethod] + public List GetOrganizationRdsCollections(int itemId) + { + return RemoteDesktopServicesController.GetOrganizationRdsCollections(itemId); + } + + [WebMethod] + public ResultObject AddRdsCollection(int itemId, RdsCollection collection) + { + return RemoteDesktopServicesController.AddRdsCollection(itemId, collection); + } + + [WebMethod] + public RdsCollectionPaged GetRdsCollectionsPaged(int itemId, string filterColumn, string filterValue, + string sortColumn, int startRow, int maximumRows) + { + return RemoteDesktopServicesController.GetRdsCollectionsPaged(itemId, filterColumn, filterValue, sortColumn, + startRow, maximumRows); + } + + [WebMethod] + public ResultObject RemoveRdsCollection(int itemId, RdsCollection collection) + { + return RemoteDesktopServicesController.RemoveRdsCollection(itemId, collection); + } + + [WebMethod] + public RdsServersPaged GetRdsServersPaged(string filterColumn, string filterValue, string sortColumn, + int startRow, int maximumRows) + { + return RemoteDesktopServicesController.GetRdsServersPaged(filterColumn, filterValue, sortColumn, startRow, + maximumRows); + } + + [WebMethod] + public RdsServersPaged GetFreeRdsServersPaged(string filterColumn, string filterValue, + string sortColumn, int startRow, int maximumRows) + { + return RemoteDesktopServicesController.GetFreeRdsServersPaged(filterColumn, filterValue, + sortColumn, startRow, maximumRows); + } + + [WebMethod] + public RdsServersPaged GetOrganizationRdsServersPaged(int itemId, string filterColumn, string filterValue, + string sortColumn, int startRow, int maximumRows) + { + return RemoteDesktopServicesController.GetOrganizationRdsServersPaged(itemId, filterColumn, filterValue, + sortColumn, startRow, maximumRows); + } + + [WebMethod] + public RdsServersPaged GetOrganizationFreeRdsServersPaged(int itemId, string filterColumn, string filterValue, + string sortColumn, int startRow, int maximumRows) + { + return RemoteDesktopServicesController.GetOrganizationFreeRdsServersPaged(itemId, filterColumn, filterValue, + sortColumn, startRow, maximumRows); + } + + [WebMethod] + public RdsServer GetRdsServer(int rdsSeverId) + { + return RemoteDesktopServicesController.GetRdsServer(rdsSeverId); + } + + [WebMethod] + public List GetCollectionRdsServers(int collectionId) + { + return RemoteDesktopServicesController.GetCollectionRdsServers(collectionId); + } + + [WebMethod] + public List GetOrganizationRdsServers(int itemId) + { + return RemoteDesktopServicesController.GetOrganizationRdsServers(itemId); + } + + [WebMethod] + public ResultObject AddRdsServer(RdsServer rdsServer) + { + return RemoteDesktopServicesController.AddRdsServer(rdsServer); + } + + [WebMethod] + public ResultObject AddRdsServerToCollection(int itemId, RdsServer rdsServer, RdsCollection rdsCollection) + { + return RemoteDesktopServicesController.AddRdsServerToCollection(itemId, rdsServer, rdsCollection); + } + + [WebMethod] + public ResultObject AddRdsServerToOrganization(int itemId, int serverId) + { + return RemoteDesktopServicesController.AddRdsServerToOrganization(itemId, serverId); + } + + [WebMethod] + public ResultObject RemoveRdsServer(int rdsServerId) + { + return RemoteDesktopServicesController.RemoveRdsServer(rdsServerId); + } + + [WebMethod] + public ResultObject RemoveRdsServerFromCollection(int itemId, RdsServer rdsServer, RdsCollection rdsCollection) + { + return RemoteDesktopServicesController.RemoveRdsServerFromCollection(itemId, rdsServer, rdsCollection); + } + + [WebMethod] + public ResultObject RemoveRdsServerFromOrganization(int rdsServerId) + { + return RemoteDesktopServicesController.RemoveRdsServerFromOrganization(rdsServerId); + } + + [WebMethod] + public ResultObject UpdateRdsServer(RdsServer rdsServer) + { + return RemoteDesktopServicesController.UpdateRdsServer(rdsServer); + } + + [WebMethod] + public List GetRdsCollectionUsers(int collectionId) + { + return RemoteDesktopServicesController.GetRdsCollectionUsers(collectionId); + } + + [WebMethod] + public ResultObject SetUsersToRdsCollection(int itemId, int collectionId, List users) + { + return RemoteDesktopServicesController.SetUsersToRdsCollection(itemId, collectionId, users); + } + + [WebMethod] + public List GetCollectionRemoteApplications(int itemId, string collectionName) + { + return RemoteDesktopServicesController.GetCollectionRemoteApplications(itemId, collectionName); + } + + [WebMethod] + public List GetAvailableRemoteApplications(int itemId, string collectionName) + { + return RemoteDesktopServicesController.GetAvailableRemoteApplications(itemId, collectionName); + } + + [WebMethod] + public ResultObject AddRemoteApplicationToCollection(int itemId, RdsCollection collection, RemoteApplication application) + { + return RemoteDesktopServicesController.AddRemoteApplicationToCollection(itemId, collection, application); + } + + [WebMethod] + public ResultObject RemoveRemoteApplicationFromCollection(int itemId, RdsCollection collection, RemoteApplication application) + { + return RemoteDesktopServicesController.RemoveRemoteApplicationFromCollection(itemId, collection, application); + } + + [WebMethod] + public ResultObject SetRemoteApplicationsToRdsCollection(int itemId, int collectionId, List remoteApps) + { + return RemoteDesktopServicesController.SetRemoteApplicationsToRdsCollection(itemId, collectionId, remoteApps); + } + + [WebMethod] + public int GetOrganizationRdsUsersCount(int itemId) + { + return RemoteDesktopServicesController.GetOrganizationRdsUsersCount(itemId); + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs index 447512ad..c9cfe32c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ActiveDirectoryUtils.cs @@ -130,6 +130,31 @@ namespace WebsitePanel.Providers.HostedSolution return res; } + public static bool IsComputerInGroup(string samAccountName, string group) + { + bool res = false; + DirectorySearcher deSearch = new DirectorySearcher + { + Filter = + ("(&(objectClass=computer)(samaccountname=" + samAccountName + "))") + }; + + //get the group result + SearchResult results = deSearch.FindOne(); + DirectoryEntry de = results.GetDirectoryEntry(); + PropertyValueCollection props = de.Properties["memberOf"]; + + foreach (string str in props) + { + if (str.IndexOf(group) != -1) + { + res = true; + break; + } + } + return res; + } + public static string CreateOrganizationalUnit(string name, string parentPath) { string ret; diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailDomain.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailDomain.cs index a452d66d..d93c54cd 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailDomain.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailDomain.cs @@ -368,6 +368,10 @@ namespace WebsitePanel.Providers.Mail #region IceWarp + public bool UseDomainDiskQuota { get; set; } + public bool UseDomainLimits { get; set; } + public bool UseUserLimits { get; set; } + public int MegaByteSendLimit { get; set; } public int NumberSendLimit { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs index 224b6991..6cf5ec6b 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs @@ -28,6 +28,9 @@ using System; using System.Collections; +using System.Collections.Generic; +using System.Net; +using System.Net.Sockets; namespace WebsitePanel.Providers.RemoteDesktopServices { @@ -36,6 +39,24 @@ namespace WebsitePanel.Providers.RemoteDesktopServices /// public interface IRemoteDesktopServices { - + bool CreateCollection(string organizationId, RdsCollection collection); + RdsCollection GetCollection(string collectionName); + bool RemoveCollection(string organizationId, string collectionName); + bool SetUsersInCollection(string organizationId, string collectionName, List users); + void AddSessionHostServerToCollection(string organizationId, string collectionName, RdsServer server); + void AddSessionHostServersToCollection(string organizationId, string collectionName, List servers); + void RemoveSessionHostServerFromCollection(string organizationId, string collectionName, RdsServer server); + void RemoveSessionHostServersFromCollection(string organizationId, string collectionName, List servers); + + List GetAvailableRemoteApplications(string collectionName); + List GetCollectionRemoteApplications(string collectionName); + bool AddRemoteApplication(string collectionName, RemoteApplication remoteApp); + bool AddRemoteApplications(string collectionName, List remoteApps); + bool RemoveRemoteApplication(string collectionName, RemoteApplication remoteApp); + + bool AddSessionHostFeatureToServer(string hostName); + bool CheckSessionHostFeatureInstallation(string hostName); + + bool CheckServerAvailability(string hostName); } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsCollection.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsCollection.cs new file mode 100644 index 00000000..dda297f9 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsCollection.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace WebsitePanel.Providers.RemoteDesktopServices +{ + [Serializable] + public class RdsCollection + { + public RdsCollection() + { + Servers = new List(); + } + + public int Id { get; set; } + public int ItemId { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public List Servers { get; set; } + + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsCollectionPaged.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsCollectionPaged.cs new file mode 100644 index 00000000..39e21c3d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsCollectionPaged.cs @@ -0,0 +1,8 @@ +namespace WebsitePanel.Providers.RemoteDesktopServices +{ + public class RdsCollectionPaged + { + public int RecordsCount { get; set; } + public RdsCollection[] Collections { get; set; } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServer.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServer.cs new file mode 100644 index 00000000..5d44984f --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServer.cs @@ -0,0 +1,22 @@ +using System.Net; + +namespace WebsitePanel.Providers.RemoteDesktopServices +{ + public class RdsServer + { + public int Id { get; set; } + public int? ItemId { get; set; } + public string Name + { + get + { + return string.IsNullOrEmpty(FqdName) ? string.Empty : FqdName.Split('.')[0]; + } + } + public string FqdName { get; set; } + public string Description { get; set; } + public string Address { get; set; } + public string ItemName { get; set; } + public int? RdsCollectionId { get; set; } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServersPaged.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServersPaged.cs new file mode 100644 index 00000000..5849a04e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServersPaged.cs @@ -0,0 +1,8 @@ +namespace WebsitePanel.Providers.RemoteDesktopServices +{ + public class RdsServersPaged + { + public int RecordsCount { get; set; } + public RdsServer[] Servers { get; set; } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RemoteApplication.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RemoteApplication.cs new file mode 100644 index 00000000..c80dde44 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RemoteApplication.cs @@ -0,0 +1,11 @@ +namespace WebsitePanel.Providers.RemoteDesktopServices +{ + public class RemoteApplication + { + public string Alias { get; set; } + public string DisplayName { get; set; } + public string FilePath { get; set; } + public string FileVirtualPath { get; set; } + public bool ShowInWebAccess { get; set; } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/SessionHostServer.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/SessionHostServer.cs new file mode 100644 index 00000000..1c23195e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/SessionHostServer.cs @@ -0,0 +1,11 @@ +using System.Net; + +namespace WebsitePanel.Providers.RemoteDesktopServices +{ + public class SessionHostServer + { + public string Name { get; set; } + public string FqdName { get; set; } + public string Address { get; set; } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs new file mode 100644 index 00000000..9259c4ed --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs @@ -0,0 +1,9 @@ +namespace WebsitePanel.Providers.RemoteDesktopServices +{ + public class StartMenuApp + { + public string DisplayName { get; set; } + public string FilePath { get; set; } + public string FileVirtualPath { get; set; } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index 297b1455..3e670e5a 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -123,6 +123,13 @@ + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2013/CRMBase.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2013/CRMBase.cs index 3a52bdca..f7c24b41 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2013/CRMBase.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Crm2013/CRMBase.cs @@ -183,12 +183,19 @@ namespace WebsitePanel.Providers.HostedSolution return orgResponse.Details; } + public virtual string GetOrganizationUniqueName(string orgName) + { + return Regex.Replace(orgName, @"[^\dA-Za-z]", "-", RegexOptions.Compiled); + } + protected virtual Uri GetCRMOrganizationUrl(string orgName) { //string url = "https://" + ProviderSettings[Constants.AppRootDomain] + ":" + ProviderSettings[Constants.Port] + "/" + orgName + "/XRMServices/2011/Organization.svc"; string url; + orgName = GetOrganizationUniqueName(orgName); + string organizationWebServiceUri = ProviderSettings[Constants.OrganizationWebService]; if (String.IsNullOrEmpty(orgName)) @@ -723,7 +730,7 @@ namespace WebsitePanel.Providers.HostedSolution OrganizationResult ret = StartLog("CreateOrganizationInternal"); - organizationUniqueName = Regex.Replace(organizationUniqueName, @"[^\dA-Za-z]", "-", RegexOptions.Compiled); + organizationUniqueName = GetOrganizationUniqueName(organizationUniqueName); // calculate UserRootPath string ldapstr = ""; diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs index 62df4ff6..fa411b12 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs @@ -1004,7 +1004,10 @@ namespace WebsitePanel.Providers.HostedSolution - if (!DeleteOrganizationMailboxes(runSpace, ou)) + if (!DeleteOrganizationMailboxes(runSpace, ou, false)) + ret = false; + + if (!DeleteOrganizationMailboxes(runSpace, ou, true)) ret = false; if (!DeleteOrganizationContacts(runSpace, ou)) @@ -1159,13 +1162,15 @@ namespace WebsitePanel.Providers.HostedSolution return ret; } - internal bool DeleteOrganizationMailboxes(Runspace runSpace, string ou) + internal bool DeleteOrganizationMailboxes(Runspace runSpace, string ou, bool publicFolder) { ExchangeLog.LogStart("DeleteOrganizationMailboxes"); bool ret = true; Command cmd = new Command("Get-Mailbox"); cmd.Parameters.Add("OrganizationalUnit", ou); + if (publicFolder) cmd.Parameters.Add("PublicFolder"); + Collection result = ExecuteShellCommand(runSpace, cmd); if (result != null && result.Count > 0) { @@ -1177,7 +1182,7 @@ namespace WebsitePanel.Providers.HostedSolution id = ObjToString(GetPSObjectProperty(obj, "Identity")); RemoveDevicesInternal(runSpace, id); - RemoveMailbox(runSpace, id, false); + RemoveMailbox(runSpace, id, publicFolder); } catch (Exception ex) { @@ -3193,6 +3198,15 @@ namespace WebsitePanel.Providers.HostedSolution #endregion #region Contacts + + private bool CheckEmailExist(Runspace runSpace, string email) + { + Command cmd = new Command("Get-Recipient"); + cmd.Parameters.Add("Identity", email); + Collection result = ExecuteShellCommand(runSpace, cmd); + return result.Count > 0; + } + private void CreateContactInternal( string organizationId, string organizationDistinguishedName, @@ -3214,9 +3228,29 @@ namespace WebsitePanel.Providers.HostedSolution { runSpace = OpenRunspace(); + // + string tempEmailUser = Guid.NewGuid().ToString("N"); + string[] parts = contactEmail.Split('@'); + if (parts.Length==2) + { + if (CheckEmailExist(runSpace, parts[0] + "@" + defaultOrganizationDomain)) + { + for(int num=1;num<100;num++) + { + string testEmailUser = parts[0] + num.ToString(); + if (!CheckEmailExist(runSpace, testEmailUser + "@" + defaultOrganizationDomain)) + { + tempEmailUser = testEmailUser; + break; + } + } + } + else + tempEmailUser = parts[0]; + } string ouName = ConvertADPathToCanonicalName(organizationDistinguishedName); - string tempEmail = string.Format("{0}@{1}", Guid.NewGuid().ToString("N"), defaultOrganizationDomain); + string tempEmail = string.Format("{0}@{1}", tempEmailUser, defaultOrganizationDomain); //create contact Command cmd = new Command("New-MailContact"); cmd.Parameters.Add("Name", contactAccountName); @@ -4575,7 +4609,6 @@ namespace WebsitePanel.Providers.HostedSolution } finally { - CloseRunspace(runSpace); } ExchangeLog.LogEnd("DeletePublicFolderInternal"); @@ -5300,6 +5333,8 @@ namespace WebsitePanel.Providers.HostedSolution cmd.Parameters.Add("Identity", id); cmd.Parameters.Add("DefaultPublicFolderMailbox", newValue); + ExecuteShellCommand(runSpace, cmd); + res.Add(newValue); } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs index b622ae19..08ee1d7f 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs @@ -624,7 +624,10 @@ namespace WebsitePanel.Providers.Mail DefaultUserQuotaInMB = Convert.ToInt32((object) domain.GetProperty("D_UserMailbox"))/1024, DefaultUserMaxMessageSizeMegaByte = Convert.ToInt32((object) domain.GetProperty("D_UserMsg"))/1024, DefaultUserMegaByteSendLimit = Convert.ToInt32((object) domain.GetProperty("D_UserMB")), - DefaultUserNumberSendLimit = Convert.ToInt32((object) domain.GetProperty("D_UserNumber")) + DefaultUserNumberSendLimit = Convert.ToInt32((object) domain.GetProperty("D_UserNumber")), + UseDomainDiskQuota = Convert.ToBoolean(ProviderSettings["UseDomainDiskQuota"]), + UseDomainLimits = Convert.ToBoolean(ProviderSettings["UseDomainLimits"]), + UseUserLimits = Convert.ToBoolean(ProviderSettings["UseUserLimits"]) }; return mailDomain; diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/WebsitePanel.Providers.RemoteDesktopServices.Windows2012.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/WebsitePanel.Providers.RemoteDesktopServices.Windows2012.csproj index 0bb44d32..66dd13d8 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/WebsitePanel.Providers.RemoteDesktopServices.Windows2012.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/WebsitePanel.Providers.RemoteDesktopServices.Windows2012.csproj @@ -33,6 +33,8 @@ + + {684C932A-6C75-46AC-A327-F3689D89EB42} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index e531a58c..934b2239 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -29,104 +29,1293 @@ using System; using System.IO; using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.NetworkInformation; +using System.Net.Sockets; +using System.Runtime.Remoting; using System.Text; using Microsoft.Win32; - +using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Server.Utils; using WebsitePanel.Providers.Utils; using WebsitePanel.Providers.OS; using WebsitePanel.Providers.Common; +using System.Management; +using System.Management.Automation; +using System.Management.Automation.Runspaces; +using System.Collections.ObjectModel; + namespace WebsitePanel.Providers.RemoteDesktopServices { - public class Windows2012 : HostingServiceProviderBase + public class Windows2012 : HostingServiceProviderBase, IRemoteDesktopServices { - #region Properties - protected string UsersHome - { - get { return FileUtils.EvaluateSystemVariables(ProviderSettings[Constants.UsersHome]); } - } + #region Constants + + private const string CapPath = @"RDS:\GatewayServer\CAP"; + private const string RapPath = @"RDS:\GatewayServer\RAP"; + private const string Computers = "Computers"; + private const string AdDcComputers = "Domain Controllers"; + private const string Users = "users"; + private const string RdsGroupFormat = "rds-{0}-{1}"; + private const string RdsModuleName = "RemoteDesktopServices"; + private const string AddNpsString = "netsh nps add np name=\"\"{0}\"\" policysource=\"1\" processingorder=\"{1}\" conditionid=\"0x3d\" conditiondata=\"^5$\" conditionid=\"0x1fb5\" conditiondata=\"{2}\" conditionid=\"0x1e\" conditiondata=\"UserAuthType:(PW|CA)\" profileid=\"0x1005\" profiledata=\"TRUE\" profileid=\"0x100f\" profiledata=\"TRUE\" profileid=\"0x1009\" profiledata=\"0x7\" profileid=\"0x1fe6\" profiledata=\"0x40000000\""; #endregion + #region Properties + + internal string PrimaryDomainController + { + get + { + return ProviderSettings["PrimaryDomainController"]; + } + } + + private string RootOU + { + get + { + return ProviderSettings["RootOU"]; + } + } + + private string CentralNpsHost + { + get + { + return ProviderSettings["CentralNPS"]; + } + } + + private IEnumerable Gateways + { + get + { + return ProviderSettings["GWServrsList"].Split(';').Select(x => string.IsNullOrEmpty(x) ? x : x.Trim()); + } + } + + private bool CentralNps + { + get + { + return Convert.ToBoolean(ProviderSettings["UseCentralNPS"]); + } + } + + private string RootDomain + { + get + { + return ServerSettings.ADRootDomain; + } + } + + private string ConnectionBroker + { + get + { + return ProviderSettings["ConnectionBroker"]; + } + } + + #endregion #region HostingServiceProvider methods - public override string[] Install() - { - List messages = new List(); - - // create folder if it not exists - try - { - if (!FileUtils.DirectoryExists(UsersHome)) - { - FileUtils.CreateDirectory(UsersHome); - } - } - catch (Exception ex) - { - messages.Add(String.Format("Folder '{0}' could not be created: {1}", - UsersHome, ex.Message)); - } - return messages.ToArray(); - } - - public override void DeleteServiceItems(ServiceProviderItem[] items) - { - foreach (ServiceProviderItem item in items) - { - try - { - if (item is HomeFolder) - // delete home folder - FileUtils.DeleteFile(item.Name); - } - catch (Exception ex) - { - Log.WriteError(String.Format("Error deleting '{0}' {1}", item.Name, item.GetType().Name), ex); - } - } - } - - public override ServiceProviderItemDiskSpace[] GetServiceItemsDiskSpace(ServiceProviderItem[] items) - { - List itemsDiskspace = new List(); - foreach (ServiceProviderItem item in items) - { - if (item is HomeFolder) - { - try - { - string path = item.Name; - - Log.WriteStart(String.Format("Calculating '{0}' folder size", path)); - - // calculate disk space - ServiceProviderItemDiskSpace diskspace = new ServiceProviderItemDiskSpace(); - diskspace.ItemId = item.Id; - diskspace.DiskSpace = FileUtils.CalculateFolderSize(path); - itemsDiskspace.Add(diskspace); - - Log.WriteEnd(String.Format("Calculating '{0}' folder size", path)); - } - catch (Exception ex) - { - Log.WriteError(ex); - } - } - } - return itemsDiskspace.ToArray(); - } - #endregion public override bool IsInstalled() { // TODO: Remove it. - return true; - - //Server.Utils.OS.WindowsVersion version = WebsitePanel.Server.Utils.OS.GetVersion(); - //return version == WebsitePanel.Server.Utils.OS.WindowsVersion.WindowsServer2012; + //return true; + Server.Utils.OS.WindowsVersion version = WebsitePanel.Server.Utils.OS.GetVersion(); + return version == WebsitePanel.Server.Utils.OS.WindowsVersion.WindowsServer2012; } + + #endregion + + #region RDS Collections + + public bool CreateCollection(string organizationId, RdsCollection collection) + { + var result = true; + + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + + foreach (var server in collection.Servers) + { + //If server will restart it will not be added to collection + //Do not install feature here + + if (!ExistRdsServerInDeployment(runSpace, server)) + { + AddRdsServerToDeployment(runSpace, server); + } + } + + Command cmd = new Command("New-RDSessionCollection"); + cmd.Parameters.Add("CollectionName", collection.Name); + cmd.Parameters.Add("SessionHost", collection.Servers.Select(x => x.FqdName).ToArray()); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + + if (!string.IsNullOrEmpty(collection.Description)) + { + cmd.Parameters.Add("CollectionDescription", collection.Description); + } + + var collectionPs = ExecuteShellCommand(runSpace, cmd, false).FirstOrDefault(); + + if (collectionPs == null) + { + throw new Exception("Collection not created"); + } + + var orgPath = GetOrganizationPath(organizationId); + + if (!ActiveDirectoryUtils.AdObjectExists(GetComputerGroupPath(organizationId, collection.Name))) + { + //Create computer group + ActiveDirectoryUtils.CreateGroup(orgPath, GetComputersGroupName(collection.Name)); + + //todo Connection broker server must be added by default ??? + //ActiveDirectoryUtils.AddObjectToGroup(GetComputerPath(ConnectionBroker), GetComputerGroupPath(organizationId, collection.Name)); + } + + if (!ActiveDirectoryUtils.AdObjectExists(GetUsersGroupPath(organizationId, collection.Name))) + { + //Create user group + ActiveDirectoryUtils.CreateGroup(orgPath, GetUsersGroupName(collection.Name)); + } + + foreach (var gateway in Gateways) + { + if (!CentralNps) + { + CreateRdCapForce(runSpace, gateway, collection.Name, new List { GetUsersGroupName(collection.Name) }); + } + + CreateRdRapForce(runSpace, gateway, collection.Name, new List { GetUsersGroupName(collection.Name) }); + } + + if (CentralNps) + { + CreateCentralNpsPolicy(runSpace, CentralNpsHost, collection.Name, organizationId); + } + + //add user group to collection + AddUserGroupsToCollection(runSpace, collection.Name, new List { GetUsersGroupName(collection.Name) }); + + //add session servers to group + foreach (var rdsServer in collection.Servers) + { + AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer); + } + } + catch (Exception e) + { + result = false; + } + finally + { + CloseRunspace(runSpace); + } + + return result; + } + + public RdsCollection GetCollection(string collectionName) + { + RdsCollection collection =null; + + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + + Command cmd = new Command("Get-RDSessionCollection"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + + var collectionPs = ExecuteShellCommand(runSpace, cmd, false).FirstOrDefault(); + + if (collectionPs != null) + { + collection = new RdsCollection(); + collection.Name = Convert.ToString(GetPSObjectProperty(collectionPs, "CollectionName")); + collection.Description = Convert.ToString(GetPSObjectProperty(collectionPs, "CollectionDescription")); + } + } + finally + { + CloseRunspace(runSpace); + } + + return collection; + } + + public bool RemoveCollection(string organizationId, string collectionName) + { + var result = true; + + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + + Command cmd = new Command("Remove-RDSessionCollection"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + cmd.Parameters.Add("Force", true); + + ExecuteShellCommand(runSpace, cmd, false); + + foreach (var gateway in Gateways) + { + if (!CentralNps) + { + RemoveRdCap(runSpace, gateway, collectionName); + } + + RemoveRdRap(runSpace, gateway, collectionName); + } + + if (CentralNps) + { + RemoveNpsPolicy(runSpace, CentralNpsHost, collectionName); + } + + //Remove security group + + ActiveDirectoryUtils.DeleteADObject(GetComputerGroupPath(organizationId, collectionName)); + + ActiveDirectoryUtils.DeleteADObject(GetUsersGroupPath(organizationId, collectionName)); + } + catch (Exception e) + { + result = false; + } + finally + { + CloseRunspace(runSpace); + } + + return result; + } + + public List GetCollectionUsers(string collectionName) + { + return GetUsersToCollectionAdGroup(collectionName); + } + + public bool SetUsersInCollection(string organizationId, string collectionName, List users) + { + var result = true; + + try + { + SetUsersToCollectionAdGroup(collectionName, organizationId, users); + } + catch (Exception e) + { + result = false; + } + + return result; + } + + public void AddSessionHostServerToCollection(string organizationId, string collectionName, RdsServer server) + { + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + + if (!ExistRdsServerInDeployment(runSpace, server)) + { + AddRdsServerToDeployment(runSpace, server); + } + + Command cmd = new Command("Add-RDSessionHost"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("SessionHost", server.FqdName); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + + ExecuteShellCommand(runSpace, cmd, false); + + AddComputerToCollectionAdComputerGroup(organizationId, collectionName, server); + } + catch (Exception e) + { + + } + finally + { + CloseRunspace(runSpace); + } + } + + public void AddSessionHostServersToCollection(string organizationId, string collectionName, List servers) + { + foreach (var server in servers) + { + AddSessionHostServerToCollection(organizationId, collectionName, server); + } + } + + public void RemoveSessionHostServerFromCollection(string organizationId, string collectionName, RdsServer server) + { + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + + Command cmd = new Command("Remove-RDSessionHost"); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + cmd.Parameters.Add("SessionHost", server.FqdName); + cmd.Parameters.Add("Force", true); + + ExecuteShellCommand(runSpace, cmd, false); + + RemoveComputerFromCollectionAdComputerGroup(organizationId, collectionName, server); + } + finally + { + CloseRunspace(runSpace); + } + } + + public void RemoveSessionHostServersFromCollection(string organizationId, string collectionName, List servers) + { + foreach (var server in servers) + { + RemoveSessionHostServerFromCollection(organizationId, collectionName, server); + } + } + + #endregion + + #region Remote Applications + + public List GetAvailableRemoteApplications(string collectionName) + { + var startApps = new List(); + + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + + Command cmd = new Command("Get-RDAvailableApp"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + + var remoteApplicationsPS = ExecuteShellCommand(runSpace, cmd, false); + + if (remoteApplicationsPS != null) + { + startApps.AddRange(remoteApplicationsPS.Select(CreateStartMenuAppFromPsObject)); + } + } + finally + { + CloseRunspace(runSpace); + } + + return startApps; + } + + public List GetCollectionRemoteApplications(string collectionName) + { + var remoteApps = new List(); + + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + + Command cmd = new Command("Get-RDRemoteApp"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + + var remoteAppsPs = ExecuteShellCommand(runSpace, cmd, false); + + if (remoteAppsPs != null) + { + remoteApps.AddRange(remoteAppsPs.Select(CreateRemoteApplicationFromPsObject)); + } + } + finally + { + CloseRunspace(runSpace); + } + + return remoteApps; + } + + public bool AddRemoteApplication(string collectionName, RemoteApplication remoteApp) + { + var result = false; + + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + + Command cmd = new Command("New-RDRemoteApp"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + cmd.Parameters.Add("Alias", remoteApp.Alias); + cmd.Parameters.Add("DisplayName", remoteApp.DisplayName); + cmd.Parameters.Add("FilePath", remoteApp.FilePath); + cmd.Parameters.Add("ShowInWebAccess", remoteApp.ShowInWebAccess); + + ExecuteShellCommand(runSpace, cmd, false); + + result = true; + } + finally + { + CloseRunspace(runSpace); + } + + return result; + } + + public bool AddRemoteApplications(string collectionName, List remoteApps) + { + var result = true; + + foreach (var remoteApp in remoteApps) + { + result = AddRemoteApplication(collectionName, remoteApp) && result; + } + + return result; + } + + public bool RemoveRemoteApplication(string collectionName, RemoteApplication remoteApp) + { + var result = false; + + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + + Command cmd = new Command("Remove-RDRemoteApp"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + cmd.Parameters.Add("Alias", remoteApp.Alias); + cmd.Parameters.Add("Force", true); + + ExecuteShellCommand(runSpace, cmd, false); + } + finally + { + CloseRunspace(runSpace); + } + + return result; + } + + #endregion + + #region Gateaway (RD CAP | RD RAP) + + internal void CreateCentralNpsPolicy(Runspace runSpace, string centralNpshost, string collectionName, string organizationId) + { + var showCmd = new Command("netsh nps show np"); + + var showResult = ExecuteRemoteShellCommand(runSpace, centralNpshost, showCmd); + + var count = showResult.Count(x => Convert.ToString(x).Contains("policy conf")) + 1001; + + var groupAd = ActiveDirectoryUtils.GetADObject(GetUsersGroupPath(organizationId, collectionName)); + + var sid = (byte[])ActiveDirectoryUtils.GetADObjectProperty(groupAd, "objectSid"); + + var addCmdString = string.Format(AddNpsString, collectionName.Replace(" ", "_"), count, ConvertByteToStringSid(sid)); + + Command addCmd = new Command(addCmdString); + + var result = ExecuteRemoteShellCommand(runSpace, centralNpshost, addCmd); + } + + internal void RemoveNpsPolicy(Runspace runSpace, string centralNpshost, string collectionName) + { + var removeCmd = new Command(string.Format("netsh nps delete np {0}", collectionName.Replace(" ", "_"))); + + var removeResult = ExecuteRemoteShellCommand(runSpace, centralNpshost, removeCmd); + } + + internal void CreateRdCapForce(Runspace runSpace, string gatewayHost, string name, List groups) + { + //New-Item -Path "RDS:\GatewayServer\CAP" -Name "Allow Admins" -UserGroups "Administrators@." -AuthMethod 1 + //Set-Item -Path "RDS:\GatewayServer\CAP\Allow Admins\SessionTimeout" -Value 480 -SessionTimeoutAction 0 + + if (ItemExistsRemote(runSpace, gatewayHost, Path.Combine(CapPath, name))) + { + RemoveRdCap(runSpace, gatewayHost, name); + } + + var userGroupParametr = string.Format("@({0})",string.Join(",", groups.Select(x => string.Format("\"{0}@{1}\"", x, RootDomain)).ToArray())); + + Command rdCapCommand = new Command("New-Item"); + rdCapCommand.Parameters.Add("Path", string.Format("\"{0}\"", CapPath)); + rdCapCommand.Parameters.Add("Name", string.Format("\"{0}\"", name)); + rdCapCommand.Parameters.Add("UserGroups", userGroupParametr); + rdCapCommand.Parameters.Add("AuthMethod", 1); + + ExecuteRemoteShellCommand(runSpace, gatewayHost, rdCapCommand, RdsModuleName); + } + + internal void RemoveRdCap(Runspace runSpace, string gatewayHost, string name) + { + RemoveItemRemote(runSpace, gatewayHost, string.Format(@"{0}\{1}", CapPath, name), RdsModuleName); + } + + internal void CreateRdRapForce(Runspace runSpace, string gatewayHost, string name, List groups) + { + //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 + + if (ItemExistsRemote(runSpace, gatewayHost, Path.Combine(RapPath, name))) + { + RemoveRdRap(runSpace, gatewayHost, name); + } + + var userGroupParametr = string.Format("@({0})", string.Join(",", groups.Select(x => string.Format("\"{0}@{1}\"", x, RootDomain)).ToArray())); + var computerGroupParametr = string.Format("\"{0}@{1}\"", GetComputersGroupName(name), RootDomain); + + Command rdRapCommand = new Command("New-Item"); + rdRapCommand.Parameters.Add("Path", string.Format("\"{0}\"", RapPath)); + rdRapCommand.Parameters.Add("Name", string.Format("\"{0}\"", name)); + rdRapCommand.Parameters.Add("UserGroups", userGroupParametr); + rdRapCommand.Parameters.Add("ComputerGroupType", 1); + rdRapCommand.Parameters.Add("ComputerGroup", computerGroupParametr); + + ExecuteRemoteShellCommand(runSpace, gatewayHost, rdRapCommand, RdsModuleName); + } + + internal void RemoveRdRap(Runspace runSpace, string gatewayHost, string name) + { + RemoveItemRemote(runSpace, gatewayHost, string.Format(@"{0}\{1}", RapPath, name), RdsModuleName); + } + + #endregion + + private void AddRdsServerToDeployment(Runspace runSpace, RdsServer server) + { + Command cmd = new Command("Add-RDserver"); + cmd.Parameters.Add("Server", server.FqdName); + cmd.Parameters.Add("Role", "RDS-RD-SERVER"); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + + ExecuteShellCommand(runSpace, cmd, false); + } + + private bool ExistRdsServerInDeployment(Runspace runSpace, RdsServer server) + { + Command cmd = new Command("Get-RDserver"); + cmd.Parameters.Add("Role", "RDS-RD-SERVER"); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + + var serversPs = ExecuteShellCommand(runSpace, cmd, false); + + if (serversPs != null) + { + foreach (var serverPs in serversPs) + { + var serverName = Convert.ToString( GetPSObjectProperty(serverPs, "Server")); + + if (string.Compare(serverName, server.FqdName, StringComparison.InvariantCultureIgnoreCase) == 0) + { + return true; + } + } + } + + return false; + } + + private void SetUsersToCollectionAdGroup(string collectionName, string organizationId, IEnumerable users) + { + var usersGroupName = GetUsersGroupName(collectionName); + var usersGroupPath = GetUsersGroupPath(organizationId, collectionName); + + //remove all users from group + foreach (string userPath in ActiveDirectoryUtils.GetGroupObjects(usersGroupName, "user")) + { + ActiveDirectoryUtils.RemoveObjectFromGroup(userPath, usersGroupPath); + } + + //adding users to group + foreach (var user in users) + { + var userPath = GetUserPath(organizationId, user); + + if (ActiveDirectoryUtils.AdObjectExists(userPath)) + { + var userObject = ActiveDirectoryUtils.GetADObject(userPath); + var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(userObject, "sAMAccountName"); + + if (!ActiveDirectoryUtils.IsUserInGroup(samName, usersGroupName)) + { + ActiveDirectoryUtils.AddObjectToGroup(userPath, GetUsersGroupPath(organizationId, collectionName)); + } + } + } + } + + private List GetUsersToCollectionAdGroup(string collectionName) + { + var users = new List(); + + var usersGroupName = GetUsersGroupName(collectionName); + + foreach (string userPath in ActiveDirectoryUtils.GetGroupObjects(usersGroupName, "user")) + { + var userObject = ActiveDirectoryUtils.GetADObject(userPath); + var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(userObject, "sAMAccountName"); + + users.Add(samName); + } + + return users; + } + + private void AddUserGroupsToCollection(Runspace runSpace, string collectionName, List groups) + { + Command cmd = new Command("Set-RDSessionCollectionConfiguration"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("UserGroup", groups); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + + ExecuteShellCommand(runSpace, cmd, false).FirstOrDefault(); + } + + private void AddComputerToCollectionAdComputerGroup(string organizationId, string collectionName, RdsServer server) + { + var computerPath = GetComputerPath(server.Name, false); + var computerGroupName = GetComputersGroupName( collectionName); + + if (!ActiveDirectoryUtils.AdObjectExists(computerPath)) + { + computerPath = GetComputerPath(server.Name, true); + } + + if (ActiveDirectoryUtils.AdObjectExists(computerPath)) + { + var computerObject = ActiveDirectoryUtils.GetADObject(computerPath); + var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(computerObject, "sAMAccountName"); + + if (!ActiveDirectoryUtils.IsComputerInGroup(samName, computerGroupName)) + { + ActiveDirectoryUtils.AddObjectToGroup(computerPath, GetComputerGroupPath(organizationId, collectionName)); + } + } + } + + private void RemoveComputerFromCollectionAdComputerGroup(string organizationId, string collectionName, RdsServer server) + { + var computerPath = GetComputerPath(server.Name, false); + var computerGroupName = GetComputersGroupName(collectionName); + + if (!ActiveDirectoryUtils.AdObjectExists(computerPath)) + { + computerPath = GetComputerPath(server.Name, true); + } + + if (ActiveDirectoryUtils.AdObjectExists(computerPath)) + { + var computerObject = ActiveDirectoryUtils.GetADObject(computerPath); + var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(computerObject, "sAMAccountName"); + + if (ActiveDirectoryUtils.IsComputerInGroup(samName, computerGroupName)) + { + ActiveDirectoryUtils.RemoveObjectFromGroup(computerPath, GetComputerGroupPath(organizationId, collectionName)); + } + } + } + + public bool AddSessionHostFeatureToServer(string hostName) + { + bool installationResult = false; + + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + + var feature = AddFeature(runSpace, hostName, "RDS-RD-Server", true, true); + + installationResult = (bool) GetPSObjectProperty(feature, "Success"); + } + finally + { + CloseRunspace(runSpace); + } + + return installationResult; + } + + public bool CheckSessionHostFeatureInstallation(string hostName) + { + bool isInstalled = false; + + Runspace runSpace = null; + try + { + runSpace = OpenRunspace(); + + Command cmd = new Command("Get-WindowsFeature"); + cmd.Parameters.Add("Name", "RDS-RD-Server"); + + var feature = ExecuteRemoteShellCommand(runSpace, hostName, cmd).FirstOrDefault(); + + if (feature != null) + { + isInstalled = (bool) GetPSObjectProperty(feature, "Installed"); + } + } + finally + { + CloseRunspace(runSpace); + } + + return isInstalled; + } + + public bool CheckServerAvailability(string hostName) + { + var ping = new Ping(); + + var ipAddress = GetServerIp(hostName); + + var reply = ping.Send(ipAddress, 3000); + + return reply != null && reply.Status == IPStatus.Success; + } + + #region Helpers + + private static string ConvertByteToStringSid(Byte[] sidBytes) + { + StringBuilder strSid = new StringBuilder(); + strSid.Append("S-"); + try + { + // Add SID revision. + strSid.Append(sidBytes[0].ToString()); + // Next six bytes are SID authority value. + if (sidBytes[6] != 0 || sidBytes[5] != 0) + { + string strAuth = String.Format + ("0x{0:2x}{1:2x}{2:2x}{3:2x}{4:2x}{5:2x}", + (Int16)sidBytes[1], + (Int16)sidBytes[2], + (Int16)sidBytes[3], + (Int16)sidBytes[4], + (Int16)sidBytes[5], + (Int16)sidBytes[6]); + strSid.Append("-"); + strSid.Append(strAuth); + } + else + { + Int64 iVal = (Int32)(sidBytes[1]) + + (Int32)(sidBytes[2] << 8) + + (Int32)(sidBytes[3] << 16) + + (Int32)(sidBytes[4] << 24); + strSid.Append("-"); + strSid.Append(iVal.ToString()); + } + + // Get sub authority count... + int iSubCount = Convert.ToInt32(sidBytes[7]); + int idxAuth = 0; + for (int i = 0; i < iSubCount; i++) + { + idxAuth = 8 + i * 4; + UInt32 iSubAuth = BitConverter.ToUInt32(sidBytes, idxAuth); + strSid.Append("-"); + strSid.Append(iSubAuth.ToString()); + } + } + catch + { + return ""; + } + return strSid.ToString(); + } + + private StartMenuApp CreateStartMenuAppFromPsObject(PSObject psObject) + { + var remoteApp = new StartMenuApp + { + DisplayName = Convert.ToString(GetPSObjectProperty(psObject, "DisplayName")), + FilePath = Convert.ToString(GetPSObjectProperty(psObject, "FilePath")), + FileVirtualPath = Convert.ToString(GetPSObjectProperty(psObject, "FileVirtualPath")) + }; + + return remoteApp; + } + + private RemoteApplication CreateRemoteApplicationFromPsObject(PSObject psObject) + { + var remoteApp = new RemoteApplication + { + DisplayName = Convert.ToString(GetPSObjectProperty(psObject, "DisplayName")), + FilePath = Convert.ToString(GetPSObjectProperty(psObject, "FilePath")), + Alias = Convert.ToString(GetPSObjectProperty(psObject, "Alias")), + ShowInWebAccess = Convert.ToBoolean(GetPSObjectProperty(psObject, "ShowInWebAccess")) + }; + + return remoteApp; + } + + internal IPAddress GetServerIp(string hostname, AddressFamily addressFamily = AddressFamily.InterNetwork) + { + var address = GetServerIps(hostname); + + return address.FirstOrDefault(x => x.AddressFamily == addressFamily); + } + + internal IEnumerable GetServerIps(string hostname) + { + var address = Dns.GetHostAddresses(hostname); + + return address; + } + + internal void RemoveItem(Runspace runSpace, string path) + { + Command rdRapCommand = new Command("Remove-Item"); + rdRapCommand.Parameters.Add("Path", path); + rdRapCommand.Parameters.Add("Force", true); + rdRapCommand.Parameters.Add("Recurse", true); + + ExecuteShellCommand(runSpace, rdRapCommand, false); + } + + internal void RemoveItemRemote(Runspace runSpace, string hostname, string path, params string[] imports) + { + Command rdRapCommand = new Command("Remove-Item"); + rdRapCommand.Parameters.Add("Path", string.Format("\"{0}\"", path)); + rdRapCommand.Parameters.Add("Force", ""); + rdRapCommand.Parameters.Add("Recurse", ""); + + ExecuteRemoteShellCommand(runSpace, hostname, rdRapCommand, imports); + } + + private string GetComputersGroupName(string collectionName) + { + return string.Format(RdsGroupFormat, collectionName, Computers.ToLowerInvariant()); + } + + private string GetUsersGroupName(string collectionName) + { + return string.Format(RdsGroupFormat, collectionName, Users.ToLowerInvariant()); + } + + internal string GetComputerGroupPath(string organizationId, string collection) + { + StringBuilder sb = new StringBuilder(); + // append provider + AppendProtocol(sb); + AppendDomainController(sb); + AppendCNPath(sb, GetComputersGroupName(collection)); + AppendOUPath(sb, organizationId); + AppendOUPath(sb, RootOU); + AppendDomainPath(sb, RootDomain); + + return sb.ToString(); + } + + internal string GetUsersGroupPath(string organizationId, string collection) + { + StringBuilder sb = new StringBuilder(); + // append provider + AppendProtocol(sb); + AppendDomainController(sb); + AppendCNPath(sb, GetUsersGroupName(collection)); + AppendOUPath(sb, organizationId); + AppendOUPath(sb, RootOU); + AppendDomainPath(sb, RootDomain); + + return sb.ToString(); + } + + private string GetUserPath(string organizationId, string loginName) + { + StringBuilder sb = new StringBuilder(); + // append provider + AppendProtocol(sb); + AppendDomainController(sb); + AppendCNPath(sb, loginName); + AppendOUPath(sb, organizationId); + AppendOUPath(sb, RootOU); + AppendDomainPath(sb, RootDomain); + + return sb.ToString(); + } + + private string GetOrganizationPath(string organizationId) + { + StringBuilder sb = new StringBuilder(); + // append provider + AppendProtocol(sb); + AppendDomainController(sb); + AppendOUPath(sb, organizationId); + AppendOUPath(sb, RootOU); + AppendDomainPath(sb, RootDomain); + + return sb.ToString(); + } + + private string GetComputerPath(string objName, bool domainController) + { + StringBuilder sb = new StringBuilder(); + // append provider + AppendProtocol(sb); + AppendDomainController(sb); + AppendCNPath(sb, objName); + if (domainController) + { + AppendOUPath(sb, AdDcComputers); + } + else + { + AppendCNPath(sb, Computers); + + } + AppendDomainPath(sb, RootDomain); + + return sb.ToString(); + } + + private static void AppendCNPath(StringBuilder sb, string organizationId) + { + if (string.IsNullOrEmpty(organizationId)) + return; + + sb.Append("CN=").Append(organizationId).Append(","); + } + + private void AppendDomainController(StringBuilder sb) + { + sb.Append(PrimaryDomainController + "/"); + } + + private static void AppendProtocol(StringBuilder sb) + { + sb.Append("LDAP://"); + } + + private static void AppendOUPath(StringBuilder sb, string ou) + { + if (string.IsNullOrEmpty(ou)) + return; + + string path = ou.Replace("/", "\\"); + string[] parts = path.Split('\\'); + for (int i = parts.Length - 1; i != -1; i--) + sb.Append("OU=").Append(parts[i]).Append(","); + } + + private static void AppendDomainPath(StringBuilder sb, string domain) + { + if (string.IsNullOrEmpty(domain)) + return; + + string[] parts = domain.Split('.'); + for (int i = 0; i < parts.Length; i++) + { + sb.Append("DC=").Append(parts[i]); + + if (i < (parts.Length - 1)) + sb.Append(","); + } + } + + #endregion + + #region Windows Feature PowerShell + + internal bool IsFeatureInstalled(string hostName, string featureName) + { + bool isInstalled = false; + + Runspace runSpace = null; + try + { + runSpace = OpenRunspace(); + + Command cmd = new Command("Get-WindowsFeature"); + cmd.Parameters.Add("Name", featureName); + + var feature = ExecuteRemoteShellCommand(runSpace, hostName, cmd).FirstOrDefault(); + + if (feature != null) + { + isInstalled = (bool) GetPSObjectProperty(feature, "Installed"); + } + } + finally + { + CloseRunspace(runSpace); + } + + return isInstalled; + } + + internal PSObject AddFeature(Runspace runSpace, string hostName, string featureName, bool includeAllSubFeature = true, bool restart = false) + { + PSObject feature; + + try + { + Command cmd = new Command("Add-WindowsFeature"); + cmd.Parameters.Add("Name", featureName); + + if (includeAllSubFeature) + { + cmd.Parameters.Add("IncludeAllSubFeature", ""); + } + + if (restart) + { + cmd.Parameters.Add("Restart", ""); + } + + feature = ExecuteRemoteShellCommand(runSpace, hostName, cmd).FirstOrDefault(); + } + finally + { + CloseRunspace(runSpace); + } + + return feature; + } + + #endregion + + #region PowerShell integration + + private static InitialSessionState session = null; + + internal virtual Runspace OpenRunspace() + { + Log.WriteStart("OpenRunspace"); + + if (session == null) + { + session = InitialSessionState.CreateDefault(); + session.ImportPSModule(new string[] { "ServerManager", "RemoteDesktop", "RemoteDesktopServices" }); + } + Runspace runSpace = RunspaceFactory.CreateRunspace(session); + // + runSpace.Open(); + // + runSpace.SessionStateProxy.SetVariable("ConfirmPreference", "none"); + Log.WriteEnd("OpenRunspace"); + return runSpace; + } + + internal void CloseRunspace(Runspace runspace) + { + try + { + if (runspace != null && runspace.RunspaceStateInfo.State == RunspaceState.Opened) + { + runspace.Close(); + } + } + catch (Exception ex) + { + Log.WriteError("Runspace error", ex); + } + } + + internal Collection ExecuteRemoteShellCommand(Runspace runSpace, string hostName, Command cmd, params string[] moduleImports) + { + Command invokeCommand = new Command("Invoke-Command"); + invokeCommand.Parameters.Add("ComputerName", hostName); + + RunspaceInvoke invoke = new RunspaceInvoke(); + + string commandString = moduleImports.Any() ? string.Format("import-module {0};", string.Join(",", moduleImports)) : string.Empty; + + commandString += cmd.CommandText; + + if (cmd.Parameters != null && cmd.Parameters.Any()) + { + commandString += " " + + string.Join(" ", + cmd.Parameters.Select(x => string.Format("-{0} {1}", x.Name, x.Value)).ToArray()); + } + + ScriptBlock sb = invoke.Invoke(string.Format("{{{0}}}", commandString))[0].BaseObject as ScriptBlock; + + invokeCommand.Parameters.Add("ScriptBlock", sb); + + return ExecuteShellCommand(runSpace, invokeCommand, false); + } + + internal Collection ExecuteShellCommand(Runspace runSpace, Command cmd) + { + return ExecuteShellCommand(runSpace, cmd, true); + } + + internal Collection ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController) + { + object[] errors; + return ExecuteShellCommand(runSpace, cmd, useDomainController, out errors); + } + + internal Collection ExecuteShellCommand(Runspace runSpace, Command cmd, out object[] errors) + { + return ExecuteShellCommand(runSpace, cmd, true, out errors); + } + + internal Collection ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController, + out object[] errors) + { + Log.WriteStart("ExecuteShellCommand"); + List errorList = new List(); + + if (useDomainController) + { + CommandParameter dc = new CommandParameter("DomainController", PrimaryDomainController); + if (!cmd.Parameters.Contains(dc)) + { + cmd.Parameters.Add(dc); + } + } + + Collection results = null; + // Create a pipeline + Pipeline pipeLine = runSpace.CreatePipeline(); + using (pipeLine) + { + // Add the command + pipeLine.Commands.Add(cmd); + // Execute the pipeline and save the objects returned. + results = pipeLine.Invoke(); + + // Log out any errors in the pipeline execution + // NOTE: These errors are NOT thrown as exceptions! + // Be sure to check this to ensure that no errors + // happened while executing the command. + if (pipeLine.Error != null && pipeLine.Error.Count > 0) + { + foreach (object item in pipeLine.Error.ReadToEnd()) + { + errorList.Add(item); + string errorMessage = string.Format("Invoke error: {0}", item); + Log.WriteWarning(errorMessage); + } + } + } + pipeLine = null; + errors = errorList.ToArray(); + Log.WriteEnd("ExecuteShellCommand"); + return results; + } + + internal object GetPSObjectProperty(PSObject obj, string name) + { + return obj.Members[name].Value; + } + + /// + /// Returns the identity of the object from the shell execution result + /// + /// + /// + internal string GetResultObjectIdentity(Collection result) + { + Log.WriteStart("GetResultObjectIdentity"); + if (result == null) + throw new ArgumentNullException("result", "Execution result is not specified"); + + if (result.Count < 1) + throw new ArgumentException("Execution result is empty", "result"); + + if (result.Count > 1) + throw new ArgumentException("Execution result contains more than one object", "result"); + + PSMemberInfo info = result[0].Members["Identity"]; + if (info == null) + throw new ArgumentException("Execution result does not contain Identity property", "result"); + + string ret = info.Value.ToString(); + Log.WriteEnd("GetResultObjectIdentity"); + return ret; + } + + internal string GetResultObjectDN(Collection result) + { + Log.WriteStart("GetResultObjectDN"); + if (result == null) + throw new ArgumentNullException("result", "Execution result is not specified"); + + if (result.Count < 1) + throw new ArgumentException("Execution result does not contain any object"); + + if (result.Count > 1) + throw new ArgumentException("Execution result contains more than one object"); + + PSMemberInfo info = result[0].Members["DistinguishedName"]; + if (info == null) + throw new ArgumentException("Execution result does not contain DistinguishedName property", "result"); + + string ret = info.Value.ToString(); + Log.WriteEnd("GetResultObjectDN"); + return ret; + } + + internal bool ItemExists(Runspace runSpace, string path) + { + Command testPathCommand = new Command("Test-Path"); + testPathCommand.Parameters.Add("Path", path); + + var testPathResult = ExecuteShellCommand(runSpace, testPathCommand, false).First(); + + var result = Convert.ToBoolean(testPathResult.ToString()); + + return result; + } + + internal bool ItemExistsRemote(Runspace runSpace, string hostname,string path) + { + Command testPathCommand = new Command("Test-Path"); + testPathCommand.Parameters.Add("Path", string.Format("\"{0}\"", path)); + + var testPathResult = ExecuteRemoteShellCommand(runSpace, hostname, testPathCommand, RdsModuleName).First(); + + var result = Convert.ToBoolean(testPathResult.ToString()); + + return result; + } + + #endregion } } + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Extensions/ExtensionsModuleService.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Extensions/ExtensionsModuleService.cs index 227001e3..7280b257 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Extensions/ExtensionsModuleService.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Extensions/ExtensionsModuleService.cs @@ -28,67 +28,50 @@ namespace WebsitePanel.Providers.Web.Iis.Extensions { - using Providers.Utils; + using Handlers; using Common; using Microsoft.Web.Administration; - using Microsoft.Web.Management.Server; - using System; - using System.Collections; using System.Collections.Generic; - using System.Text; - using System.Text.RegularExpressions; - using Microsoft.Win32; -using System.Collections.Specialized; internal sealed class ExtensionsModuleService : ConfigurationModuleService { - public const string PathAttribute = "path"; - - // Mappings collection to properly detect ISAPI modules registered in IIS. - static NameValueCollection ISAPI_MODULES = new NameValueCollection - { - // Misc - { Constants.AspPathSetting, @"\inetsrv\asp.dll" }, - // ASP.NET x86 - { Constants.AspNet11PathSetting, @"\Framework\v1.1.4322\aspnet_isapi.dll" }, - { Constants.AspNet20PathSetting, @"\Framework\v2.0.50727\aspnet_isapi.dll" }, - { Constants.AspNet40PathSetting, @"\Framework\v4.0.30128\aspnet_isapi.dll" }, - // ASP.NET x64 - { Constants.AspNet20x64PathSetting, @"\Framework64\v2.0.50727\aspnet_isapi.dll" }, - { Constants.AspNet40x64PathSetting, @"\Framework64\v4.0.30128\aspnet_isapi.dll" } - }; - - public SettingPair[] GetISAPIExtensionsInstalled(ServerManager srvman) + public SettingPair[] GetExtensionsInstalled(ServerManager srvman) { - List settings = new List(); - // + var settings = new List(); var config = srvman.GetApplicationHostConfiguration(); - // - var section = config.GetSection(Constants.IsapiCgiRestrictionSection); - // - foreach (var item in section.GetCollection()) - { - var isapiModulePath = Convert.ToString(item.GetAttributeValue(PathAttribute)); - // - for (int i = 0; i < ISAPI_MODULES.Keys.Count; i++) - { - var pathExt = ISAPI_MODULES.Get(i); - // - if (isapiModulePath.EndsWith(pathExt)) - { - settings.Add(new SettingPair - { - // Retrieve key name - Name = ISAPI_MODULES.GetKey(i), - // Evaluate ISAPI module path - Value = isapiModulePath - }); - // - break; - } - } - } - // + + var handlersSection = (HandlersSection) config.GetSection(Constants.HandlersSection, typeof (HandlersSection)); + + var executalbesToLookFor = new[] + { + // Perl + new KeyValuePair(Constants.PerlPathSetting, "\\perl.exe"), + // Php + new KeyValuePair(Constants.Php4PathSetting, "\\php.exe"), + new KeyValuePair(Constants.PhpPathSetting, "\\php-cgi.exe"), + // Classic ASP + new KeyValuePair(Constants.AspPathSetting, @"\inetsrv\asp.dll"), + // ASP.NET + new KeyValuePair(Constants.AspNet11PathSetting, @"\Framework\v1.1.4322\aspnet_isapi.dll"), + new KeyValuePair(Constants.AspNet20PathSetting, @"\Framework\v2.0.50727\aspnet_isapi.dll"), + new KeyValuePair(Constants.AspNet40PathSetting, @"\Framework\v4.0.30319\aspnet_isapi.dll"), + // ASP.NET x64 + new KeyValuePair(Constants.AspNet20x64PathSetting, @"\Framework64\v2.0.50727\aspnet_isapi.dll"), + new KeyValuePair(Constants.AspNet40x64PathSetting, @"\Framework64\v4.0.30319\aspnet_isapi.dll"), + }; + + foreach (var handler in handlersSection.Handlers) + { + foreach (var valuePair in executalbesToLookFor) + { + var key = valuePair.Key; + if (handler.ScriptProcessor.EndsWith(valuePair.Value) && !settings.Exists(s => s.Name == key)) + { + settings.Add(new SettingPair{Name = valuePair.Key, Value = handler.ScriptProcessor}); + } + } + } + return settings.ToArray(); } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs index cd3a07b5..3f83a44d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs @@ -100,6 +100,9 @@ namespace WebsitePanel.Providers.Web public const string AspNet20x64PathSetting = "AspNet20x64Path"; public const string AspNet40PathSetting = "AspNet40Path"; public const string AspNet40x64PathSetting = "AspNet40x64Path"; + public const string PerlPathSetting = "PerlPath"; + public const string Php4PathSetting = "Php4Path"; + public const string PhpPathSetting = "PhpPath"; public const string WEBSITEPANEL_IISMODULES = "WebsitePanel.IIsModules"; public const string DOTNETPANEL_IISMODULES = "DotNetPanel.IIsModules"; @@ -892,7 +895,7 @@ namespace WebsitePanel.Providers.Web if (handlerName != GetActivePhpHandlerName(virtualDir)) { // Only change handler if it is different from the current one - handlersSvc.CopyInheritedHandlers(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath); + handlersSvc.CopyInheritedHandlers(GetSiteIdFromVirtualDir(virtualDir), virtualDir.VirtualPath); MakeHandlerActive(handlerName, virtualDir); } } @@ -3409,7 +3412,7 @@ namespace WebsitePanel.Providers.Web using (ServerManager srvman = webObjectsSvc.GetServerManager()) { - allSettings.AddRange(extensionsSvc.GetISAPIExtensionsInstalled(srvman)); + allSettings.AddRange(extensionsSvc.GetExtensionsInstalled(srvman)); // add default web management settings WebManagementServiceSettings wmSettings = GetWebManagementServiceSettings(); @@ -4484,7 +4487,7 @@ namespace WebsitePanel.Providers.Web protected PhpVersion[] GetPhpVersions(ServerManager srvman, WebVirtualDirectory virtualDir) { - var config = srvman.GetWebConfiguration(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath); + var config = srvman.GetWebConfiguration(GetSiteIdFromVirtualDir(virtualDir), virtualDir.VirtualPath); //var config = srvman.GetApplicationHostConfiguration(); var handlersSection = config.GetSection(Constants.HandlersSection); @@ -4526,7 +4529,7 @@ namespace WebsitePanel.Providers.Web protected string GetActivePhpHandlerName(ServerManager srvman, WebVirtualDirectory virtualDir) { - var config = srvman.GetWebConfiguration(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath); + var config = srvman.GetWebConfiguration(GetSiteIdFromVirtualDir(virtualDir), virtualDir.VirtualPath); var handlersSection = config.GetSection(Constants.HandlersSection); // Find first handler for *.php @@ -4545,7 +4548,7 @@ namespace WebsitePanel.Providers.Web { using (var srvman = webObjectsSvc.GetServerManager()) { - var config = srvman.GetWebConfiguration(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath); + var config = srvman.GetWebConfiguration(GetSiteIdFromVirtualDir(virtualDir), virtualDir.VirtualPath); var handlersSection = (HandlersSection)config.GetSection(Constants.HandlersSection, typeof(HandlersSection)); @@ -4564,6 +4567,11 @@ namespace WebsitePanel.Providers.Web } } - #endregion + protected string GetSiteIdFromVirtualDir(WebVirtualDirectory virtualDir) + { + return string.IsNullOrEmpty(virtualDir.ParentSiteName) ? ((WebSite) virtualDir).SiteId : virtualDir.ParentSiteName; + } + + #endregion } } diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs index 0b6d8aad..699cb445 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs @@ -43,25 +43,1326 @@ using WebsitePanel.Providers.HostedSolution; namespace WebsitePanel.Providers.RemoteDesktopServices { - using System.Xml.Serialization; - using System.Web.Services; - using System.ComponentModel; - using System.Web.Services.Protocols; using System; + using System.ComponentModel; using System.Diagnostics; - - + using System.Web.Services; + using System.Web.Services.Protocols; + using System.Xml.Serialization; + /// - // CODEGEN: No methods were found in the WSDL for this protocol. [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Web.Services.WebServiceBindingAttribute(Name="RemoteDesktopServicesSoap", Namespace="http://smbsaas/websitepanel/server/")] - public partial class RemoteDesktopServices : Microsoft.Web.Services3.WebServicesClientProtocol { - + [System.Web.Services.WebServiceBindingAttribute(Name = "RemoteDesktopServicesSoap", Namespace = "http://smbsaas/websitepanel/server/")] + public partial class RemoteDesktopServices : Microsoft.Web.Services3.WebServicesClientProtocol + { + public ServiceProviderSettingsSoapHeader ServiceProviderSettingsSoapHeaderValue; + + private System.Threading.SendOrPostCallback CreateCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback GetCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback RemoveCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback SetUsersInCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback AddSessionHostServerToCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback AddSessionHostServersToCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback RemoveSessionHostServerFromCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback RemoveSessionHostServersFromCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback GetAvailableRemoteApplicationsOperationCompleted; + + private System.Threading.SendOrPostCallback GetCollectionRemoteApplicationsOperationCompleted; + + private System.Threading.SendOrPostCallback AddRemoteApplicationOperationCompleted; + + private System.Threading.SendOrPostCallback AddRemoteApplicationsOperationCompleted; + + private System.Threading.SendOrPostCallback RemoveRemoteApplicationOperationCompleted; + + private System.Threading.SendOrPostCallback AddSessionHostFeatureToServerOperationCompleted; + + private System.Threading.SendOrPostCallback CheckSessionHostFeatureInstallationOperationCompleted; + + private System.Threading.SendOrPostCallback CheckServerAvailabilityOperationCompleted; + /// - public RemoteDesktopServices() { - this.Url = "http://localhost:9003/RemoteDesktopServices.asmx"; + public RemoteDesktopServices() + { + this.Url = "http://127.0.0.1:9003/RemoteDesktopServices.asmx"; + } + + /// + public event CreateCollectionCompletedEventHandler CreateCollectionCompleted; + + /// + public event GetCollectionCompletedEventHandler GetCollectionCompleted; + + /// + public event RemoveCollectionCompletedEventHandler RemoveCollectionCompleted; + + /// + public event SetUsersInCollectionCompletedEventHandler SetUsersInCollectionCompleted; + + /// + public event AddSessionHostServerToCollectionCompletedEventHandler AddSessionHostServerToCollectionCompleted; + + /// + public event AddSessionHostServersToCollectionCompletedEventHandler AddSessionHostServersToCollectionCompleted; + + /// + public event RemoveSessionHostServerFromCollectionCompletedEventHandler RemoveSessionHostServerFromCollectionCompleted; + + /// + public event RemoveSessionHostServersFromCollectionCompletedEventHandler RemoveSessionHostServersFromCollectionCompleted; + + /// + public event GetAvailableRemoteApplicationsCompletedEventHandler GetAvailableRemoteApplicationsCompleted; + + /// + public event GetCollectionRemoteApplicationsCompletedEventHandler GetCollectionRemoteApplicationsCompleted; + + /// + public event AddRemoteApplicationCompletedEventHandler AddRemoteApplicationCompleted; + + /// + public event AddRemoteApplicationsCompletedEventHandler AddRemoteApplicationsCompleted; + + /// + public event RemoveRemoteApplicationCompletedEventHandler RemoveRemoteApplicationCompleted; + + /// + public event AddSessionHostFeatureToServerCompletedEventHandler AddSessionHostFeatureToServerCompleted; + + /// + public event CheckSessionHostFeatureInstallationCompletedEventHandler CheckSessionHostFeatureInstallationCompleted; + + /// + public event CheckServerAvailabilityCompletedEventHandler CheckServerAvailabilityCompleted; + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CreateCollection", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public bool CreateCollection(string organizationId, RdsCollection collection) + { + object[] results = this.Invoke("CreateCollection", new object[] { + organizationId, + collection}); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginCreateCollection(string organizationId, RdsCollection collection, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("CreateCollection", new object[] { + organizationId, + collection}, callback, asyncState); + } + + /// + public bool EndCreateCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void CreateCollectionAsync(string organizationId, RdsCollection collection) + { + this.CreateCollectionAsync(organizationId, collection, null); + } + + /// + public void CreateCollectionAsync(string organizationId, RdsCollection collection, object userState) + { + if ((this.CreateCollectionOperationCompleted == null)) + { + this.CreateCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateCollectionOperationCompleted); + } + this.InvokeAsync("CreateCollection", new object[] { + organizationId, + collection}, this.CreateCollectionOperationCompleted, userState); + } + + private void OnCreateCollectionOperationCompleted(object arg) + { + if ((this.CreateCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CreateCollectionCompleted(this, new CreateCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetCollection", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RdsCollection GetCollection(string collectionName) + { + object[] results = this.Invoke("GetCollection", new object[] { + collectionName}); + return ((RdsCollection)(results[0])); + } + + /// + public System.IAsyncResult BeginGetCollection(string collectionName, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetCollection", new object[] { + collectionName}, callback, asyncState); + } + + /// + public RdsCollection EndGetCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RdsCollection)(results[0])); + } + + /// + public void GetCollectionAsync(string collectionName) + { + this.GetCollectionAsync(collectionName, null); + } + + /// + public void GetCollectionAsync(string collectionName, object userState) + { + if ((this.GetCollectionOperationCompleted == null)) + { + this.GetCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCollectionOperationCompleted); + } + this.InvokeAsync("GetCollection", new object[] { + collectionName}, this.GetCollectionOperationCompleted, userState); + } + + private void OnGetCollectionOperationCompleted(object arg) + { + if ((this.GetCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetCollectionCompleted(this, new GetCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/RemoveCollection", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public bool RemoveCollection(string organizationId, string collectionName) + { + object[] results = this.Invoke("RemoveCollection", new object[] { + organizationId, + collectionName}); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginRemoveCollection(string organizationId, string collectionName, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("RemoveCollection", new object[] { + organizationId, + collectionName}, callback, asyncState); + } + + /// + public bool EndRemoveCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void RemoveCollectionAsync(string organizationId, string collectionName) + { + this.RemoveCollectionAsync(organizationId, collectionName, null); + } + + /// + public void RemoveCollectionAsync(string organizationId, string collectionName, object userState) + { + if ((this.RemoveCollectionOperationCompleted == null)) + { + this.RemoveCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveCollectionOperationCompleted); + } + this.InvokeAsync("RemoveCollection", new object[] { + organizationId, + collectionName}, this.RemoveCollectionOperationCompleted, userState); + } + + private void OnRemoveCollectionOperationCompleted(object arg) + { + if ((this.RemoveCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.RemoveCollectionCompleted(this, new RemoveCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/SetUsersInCollection", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public bool SetUsersInCollection(string organizationId, string collectionName, string[] users) + { + object[] results = this.Invoke("SetUsersInCollection", new object[] { + organizationId, + collectionName, + users}); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginSetUsersInCollection(string organizationId, string collectionName, string[] users, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("SetUsersInCollection", new object[] { + organizationId, + collectionName, + users}, callback, asyncState); + } + + /// + public bool EndSetUsersInCollection(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void SetUsersInCollectionAsync(string organizationId, string collectionName, string[] users) + { + this.SetUsersInCollectionAsync(organizationId, collectionName, users, null); + } + + /// + public void SetUsersInCollectionAsync(string organizationId, string collectionName, string[] users, object userState) + { + if ((this.SetUsersInCollectionOperationCompleted == null)) + { + this.SetUsersInCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetUsersInCollectionOperationCompleted); + } + this.InvokeAsync("SetUsersInCollection", new object[] { + organizationId, + collectionName, + users}, this.SetUsersInCollectionOperationCompleted, userState); + } + + private void OnSetUsersInCollectionOperationCompleted(object arg) + { + if ((this.SetUsersInCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetUsersInCollectionCompleted(this, new SetUsersInCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/AddSessionHostServerToCollection", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void AddSessionHostServerToCollection(string organizationId, string collectionName, RdsServer server) + { + this.Invoke("AddSessionHostServerToCollection", new object[] { + organizationId, + collectionName, + server}); + } + + /// + public System.IAsyncResult BeginAddSessionHostServerToCollection(string organizationId, string collectionName, RdsServer server, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("AddSessionHostServerToCollection", new object[] { + organizationId, + collectionName, + server}, callback, asyncState); + } + + /// + public void EndAddSessionHostServerToCollection(System.IAsyncResult asyncResult) + { + this.EndInvoke(asyncResult); + } + + /// + public void AddSessionHostServerToCollectionAsync(string organizationId, string collectionName, RdsServer server) + { + this.AddSessionHostServerToCollectionAsync(organizationId, collectionName, server, null); + } + + /// + public void AddSessionHostServerToCollectionAsync(string organizationId, string collectionName, RdsServer server, object userState) + { + if ((this.AddSessionHostServerToCollectionOperationCompleted == null)) + { + this.AddSessionHostServerToCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddSessionHostServerToCollectionOperationCompleted); + } + this.InvokeAsync("AddSessionHostServerToCollection", new object[] { + organizationId, + collectionName, + server}, this.AddSessionHostServerToCollectionOperationCompleted, userState); + } + + private void OnAddSessionHostServerToCollectionOperationCompleted(object arg) + { + if ((this.AddSessionHostServerToCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddSessionHostServerToCollectionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/AddSessionHostServersToCollection", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void AddSessionHostServersToCollection(string organizationId, string collectionName, RdsServer[] servers) + { + this.Invoke("AddSessionHostServersToCollection", new object[] { + organizationId, + collectionName, + servers}); + } + + /// + public System.IAsyncResult BeginAddSessionHostServersToCollection(string organizationId, string collectionName, RdsServer[] servers, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("AddSessionHostServersToCollection", new object[] { + organizationId, + collectionName, + servers}, callback, asyncState); + } + + /// + public void EndAddSessionHostServersToCollection(System.IAsyncResult asyncResult) + { + this.EndInvoke(asyncResult); + } + + /// + public void AddSessionHostServersToCollectionAsync(string organizationId, string collectionName, RdsServer[] servers) + { + this.AddSessionHostServersToCollectionAsync(organizationId, collectionName, servers, null); + } + + /// + public void AddSessionHostServersToCollectionAsync(string organizationId, string collectionName, RdsServer[] servers, object userState) + { + if ((this.AddSessionHostServersToCollectionOperationCompleted == null)) + { + this.AddSessionHostServersToCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddSessionHostServersToCollectionOperationCompleted); + } + this.InvokeAsync("AddSessionHostServersToCollection", new object[] { + organizationId, + collectionName, + servers}, this.AddSessionHostServersToCollectionOperationCompleted, userState); + } + + private void OnAddSessionHostServersToCollectionOperationCompleted(object arg) + { + if ((this.AddSessionHostServersToCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddSessionHostServersToCollectionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/RemoveSessionHostServerFromCollection", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void RemoveSessionHostServerFromCollection(string organizationId, string collectionName, RdsServer server) + { + this.Invoke("RemoveSessionHostServerFromCollection", new object[] { + organizationId, + collectionName, + server}); + } + + /// + public System.IAsyncResult BeginRemoveSessionHostServerFromCollection(string organizationId, string collectionName, RdsServer server, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("RemoveSessionHostServerFromCollection", new object[] { + organizationId, + collectionName, + server}, callback, asyncState); + } + + /// + public void EndRemoveSessionHostServerFromCollection(System.IAsyncResult asyncResult) + { + this.EndInvoke(asyncResult); + } + + /// + public void RemoveSessionHostServerFromCollectionAsync(string organizationId, string collectionName, RdsServer server) + { + this.RemoveSessionHostServerFromCollectionAsync(organizationId, collectionName, server, null); + } + + /// + public void RemoveSessionHostServerFromCollectionAsync(string organizationId, string collectionName, RdsServer server, object userState) + { + if ((this.RemoveSessionHostServerFromCollectionOperationCompleted == null)) + { + this.RemoveSessionHostServerFromCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveSessionHostServerFromCollectionOperationCompleted); + } + this.InvokeAsync("RemoveSessionHostServerFromCollection", new object[] { + organizationId, + collectionName, + server}, this.RemoveSessionHostServerFromCollectionOperationCompleted, userState); + } + + private void OnRemoveSessionHostServerFromCollectionOperationCompleted(object arg) + { + if ((this.RemoveSessionHostServerFromCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.RemoveSessionHostServerFromCollectionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/RemoveSessionHostServersFromCollection", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void RemoveSessionHostServersFromCollection(string organizationId, string collectionName, RdsServer[] servers) + { + this.Invoke("RemoveSessionHostServersFromCollection", new object[] { + organizationId, + collectionName, + servers}); + } + + /// + public System.IAsyncResult BeginRemoveSessionHostServersFromCollection(string organizationId, string collectionName, RdsServer[] servers, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("RemoveSessionHostServersFromCollection", new object[] { + organizationId, + collectionName, + servers}, callback, asyncState); + } + + /// + public void EndRemoveSessionHostServersFromCollection(System.IAsyncResult asyncResult) + { + this.EndInvoke(asyncResult); + } + + /// + public void RemoveSessionHostServersFromCollectionAsync(string organizationId, string collectionName, RdsServer[] servers) + { + this.RemoveSessionHostServersFromCollectionAsync(organizationId, collectionName, servers, null); + } + + /// + public void RemoveSessionHostServersFromCollectionAsync(string organizationId, string collectionName, RdsServer[] servers, object userState) + { + if ((this.RemoveSessionHostServersFromCollectionOperationCompleted == null)) + { + this.RemoveSessionHostServersFromCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveSessionHostServersFromCollectionOperationCompleted); + } + this.InvokeAsync("RemoveSessionHostServersFromCollection", new object[] { + organizationId, + collectionName, + servers}, this.RemoveSessionHostServersFromCollectionOperationCompleted, userState); + } + + private void OnRemoveSessionHostServersFromCollectionOperationCompleted(object arg) + { + if ((this.RemoveSessionHostServersFromCollectionCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.RemoveSessionHostServersFromCollectionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetAvailableRemoteApplications", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public StartMenuApp[] GetAvailableRemoteApplications(string collectionName) + { + object[] results = this.Invoke("GetAvailableRemoteApplications", new object[] { + collectionName}); + return ((StartMenuApp[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetAvailableRemoteApplications(string collectionName, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetAvailableRemoteApplications", new object[] { + collectionName}, callback, asyncState); + } + + /// + public StartMenuApp[] EndGetAvailableRemoteApplications(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((StartMenuApp[])(results[0])); + } + + /// + public void GetAvailableRemoteApplicationsAsync(string collectionName) + { + this.GetAvailableRemoteApplicationsAsync(collectionName, null); + } + + /// + public void GetAvailableRemoteApplicationsAsync(string collectionName, object userState) + { + if ((this.GetAvailableRemoteApplicationsOperationCompleted == null)) + { + this.GetAvailableRemoteApplicationsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetAvailableRemoteApplicationsOperationCompleted); + } + this.InvokeAsync("GetAvailableRemoteApplications", new object[] { + collectionName}, this.GetAvailableRemoteApplicationsOperationCompleted, userState); + } + + private void OnGetAvailableRemoteApplicationsOperationCompleted(object arg) + { + if ((this.GetAvailableRemoteApplicationsCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetAvailableRemoteApplicationsCompleted(this, new GetAvailableRemoteApplicationsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetCollectionRemoteApplications", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RemoteApplication[] GetCollectionRemoteApplications(string collectionName) + { + object[] results = this.Invoke("GetCollectionRemoteApplications", new object[] { + collectionName}); + return ((RemoteApplication[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetCollectionRemoteApplications(string collectionName, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetCollectionRemoteApplications", new object[] { + collectionName}, callback, asyncState); + } + + /// + public RemoteApplication[] EndGetCollectionRemoteApplications(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((RemoteApplication[])(results[0])); + } + + /// + public void GetCollectionRemoteApplicationsAsync(string collectionName) + { + this.GetCollectionRemoteApplicationsAsync(collectionName, null); + } + + /// + public void GetCollectionRemoteApplicationsAsync(string collectionName, object userState) + { + if ((this.GetCollectionRemoteApplicationsOperationCompleted == null)) + { + this.GetCollectionRemoteApplicationsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCollectionRemoteApplicationsOperationCompleted); + } + this.InvokeAsync("GetCollectionRemoteApplications", new object[] { + collectionName}, this.GetCollectionRemoteApplicationsOperationCompleted, userState); + } + + private void OnGetCollectionRemoteApplicationsOperationCompleted(object arg) + { + if ((this.GetCollectionRemoteApplicationsCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetCollectionRemoteApplicationsCompleted(this, new GetCollectionRemoteApplicationsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/AddRemoteApplication", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public bool AddRemoteApplication(string collectionName, RemoteApplication remoteApp) + { + object[] results = this.Invoke("AddRemoteApplication", new object[] { + collectionName, + remoteApp}); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginAddRemoteApplication(string collectionName, RemoteApplication remoteApp, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("AddRemoteApplication", new object[] { + collectionName, + remoteApp}, callback, asyncState); + } + + /// + public bool EndAddRemoteApplication(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void AddRemoteApplicationAsync(string collectionName, RemoteApplication remoteApp) + { + this.AddRemoteApplicationAsync(collectionName, remoteApp, null); + } + + /// + public void AddRemoteApplicationAsync(string collectionName, RemoteApplication remoteApp, object userState) + { + if ((this.AddRemoteApplicationOperationCompleted == null)) + { + this.AddRemoteApplicationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRemoteApplicationOperationCompleted); + } + this.InvokeAsync("AddRemoteApplication", new object[] { + collectionName, + remoteApp}, this.AddRemoteApplicationOperationCompleted, userState); + } + + private void OnAddRemoteApplicationOperationCompleted(object arg) + { + if ((this.AddRemoteApplicationCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddRemoteApplicationCompleted(this, new AddRemoteApplicationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/AddRemoteApplications", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public bool AddRemoteApplications(string collectionName, RemoteApplication[] remoteApps) + { + object[] results = this.Invoke("AddRemoteApplications", new object[] { + collectionName, + remoteApps}); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginAddRemoteApplications(string collectionName, RemoteApplication[] remoteApps, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("AddRemoteApplications", new object[] { + collectionName, + remoteApps}, callback, asyncState); + } + + /// + public bool EndAddRemoteApplications(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void AddRemoteApplicationsAsync(string collectionName, RemoteApplication[] remoteApps) + { + this.AddRemoteApplicationsAsync(collectionName, remoteApps, null); + } + + /// + public void AddRemoteApplicationsAsync(string collectionName, RemoteApplication[] remoteApps, object userState) + { + if ((this.AddRemoteApplicationsOperationCompleted == null)) + { + this.AddRemoteApplicationsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRemoteApplicationsOperationCompleted); + } + this.InvokeAsync("AddRemoteApplications", new object[] { + collectionName, + remoteApps}, this.AddRemoteApplicationsOperationCompleted, userState); + } + + private void OnAddRemoteApplicationsOperationCompleted(object arg) + { + if ((this.AddRemoteApplicationsCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddRemoteApplicationsCompleted(this, new AddRemoteApplicationsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/RemoveRemoteApplication", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public bool RemoveRemoteApplication(string collectionName, RemoteApplication remoteApp) + { + object[] results = this.Invoke("RemoveRemoteApplication", new object[] { + collectionName, + remoteApp}); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginRemoveRemoteApplication(string collectionName, RemoteApplication remoteApp, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("RemoveRemoteApplication", new object[] { + collectionName, + remoteApp}, callback, asyncState); + } + + /// + public bool EndRemoveRemoteApplication(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void RemoveRemoteApplicationAsync(string collectionName, RemoteApplication remoteApp) + { + this.RemoveRemoteApplicationAsync(collectionName, remoteApp, null); + } + + /// + public void RemoveRemoteApplicationAsync(string collectionName, RemoteApplication remoteApp, object userState) + { + if ((this.RemoveRemoteApplicationOperationCompleted == null)) + { + this.RemoveRemoteApplicationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveRemoteApplicationOperationCompleted); + } + this.InvokeAsync("RemoveRemoteApplication", new object[] { + collectionName, + remoteApp}, this.RemoveRemoteApplicationOperationCompleted, userState); + } + + private void OnRemoveRemoteApplicationOperationCompleted(object arg) + { + if ((this.RemoveRemoteApplicationCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.RemoveRemoteApplicationCompleted(this, new RemoveRemoteApplicationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/AddSessionHostFeatureToServer", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public bool AddSessionHostFeatureToServer(string hostName) + { + object[] results = this.Invoke("AddSessionHostFeatureToServer", new object[] { + hostName}); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginAddSessionHostFeatureToServer(string hostName, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("AddSessionHostFeatureToServer", new object[] { + hostName}, callback, asyncState); + } + + /// + public bool EndAddSessionHostFeatureToServer(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void AddSessionHostFeatureToServerAsync(string hostName) + { + this.AddSessionHostFeatureToServerAsync(hostName, null); + } + + /// + public void AddSessionHostFeatureToServerAsync(string hostName, object userState) + { + if ((this.AddSessionHostFeatureToServerOperationCompleted == null)) + { + this.AddSessionHostFeatureToServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddSessionHostFeatureToServerOperationCompleted); + } + this.InvokeAsync("AddSessionHostFeatureToServer", new object[] { + hostName}, this.AddSessionHostFeatureToServerOperationCompleted, userState); + } + + private void OnAddSessionHostFeatureToServerOperationCompleted(object arg) + { + if ((this.AddSessionHostFeatureToServerCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddSessionHostFeatureToServerCompleted(this, new AddSessionHostFeatureToServerCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CheckSessionHostFeatureInstallation", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public bool CheckSessionHostFeatureInstallation(string hostName) + { + object[] results = this.Invoke("CheckSessionHostFeatureInstallation", new object[] { + hostName}); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginCheckSessionHostFeatureInstallation(string hostName, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("CheckSessionHostFeatureInstallation", new object[] { + hostName}, callback, asyncState); + } + + /// + public bool EndCheckSessionHostFeatureInstallation(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void CheckSessionHostFeatureInstallationAsync(string hostName) + { + this.CheckSessionHostFeatureInstallationAsync(hostName, null); + } + + /// + public void CheckSessionHostFeatureInstallationAsync(string hostName, object userState) + { + if ((this.CheckSessionHostFeatureInstallationOperationCompleted == null)) + { + this.CheckSessionHostFeatureInstallationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCheckSessionHostFeatureInstallationOperationCompleted); + } + this.InvokeAsync("CheckSessionHostFeatureInstallation", new object[] { + hostName}, this.CheckSessionHostFeatureInstallationOperationCompleted, userState); + } + + private void OnCheckSessionHostFeatureInstallationOperationCompleted(object arg) + { + if ((this.CheckSessionHostFeatureInstallationCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CheckSessionHostFeatureInstallationCompleted(this, new CheckSessionHostFeatureInstallationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CheckServerAvailability", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public bool CheckServerAvailability(string hostName) + { + object[] results = this.Invoke("CheckServerAvailability", new object[] { + hostName}); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginCheckServerAvailability(string hostName, System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("CheckServerAvailability", new object[] { + hostName}, callback, asyncState); + } + + /// + public bool EndCheckServerAvailability(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void CheckServerAvailabilityAsync(string hostName) + { + this.CheckServerAvailabilityAsync(hostName, null); + } + + /// + public void CheckServerAvailabilityAsync(string hostName, object userState) + { + if ((this.CheckServerAvailabilityOperationCompleted == null)) + { + this.CheckServerAvailabilityOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCheckServerAvailabilityOperationCompleted); + } + this.InvokeAsync("CheckServerAvailability", new object[] { + hostName}, this.CheckServerAvailabilityOperationCompleted, userState); + } + + private void OnCheckServerAvailabilityOperationCompleted(object arg) + { + if ((this.CheckServerAvailabilityCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CheckServerAvailabilityCompleted(this, new CheckServerAvailabilityCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + public new void CancelAsync(object userState) + { + base.CancelAsync(userState); } } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void CreateCollectionCompletedEventHandler(object sender, CreateCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CreateCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal CreateCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public bool Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetCollectionCompletedEventHandler(object sender, GetCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RdsCollection Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RdsCollection)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void RemoveCollectionCompletedEventHandler(object sender, RemoveCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class RemoveCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal RemoveCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public bool Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SetUsersInCollectionCompletedEventHandler(object sender, SetUsersInCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SetUsersInCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal SetUsersInCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public bool Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddSessionHostServerToCollectionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddSessionHostServersToCollectionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void RemoveSessionHostServerFromCollectionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void RemoveSessionHostServersFromCollectionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetAvailableRemoteApplicationsCompletedEventHandler(object sender, GetAvailableRemoteApplicationsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetAvailableRemoteApplicationsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetAvailableRemoteApplicationsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public StartMenuApp[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((StartMenuApp[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetCollectionRemoteApplicationsCompletedEventHandler(object sender, GetCollectionRemoteApplicationsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetCollectionRemoteApplicationsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetCollectionRemoteApplicationsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public RemoteApplication[] Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((RemoteApplication[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddRemoteApplicationCompletedEventHandler(object sender, AddRemoteApplicationCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddRemoteApplicationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal AddRemoteApplicationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public bool Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddRemoteApplicationsCompletedEventHandler(object sender, AddRemoteApplicationsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddRemoteApplicationsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal AddRemoteApplicationsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public bool Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void RemoveRemoteApplicationCompletedEventHandler(object sender, RemoveRemoteApplicationCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class RemoveRemoteApplicationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal RemoveRemoteApplicationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public bool Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddSessionHostFeatureToServerCompletedEventHandler(object sender, AddSessionHostFeatureToServerCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddSessionHostFeatureToServerCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal AddSessionHostFeatureToServerCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public bool Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void CheckSessionHostFeatureInstallationCompletedEventHandler(object sender, CheckSessionHostFeatureInstallationCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CheckSessionHostFeatureInstallationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal CheckSessionHostFeatureInstallationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public bool Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void CheckServerAvailabilityCompletedEventHandler(object sender, CheckServerAvailabilityCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CheckServerAvailabilityCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal CheckServerAvailabilityCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public bool Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[0])); + } + } + } + } diff --git a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs index d6825a2a..96836db9 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs @@ -27,7 +27,10 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Collections.Generic; using System.Data; +using System.Net; +using System.Net.Sockets; using System.Web; using System.Collections; using System.Web.Services; @@ -36,6 +39,7 @@ using System.ComponentModel; using Microsoft.Web.Services3; using WebsitePanel.Providers; +using WebsitePanel.Providers.OS; using WebsitePanel.Providers.RemoteDesktopServices; using WebsitePanel.Server.Utils; @@ -55,7 +59,273 @@ namespace WebsitePanel.Server get { return (IRemoteDesktopServices)Provider; } } + [WebMethod, SoapHeader("settings")] + public bool CreateCollection(string organizationId, RdsCollection collection) + { + try + { + Log.WriteStart("'{0}' CreateCollection", ProviderSettings.ProviderName); + var result = RDSProvider.CreateCollection(organizationId, collection); + Log.WriteEnd("'{0}' CreateCollection", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' CreateCollection", ProviderSettings.ProviderName), ex); + throw; + } + } + [WebMethod, SoapHeader("settings")] + public RdsCollection GetCollection(string collectionName) + { + try + { + Log.WriteStart("'{0}' GetCollection", ProviderSettings.ProviderName); + var result = RDSProvider.GetCollection(collectionName); + Log.WriteEnd("'{0}' GetCollection", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' GetCollection", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public bool RemoveCollection(string organizationId, string collectionName) + { + try + { + Log.WriteStart("'{0}' RemoveCollection", ProviderSettings.ProviderName); + var result = RDSProvider.RemoveCollection(organizationId,collectionName); + Log.WriteEnd("'{0}' RemoveCollection", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' RemoveCollection", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public bool SetUsersInCollection(string organizationId, string collectionName, List users) + { + try + { + Log.WriteStart("'{0}' UpdateUsersInCollection", ProviderSettings.ProviderName); + var result = RDSProvider.SetUsersInCollection(organizationId, collectionName, users); + Log.WriteEnd("'{0}' UpdateUsersInCollection", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' UpdateUsersInCollection", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public void AddSessionHostServerToCollection(string organizationId, string collectionName, RdsServer server) + { + try + { + Log.WriteStart("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName); + RDSProvider.AddSessionHostServerToCollection(organizationId, collectionName, server); + Log.WriteEnd("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName); + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public void AddSessionHostServersToCollection(string organizationId, string collectionName, List servers) + { + try + { + Log.WriteStart("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName); + RDSProvider.AddSessionHostServersToCollection(organizationId, collectionName, servers); + Log.WriteEnd("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName); + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public void RemoveSessionHostServerFromCollection(string organizationId, string collectionName, RdsServer server) + { + try + { + Log.WriteStart("'{0}' RemoveSessionHostServerFromCollection", ProviderSettings.ProviderName); + RDSProvider.RemoveSessionHostServerFromCollection(organizationId, collectionName, server); + Log.WriteEnd("'{0}' RemoveSessionHostServerFromCollection", ProviderSettings.ProviderName); + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' RemoveSessionHostServerFromCollection", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public void RemoveSessionHostServersFromCollection(string organizationId, string collectionName, List servers) + { + try + { + Log.WriteStart("'{0}' RemoveSessionHostServersFromCollection", ProviderSettings.ProviderName); + RDSProvider.RemoveSessionHostServersFromCollection(organizationId, collectionName, servers); + Log.WriteEnd("'{0}' RemoveSessionHostServersFromCollection", ProviderSettings.ProviderName); + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' RemoveSessionHostServersFromCollection", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public List GetAvailableRemoteApplications(string collectionName) + { + try + { + Log.WriteStart("'{0}' GetAvailableRemoteApplications", ProviderSettings.ProviderName); + var result = RDSProvider.GetAvailableRemoteApplications(collectionName); + Log.WriteEnd("'{0}' GetAvailableRemoteApplications", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' UpdateUsersInCollection", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public List GetCollectionRemoteApplications(string collectionName) + { + try + { + Log.WriteStart("'{0}' GetCollectionRemoteApplications", ProviderSettings.ProviderName); + var result = RDSProvider.GetCollectionRemoteApplications(collectionName); + Log.WriteEnd("'{0}' GetCollectionRemoteApplications", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' GetCollectionRemoteApplications", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public bool AddRemoteApplication(string collectionName, RemoteApplication remoteApp) + { + try + { + Log.WriteStart("'{0}' AddRemoteApplication", ProviderSettings.ProviderName); + var result = RDSProvider.AddRemoteApplication(collectionName, remoteApp); + Log.WriteEnd("'{0}' AddRemoteApplication", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' AddRemoteApplication", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public bool AddRemoteApplications(string collectionName, List remoteApps) + { + try + { + Log.WriteStart("'{0}' AddRemoteApplications", ProviderSettings.ProviderName); + var result = RDSProvider.AddRemoteApplications(collectionName, remoteApps); + Log.WriteEnd("'{0}' AddRemoteApplications", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' AddRemoteApplications", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public bool RemoveRemoteApplication(string collectionName, RemoteApplication remoteApp) + { + try + { + Log.WriteStart("'{0}' RemoveRemoteApplication", ProviderSettings.ProviderName); + var result = RDSProvider.RemoveRemoteApplication(collectionName, remoteApp); + Log.WriteEnd("'{0}' RemoveRemoteApplication", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' RemoveRemoteApplication", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public bool AddSessionHostFeatureToServer(string hostName) + { + try + { + Log.WriteStart("'{0}' AddSessionHostFeatureToServer", ProviderSettings.ProviderName); + var result = RDSProvider.AddSessionHostFeatureToServer(hostName); + Log.WriteEnd("'{0}' AddSessionHostFeatureToServer", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public bool CheckSessionHostFeatureInstallation(string hostName) + { + try + { + Log.WriteStart("'{0}' CheckSessionHostFeatureInstallation", ProviderSettings.ProviderName); + var result = RDSProvider.CheckSessionHostFeatureInstallation(hostName); + Log.WriteEnd("'{0}' CheckSessionHostFeatureInstallation", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' CheckSessionHostFeatureInstallation", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public bool CheckServerAvailability(string hostName) + { + try + { + Log.WriteStart("'{0}' CheckServerAvailability", ProviderSettings.ProviderName); + var result = RDSProvider.CheckServerAvailability(hostName); + Log.WriteEnd("'{0}' CheckServerAvailability", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' CheckServerAvailability", ProviderSettings.ProviderName), ex); + throw; + } + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config index a4255204..f2f41087 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config @@ -132,4 +132,13 @@ + + + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config index 08973316..b43e286a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config @@ -168,7 +168,13 @@ - + + + + + + + @@ -561,6 +567,13 @@ + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config index 19904477..e10593c1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config @@ -712,6 +712,16 @@ + + + + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Modules.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Modules.ascx.resx index b408a42b..284db1c3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Modules.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Modules.ascx.resx @@ -789,4 +789,10 @@ Hosted Organization + + RDS Servers + + + Add New RDS Server + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Pages.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Pages.ascx.resx index 4b8617d3..dace43a8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Pages.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Pages.ascx.resx @@ -288,10 +288,10 @@ {user} - {space} - SQL Server 2012 - + SQL Server 2014 - + {user} - {space} - SQL Server 2014 @@ -480,4 +480,7 @@ Phone Numbers + + RDS Servers + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index 72400db0..f7a9f87f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5584,4 +5584,13 @@ Unable to remove Service Level because it is being used + + Remote Desktop Servers + + + Remote Desktop Users + + + Error creating rds collection. You need to add at least 1 rds server to collection + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin index a6c5e672..a63abe82 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin @@ -96,4 +96,8 @@ Default skin template. The following skins are provided as examples only. <%-- Enterprise Storage Icons --%> - \ No newline at end of file + + +<%-- RDS Icons --%> + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Styles/Skin.css b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Styles/Skin.css index 648d27e7..68a8e7e1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Styles/Skin.css +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Styles/Skin.css @@ -163,7 +163,9 @@ h2.ProductTitle.Huge {margin:0;} .NormalGreen {color:#87c442;} .NormalRed {color:#f25555;} .FormBody {margin:10px 0;} - +.FormContentRDS {border: 2px solid #eee;padding: 10px;margin: 10px;} +.FormFooterRDSConf {border-color: #eee;border-style: none solid solid;border-width: 2px;padding: 20px 15px 15px 10px;width: 97%;} +.FormContentRDSConf {border-color: #eee;border-style: solid;border-width: 2px;padding: 30px 15px 15px 10px;width: 97%;} /* not modified */ /* diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalUtils.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalUtils.cs index 3719073a..e8c0943c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalUtils.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalUtils.cs @@ -290,7 +290,7 @@ namespace WebsitePanel.Portal authCookie.HttpOnly = true; if (persistent) - authCookie.Expires = DateTime.Now.AddMonths(1); + authCookie.Expires = ticket.Expiration; HttpContext.Current.Response.Cookies.Add(authCookie); } @@ -457,7 +457,7 @@ namespace WebsitePanel.Portal 1, username, DateTime.Now, - DateTime.Now.AddMinutes(GetAuthenticationFormsTimeout()), + persistent ? DateTime.Now.AddMonths(1) : DateTime.Now.AddMinutes(GetAuthenticationFormsTimeout()), persistent, String.Concat(password, Environment.NewLine, Enum.GetName(typeof(UserRole), role)) ); @@ -592,9 +592,9 @@ namespace WebsitePanel.Portal // set theme SetCurrentTheme(theme); - // remember me - if (rememberLogin) - HttpContext.Current.Response.Cookies[FormsAuthentication.FormsCookieName].Expires = DateTime.Now.AddMonths(1); + //// remember me + //if (rememberLogin) + // HttpContext.Current.Response.Cookies[FormsAuthentication.FormsCookieName].Expires = DateTime.Now.AddMonths(1); } public static void SetCurrentLanguage(string preferredLocale) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx index 7473ebba..64c844bb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx @@ -231,4 +231,13 @@ Drive Maps + + RDS Collections + + + RDS + + + RDS Servers + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/RDSServers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/RDSServers.ascx.resx new file mode 100644 index 00000000..4677be06 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/RDSServers.ascx.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add RDS Server + + + The list of RDS Servers is empty.<br><br>To add a new Server click "Add RDS Sever" button. + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx index 3da7bae5..87ea907c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx @@ -252,4 +252,13 @@ Create Organization + + RDS Collections + + + Hosted Organization - Remote Desktop Services + + + RDS Servers + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/ES.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/ES.cs index 91d6d5a3..ecd77e7d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/ES.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/ES.cs @@ -224,6 +224,11 @@ namespace WebsitePanel.Portal { get { return GetCachedProxy(); } } + + public esRemoteDesktopServices RDS + { + get { return GetCachedProxy(); } + } protected ES() { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/PanelRequest.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/PanelRequest.cs index eaa1d4eb..9b300ec1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/PanelRequest.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/PanelRequest.cs @@ -213,5 +213,10 @@ namespace WebsitePanel.Portal { get { return HttpContext.Current.Request["ctl"] ?? ""; } } + + public static int CollectionID + { + get { return GetInt("CollectionId"); } + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs new file mode 100644 index 00000000..f8197414 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs @@ -0,0 +1,104 @@ +// Copyright (c) 2012, 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. + +using System; +using System.Data; +using System.Collections.Generic; +using System.Text; + +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.RemoteDesktopServices; + +namespace WebsitePanel.Portal +{ + public class RDSHelper + { + #region RDS Servers + + RdsServersPaged rdsServers; + + public int GetRDSServersPagedCount(string filterValue) + { + //return 4; + return rdsServers.RecordsCount; + } + + public RdsServer[] GetRDSServersPaged(int maximumRows, int startRowIndex, string sortColumn, string filterValue) + { + rdsServers = ES.Services.RDS.GetRdsServersPaged("", filterValue, sortColumn, startRowIndex, maximumRows); + + return rdsServers.Servers; + //return new RdsServer[] { new RdsServer { Name = "rds.1.server", FqdName = "", Address = "127.0.0.1" }, + // new RdsServer { Name = "rds.2.server", FqdName = "", Address = "127.0.0.2" }, + // new RdsServer { Name = "rds.3.server", FqdName = "", Address = "127.0.0.3" }, + // new RdsServer { Name = "rds.4.server", FqdName = "", Address = "127.0.0.4" }}; + } + + public int GetOrganizationRdsServersPagedCount(int itemId, string filterValue) + { + return rdsServers.RecordsCount; + } + + public RdsServer[] GetOrganizationRdsServersPaged(int itemId, int maximumRows, int startRowIndex, string sortColumn, string filterValue) + { + rdsServers = ES.Services.RDS.GetOrganizationRdsServersPaged(itemId, "", filterValue, sortColumn, startRowIndex, maximumRows); + + return rdsServers.Servers; + } + + public RdsServer[] GetFreeRDSServers() + { + return ES.Services.RDS.GetFreeRdsServersPaged("", "", "", 0, 1000).Servers; + } + + #endregion + + #region RDS Collectons + + RdsCollectionPaged rdsCollections; + + public int GetRDSCollectonsPagedCount(int itemId, string filterValue) + { + //return 3; + return rdsCollections.RecordsCount; + } + + public RdsCollection[] GetRDSCollectonsPaged(int itemId, int maximumRows, int startRowIndex, string sortColumn, string filterValue) + { + rdsCollections = ES.Services.RDS.GetRdsCollectionsPaged(itemId, "Name", filterValue, sortColumn, startRowIndex, maximumRows); + + return rdsCollections.Collections; + + //return new RdsCollection[] { new RdsCollection { Name = "Collection 1", Description = "" }, + // new RdsCollection { Name = "Collection 2", Description = "" }, + // new RdsCollection { Name = "Collection 3", Description = "" }}; + } + + #endregion + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx index 2f5a009f..a7b93c8b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx @@ -15,7 +15,7 @@ ControlToValidate="DomainName" Display="Dynamic" ValidationGroup="Domain" SetFocusOnError="true"> + ValidationExpression="^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.){1,10}[a-zA-Z]{2,15}$">

diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditAccount.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditAccount.ascx.resx index 946cd8c0..5c51215e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditAccount.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditAccount.ascx.resx @@ -270,4 +270,7 @@ Handle older mails + + Enable forwarding of older messages + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx index 4d4122d3..aeae00bc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx @@ -181,7 +181,7 @@ diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx.cs index c4e36d44..50182f1b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx.cs @@ -38,29 +38,6 @@ namespace WebsitePanel.Portal.ProviderControls { public partial class IceWarp_EditDomain : WebsitePanelControlBase, IMailEditDomainControl { - private StringDictionary _serviceSettings; - - private StringDictionary ServiceSettings - { - get - { - if (_serviceSettings != null) - return _serviceSettings; - - _serviceSettings = new StringDictionary(); - var domain = ES.Services.MailServers.GetMailDomain(PanelRequest.ItemID); - - var settings = ES.Services.Servers.GetServiceSettings(domain.ServiceId); - - foreach (var settingPair in settings.Select(setting => setting.Split('='))) - { - _serviceSettings.Add(settingPair[0], settingPair[1]); - } - - return _serviceSettings; - } - } - protected void Page_Load(object sender, EventArgs e) { AdvancedSettingsPanel.Visible = PanelSecurity.EffectiveUser.Role == UserRole.Administrator; @@ -77,9 +54,9 @@ namespace WebsitePanel.Portal.ProviderControls public void BindItem(MailDomain item) { // Hide/show controls when not enabled on service level - rowMaxDomainDiskSpace.Visible = ServiceSettings.ContainsKey("UseDomainDiskQuota") && Convert.ToBoolean(ServiceSettings["UseDomainDiskQuota"]); - rowDomainLimits.Visible = ServiceSettings.ContainsKey("UseDomainLimits") && Convert.ToBoolean(ServiceSettings["UseDomainLimits"]); - rowUserLimits.Visible = ServiceSettings.ContainsKey("UseUserLimits") && Convert.ToBoolean(ServiceSettings["UseUserLimits"]); + rowMaxDomainDiskSpace.Visible = item.UseDomainDiskQuota; + rowDomainLimits.Visible = item.UseDomainLimits; + rowUserLimits.Visible = item.UseUserLimits; txtMaxDomainDiskSpace.Text = item.MaxDomainSizeInMB.ToString(); txtMaxDomainUsers.Text = item.MaxDomainUsers.ToString(); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx index 209e90f0..eb1de52b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx @@ -1,12 +1,55 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDS_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.RDS_Settings" %>
-
- + + + + + + + + + + + + + + + + + + + +
- + + - - + + +
+ + + + +
+ + + + +
+ + + + +
+ + + +
+ + +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.cs index 03411f0b..0eaea7f4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.cs @@ -36,16 +36,44 @@ namespace WebsitePanel.Portal.ProviderControls { protected void Page_Load(object sender, EventArgs e) { + } public void BindSettings(System.Collections.Specialized.StringDictionary settings) { - txtUsersHome.Text = settings[Constants.UsersHome]; + txtConnectionBroker.Text = settings["ConnectionBroker"]; + txtGateway.Text = settings["GWServrsList"]; + txtRootOU.Text = settings["RootOU"]; + txtPrimaryDomainController.Text = settings["PrimaryDomainController"]; + + if (!string.IsNullOrEmpty(settings["UseCentralNPS"]) && bool.TrueString == settings["UseCentralNPS"]) + { + chkUseCentralNPS.Checked = true; + txtCentralNPS.Enabled = true; + txtCentralNPS.Text = settings["CentralNPS"]; + } + else + { + chkUseCentralNPS.Checked = false; + txtCentralNPS.Enabled = false; + txtCentralNPS.Text = string.Empty; + } } public void SaveSettings(System.Collections.Specialized.StringDictionary settings) { - settings[Constants.UsersHome] = txtUsersHome.Text; + settings["ConnectionBroker"] = txtConnectionBroker.Text; + settings["GWServrsList"] = txtGateway.Text; + settings["RootOU"] = txtRootOU.Text; + settings["PrimaryDomainController"] = txtPrimaryDomainController.Text; + settings["UseCentralNPS"] = chkUseCentralNPS.Checked.ToString(); + settings["CentralNPS"] = chkUseCentralNPS.Checked ? txtCentralNPS.Text : string.Empty; + } + + protected void chkUseCentralNPS_CheckedChanged(object sender, EventArgs e) + { + txtCentralNPS.Enabled = chkUseCentralNPS.Checked; + txtCentralNPS.Text = chkUseCentralNPS.Checked ? txtCentralNPS.Text : string.Empty; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.designer.cs index a4cc7cec..e3f1f911 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/RDS_Settings.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2014, 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. - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -35,37 +7,153 @@ // //------------------------------------------------------------------------------ - namespace WebsitePanel.Portal.ProviderControls { public partial class RDS_Settings { ///

- /// lblUsersHome control. + /// lblConnectionBroker control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Label lblUsersHome; + protected global::System.Web.UI.WebControls.Label lblConnectionBroker; /// - /// txtUsersHome control. + /// txtConnectionBroker control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.TextBox txtUsersHome; + protected global::System.Web.UI.WebControls.TextBox txtConnectionBroker; /// - /// RequiredFieldValidator1 control. + /// RequiredFieldValidator2 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2; + + /// + /// lblGateway control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblGateway; + + /// + /// txtGateway control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtGateway; + + /// + /// RequiredFieldValidator3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3; + + /// + /// lblRootOU control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblRootOU; + + /// + /// txtRootOU control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtRootOU; + + /// + /// RequiredFieldValidator4 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4; + + /// + /// lblPrimaryDomainController control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblPrimaryDomainController; + + /// + /// txtPrimaryDomainController control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPrimaryDomainController; + + /// + /// RequiredFieldValidator5 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator5; + + /// + /// lblUseCentralNPS control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblUseCentralNPS; + + /// + /// chkUseCentralNPS control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkUseCentralNPS; + + /// + /// lblCentralNPS control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblCentralNPS; + + /// + /// txtCentralNPS control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtCentralNPS; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx new file mode 100644 index 00000000..b7bd03b5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx @@ -0,0 +1,38 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddRDSServer.ascx.cs" Inherits="WebsitePanel.Portal.RDS.AddRDSServer" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> + + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + +
+ +
+ +
+ + +
+
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx.cs new file mode 100644 index 00000000..cd879f04 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx.cs @@ -0,0 +1,76 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.OS; + +namespace WebsitePanel.Portal.RDS +{ + public partial class AddRDSServer : WebsitePanelModuleBase + { + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + BindRDSServers(); + } + + btnAdd.Enabled = ddlServers.Items.Count > 0; + } + + private void BindRDSServers() + { + ddlServers.DataSource = new RDSHelper().GetFreeRDSServers(); + ddlServers.DataTextField = "Name"; + ddlServers.DataValueField = "Id"; + ddlServers.DataBind(); + } + + protected void btnAdd_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + return; + + try + { + ES.Services.RDS.AddRdsServerToOrganization(PanelRequest.ItemID, int.Parse(ddlServers.SelectedValue)); + + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_servers", + "SpaceID=" + PanelSecurity.PackageId)); + } + catch { } + + + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx.designer.cs new file mode 100644 index 00000000..849391b4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx.designer.cs @@ -0,0 +1,87 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.RDS { + + + public partial class AddRDSServer { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// imgAddRDSServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgAddRDSServer; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// locServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locServer; + + /// + /// ddlServers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlServers; + + /// + /// btnAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAdd; + + /// + /// valSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ValidationSummary valSummary; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/AddRDSServer.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/AddRDSServer.ascx.resx new file mode 100644 index 00000000..899bb03d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/AddRDSServer.ascx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ShowProgressDialog('Adding RDS Server ...'); + + + Add + + + + + + Add RDS Server + + + Enter Folder Name + + + * + + + Add RDS Server To Organization + + + Select RDS Server: + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/AssignedRDSServers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/AssignedRDSServers.ascx.resx new file mode 100644 index 00000000..56d959f7 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/AssignedRDSServers.ascx.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add... + + + if(!confirm('Are you sure you want to remove selected server?')) return false; else ShowProgressDialog('Removing server...'); + + + Remove + + + Remove Server + + + No RDS Servers have been added yet. To add a new RDS Servers click "Add..." button. + + + + + + RDS Servers + + + Server + + + Assigned RDS Servers + + + Total RDS Servers Allocated: + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSCollections.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSCollections.ascx.resx new file mode 100644 index 00000000..b231aa48 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSCollections.ascx.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Create New RDS Collection + + + if(!confirm('Are you sure you want to remove selected rds collection?')) return false; else ShowProgressDialog('Deleting Collection...'); + + + Remove + + + Delete Collection + + + No collections have been added yet. To add a new click "Create New RDS Collection" button. + + + + + + RDS Collections + + + Collection Name + + + RDS Collections + + + RDS Server + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSCreateCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSCreateCollection.ascx.resx new file mode 100644 index 00000000..4646b3b2 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSCreateCollection.ascx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ShowProgressDialog('Adding RDS Server ...'); + + + Save + + + + + + Create RDS Collection + + + Create New RDS Collection + + + Collection Name + + + Server Name + + + No RDS Servers have been added yet. To add a new RDS Servers click "Add RDS Server" button. + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditCollectionApps.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditCollectionApps.ascx.resx new file mode 100644 index 00000000..d5574a20 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditCollectionApps.ascx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ShowProgressDialog('Adding RDS Server ...'); + + + Save Changes + + + + + + Edit RDS Collection + + + Edit RDS Collection + + + Collection Name: + + + Server Name + + + No RDS Servers have been added yet. To add a new RDS Servers click "Add RDS Server" button. + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditCollectionUsers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditCollectionUsers.ascx.resx new file mode 100644 index 00000000..d5574a20 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditCollectionUsers.ascx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ShowProgressDialog('Adding RDS Server ...'); + + + Save Changes + + + + + + Edit RDS Collection + + + Edit RDS Collection + + + Collection Name: + + + Server Name + + + No RDS Servers have been added yet. To add a new RDS Servers click "Add RDS Server" button. + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx new file mode 100644 index 00000000..eab349e5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx @@ -0,0 +1,79 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AssignedRDSServers.ascx.cs" Inherits="WebsitePanel.Portal.RDS.AssignedRDSServers" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> + + + +
+
+
+
+
+
+
+ + +
+
+ + +
+
+ +
+
+ + + + 10 + 20 + 50 + 100 + + + + + +
+
+ + + + + + + + <%# Eval("Name") %> + + + + + + + + + + + + + + + + +
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx.cs new file mode 100644 index 00000000..af6144d6 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx.cs @@ -0,0 +1,94 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.OS; +using WebsitePanel.WebPortal; + +namespace WebsitePanel.Portal.RDS +{ + public partial class AssignedRDSServers : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + + } + + PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + if (cntx.Quotas.ContainsKey(Quotas.RDS_SERVERS)) + { + btnAddServerToOrg.Enabled = (!(cntx.Quotas[Quotas.RDS_SERVERS].QuotaAllocatedValue <= gvRDSAssignedServers.Rows.Count) || (cntx.Quotas[Quotas.RDS_SERVERS].QuotaAllocatedValue == -1)); + } + } + + protected void btnAddServerToOrg_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_add_server", + "SpaceID=" + PanelSecurity.PackageId)); + } + + protected void gvRDSAssignedServers_RowCommand(object sender, GridViewCommandEventArgs e) + { + if (e.CommandName == "DeleteItem") + { + // delete RDS Server + int rdsServerId = int.Parse(e.CommandArgument.ToString()); + + try + { + ResultObject result = ES.Services.RDS.RemoveRdsServerFromOrganization(rdsServerId); + if (!result.IsSuccess) + { + messageBox.ShowMessage(result, "REMOTE_DESKTOP_SERVICES_UNASSIGN_SERVER_FROM_ORG", "RDS"); + return; + } + + gvRDSAssignedServers.DataBind(); + + } + catch (Exception ex) + { + ShowErrorMessage("REMOTE_DESKTOP_SERVICES_UNASSIGN_SERVER_FROM_ORG", ex); + } + } + } + + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + gvRDSAssignedServers.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue); + + gvRDSAssignedServers.DataBind(); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx.designer.cs new file mode 100644 index 00000000..0ad4c109 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AssignedRDSServers.ascx.designer.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.RDS { + + + public partial class AssignedRDSServers { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// imgRDSServers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgRDSServers; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// btnAddServerToOrg control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddServerToOrg; + + /// + /// SearchPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SearchPanel; + + /// + /// locSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locSearch; + + /// + /// ddlPageSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlPageSize; + + /// + /// txtSearchValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSearchValue; + + /// + /// cmdSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ImageButton cmdSearch; + + /// + /// gvRDSAssignedServers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvRDSAssignedServers; + + /// + /// odsRDSAssignedServersPaged control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ObjectDataSource odsRDSAssignedServersPaged; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx new file mode 100644 index 00000000..7fc47b47 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx @@ -0,0 +1,87 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSCollections.ascx.cs" Inherits="WebsitePanel.Portal.RDS.RDSCollections" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> + + + +
+
+
+
+
+
+
+ + +
+
+ + +
+
+ +
+
+ + + + 10 + 20 + 50 + 100 + + + + + +
+
+ + + + + + + + + + + + + + + + + + Applications + | + Users + | + + + + + + + + + + + +
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs new file mode 100644 index 00000000..1842197e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs @@ -0,0 +1,115 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Linq; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.OS; +using WebsitePanel.Providers.RemoteDesktopServices; +using WebsitePanel.WebPortal; + +namespace WebsitePanel.Portal.RDS +{ + public partial class RDSCollections : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + } + } + + public string GetServerName(string collectionId) + { + int id = int.Parse(collectionId); + + RdsServer[] servers = ES.Services.RDS.GetCollectionRdsServers(id); + + return servers.FirstOrDefault().FqdName; + } + + protected void btnAddCollection_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_create_collection", + "SpaceID=" + PanelSecurity.PackageId)); + } + + protected void gvRDSCollections_RowCommand(object sender, GridViewCommandEventArgs e) + { + if (e.CommandName == "DeleteItem") + { + // delete RDS Collection + int rdsCollectionId = int.Parse(e.CommandArgument.ToString()); + + try + { + RdsCollection collection = ES.Services.RDS.GetRdsCollection(rdsCollectionId); + + ResultObject result = ES.Services.RDS.RemoveRdsCollection(PanelRequest.ItemID, collection); + + if (!result.IsSuccess) + { + messageBox.ShowMessage(result, "REMOTE_DESKTOP_SERVICES_REMOVE_COLLECTION", "RDS"); + return; + } + + gvRDSCollections.DataBind(); + + } + catch (Exception ex) + { + ShowErrorMessage("REMOTE_DESKTOP_SERVICES_REMOVE_COLLECTION", ex); + } + } + } + + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + gvRDSCollections.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue); + + gvRDSCollections.DataBind(); + } + + public string GetCollectionAppsEditUrl(string collectionId) + { + return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_collection_edit_apps", + "CollectionId=" + collectionId, + "ItemID=" + PanelRequest.ItemID); + } + + public string GetCollectionUsersEditUrl(string collectionId) + { + return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_collection_edit_users", + "CollectionId=" + collectionId, + "ItemID=" + PanelRequest.ItemID); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.designer.cs new file mode 100644 index 00000000..7b951606 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.designer.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.RDS { + + + public partial class RDSCollections { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// imgRDSCollections control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgRDSCollections; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// btnAddCollection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddCollection; + + /// + /// SearchPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SearchPanel; + + /// + /// locSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locSearch; + + /// + /// ddlPageSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlPageSize; + + /// + /// txtSearchValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSearchValue; + + /// + /// cmdSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ImageButton cmdSearch; + + /// + /// gvRDSCollections control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvRDSCollections; + + /// + /// odsRDSCollectionsPaged control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ObjectDataSource odsRDSCollectionsPaged; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx new file mode 100644 index 00000000..7047502f --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx @@ -0,0 +1,46 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSCreateCollection.ascx.cs" Inherits="WebsitePanel.Portal.RDS.RDSCreateCollection" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register Src="UserControls/RDSCollectionServers.ascx" TagName="CollectionServers" TagPrefix="wsp"%> + + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.cs new file mode 100644 index 00000000..ba53d8a8 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.cs @@ -0,0 +1,72 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.OS; +using WebsitePanel.Providers.RemoteDesktopServices; + +namespace WebsitePanel.Portal.RDS +{ + public partial class RDSCreateCollection : WebsitePanelModuleBase + { + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + + } + } + + protected void btnSave_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + return; + + try + { + if (servers.GetServers().Count < 1) + { + messageBox.ShowErrorMessage("RDS_CREATE_COLLECTION_RDSSERVER_REQUAIRED"); + return; + } + RdsCollection collection = new RdsCollection{ Name = txtCollectionName.Text, Servers = servers.GetServers(), Description = "" }; + + ES.Services.RDS.AddRdsCollection(PanelRequest.ItemID, collection); + + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", + "SpaceID=" + PanelSecurity.PackageId)); + } + catch { } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.designer.cs new file mode 100644 index 00000000..b1666d95 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx.designer.cs @@ -0,0 +1,114 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.RDS { + + + public partial class RDSCreateCollection { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// imgAddRDSServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgAddRDSServer; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// locCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCollectionName; + + /// + /// txtCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtCollectionName; + + /// + /// valCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valCollectionName; + + /// + /// RDSServersPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl RDSServersPanel; + + /// + /// locRDSServersSection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locRDSServersSection; + + /// + /// servers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.RDS.UserControls.RDSCollectionServers servers; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx new file mode 100644 index 00000000..e9ab9fc9 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx @@ -0,0 +1,46 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSEditCollectionApps.ascx.cs" Inherits="WebsitePanel.Portal.RDS.RDSEditCollectionApps" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register Src="UserControls/RDSCollectionApps.ascx" TagName="CollectionApps" TagPrefix="wsp"%> + + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + +
+ +
+ +
+ +
+ +
+
+ +
+ + +
+
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx.cs new file mode 100644 index 00000000..0d647cb3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx.cs @@ -0,0 +1,69 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.OS; +using WebsitePanel.Providers.RemoteDesktopServices; + +namespace WebsitePanel.Portal.RDS +{ + public partial class RDSEditCollectionApps : WebsitePanelModuleBase + { + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + RdsCollection collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); + var collectionApps = ES.Services.RDS.GetCollectionRemoteApplications(PanelRequest.ItemID, collection.Name); + + locCName.Text = collection.Name; + + remoreApps.SetApps(collectionApps); + } + } + + protected void btnSave_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + return; + try + { + ES.Services.RDS.SetRemoteApplicationsToRdsCollection(PanelRequest.ItemID, PanelRequest.CollectionID, remoreApps.GetApps()); + + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", + "SpaceID=" + PanelSecurity.PackageId)); + } + catch (Exception ex) { } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx.designer.cs new file mode 100644 index 00000000..86f32f54 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx.designer.cs @@ -0,0 +1,114 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.RDS { + + + public partial class RDSEditCollectionApps { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// imgEditRDSCollection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgEditRDSCollection; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// locCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCollectionName; + + /// + /// locCName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCName; + + /// + /// RemoteAppsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl RemoteAppsPanel; + + /// + /// locRemoteAppsSection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locRemoteAppsSection; + + /// + /// remoreApps control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.RDS.UserControls.RDSCollectionApps remoreApps; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + + /// + /// valSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ValidationSummary valSummary; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx new file mode 100644 index 00000000..59be0b41 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx @@ -0,0 +1,46 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSEditCollectionUsers.ascx.cs" Inherits="WebsitePanel.Portal.RDS.RDSEditCollectionUsers" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register Src="UserControls/RDSCollectionUsers.ascx" TagName="CollectionUsers" TagPrefix="wsp"%> + + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + +
+ +
+ +
+ +
+ +
+
+ +
+ + +
+
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.cs new file mode 100644 index 00000000..a6db5a72 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.cs @@ -0,0 +1,68 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.OS; + +namespace WebsitePanel.Portal.RDS +{ + public partial class RDSEditCollectionUsers : WebsitePanelModuleBase + { + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + var collectionUsers = ES.Services.RDS.GetRdsCollectionUsers(PanelRequest.CollectionID); + var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); + + locCName.Text = collection.Name; + + users.SetUsers(collectionUsers); + } + } + + protected void btnSave_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + return; + try + { + ES.Services.RDS.SetUsersToRdsCollection(PanelRequest.ItemID, PanelRequest.CollectionID, users.GetUsers()); + + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", + "SpaceID=" + PanelSecurity.PackageId)); + } + catch(Exception ex) { } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.designer.cs new file mode 100644 index 00000000..8bbd99d4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionUsers.ascx.designer.cs @@ -0,0 +1,114 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.RDS { + + + public partial class RDSEditCollectionUsers { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// imgEditRDSCollection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgEditRDSCollection; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// locCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCollectionName; + + /// + /// locCName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCName; + + /// + /// UsersPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl UsersPanel; + + /// + /// locUsersSection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locUsersSection; + + /// + /// users control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.RDS.UserControls.RDSCollectionUsers users; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + + /// + /// valSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ValidationSummary valSummary; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionApps.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionApps.ascx.resx new file mode 100644 index 00000000..aebc0900 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionApps.ascx.resx @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add... + + + Add Apps + + + Cancel + + + Delete + + + Remote Application Name + + + The list of remote apps is empty. Click "Add..." button. + + + Remote App Name + + + No remote apps found. + + + Available Remote Applications + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionServers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionServers.ascx.resx new file mode 100644 index 00000000..814527a9 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionServers.ascx.resx @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add... + + + Add Servers + + + Cancel + + + Delete + + + Server Name + + + No servers found. + + + Server Name + + + The list of servers is empty. Click "Add..." button. + + + Enabled Servers + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionUsers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionUsers.ascx.resx new file mode 100644 index 00000000..47a2f1e3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionUsers.ascx.resx @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add... + + + Add Accounts + + + Cancel + + + Delete + + + Display Name + + + E-mail Address + + + Display Name + + + Email + + + No accounts found. + + + The list of users is empty. Click "Add..." button. + + + Users + + + Enabled Users + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx new file mode 100644 index 00000000..fc3a8844 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx @@ -0,0 +1,95 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSCollectionApps.ascx.cs" Inherits="WebsitePanel.Portal.RDS.UserControls.RDSCollectionApps" %> +<%@ Register Src="../../UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %> + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs new file mode 100644 index 00000000..d00a249e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs @@ -0,0 +1,222 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Collections.Generic; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Providers.HostedSolution; +using System.Linq; +using WebsitePanel.Providers.Web; +using WebsitePanel.EnterpriseServer.Base.HostedSolution; +using WebsitePanel.Providers.RemoteDesktopServices; + +namespace WebsitePanel.Portal.RDS.UserControls +{ + public partial class RDSCollectionApps : WebsitePanelControlBase + { + public const string DirectionString = "DirectionString"; + + protected enum SelectedState + { + All, + Selected, + Unselected + } + + public void SetApps(RemoteApplication[] apps) + { + BindApps(apps, false); + } + + public RemoteApplication[] GetApps() + { + return GetGridViewApps(SelectedState.All).ToArray(); + } + + protected void Page_Load(object sender, EventArgs e) + { + // register javascript + if (!Page.ClientScript.IsClientScriptBlockRegistered("SelectAllCheckboxes")) + { + string script = @" function SelectAllCheckboxes(box) + { + var state = box.checked; + var elm = box.parentElement.parentElement.parentElement.parentElement.getElementsByTagName(""INPUT""); + for(i = 0; i < elm.length; i++) + if(elm[i].type == ""checkbox"" && elm[i].id != box.id && elm[i].checked != state && !elm[i].disabled) + elm[i].checked = state; + }"; + Page.ClientScript.RegisterClientScriptBlock(typeof(RDSCollectionUsers), "SelectAllCheckboxes", + script, true); + } + } + + protected void btnAdd_Click(object sender, EventArgs e) + { + // bind all servers + BindPopupApps(); + + // show modal + AddAppsModal.Show(); + } + + protected void btnDelete_Click(object sender, EventArgs e) + { + List selectedApps = GetGridViewApps(SelectedState.Unselected); + + BindApps(selectedApps.ToArray(), false); + } + + protected void btnAddSelected_Click(object sender, EventArgs e) + { + List selectedApps = GetPopUpGridViewApps(); + + BindApps(selectedApps.ToArray(), true); + + } + + protected void BindPopupApps() + { + RdsCollection collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); + StartMenuApp[] apps = ES.Services.RDS.GetAvailableRemoteApplications(PanelRequest.ItemID, collection.Name); + + apps = apps.Where(x => !GetApps().Select(p => p.DisplayName).Contains(x.DisplayName)).ToArray(); + Array.Sort(apps, CompareAccount); + if (Direction == SortDirection.Ascending) + { + Array.Reverse(apps); + Direction = SortDirection.Descending; + } + else + Direction = SortDirection.Ascending; + + gvPopupApps.DataSource = apps; + gvPopupApps.DataBind(); + } + + protected void BindApps(RemoteApplication[] newApps, bool preserveExisting) + { + // get binded addresses + List apps = new List(); + if(preserveExisting) + apps.AddRange(GetGridViewApps(SelectedState.All)); + + // add new servers + if (newApps != null) + { + foreach (RemoteApplication newApp in newApps) + { + // check if exists + bool exists = false; + foreach (RemoteApplication app in apps) + { + if (app.DisplayName == newApp.DisplayName) + { + exists = true; + break; + } + } + + if (exists) + continue; + + apps.Add(newApp); + } + } + + gvApps.DataSource = apps; + gvApps.DataBind(); + } + + protected List GetGridViewApps(SelectedState state) + { + List apps = new List(); + for (int i = 0; i < gvApps.Rows.Count; i++) + { + GridViewRow row = gvApps.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect == null) + continue; + + RemoteApplication app = new RemoteApplication(); + app.Alias = (string)gvApps.DataKeys[i][0]; + app.DisplayName = ((Literal)row.FindControl("litDisplayName")).Text; + app.FilePath = ((HiddenField)row.FindControl("hfFilePath")).Value; + + if (state == SelectedState.All || + (state == SelectedState.Selected && chkSelect.Checked) || + (state == SelectedState.Unselected && !chkSelect.Checked)) + apps.Add(app); + } + + return apps; + } + + protected List GetPopUpGridViewApps() + { + List apps = new List(); + for (int i = 0; i < gvPopupApps.Rows.Count; i++) + { + GridViewRow row = gvPopupApps.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect == null) + continue; + + if (chkSelect.Checked) + { + apps.Add(new RemoteApplication + { + Alias = (string)gvPopupApps.DataKeys[i][0], + DisplayName = ((Literal)row.FindControl("litName")).Text, + FilePath = ((HiddenField)row.FindControl("hfFilePathPopup")).Value + }); + } + } + + return apps; + + } + + protected void cmdSearch_Click(object sender, ImageClickEventArgs e) + { + BindPopupApps(); + } + + protected SortDirection Direction + { + get { return ViewState[DirectionString] == null ? SortDirection.Descending : (SortDirection)ViewState[DirectionString]; } + set { ViewState[DirectionString] = value; } + } + + protected static int CompareAccount(StartMenuApp app1, StartMenuApp app2) + { + return string.Compare(app1.DisplayName, app2.DisplayName); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.designer.cs new file mode 100644 index 00000000..6c195540 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.designer.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.RDS.UserControls { + + + public partial class RDSCollectionApps { + + /// + /// RDAppsUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel RDAppsUpdatePanel; + + /// + /// btnAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAdd; + + /// + /// btnDelete control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnDelete; + + /// + /// gvApps control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvApps; + + /// + /// AddAppsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel AddAppsPanel; + + /// + /// headerAddApps control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize headerAddApps; + + /// + /// AddAppsUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel AddAppsUpdatePanel; + + /// + /// gvPopupApps control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvPopupApps; + + /// + /// btnAddSelected control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddSelected; + + /// + /// btnCancelAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancelAdd; + + /// + /// btnAddAppsFake control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddAppsFake; + + /// + /// AddAppsModal control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::AjaxControlToolkit.ModalPopupExtender AddAppsModal; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx new file mode 100644 index 00000000..272374a6 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx @@ -0,0 +1,100 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSCollectionServers.ascx.cs" Inherits="WebsitePanel.Portal.RDS.UserControls.RDSCollectionServers" %> +<%@ Register Src="../../UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %> + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs new file mode 100644 index 00000000..f096ed25 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs @@ -0,0 +1,224 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Collections.Generic; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Providers.HostedSolution; +using System.Linq; +using WebsitePanel.Providers.Web; +using WebsitePanel.EnterpriseServer.Base.HostedSolution; +using WebsitePanel.Providers.RemoteDesktopServices; + +namespace WebsitePanel.Portal.RDS.UserControls +{ + public partial class RDSCollectionServers : WebsitePanelControlBase + { + public const string DirectionString = "DirectionString"; + + protected enum SelectedState + { + All, + Selected, + Unselected + } + + public void SetServers(RdsServer[] servers) + { + BindServers(servers, false); + } + + //public RdsServer[] GetServers() + //{ + // return GetGridViewServers(SelectedState.All).ToArray(); + //} + + public List GetServers() + { + return GetGridViewServers(SelectedState.All); + } + + protected void Page_Load(object sender, EventArgs e) + { + // register javascript + if (!Page.ClientScript.IsClientScriptBlockRegistered("SelectAllCheckboxes")) + { + string script = @" function SelectAllCheckboxes(box) + { + var state = box.checked; + var elm = box.parentElement.parentElement.parentElement.parentElement.getElementsByTagName(""INPUT""); + for(i = 0; i < elm.length; i++) + if(elm[i].type == ""checkbox"" && elm[i].id != box.id && elm[i].checked != state && !elm[i].disabled) + elm[i].checked = state; + }"; + Page.ClientScript.RegisterClientScriptBlock(typeof(RDSCollectionUsers), "SelectAllCheckboxes", + script, true); + } + } + + protected void btnAdd_Click(object sender, EventArgs e) + { + // bind all servers + BindPopupServers(); + + // show modal + AddServersModal.Show(); + } + + protected void btnDelete_Click(object sender, EventArgs e) + { + List selectedServers = GetGridViewServers(SelectedState.Unselected); + + BindServers(selectedServers.ToArray(), false); + } + + protected void btnAddSelected_Click(object sender, EventArgs e) + { + List selectedServers = GetPopUpGridViewServers(); + + BindServers(selectedServers.ToArray(), true); + + } + + protected void BindPopupServers() + { + RdsServer[] servers = ES.Services.RDS.GetOrganizationFreeRdsServersPaged(PanelRequest.ItemID, "FqdName", txtSearchValue.Text, null, 0, 1000).Servers; + + servers = servers.Where(x => !GetServers().Select(p => p.Id).Contains(x.Id)).ToArray(); + Array.Sort(servers, CompareAccount); + if (Direction == SortDirection.Ascending) + { + Array.Reverse(servers); + Direction = SortDirection.Descending; + } + else + Direction = SortDirection.Ascending; + + gvPopupServers.DataSource = servers; + gvPopupServers.DataBind(); + } + + protected void BindServers(RdsServer[] newServers, bool preserveExisting) + { + // get binded addresses + List servers = new List(); + if(preserveExisting) + servers.AddRange(GetGridViewServers(SelectedState.All)); + + // add new servers + if (newServers != null) + { + foreach (RdsServer newServer in newServers) + { + // check if exists + bool exists = false; + foreach (RdsServer server in servers) + { + if (server.Id == newServer.Id) + { + exists = true; + break; + } + } + + if (exists) + continue; + + servers.Add(newServer); + } + } + + gvServers.DataSource = servers; + gvServers.DataBind(); + } + + protected List GetGridViewServers(SelectedState state) + { + List servers = new List(); + for (int i = 0; i < gvServers.Rows.Count; i++) + { + GridViewRow row = gvServers.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect == null) + continue; + + RdsServer server = new RdsServer(); + server.Id = (int)gvServers.DataKeys[i][0]; + server.FqdName = ((Literal)row.FindControl("litFqdName")).Text; + + if (state == SelectedState.All || + (state == SelectedState.Selected && chkSelect.Checked) || + (state == SelectedState.Unselected && !chkSelect.Checked)) + servers.Add(server); + } + + return servers; + } + + protected List GetPopUpGridViewServers() + { + List servers = new List(); + for (int i = 0; i < gvPopupServers.Rows.Count; i++) + { + GridViewRow row = gvPopupServers.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect == null) + continue; + + if (chkSelect.Checked) + { + servers.Add(new RdsServer + { + Id = (int)gvPopupServers.DataKeys[i][0], + FqdName = ((Literal)row.FindControl("litName")).Text + }); + } + } + + return servers; + + } + + protected void cmdSearch_Click(object sender, ImageClickEventArgs e) + { + BindPopupServers(); + } + + protected SortDirection Direction + { + get { return ViewState[DirectionString] == null ? SortDirection.Descending : (SortDirection)ViewState[DirectionString]; } + set { ViewState[DirectionString] = value; } + } + + protected static int CompareAccount(RdsServer server1, RdsServer server2) + { + return string.Compare(server1.FqdName, server2.FqdName); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.designer.cs new file mode 100644 index 00000000..6a0e9660 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.designer.cs @@ -0,0 +1,150 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.RDS.UserControls { + + + public partial class RDSCollectionServers { + + /// + /// UsersUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel UsersUpdatePanel; + + /// + /// btnAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAdd; + + /// + /// btnDelete control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnDelete; + + /// + /// gvServers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvServers; + + /// + /// AddServersPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel AddServersPanel; + + /// + /// headerAddServers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize headerAddServers; + + /// + /// AddServersUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel AddServersUpdatePanel; + + /// + /// SearchPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SearchPanel; + + /// + /// txtSearchValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSearchValue; + + /// + /// cmdSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ImageButton cmdSearch; + + /// + /// gvPopupServers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvPopupServers; + + /// + /// btnAddSelected control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddSelected; + + /// + /// btnCancelAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancelAdd; + + /// + /// btnAddServersFake control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddServersFake; + + /// + /// AddServersModal control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::AjaxControlToolkit.ModalPopupExtender AddServersModal; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx new file mode 100644 index 00000000..db0a67d5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx @@ -0,0 +1,111 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSCollectionUsers.ascx.cs" Inherits="WebsitePanel.Portal.RDS.UserControls.RDSCollectionUsers" %> +<%@ Register Src="../../UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %> + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx.cs new file mode 100644 index 00000000..a54796e6 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx.cs @@ -0,0 +1,247 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Collections.Generic; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Providers.HostedSolution; +using System.Linq; +using WebsitePanel.Providers.Web; +using WebsitePanel.EnterpriseServer.Base.HostedSolution; +using WebsitePanel.EnterpriseServer; + +namespace WebsitePanel.Portal.RDS.UserControls +{ + public partial class RDSCollectionUsers : WebsitePanelControlBase + { + public const string DirectionString = "DirectionString"; + + protected enum SelectedState + { + All, + Selected, + Unselected + } + + public void SetUsers(OrganizationUser[] users) + { + BindAccounts(users, false); + } + + public OrganizationUser[] GetUsers() + { + return GetGridViewUsers(SelectedState.All).ToArray(); + } + + protected void Page_Load(object sender, EventArgs e) + { + // register javascript + if (!Page.ClientScript.IsClientScriptBlockRegistered("SelectAllCheckboxes")) + { + string script = @" function SelectAllCheckboxes(box) + { + var state = box.checked; + var elm = box.parentElement.parentElement.parentElement.parentElement.getElementsByTagName(""INPUT""); + for(i = 0; i < elm.length; i++) + if(elm[i].type == ""checkbox"" && elm[i].id != box.id && elm[i].checked != state && !elm[i].disabled) + elm[i].checked = state; + }"; + Page.ClientScript.RegisterClientScriptBlock(typeof(RDSCollectionUsers), "SelectAllCheckboxes", + script, true); + } + + PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + if (cntx.Quotas.ContainsKey(Quotas.RDS_USERS)) + { + int rdsUsersCount = ES.Services.RDS.GetOrganizationRdsUsersCount(PanelRequest.ItemID); + btnAdd.Enabled = (!(cntx.Quotas[Quotas.RDS_USERS].QuotaAllocatedValue <= rdsUsersCount) || (cntx.Quotas[Quotas.RDS_USERS].QuotaAllocatedValue == -1)); + } + } + + protected void btnAdd_Click(object sender, EventArgs e) + { + // bind all accounts + BindPopupAccounts(); + + // show modal + AddAccountsModal.Show(); + } + + protected void btnDelete_Click(object sender, EventArgs e) + { + List selectedAccounts = GetGridViewUsers(SelectedState.Unselected); + + BindAccounts(selectedAccounts.ToArray(), false); + } + + protected void btnAddSelected_Click(object sender, EventArgs e) + { + List selectedAccounts = GetGridViewAccounts(); + + BindAccounts(selectedAccounts.ToArray(), true); + + } + + public string GetAccountImage(int accountTypeId) + { + string imgName = string.Empty; + + ExchangeAccountType accountType = (ExchangeAccountType)accountTypeId; + switch (accountType) + { + case ExchangeAccountType.Room: + imgName = "room_16.gif"; + break; + case ExchangeAccountType.Equipment: + imgName = "equipment_16.gif"; + break; + default: + imgName = "admin_16.png"; + break; + } + + return GetThemedImage("Exchange/" + imgName); + } + + protected void BindPopupAccounts() + { + OrganizationUser[] accounts = ES.Services.Organizations.GetOrganizationUsersPaged(PanelRequest.ItemID, null, null, null, 0, Int32.MaxValue).PageUsers; + + accounts = accounts.Where(x => !GetUsers().Select(p => p.AccountName).Contains(x.AccountName)).ToArray(); + Array.Sort(accounts, CompareAccount); + if (Direction == SortDirection.Ascending) + { + Array.Reverse(accounts); + Direction = SortDirection.Descending; + } + else + Direction = SortDirection.Ascending; + + gvPopupAccounts.DataSource = accounts; + gvPopupAccounts.DataBind(); + } + + protected void BindAccounts(OrganizationUser[] newUsers, bool preserveExisting) + { + // get binded addresses + List users = new List(); + if(preserveExisting) + users.AddRange(GetGridViewUsers(SelectedState.All)); + + // add new accounts + if (newUsers != null) + { + foreach (OrganizationUser newUser in newUsers) + { + // check if exists + bool exists = false; + foreach (OrganizationUser user in users) + { + if (String.Compare(user.AccountName, newUser.AccountName, true) == 0) + { + exists = true; + break; + } + } + + if (exists) + continue; + + users.Add(newUser); + } + } + + gvUsers.DataSource = users; + gvUsers.DataBind(); + } + + protected List GetGridViewUsers(SelectedState state) + { + List users = new List(); + for (int i = 0; i < gvUsers.Rows.Count; i++) + { + GridViewRow row = gvUsers.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect == null) + continue; + + OrganizationUser user = new OrganizationUser(); + user.AccountName = (string)gvUsers.DataKeys[i][0]; + user.DisplayName = ((Literal)row.FindControl("litAccount")).Text; + + if (state == SelectedState.All || + (state == SelectedState.Selected && chkSelect.Checked) || + (state == SelectedState.Unselected && !chkSelect.Checked)) + users.Add(user); + } + + return users; + } + + protected List GetGridViewAccounts() + { + List accounts = new List(); + for (int i = 0; i < gvPopupAccounts.Rows.Count; i++) + { + GridViewRow row = gvPopupAccounts.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect == null) + continue; + + if (chkSelect.Checked) + { + accounts.Add(new OrganizationUser + { + AccountName = (string)gvPopupAccounts.DataKeys[i][0], + DisplayName = ((Literal)row.FindControl("litDisplayName")).Text + }); + } + } + + return accounts; + + } + + protected void cmdSearch_Click(object sender, ImageClickEventArgs e) + { + BindPopupAccounts(); + } + + protected SortDirection Direction + { + get { return ViewState[DirectionString] == null ? SortDirection.Descending : (SortDirection)ViewState[DirectionString]; } + set { ViewState[DirectionString] = value; } + } + + protected static int CompareAccount(OrganizationUser user1, OrganizationUser user2) + { + return string.Compare(user1.DisplayName, user2.DisplayName); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx.designer.cs new file mode 100644 index 00000000..0ee1baea --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx.designer.cs @@ -0,0 +1,159 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.RDS.UserControls { + + + public partial class RDSCollectionUsers { + + /// + /// UsersUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel UsersUpdatePanel; + + /// + /// btnAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAdd; + + /// + /// btnDelete control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnDelete; + + /// + /// gvUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvUsers; + + /// + /// AddAccountsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel AddAccountsPanel; + + /// + /// headerAddAccounts control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize headerAddAccounts; + + /// + /// AddAccountsUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel AddAccountsUpdatePanel; + + /// + /// SearchPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SearchPanel; + + /// + /// ddlSearchColumn control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlSearchColumn; + + /// + /// txtSearchValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSearchValue; + + /// + /// cmdSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ImageButton cmdSearch; + + /// + /// gvPopupAccounts control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvPopupAccounts; + + /// + /// btnAddSelected control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddSelected; + + /// + /// btnCancelAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancelAdd; + + /// + /// btnAddAccountsFake control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddAccountsFake; + + /// + /// AddAccountsModal control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::AjaxControlToolkit.ModalPopupExtender AddAccountsModal; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx new file mode 100644 index 00000000..70cf33d6 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx @@ -0,0 +1,67 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSServers.ascx.cs" Inherits="WebsitePanel.Portal.RDSServers" %> +<%@ Import Namespace="WebsitePanel.Portal" %> +<%@ Register Src="UserControls/Comments.ascx" TagName="Comments" TagPrefix="uc4" %> +<%@ Register Src="UserControls/SearchBox.ascx" TagName="SearchBox" TagPrefix="uc1" %> +<%@ Register Src="UserControls/UserDetails.ascx" TagName="UserDetails" TagPrefix="uc2" %> +<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> +<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> + + + + + + +
+
+ +
+
+ + + + 10 + 20 + 50 + 100 + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.cs new file mode 100644 index 00000000..dd65214a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.cs @@ -0,0 +1,111 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; + +namespace WebsitePanel.Portal +{ + public partial class RDSServers : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + gvRDSServers.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue); + gvRDSServers.Sort("Name", System.Web.UI.WebControls.SortDirection.Ascending); + } + } + + protected void odsRDSServersPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) + { + if (e.Exception != null) + { + ProcessException(e.Exception.InnerException); + this.DisableControls = true; + e.ExceptionHandled = true; + } + } + + protected void btnAddRDSServer_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("add_rdsserver")); + } + + protected void gvRDSServers_RowCommand(object sender, GridViewCommandEventArgs e) + { + if (e.CommandName == "DeleteItem") + { + // delete rds server + int rdsServerId; + bool hasValue = int.TryParse(e.CommandArgument.ToString(), out rdsServerId); + + ResultObject result = new ResultObject(); + result.IsSuccess = false; + + try + { + if (hasValue) + { + result = ES.Services.RDS.RemoveRdsServer(rdsServerId); + } + + if (!result.IsSuccess) + { + messageBox.ShowMessage(result, "REMOTE_DESKTOP_SERVICES_REMOVE_RDSSERVER", "RDS"); + return; + } + + gvRDSServers.DataBind(); + } + catch (Exception ex) + { + ShowErrorMessage("REMOTE_DESKTOP_SERVICES_REMOVE_RDSSERVER", ex); + } + } + } + + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + gvRDSServers.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue); + + gvRDSServers.DataBind(); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.designer.cs new file mode 100644 index 00000000..ca243bca --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx.designer.cs @@ -0,0 +1,105 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class RDSServers { + + /// + /// updatePanelUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel updatePanelUsers; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// btnAddRDSServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddRDSServer; + + /// + /// SearchPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SearchPanel; + + /// + /// locSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locSearch; + + /// + /// ddlPageSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlPageSize; + + /// + /// txtSearchValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSearchValue; + + /// + /// cmdSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ImageButton cmdSearch; + + /// + /// gvRDSServers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvRDSServers; + + /// + /// odsRDSServersPaged control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ObjectDataSource odsRDSServersPaged; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx new file mode 100644 index 00000000..2f9d100a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx @@ -0,0 +1,38 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSServersAddserver.ascx.cs" Inherits="WebsitePanel.Portal.RDSServersAddserver" %> +<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> + + + + +
+ + +
+ + + + + + + + + +
+ + +
+ + +
+
+ +
+ + +
+
+ + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.cs new file mode 100644 index 00000000..005d3216 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.cs @@ -0,0 +1,83 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.OS; + +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.RemoteDesktopServices; + +namespace WebsitePanel.Portal +{ + public partial class RDSServersAddserver : WebsitePanelModuleBase + { + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + } + } + + protected void btnAdd_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + return; + try + { + RdsServer rdsServer = new RdsServer(); + + rdsServer.FqdName = txtServerName.Text; + rdsServer.Description = txtServerComments.Text; + + ResultObject result = ES.Services.RDS.AddRdsServer(rdsServer); + + if (!result.IsSuccess && result.ErrorCodes.Count > 0) + { + messageBox.ShowMessage(result, "", ""); + return; + } + + RedirectToBrowsePage(); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("", ex); + } + } + + protected void btnCancel_Click(object sender, EventArgs e) + { + RedirectToBrowsePage(); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.designer.cs new file mode 100644 index 00000000..526938b3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServersAddserver.ascx.designer.cs @@ -0,0 +1,105 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class RDSServersAddserver { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// locServerName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locServerName; + + /// + /// txtServerName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtServerName; + + /// + /// valServerName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valServerName; + + /// + /// locServerComments control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locServerComments; + + /// + /// txtServerComments control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtServerComments; + + /// + /// valServerComments control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valServerComments; + + /// + /// btnAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAdd; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Scripts/RandomPassword.js b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Scripts/RandomPassword.js index 8428ed9b..f34f443f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Scripts/RandomPassword.js +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Scripts/RandomPassword.js @@ -111,7 +111,13 @@ function nchar(num) { } var pass = ""; var pas_chars = []; - var _Lower = _maxLength - _Upper - _Number - _Special; + var _Lower = _maxLength - _Upper - _Number - _Special; + while (_Lower > 26) { + _Upper++; + _Number++; + _Special++; + _Lower = _maxLength - _Upper - _Number - _Special; + } getRandomChars([0, 22], _Special, pas_chars); getRandomChars([23, 32], _Number, pas_chars); getRandomChars([33, 58], _Upper, pas_chars); @@ -120,6 +126,6 @@ function nchar(num) { pass = mixCharArray(pas_chars); document.getElementById(txt1).value = pass; - document.getElementById(txt2).value = pass; - } + document.getElementById(txt2).value = pass; + } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceImportResources.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceImportResources.ascx index 3f1074af..fcba0a52 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceImportResources.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceImportResources.ascx @@ -1,14 +1,13 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SpaceImportResources.ascx.cs" Inherits="WebsitePanel.Portal.SpaceImportResources" %> <%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> - +