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);
                }
            }
            else if (e.CommandName == "EditCollection")
            {
                Response.Redirect(GetCollectionEditUrl(e.CommandArgument.ToString()));
            }
        }
Beispiel #2
0
        private bool SaveRdsServers(bool exit = false)
        {
            try
            {
                if (servers.GetServers().Count < 1)
                {
                    messageBox.ShowErrorMessage("RDS_CREATE_COLLECTION_RDSSERVER_REQUAIRED");
                    return(false);
                }

                RdsCollection collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID);
                collection.Servers = servers.GetServers();

                ES.Services.RDS.EditRdsCollection(PanelRequest.ItemID, collection);

                if (!exit)
                {
                    foreach (var rdsServer in collection.Servers)
                    {
                        rdsServer.Status = ES.Services.RDS.GetRdsServerStatus(PanelRequest.ItemID, rdsServer.FqdName);
                    }

                    servers.BindServers(collection.Servers.ToArray());
                }
            }
            catch (Exception ex)
            {
                messageBox.ShowErrorMessage(ex.Message);
                return(false);
            }

            return(true);
        }
        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, DisplayName = txtCollectionName.Text, Servers = servers.GetServers(), Description = ""
                };
                int collectionId = ES.Services.RDS.AddRdsCollection(PanelRequest.ItemID, collection);

                Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_edit_collection", "CollectionId=" + collectionId, "ItemID=" + PanelRequest.ItemID));
            }
            catch (Exception ex)
            {
                ShowErrorMessage("RDSCOLLECTION_NOT_CREATED", ex);
            }
        }
        protected void BindPopupApps()
        {
            RdsCollection       collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID);
            List <StartMenuApp> apps       = ES.Services.RDS.GetAvailableRemoteApplications(PanelRequest.ItemID, collection.Name).ToList();
            var sessionHosts = ES.Services.RDS.GetRdsCollectionSessionHosts(PanelRequest.CollectionID);

            var addedApplications = GetApps();
            var aliases           = addedApplications.Select(p => p.Alias);

            apps = apps.Where(x => !aliases.Contains(x.Alias)).ToList();

            if (Direction == SortDirection.Ascending)
            {
                apps      = apps.OrderBy(a => a.DisplayName).ToList();
                Direction = SortDirection.Descending;
            }
            else
            {
                apps      = apps.OrderByDescending(a => a.DisplayName).ToList();
                Direction = SortDirection.Ascending;
            }

            var requiredParams = addedApplications.Select(a => a.RequiredCommandLine.ToLower());

            foreach (var host in sessionHosts)
            {
                if (!requiredParams.Contains(string.Format("/v:{0}", host.ToLower())))
                {
                    var fullRemote = new StartMenuApp
                    {
                        DisplayName         = string.Format("Full Desktop - {0}", host.ToLower()),
                        FilePath            = "c:\\windows\\system32\\mstsc.exe",
                        RequiredCommandLine = string.Format("/admin /v:{0}", host.ToLower())
                    };

                    var sessionHost = collection.Servers.Where(s => s.FqdName.Equals(host, StringComparison.CurrentCultureIgnoreCase)).First();

                    if (sessionHost != null)
                    {
                        fullRemote.DisplayName = string.Format("Full Desktop - {0}", sessionHost.Name.ToLower());
                    }

                    fullRemote.Alias = fullRemote.DisplayName.Replace(" ", "");

                    if (apps.Count > 0)
                    {
                        apps.Insert(0, fullRemote);
                    }
                    else
                    {
                        apps.Add(fullRemote);
                    }
                }
            }

            gvPopupApps.DataSource = apps;
            gvPopupApps.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            remoreApps.Module = Module;

            if (!IsPostBack)
            {
                RdsCollection collection     = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID);
                var           collectionApps = ES.Services.RDS.GetCollectionRemoteApplications(PanelRequest.ItemID, collection.Name);

                litCollectionName.Text = collection.DisplayName;
                remoreApps.SetApps(collectionApps);
            }
        }
