Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageTitle.TitleText = GetString("Task.ViewHeader");
        RegisterModalPageScripts();

        IntegrationTaskInfo ti = IntegrationTaskInfoProvider.GetIntegrationTaskInfo(TaskID);

        // Set edited object
        EditedObject = ti;

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

            string direction = GetString(ti.TaskIsInbound ? "integration.inbound" : "integration.outbound");

            // Prepare task description
            StringBuilder sbTaskInfo = new StringBuilder();
            sbTaskInfo.Append("<table class='table table-hover'>");
            sbTaskInfo.Append("<tr><td style='width: 20%;'><strong>" + GetString("integration.taskdirection") + ":</strong></td><td>" + direction + "</td></tr>");
            sbTaskInfo.Append("<tr><td><strong>" + GetString("integration.tasktype") + ":</strong></td><td>" + ti.TaskType + "</td></tr>");
            sbTaskInfo.Append("<tr><td><strong>" + GetString("integration.tasktime") + ":</strong></td><td>" + ti.TaskTime + "</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();
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.Title.TitleText  = GetString("Task.ViewHeader");
        CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Integration/tasks.png");

        IntegrationTaskInfo ti = IntegrationTaskInfoProvider.GetIntegrationTaskInfo(TaskID);

        // Set edited object
        EditedObject = ti;

        if (ti != null)
        {
            CurrentMaster.Title.TitleText += " (" + HTMLHelper.HTMLEncode(ti.TaskTitle) + ")";

            string direction = GetString(ti.TaskIsInbound ? "integration.inbound" : "integration.outbound");

            // Prepare task description
            StringBuilder sbTaskInfo = new StringBuilder();
            sbTaskInfo.Append("<table>");
            sbTaskInfo.Append("<tr><td class=\"Title Grid\">" + GetString("integration.taskdirection") + ":</td><td>" + direction + "</td></tr>");
            sbTaskInfo.Append("<tr><td class=\"Title Grid\">" + GetString("integration.tasktype") + ":</td><td>" + ti.TaskType + "</td></tr>");
            sbTaskInfo.Append("<tr><td class=\"Title Grid\">" + GetString("integration.tasktime") + ":</td><td>" + ti.TaskTime + "</td></tr>");
            sbTaskInfo.Append("</table>");

            string objectType = ti.TaskObjectType;
            if (ti.TaskNodeID > 0)
            {
                objectType = PredefinedObjectType.DOCUMENT;
            }
            viewDataSet.ObjectType        = objectType;
            viewDataSet.DataSet           = GetDataSet(ti.TaskData, ti.TaskType, ti.TaskObjectType);
            viewDataSet.AdditionalContent = sbTaskInfo.ToString();
        }
    }
Пример #3
0
 protected override void OnPreRender(EventArgs e)
 {
     if (SynchronizationInfo != null)
     {
         IntegrationTaskInfo      ti = IntegrationTaskInfoProvider.GetIntegrationTaskInfo(SynchronizationInfo.SynchronizationTaskID);
         IntegrationConnectorInfo si = IntegrationConnectorInfoProvider.GetIntegrationConnectorInfo(SynchronizationInfo.SynchronizationConnectorID);
         // Prepare task description
         StringBuilder sbTaskInfo = new StringBuilder();
         sbTaskInfo.Append("<table>");
         if ((ti != null) || (si != null))
         {
             if (ti != null)
             {
                 sbTaskInfo.Append("<tr><td class=\"Title Grid\">" + GetString("integration.tasktitle") + ":</td><td>" + HTMLHelper.HTMLEncode(ti.TaskTitle) + "</td></tr>");
             }
             if (si != null)
             {
                 sbTaskInfo.Append("<tr><td class=\"Title Grid\">" + GetString("integration.connectorname") + ":</td><td>" + HTMLHelper.HTMLEncode(si.ConnectorDisplayName) + "</td></tr>");
             }
         }
         sbTaskInfo.Append("</table>");
         lblInfo.Text = sbTaskInfo.ToString();
     }
     lblInfo.Visible = (lblInfo.Text != "");
     base.OnPreRender(e);
 }
Пример #4
0
 protected override void OnPreRender(EventArgs e)
 {
     if (SynchronizationInfo != null)
     {
         IntegrationTaskInfo      ti = IntegrationTaskInfoProvider.GetIntegrationTaskInfo(SynchronizationInfo.SynchronizationTaskID);
         IntegrationConnectorInfo si = IntegrationConnectorInfoProvider.GetIntegrationConnectorInfo(SynchronizationInfo.SynchronizationConnectorID);
         // Prepare task description
         StringBuilder sbTaskInfo = new StringBuilder();
         sbTaskInfo.Append("<div class=\"form-horizontal\">");
         if ((ti != null) || (si != null))
         {
             if (ti != null)
             {
                 sbTaskInfo.Append("<div class=\"form-group\"><div class=\"editing-form-label-cell\"><span class=\"control-label\">" + GetString("integration.tasktitle") + ":</span></div><div class=\"editing-form-value-cell\"><span class=\"form-control-text\">" + HTMLHelper.HTMLEncode(ti.TaskTitle) + "</span></div></div>");
             }
             if (si != null)
             {
                 sbTaskInfo.Append("<div class=\"form-group\"><div class=\"editing-form-label-cell\"><span class=\"control-label\">" + GetString("integration.connectorname") + ":</span></div><div class=\"editing-form-value-cell\"><span class=\"form-control-text\">" + HTMLHelper.HTMLEncode(si.ConnectorDisplayName) + "</span></div></div>");
             }
         }
         sbTaskInfo.Append("</div>");
         lblInfo.Text = sbTaskInfo.ToString();
     }
     lblInfo.Visible = (lblInfo.Text != "");
     base.OnPreRender(e);
 }
