protected DataSet tasksUniGrid_OnDataReload(string completeWhere, string currentOrder, int currentTopN, string columns, int currentOffset, int currentPageSize, ref int totalRecords)
    {
        // Get the tasks
        DataSet ds = StagingTaskInfoProvider.SelectDocumentTaskList(CurrentSiteID, SelectedServerID, aliasPath, completeWhere, currentOrder, currentTopN, columns, currentOffset, currentPageSize, ref totalRecords);

        pnlFooter.Visible = (totalRecords > 0);
        return(ds);
    }
    protected DataSet tasksUniGrid_OnDataReload(string completeWhere, string currentOrder, int currentTopN, string columns, int currentOffset, int currentPageSize, ref int totalRecords)
    {
        // Get the tasks
        var tasksQuery = StagingTaskInfoProvider.SelectDocumentTaskList(CurrentSiteID, SelectedServerID, aliasPath, completeWhere, currentOrder, currentTopN, columns, currentOffset, currentPageSize);
        var result     = tasksQuery.Result;

        totalRecords = tasksQuery.TotalRecords;

        return(result);
    }
    private string DeleteAllInternal()
    {
        AddLog(GetString("Synchronization.DeletingTasks"));

        // Get the tasks
        DataSet ds = StagingTaskInfoProvider.SelectDocumentTaskList(CurrentSiteID, SelectedServerID, aliasPath, tasksUniGrid.CustomFilter.WhereCondition, null, -1, "TaskID, TaskTitle");

        DeleteTasks(ds);

        return(null);
    }
Пример #4
0
    /// <summary>
    /// All items synchronization.
    /// </summary>
    public void SynchronizeAll(object parameter)
    {
        string result = string.Empty;

        eventCode      = "SYNCALLDOCS";
        CanceledString = GetString("Tasks.SynchronizationCanceled");
        try
        {
            AddLog(GetString("Synchronization.RunningTasks"));

            // Process all records
            DataSet ds = StagingTaskInfoProvider.SelectDocumentTaskList(currentSiteId, serverId, aliasPath, null, "TaskID", -1, "TaskID, TaskTitle");

            // Run the synchronization
            result = StagingHelper.RunSynchronization(ds, serverId, true, currentSiteId, AddLog);

            // Log possible error
            if (!String.IsNullOrEmpty(result))
            {
                CurrentError = GetString("Tasks.SynchronizationFailed");
                AddErrorLog(CurrentError, null);
            }
            else
            {
                CurrentInfo = GetString("Tasks.SynchronizationOK");
                AddLog(CurrentInfo);
            }
        }
        catch (ThreadAbortException ex)
        {
            string state = ValidationHelper.GetString(ex.ExceptionState, string.Empty);
            if (state == CMSThread.ABORT_REASON_STOP)
            {
                // Canceled by user
                CurrentInfo = CanceledString;
                AddLog(CurrentInfo);
            }
            else
            {
                CurrentError = GetString("Tasks.SynchronizationFailed");
                AddErrorLog(CurrentError, result);
            }
        }
        catch (Exception ex)
        {
            CurrentError = GetString("Tasks.SynchronizationFailed") + ": " + ex.Message;
            AddErrorLog(CurrentError);
        }
        finally
        {
            // Finalize log context
            FinalizeContext();
        }
    }
    private string SynchronizeAllInternal()
    {
        EventCode = "SYNCALLDOCS";

        AddLog(GetString("Synchronization.RunningTasks"));

        // Process all records
        DataSet ds = StagingTaskInfoProvider.SelectDocumentTaskList(CurrentSiteID, SelectedServerID, aliasPath, tasksUniGrid.CustomFilter.WhereCondition, "TaskID", -1, "TaskID");

        // Run the synchronization
        return(StagingTaskRunner.RunSynchronization(ds));
    }