Beispiel #6
0
 public void EditRdsCollectionSettings(RdsCollection collection)
 {
     try
     {
         Log.WriteStart("'{0}' EditRdsCollectionSettings", ProviderSettings.ProviderName);
         RDSProvider.EditRdsCollectionSettings(collection);
         Log.WriteEnd("'{0}' EditRdsCollectionSettings", ProviderSettings.ProviderName);
     }
     catch (Exception ex)
     {
         Log.WriteError(String.Format("'{0}' EditRdsCollectionSettings", ProviderSettings.ProviderName), ex);
         throw;
     }
 }
Beispiel #7
0
 public void ImportCollection(string organizationId, RdsCollection collection, List <string> users)
 {
     try
     {
         Log.WriteStart("'{0}' ImportCollection", ProviderSettings.ProviderName);
         RDSProvider.ImportCollection(organizationId, collection, users);
         Log.WriteEnd("'{0}' ImportCollection", ProviderSettings.ProviderName);
     }
     catch (Exception ex)
     {
         Log.WriteError(String.Format("'{0}' ImportCollection", ProviderSettings.ProviderName), ex);
         throw;
     }
 }
Beispiel #8
0
 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;
     }
 }
        private bool EditCollectionSettings()
        {
            try
            {
                RdsCollection collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID);
                collection.Settings.RdsCollectionId = collection.Id;
                collection.Settings = GetSettings(collection.Settings);
                ES.Services.RDS.EditRdsCollectionSettings(PanelRequest.ItemID, collection);
            }
            catch (Exception ex)
            {
                ShowErrorMessage("RDSCOLLECTIONSETTINGS_NOT_UPDATES", ex);
                return(false);
            }

            return(true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WriteScriptBlock();

            if (!IsPostBack)
            {
                RdsCollection         collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID);
                RdsCollectionSettings settings   = ES.Services.RDS.GetRdsCollectionSettings(PanelRequest.CollectionID);
                collection.Settings = settings;

                if (collection.Settings == null)
                {
                    collection.Settings = new RdsCollectionSettings
                    {
                        DisconnectedSessionLimitMin    = 0,
                        ActiveSessionLimitMin          = 0,
                        IdleSessionLimitMin            = 0,
                        BrokenConnectionAction         = BrokenConnectionActionValues.Disconnect.ToString(),
                        AutomaticReconnectionEnabled   = true,
                        TemporaryFoldersDeletedOnExit  = true,
                        TemporaryFoldersPerSession     = true,
                        ClientDeviceRedirectionOptions = string.Join(",", new List <string>
                        {
                            ClientDeviceRedirectionOptionValues.AudioVideoPlayBack.ToString(),
                            ClientDeviceRedirectionOptionValues.AudioRecording.ToString(),
                            ClientDeviceRedirectionOptionValues.SmartCard.ToString(),
                            ClientDeviceRedirectionOptionValues.Clipboard.ToString(),
                            ClientDeviceRedirectionOptionValues.Drive.ToString(),
                            ClientDeviceRedirectionOptionValues.PlugAndPlayDevice.ToString()
                        }.ToArray()),
                        ClientPrinterRedirected  = true,
                        ClientPrinterAsDefault   = true,
                        RDEasyPrintDriverEnabled = true,
                        MaxRedirectedMonitors    = 16,
                        EncryptionLevel          = EncryptionLevel.ClientCompatible.ToString(),
                        SecurityLayer            = SecurityLayerValues.Negotiate.ToString(),
                        AuthenticateUsingNLA     = true
                    };
                }

                litCollectionName.Text = collection.DisplayName;
                BindControls(collection);
            }
        }
        private void BindControls(RdsCollection collection)
        {
            slDisconnectedSessionLimit.SelectedLimit = collection.Settings.DisconnectedSessionLimitMin;
            slActiveSessionLimit.SelectedLimit       = collection.Settings.ActiveSessionLimitMin;
            slIdleSessionLimit.SelectedLimit         = collection.Settings.IdleSessionLimitMin;

            if (collection.Settings.BrokenConnectionAction == BrokenConnectionActionValues.Disconnect.ToString())
            {
                chDisconnect.Checked            = true;
                chAutomaticReconnection.Enabled = true;
            }
            else
            {
                chEndSession.Checked            = true;
                chAutomaticReconnection.Enabled = false;
            }

            chAutomaticReconnection.Checked = collection.Settings.AutomaticReconnectionEnabled;
            chDeleteOnExit.Checked          = collection.Settings.TemporaryFoldersDeletedOnExit;
            chUseFolders.Checked            = collection.Settings.TemporaryFoldersPerSession;

            if (collection.Settings.ClientDeviceRedirectionOptions != null)
            {
                chAudioVideo.Checked     = collection.Settings.ClientDeviceRedirectionOptions.Contains(ClientDeviceRedirectionOptionValues.AudioVideoPlayBack.ToString());
                chAudioRecording.Checked = collection.Settings.ClientDeviceRedirectionOptions.Contains(ClientDeviceRedirectionOptionValues.AudioRecording.ToString());
                chDrives.Checked         = collection.Settings.ClientDeviceRedirectionOptions.Contains(ClientDeviceRedirectionOptionValues.Drive.ToString());
                chSmartCards.Checked     = collection.Settings.ClientDeviceRedirectionOptions.Contains(ClientDeviceRedirectionOptionValues.SmartCard.ToString());
                chPlugPlay.Checked       = collection.Settings.ClientDeviceRedirectionOptions.Contains(ClientDeviceRedirectionOptionValues.PlugAndPlayDevice.ToString());
                chClipboard.Checked      = collection.Settings.ClientDeviceRedirectionOptions.Contains(ClientDeviceRedirectionOptionValues.Clipboard.ToString());
            }

            chPrinterRedirection.Checked    = collection.Settings.ClientPrinterRedirected;
            chDefaultDevice.Checked         = collection.Settings.ClientPrinterAsDefault;
            chDefaultDevice.Enabled         = collection.Settings.ClientPrinterRedirected;
            chEasyPrint.Checked             = collection.Settings.RDEasyPrintDriverEnabled;
            chEasyPrint.Enabled             = collection.Settings.ClientPrinterRedirected;
            tbMonitorsNumber.Text           = collection.Settings.MaxRedirectedMonitors.ToString();
            cbAuthentication.Checked        = collection.Settings.AuthenticateUsingNLA;
            ddSecurityLayer.SelectedValue   = collection.Settings.SecurityLayer;
            ddEncryptionLevel.SelectedValue = collection.Settings.EncryptionLevel;
        }
