Beispiel #1
0
    /// <summary>
    /// Deletes staging tasks. Called when the "Delete tasks" button is pressed.
    /// Expects the CreateStagingServer method to be run first.
    /// </summary>
    private bool DeleteTasks()
    {
        // Get server
        ServerInfo server = ServerInfoProvider.GetServerInfo("MyNewServer", SiteContext.CurrentSiteID);

        if (server != null)
        {
            // Get tasks for the server
            DataSet tasks = StagingTaskInfoProvider.SelectTaskList(SiteContext.CurrentSiteID, server.ServerID, null, null);

            if (!DataHelper.DataSourceIsEmpty(tasks))
            {
                foreach (DataRow taskDr in tasks.Tables[0].Rows)
                {
                    // Create task info object from data row
                    StagingTaskInfo deleteTask = new StagingTaskInfo(taskDr);

                    // Delete the task
                    StagingTaskInfoProvider.DeleteTaskInfo(deleteTask);
                }

                return(true);
            }

            apiDeleteTasks.ErrorMessage = "No tasks found.";
        }

        return(false);
    }
Beispiel #2
0
        /// <inheritdoc/>
        public void DeleteStagingTask(IServer server)
        {
            // Gets the staging server
            ServerInfo stagingServer = this.GetServer(server.ServerName, server.ServerSiteID).UndoActLike();

            if (stagingServer != null)
            {
                // Gets all staging tasks that target the given server
                var tasks = StagingTaskInfoProvider.SelectTaskList(stagingServer.ServerSiteID, stagingServer.ServerID, null, null);

                // Loops through individual staging tasks
                foreach (StagingTaskInfo task in tasks)
                {
                    // Deletes the staging task
                    StagingTaskInfoProvider.DeleteTaskInfo(task);
                }
            }
        }