diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs index 2bad8a81..acccc914 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs @@ -18,9 +18,8 @@ namespace WebsitePanel.EnterpriseServer { using System.Web.Services.Protocols; using System; using System.Diagnostics; - - using WebsitePanel.Providers.Common; using WebsitePanel.Providers.RemoteDesktopServices; + using WebsitePanel.Providers.Common; using WebsitePanel.Providers.HostedSolution; @@ -37,6 +36,8 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback AddRdsCollectionOperationCompleted; + private System.Threading.SendOrPostCallback EditRdsCollectionOperationCompleted; + private System.Threading.SendOrPostCallback GetRdsCollectionsPagedOperationCompleted; private System.Threading.SendOrPostCallback RemoveRdsCollectionOperationCompleted; @@ -101,6 +102,9 @@ namespace WebsitePanel.EnterpriseServer { /// public event AddRdsCollectionCompletedEventHandler AddRdsCollectionCompleted; + /// + public event EditRdsCollectionCompletedEventHandler EditRdsCollectionCompleted; + /// public event GetRdsCollectionsPagedCompletedEventHandler GetRdsCollectionsPagedCompleted; @@ -302,6 +306,50 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/EditRdsCollection", 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 EditRdsCollection(int itemId, RdsCollection collection) { + object[] results = this.Invoke("EditRdsCollection", new object[] { + itemId, + collection}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginEditRdsCollection(int itemId, RdsCollection collection, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("EditRdsCollection", new object[] { + itemId, + collection}, callback, asyncState); + } + + /// + public ResultObject EndEditRdsCollection(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void EditRdsCollectionAsync(int itemId, RdsCollection collection) { + this.EditRdsCollectionAsync(itemId, collection, null); + } + + /// + public void EditRdsCollectionAsync(int itemId, RdsCollection collection, object userState) { + if ((this.EditRdsCollectionOperationCompleted == null)) { + this.EditRdsCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEditRdsCollectionOperationCompleted); + } + this.InvokeAsync("EditRdsCollection", new object[] { + itemId, + collection}, this.EditRdsCollectionOperationCompleted, userState); + } + + private void OnEditRdsCollectionOperationCompleted(object arg) { + if ((this.EditRdsCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.EditRdsCollectionCompleted(this, new EditRdsCollectionCompletedEventArgs(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) { @@ -510,9 +558,10 @@ namespace WebsitePanel.EnterpriseServer { /// [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) { + public RdsServersPaged GetOrganizationRdsServersPaged(int itemId, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] System.Nullable collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { object[] results = this.Invoke("GetOrganizationRdsServersPaged", new object[] { itemId, + collectionId, filterColumn, filterValue, sortColumn, @@ -522,9 +571,10 @@ namespace WebsitePanel.EnterpriseServer { } /// - public System.IAsyncResult BeginGetOrganizationRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginGetOrganizationRdsServersPaged(int itemId, System.Nullable collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetOrganizationRdsServersPaged", new object[] { itemId, + collectionId, filterColumn, filterValue, sortColumn, @@ -539,17 +589,18 @@ namespace WebsitePanel.EnterpriseServer { } /// - 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, System.Nullable collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { + this.GetOrganizationRdsServersPagedAsync(itemId, collectionId, filterColumn, filterValue, sortColumn, startRow, maximumRows, null); } /// - public void GetOrganizationRdsServersPagedAsync(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) { + public void GetOrganizationRdsServersPagedAsync(int itemId, System.Nullable collectionId, 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, + collectionId, filterColumn, filterValue, sortColumn, @@ -1536,6 +1587,32 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void EditRdsCollectionCompletedEventHandler(object sender, EditRdsCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class EditRdsCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal EditRdsCollectionCompletedEventArgs(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); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs index c3c154a7..471a6adb 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs @@ -68,6 +68,11 @@ namespace WebsitePanel.EnterpriseServer return AddRdsCollectionInternal(itemId, collection); } + public static ResultObject EditRdsCollection(int itemId, RdsCollection collection) + { + return EditRdsCollectionInternal(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); @@ -93,9 +98,9 @@ namespace WebsitePanel.EnterpriseServer return GetFreeRdsServersPagedInternal(filterColumn, filterValue, sortColumn, startRow, maximumRows); } - public static RdsServersPaged GetOrganizationRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + public static RdsServersPaged GetOrganizationRdsServersPaged(int itemId, int? collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { - return GetOrganizationRdsServersPagedInternal(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows); + return GetOrganizationRdsServersPagedInternal(itemId, collectionId, filterColumn, filterValue, sortColumn, startRow, maximumRows); } public static RdsServersPaged GetOrganizationFreeRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) @@ -285,6 +290,58 @@ namespace WebsitePanel.EnterpriseServer return result; } + private static ResultObject EditRdsCollectionInternal(int itemId, RdsCollection collection) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "EDIT_RDS_COLLECTION"); + + try + { + 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 existingServers = + ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByCollectionId(collection.Id)).ToList(); + var removedServers = existingServers.Where(x => !collection.Servers.Select(y => y.Id).Contains(x.Id)); + var newServers = collection.Servers.Where(x => !existingServers.Select(y => y.Id).Contains(x.Id)); + + foreach(var server in removedServers) + { + DataProvider.RemoveRDSServerFromCollection(server.Id); + } + + rds.AddRdsServersToDeployment(newServers.ToArray()); + + foreach (var server in newServers) + { + 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); @@ -425,9 +482,9 @@ namespace WebsitePanel.EnterpriseServer return result; } - private static RdsServersPaged GetOrganizationRdsServersPagedInternal(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + private static RdsServersPaged GetOrganizationRdsServersPagedInternal(int itemId, int? collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { - DataSet ds = DataProvider.GetRDSServersPaged(itemId, null, filterColumn, filterValue, sortColumn, startRow, maximumRows, ignoreRdsCollectionId: true); + DataSet ds = DataProvider.GetRDSServersPaged(itemId, collectionId, filterColumn, filterValue, sortColumn, startRow, maximumRows, ignoreRdsCollectionId: !collectionId.HasValue); RdsServersPaged result = new RdsServersPaged(); result.RecordsCount = (int)ds.Tables[0].Rows[0][0]; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs index d86b9733..05baf26c 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs @@ -70,6 +70,12 @@ namespace WebsitePanel.EnterpriseServer return RemoteDesktopServicesController.AddRdsCollection(itemId, collection); } + [WebMethod] + public ResultObject EditRdsCollection(int itemId, RdsCollection collection) + { + return RemoteDesktopServicesController.EditRdsCollection(itemId, collection); + } + [WebMethod] public RdsCollectionPaged GetRdsCollectionsPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) @@ -101,10 +107,10 @@ namespace WebsitePanel.EnterpriseServer } [WebMethod] - public RdsServersPaged GetOrganizationRdsServersPaged(int itemId, string filterColumn, string filterValue, + public RdsServersPaged GetOrganizationRdsServersPaged(int itemId, int? collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { - return RemoteDesktopServicesController.GetOrganizationRdsServersPaged(itemId, filterColumn, filterValue, + return RemoteDesktopServicesController.GetOrganizationRdsServersPaged(itemId, collectionId, filterColumn, filterValue, sortColumn, startRow, maximumRows); } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs index db2e114c..7a92294a 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs @@ -40,6 +40,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices public interface IRemoteDesktopServices { bool CreateCollection(string organizationId, RdsCollection collection); + bool AddRdsServersToDeployment(RdsServer[] servers); RdsCollection GetCollection(string collectionName); bool RemoveCollection(string organizationId, string collectionName); bool SetUsersInCollection(string organizationId, string collectionName, List users); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index 1e8d85bc..b01884db 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -169,6 +169,35 @@ namespace WebsitePanel.Providers.RemoteDesktopServices #region RDS Collections + public bool AddRdsServersToDeployment(RdsServer[] servers) + { + var result = true; + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + + foreach (var server in servers) + { + if (!ExistRdsServerInDeployment(runSpace, server)) + { + AddRdsServerToDeployment(runSpace, server); + } + } + } + catch (Exception e) + { + result = false; + } + finally + { + CloseRunspace(runSpace); + } + + return result; + } + public bool CreateCollection(string organizationId, RdsCollection collection) { var result = true; diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs index 341c32cf..a78e54ae 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs @@ -31,6 +31,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { private System.Threading.SendOrPostCallback CreateCollectionOperationCompleted; + private System.Threading.SendOrPostCallback AddRdsServersToDeploymentOperationCompleted; + private System.Threading.SendOrPostCallback GetCollectionOperationCompleted; private System.Threading.SendOrPostCallback RemoveCollectionOperationCompleted; @@ -71,6 +73,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { /// public event CreateCollectionCompletedEventHandler CreateCollectionCompleted; + /// + public event AddRdsServersToDeploymentCompletedEventHandler AddRdsServersToDeploymentCompleted; + /// public event GetCollectionCompletedEventHandler GetCollectionCompleted; @@ -164,6 +169,48 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { } } + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/AddRdsServersToDeployment", 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 AddRdsServersToDeployment(RdsServer[] servers) { + object[] results = this.Invoke("AddRdsServersToDeployment", new object[] { + servers}); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginAddRdsServersToDeployment(RdsServer[] servers, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("AddRdsServersToDeployment", new object[] { + servers}, callback, asyncState); + } + + /// + public bool EndAddRdsServersToDeployment(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void AddRdsServersToDeploymentAsync(RdsServer[] servers) { + this.AddRdsServersToDeploymentAsync(servers, null); + } + + /// + public void AddRdsServersToDeploymentAsync(RdsServer[] servers, object userState) { + if ((this.AddRdsServersToDeploymentOperationCompleted == null)) { + this.AddRdsServersToDeploymentOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRdsServersToDeploymentOperationCompleted); + } + this.InvokeAsync("AddRdsServersToDeployment", new object[] { + servers}, this.AddRdsServersToDeploymentOperationCompleted, userState); + } + + private void OnAddRdsServersToDeploymentOperationCompleted(object arg) { + if ((this.AddRdsServersToDeploymentCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddRdsServersToDeploymentCompleted(this, new AddRdsServersToDeploymentCompletedEventArgs(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)] @@ -903,6 +950,32 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddRdsServersToDeploymentCompletedEventHandler(object sender, AddRdsServersToDeploymentCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddRdsServersToDeploymentCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AddRdsServersToDeploymentCompletedEventArgs(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); diff --git a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs index 91d8d444..d515b37a 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs @@ -76,6 +76,23 @@ namespace WebsitePanel.Server } } + [WebMethod, SoapHeader("settings")] + public bool AddRdsServersToDeployment(RdsServer[] servers) + { + try + { + Log.WriteStart("'{0}' AddRdsServersToDeployment", ProviderSettings.ProviderName); + var result = RDSProvider.AddRdsServersToDeployment(servers); + Log.WriteEnd("'{0}' AddRdsServersToDeployment", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' AddRdsServersToDeployment", ProviderSettings.ProviderName), ex); + throw; + } + } + [WebMethod, SoapHeader("settings")] public RdsCollection GetCollection(string collectionName) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config index f2f41087..43015b80 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config @@ -141,4 +141,5 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config index b43e286a..239c3893 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config @@ -574,6 +574,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs index f8197414..8b8f8f72 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs @@ -66,7 +66,7 @@ namespace WebsitePanel.Portal public RdsServer[] GetOrganizationRdsServersPaged(int itemId, int maximumRows, int startRowIndex, string sortColumn, string filterValue) { - rdsServers = ES.Services.RDS.GetOrganizationRdsServersPaged(itemId, "", filterValue, sortColumn, startRowIndex, maximumRows); + rdsServers = ES.Services.RDS.GetOrganizationRdsServersPaged(itemId, null, "", filterValue, sortColumn, startRowIndex, maximumRows); return rdsServers.Servers; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditCollection.ascx.resx new file mode 100644 index 00000000..a4a9dd20 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditCollection.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 + + + + + + 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/RDSCollections.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx index 7fc47b47..6c77a487 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx @@ -47,8 +47,8 @@ - - + + <%# Eval("Name").ToString() %> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs index 1842197e..2a58751d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs @@ -111,5 +111,10 @@ namespace WebsitePanel.Portal.RDS "CollectionId=" + collectionId, "ItemID=" + PanelRequest.ItemID); } + + public string GetCollectionEditUrl(string collectionId) + { + return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_edit_collection", "CollectionId=" + collectionId, "ItemID=" + PanelRequest.ItemID); + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx new file mode 100644 index 00000000..f140dbe4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx @@ -0,0 +1,36 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSEditCollection.ascx.cs" Inherits="WebsitePanel.Portal.RDS.RDSEditCollection" %> +<%@ 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/RDSEditCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx.cs new file mode 100644 index 00000000..3f6c8e22 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Providers.RemoteDesktopServices; + +namespace WebsitePanel.Portal.RDS +{ + public partial class RDSEditCollection : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + 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 = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); + collection.Servers = servers.GetServers(); + + ES.Services.RDS.EditRdsCollection(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/RDSEditCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx.designer.cs new file mode 100644 index 00000000..cd24985d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.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 RDSEditCollection { + + /// + /// 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; + + /// + /// 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/UserControls/RDSCollectionServers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs index b3ca3c35..55d5eefd 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs @@ -53,19 +53,14 @@ namespace WebsitePanel.Portal.RDS.UserControls { 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")) { @@ -80,8 +75,14 @@ namespace WebsitePanel.Portal.RDS.UserControls Page.ClientScript.RegisterClientScriptBlock(typeof(RDSCollectionUsers), "SelectAllCheckboxes", script, true); } + + if (!IsPostBack && PanelRequest.CollectionID > 0) + { + BindOrganizationServers(); + } } + protected void btnAdd_Click(object sender, EventArgs e) { // bind all servers @@ -205,6 +206,25 @@ namespace WebsitePanel.Portal.RDS.UserControls } + protected void BindOrganizationServers() + { + RdsServer[] servers = ES.Services.RDS.GetOrganizationRdsServersPaged(PanelRequest.ItemID, PanelRequest.CollectionID, "FqdName", txtSearchValue.Text, null, 0, 1000).Servers; + Array.Sort(servers, CompareAccount); + + if (Direction == SortDirection.Ascending) + { + Array.Reverse(servers); + Direction = SortDirection.Descending; + } + else + { + Direction = SortDirection.Ascending; + } + + gvServers.DataSource = servers; + gvServers.DataBind(); + } + protected void cmdSearch_Click(object sender, ImageClickEventArgs e) { BindPopupServers(); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index 25d1e885..b3c91a22 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -239,6 +239,13 @@ AddRDSServer.ascx + + RDSEditCollection.ascx + ASPXCodeBehind + + + RDSEditCollection.ascx + RDSEditCollectionApps.ascx ASPXCodeBehind @@ -4267,6 +4274,7 @@ + @@ -4277,6 +4285,9 @@ + + Designer + ResXFileCodeGenerator DomainLookupView.ascx.Designer.cs @@ -5584,7 +5595,9 @@ Designer - + + Designer +