Пример #5
0
    /// <summary>
    /// Deletes selected tasks.
    /// </summary>
    protected void DeleteSelected(object parameter)
    {
        List <String> list = parameter as List <String>;

        if (list == null)
        {
            return;
        }

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

            list.Sort();
            foreach (string synchronizationIdString in list)
            {
                int synchronizationId = ValidationHelper.GetInteger(synchronizationIdString, 0);
                if (synchronizationId > 0)
                {
                    IntegrationSynchronizationInfo synchronization = IntegrationSynchronizationInfoProvider.GetIntegrationSynchronizationInfo(synchronizationId);

                    if (synchronization != null)
                    {
                        IntegrationTaskInfo task = IntegrationTaskInfoProvider.GetIntegrationTaskInfo(synchronization.SynchronizationTaskID);

                        if (task != null)
                        {
                            DeleteSynchronization(synchronizationId, task.TaskTitle);
                        }
                    }
                }
            }

            CurrentInfo = GetString("tasks.deletionok");
            AddLog(CurrentInfo);
        }
        catch (ThreadAbortException ex)
        {
            if (CMSThread.Stopped(ex))
            {
                // 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);
        }
    }
Пример #6
0
    private string ProcessSynchronization(int connectorId, int taskId)
    {
        if ((taskId > 0) && (connectorId > 0))
        {
            // Get connector and task
            IntegrationConnectorInfo connectorInfo = IntegrationConnectorInfoProvider.GetIntegrationConnectorInfo(connectorId);
            IntegrationTaskInfo      taskInfo      = IntegrationTaskInfoProvider.GetIntegrationTaskInfo(taskId);
            if ((connectorInfo != null) && (taskInfo != null))
            {
                if (connectorInfo.ConnectorEnabled)
                {
                    // Get connector instance
                    BaseIntegrationConnector connector = IntegrationHelper.GetConnector(connectorInfo.ConnectorName) as BaseIntegrationConnector;
                    if (connector != null)
                    {
                        AddLog(String.Format(ResHelper.GetAPIString("synchronization.running", "Processing '{0}' task"), HTMLHelper.HTMLEncode(taskInfo.TaskTitle)));

                        // Process the task
                        if (TasksAreInbound)
                        {
                            // Always try to process the task when requested from UI
                            taskInfo.TaskProcessType = IntegrationProcessTypeEnum.Default;
                            return(connector.ProcessExternalTask(taskInfo));
                        }
                        else
                        {
                            return(connector.ProcessInternalTask(taskInfo));
                        }
                    }
                    else
                    {
                        // Can't load connector
                        AddLog(String.Format(ResHelper.GetAPIString("synchronization.skippingunavailable", "Skipping '{0}' task - failed to load associated connector."), HTMLHelper.HTMLEncode(taskInfo.TaskTitle)));
                    }
                }
                else
                {
                    // Connector is disabled
                    AddLog(String.Format(ResHelper.GetAPIString("synchronization.skippingdisabled", "Skipping '{0}' task - associated connector is disabled."), HTMLHelper.HTMLEncode(taskInfo.TaskTitle)));
                }
            }
        }

        return(null);
    }
Пример #7
0
    protected void gridElem_OnAction(string actionName, object actionArgument)
    {
        int synchronizationId = ValidationHelper.GetInteger(actionArgument, 0);

        switch (actionName.ToLowerInvariant())
        {
        case "delete":
            // Delete synchronization
            IntegrationSynchronizationInfoProvider.DeleteIntegrationSynchronizationInfo(synchronizationId);
            break;

        case "run":
            // Get synchronization
            IntegrationSynchronizationInfo synchronization = IntegrationSynchronizationInfoProvider.GetIntegrationSynchronizationInfo(synchronizationId);
            if (synchronization != null)
            {
                // Get connector and task
                IntegrationConnectorInfo connectorInfo = IntegrationConnectorInfoProvider.GetIntegrationConnectorInfo(synchronization.SynchronizationConnectorID);
                IntegrationTaskInfo      taskInfo      = IntegrationTaskInfoProvider.GetIntegrationTaskInfo(synchronization.SynchronizationTaskID);
                if ((connectorInfo != null) && (taskInfo != null))
                {
                    // Get connector instance
                    BaseIntegrationConnector connector = IntegrationHelper.GetConnector(connectorInfo.ConnectorName) as BaseIntegrationConnector;
                    if (connector != null)
                    {
                        // Process the task
                        if (TasksAreInbound)
                        {
                            // Always try to process the task when requested from UI
                            taskInfo.TaskProcessType = IntegrationProcessTypeEnum.Default;
                            connector.ProcessExternalTask(taskInfo);
                        }
                        else
                        {
                            connector.ProcessInternalTask(taskInfo);
                        }
                    }
                }
            }
            break;
        }
    }
Пример #8
0
    /// <summary>
    /// Deletes selected tasks.
    /// </summary>
    protected void DeleteSelected(object parameter)
    {
        ArrayList list = parameter as ArrayList;

        if (list == null)
        {
            return;
        }

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

            list.Sort();

            foreach (string synchronizationIdString in list)
            {
                int synchronizationId = ValidationHelper.GetInteger(synchronizationIdString, 0);
                if (synchronizationId > 0)
                {
                    IntegrationSynchronizationInfo synchronization = IntegrationSynchronizationInfoProvider.GetIntegrationSynchronizationInfo(synchronizationId);

                    if (synchronization != null)
                    {
                        IntegrationTaskInfo task = IntegrationTaskInfoProvider.GetIntegrationTaskInfo(synchronization.SynchronizationTaskID);

                        if (task != null)
                        {
                            DeleteSynchronization(synchronizationId, task.TaskTitle);
                        }
                    }
                }
            }

            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();
        }
    }