Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        StagingTaskInfo ti = StagingTaskInfoProvider.GetTaskInfo(TaskId);

        // Set edited object
        EditedObject = ti;

        if (ti != null)
        {
            ((CMSDeskPage)Page).PageTitle.TitleText += " (" + HTMLHelper.HTMLEncode(ti.TaskTitle) + ")";

            // Prepare task description
            StringBuilder sbTaskInfo = new StringBuilder();
            sbTaskInfo.Append("<table>");
            sbTaskInfo.Append("<tr><td class=\"Title Grid\" style=\"width:135px\">" + GetString("staging.tasktype") + "</td><td>" + ti.TaskType.ToString() + "</td></tr>");
            sbTaskInfo.Append("<tr><td class=\"Title Grid\">" + GetString("staging.tasktime") + "</td><td>" + ti.TaskTime.ToString() + "</td></tr>");
            sbTaskInfo.Append("<tr><td class=\"Title Grid\">" + GetString("staging.taskprocessedby") + "</td><td>" + DataHelper.GetNotEmpty(ti.TaskServers.Trim(';').Replace(";", ", "), "-") + "</td></tr>");
            sbTaskInfo.Append("</table>");

            string objectType = ti.TaskObjectType;
            if (ti.TaskNodeID > 0)
            {
                objectType = TreeNode.OBJECT_TYPE;
            }
            viewDataSet.ObjectType        = objectType;
            viewDataSet.DataSet           = GetDataSet(ti.TaskData, ti.TaskType, ti.TaskObjectType);
            viewDataSet.AdditionalContent = sbTaskInfo.ToString();
        }
    }
Esempio n. 2
0
 protected override void OnPreRender(EventArgs e)
 {
     // Get task data
     if (taskId > 0)
     {
         StagingTaskInfo ti = StagingTaskInfoProvider.GetTaskInfo(taskId);
         if (ti != null)
         {
             lblInfo.Text += String.Format(GetString("Task.LogTaskInfo"), HTMLHelper.HTMLEncode(ti.TaskTitle));
         }
     }
     // Get server data
     if (serverId > 0)
     {
         ServerInfo si = ServerInfoProvider.GetServerInfo(serverId);
         if (si != null)
         {
             if (lblInfo.Text != "")
             {
                 lblInfo.Text += "<br /><br />";
             }
             lblInfo.Text += String.Format(GetString("Task.LogServerInfo"), si.ServerDisplayName);
         }
     }
     lblInfo.Visible = (lblInfo.Text != "");
     base.OnPreRender(e);
 }
Esempio n. 3
0
    /// <summary>
    /// Deletes selected tasks.
    /// </summary>
    protected void DeleteSelected(object parameter)
    {
        List <String> list = parameter as List <String>;

        if (list == null)
        {
            return;
        }

        eventCode      = "DELETESELECTEDOBJECTS";
        CanceledString = GetString("Tasks.DeletionCanceled");
        try
        {
            AddLog(GetString("Synchronization.DeletingTasks"));

            foreach (string taskIdString in list)
            {
                int taskId = ValidationHelper.GetInteger(taskIdString, 0);
                if (taskId > 0)
                {
                    StagingTaskInfo task = StagingTaskInfoProvider.GetTaskInfo(taskId);

                    if (task != null)
                    {
                        AddLog(string.Format(ResHelper.GetAPIString("deletion.running", "Deleting '{0}' task"), HTMLHelper.HTMLEncode(task.TaskTitle)));
                        // Delete synchronization
                        SynchronizationInfoProvider.DeleteSynchronizationInfo(task.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
        {
            // Finalizes log context
            FinalizeContext();
        }
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        StagingTaskInfo ti = StagingTaskInfoProvider.GetTaskInfo(TaskId);

        // Set edited object
        EditedObject = ti;

        if (ti == null)
        {
            return;
        }

        ((CMSDeskPage)Page).PageTitle.TitleText += " (" + HTMLHelper.HTMLEncode(ti.TaskTitle) + ")";

        // Get users and task groups
        var usersWhoModifiedObject = GetUsersFromStagingTask(ti);
        var taskInGroups           = GetTaskGroupsFromStagingTask(ti);

        string objectType = ti.TaskObjectType;

        if (ti.TaskNodeID > 0)
        {
            objectType = TreeNode.OBJECT_TYPE;
        }

        viewDataSet.ObjectType        = objectType;
        viewDataSet.DataSet           = GetDataSet(ti.TaskData, ti.TaskType, ti.TaskObjectType);
        viewDataSet.AdditionalContent = GetTaskHeader(ti, usersWhoModifiedObject, taskInGroups);
    }
Esempio n. 5
0
    protected void gridTasks_OnAction(string actionName, object actionArgument)
    {
        // Parse action argument
        int taskId = ValidationHelper.GetInteger(actionArgument, 0);

        eventType = EventType.INFORMATION;

        if (taskId > 0)
        {
            StagingTaskInfo task = StagingTaskInfoProvider.GetTaskInfo(taskId);

            if (task != null)
            {
                switch (actionName.ToLowerCSafe())
                {
                case "delete":
                    // Delete task
                    eventCode = "DELETESELECTEDOBJECT";
                    AddEventLog(string.Format(ResHelper.GetAPIString("deletion.running", "Deleting '{0}' task"), HTMLHelper.HTMLEncode(task.TaskTitle)));
                    SynchronizationInfoProvider.DeleteSynchronizationInfo(taskId, serverId, currentSiteId);
                    break;

                case "synchronize":
                    string result = null;
                    try
                    {
                        // Run task synchronization
                        eventCode = "SYNCSELECTEDOBJECT";
                        result    = StagingHelper.RunSynchronization(taskId, serverId, true, currentSiteId);

                        if (string.IsNullOrEmpty(result))
                        {
                            ShowConfirmation(GetString("Tasks.SynchronizationOK"));
                        }
                        else
                        {
                            ShowError(GetString("Tasks.SynchronizationFailed"));
                            eventType = EventType.ERROR;
                        }
                    }
                    catch (Exception ex)
                    {
                        result = ex.Message;
                        ShowError(GetString("Tasks.SynchronizationFailed"));
                        eventType = EventType.ERROR;
                    }
                    // Log message
                    AddEventLog(result + string.Format(ResHelper.GetAPIString("synchronization.running", "Processing '{0}' task"), HTMLHelper.HTMLEncode(task.TaskTitle)));
                    break;
                }
            }
        }
    }