Beispiel #12
0
 public ResultObject AddRdsServerToCollection(int itemId, RdsServer rdsServer, RdsCollection rdsCollection)
 {
     return(RemoteDesktopServicesController.AddRdsServerToCollection(itemId, rdsServer, rdsCollection));
 }
Beispiel #13
0
 public ResultObject RemoveRemoteApplicationFromCollection(int itemId, RdsCollection collection, RemoteApplication application)
 {
     return(RemoteDesktopServicesController.RemoveRemoteApplicationFromCollection(itemId, collection, application));
 }
Beispiel #14
0
 public int AddRdsCollection(int itemId, RdsCollection collection)
 {
     return(RemoteDesktopServicesController.AddRdsCollection(itemId, collection));
 }
Beispiel #15
0
 public ResultObject RemoveRdsServerFromCollection(int itemId, RdsServer rdsServer, RdsCollection rdsCollection)
 {
     return(RemoteDesktopServicesController.RemoveRdsServerFromCollection(itemId, rdsServer, rdsCollection));
 }
Beispiel #16
0
 public ResultObject EditRdsCollectionSettings(int itemId, RdsCollection collection)
 {
     return(RemoteDesktopServicesController.EditRdsCollectionSettings(itemId, collection));
 }
Beispiel #17
0
 public ResultObject RemoveRdsCollection(int itemId, RdsCollection collection)
 {
     return(RemoteDesktopServicesController.RemoveRdsCollection(itemId, collection));
 }