Example #1
0
    /// <summary>
    /// Gets and bulk updates staging servers. Called when the "Get and bulk update servers" button is pressed.
    /// Expects the CreateStagingServer method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateStagingServers()
    {
        // Prepare the parameters
        string where = "ServerName LIKE N'MyNewServer%'";

        // Get the data for the current site
        DataSet servers = ServerInfoProvider.GetSiteServers(SiteContext.CurrentSiteID, where, null, -1, null, false);

        if (!DataHelper.DataSourceIsEmpty(servers))
        {
            // Loop through the individual items
            foreach (DataRow serverDr in servers.Tables[0].Rows)
            {
                // Create object from DataRow
                ServerInfo modifyServer = new ServerInfo(serverDr);

                // Update the properties
                modifyServer.ServerDisplayName = modifyServer.ServerDisplayName.ToUpper();

                // Save the changes
                ServerInfoProvider.SetServerInfo(modifyServer);
            }

            return(true);
        }

        return(false);
    }