Пример #6
0
    /// <summary>
    /// Deletes all tasks.
    /// </summary>
    protected void DeleteAll(object parameter)
    {
        eventCode      = "DELETEALLDOCS";
        CanceledString = GetString("Tasks.DeletionCanceled");
        try
        {
            AddLog(GetString("Synchronization.DeletingTasks"));
            // Get the tasks
            DataSet ds = StagingTaskInfoProvider.SelectDocumentTaskList(currentSiteId, serverId, aliasPath, null, null, -1, "TaskID, TaskTitle");
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    int taskId = ValidationHelper.GetInteger(row["TaskID"], 0);
                    if (taskId > 0)
                    {
                        string taskTitle = ValidationHelper.GetString(row["TaskTitle"], null);
                        AddLog(string.Format(ResHelper.GetAPIString("deletion.running", "Deleting '{0}' task"), HTMLHelper.HTMLEncode(taskTitle)));
                        // Delete synchronization
                        SynchronizationInfoProvider.DeleteSynchronizationInfo(taskId, serverId, currentSiteId);
                    }
                }
            }

            CurrentInfo = GetString("Tasks.DeleteOK");
            AddLog(CurrentInfo);
        }
        catch (ThreadAbortException ex)
        {
            string state = ValidationHelper.GetString(ex.ExceptionState, string.Empty);
            if (state == CMSThread.ABORT_REASON_STOP)
            {
                // Canceled by user
                CurrentInfo = CanceledString;
                AddLog(CurrentInfo);
            }
            else
            {
                CurrentError = GetString("Tasks.DeletionFailed");
                AddErrorLog(CurrentError);
            }
        }
        catch (Exception ex)
        {
            CurrentError = GetString("Tasks.DeletionFailed") + ": " + ex.Message;
            AddErrorLog(CurrentError);
        }
        finally
        {
            // Finalize log context
            FinalizeContext();
        }
    }
    private string CreateUpdateTasksAndRunTasksInternal(string action)
    {
        string result;
        int    sid = SelectedServerID;

        if (sid <= 0)
        {
            sid = SynchronizationInfoProvider.ENABLED_SERVERS;
        }

        EventCode = "SYNCHRONIZE";

        AddLog(String.Format(GetString("Synchronization.LoggingTasks"), PredefinedObjectType.DOCUMENT));

        // Prepare settings for current node
        var settings = new LogMultipleDocumentChangeSettings
        {
            EnsurePublishTask = true,
            NodeAliasPath     = aliasPath,
            TaskType          = TaskTypeEnum.UpdateDocument,
            ServerID          = sid,
            KeepTaskData      = false,
            RunAsynchronously = false,
            SiteName          = CurrentSiteName
        };

        // Create update task for current node
        var currentNodeUpdateTask = DocumentSynchronizationHelper.LogDocumentChange(settings);

        // Create update tasks for subtree or for the whole tree, depends on sync action
        if (action != SYNCHRONIZE_CURRENT)
        {
            settings.NodeAliasPath = action == SYNCHRONIZE_COMPLETE ? "/%" : aliasPath.TrimEnd('/') + "/%";
            DocumentSynchronizationHelper.LogDocumentChange(settings);
        }

        AddLog(GetString("Synchronization.RunningTasks"));

        if (action == SYNCHRONIZE_CURRENT)
        {
            // Run sync for the current node only
            result = StagingTaskRunner.RunSynchronization(currentNodeUpdateTask.Select(t => t.TaskID));
        }
        else
        {
            // Get all tasks for given path, depends on the sync action and run them
            string  path = action == SYNCHRONIZE_COMPLETE ? "/" : aliasPath;
            DataSet ds   = StagingTaskInfoProvider.SelectDocumentTaskList(CurrentSiteID, SelectedServerID, path, null, "TaskID", -1, "TaskID");
            result = StagingTaskRunner.RunSynchronization(ds);
        }
        return(result);
    }
Пример #8
0
    protected DataSet tasksUniGrid_OnDataReload(string completeWhere, string currentOrder, int currentTopN, string columns, int currentOffset, int currentPageSize, ref int totalRecords)
    {
        // Get the tasks
        DataSet ds = StagingTaskInfoProvider.SelectDocumentTaskList(currentSiteId, serverId, aliasPath, null, currentOrder, 0, columns, currentOffset, currentPageSize, ref totalRecords);

        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            pnlTasksGrid.Visible = true;
            pnlFooter.Visible    = true;
        }
        else
        {
            lblInfo.Text         = GetString("Tasks.NoTasks");
            lblInfo.Visible      = true;
            pnlFooter.Visible    = false;
            pnlTasksGrid.Visible = false;
        }
        return(ds);
    }