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); }
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); }
/// <summary> /// Deletes integration connector. Called when the "Delete connector" button is pressed. /// Expects the CreateIntegrationConnector method to be run first. /// </summary> private bool DeleteIntegrationConnector() { // Get the integration connector IntegrationConnectorInfo deleteConnector = IntegrationConnectorInfoProvider.GetIntegrationConnectorInfo("MyNewConnector"); // Delete the integration connector IntegrationConnectorInfoProvider.DeleteIntegrationConnectorInfo(deleteConnector); return(deleteConnector != null); }
/// <summary> /// Gets and updates integration connector. Called when the "Get and update connector" button is pressed. /// Expects the CreateIntegrationConnector method to be run first. /// </summary> private bool GetAndUpdateIntegrationConnector() { // Get the integration connector IntegrationConnectorInfo updateConnector = IntegrationConnectorInfoProvider.GetIntegrationConnectorInfo("MyNewConnector"); if (updateConnector != null) { // Update the properties updateConnector.ConnectorDisplayName = updateConnector.ConnectorDisplayName.ToLower(); // Save the changes IntegrationConnectorInfoProvider.SetIntegrationConnectorInfo(updateConnector); return(true); } return(false); }
protected override void OnPreRender(EventArgs e) { // Hide multiple actions if grid is empty pnlFooter.Visible = !gridElem.IsEmpty; // Initialize actions dropdown list - they need to be refreshed on connector selection drpAction.Items.Clear(); drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString())); // Add synchronize option only when task processing is enabled IntegrationConnectorInfo connector = IntegrationConnectorInfoProvider.GetIntegrationConnectorInfo(ConnectorID); if ((TasksAreInbound ? IntegrationHelper.IntegrationProcessExternal : IntegrationHelper.IntegrationProcessInternal) && ((ConnectorID <= 0) || (connector != null) && connector.ConnectorEnabled && (IntegrationHelper.GetConnector(connector.ConnectorName) != null))) { drpAction.Items.Add(new ListItem(GetString("general." + Action.Synchronize), Convert.ToInt32(Action.Synchronize).ToString())); } drpAction.Items.Add(new ListItem(GetString("general." + Action.Delete), Convert.ToInt32(Action.Delete).ToString())); base.OnPreRender(e); }
protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter) { DataRowView drv; switch (sourceName.ToLowerInvariant()) { case "result": { drv = parameter as DataRowView; if (drv != null) { string errorMsg = ValidationHelper.GetString(drv["SynchronizationErrorMessage"], string.Empty); if (!string.IsNullOrEmpty(errorMsg)) { int synchronizationId = ValidationHelper.GetInteger(drv["SynchronizationID"], 0); string logUrl = ResolveUrl("~/CMSModules/Integration/Pages/Administration/Log.aspx?synchronizationid=") + synchronizationId; return(String.Format("<a target=\"_blank\" href=\"{0}\" onclick=\"modalDialog('{0}', 'tasklog', 1400, 1200); return false;\">{1}</a>", logUrl, GetString("Tasks.ResultFailed"))); } } return(string.Empty); } case "view": if (sender is CMSGridActionButton) { CMSGridActionButton viewButton = sender as CMSGridActionButton; drv = UniGridFunctions.GetDataRowView(viewButton.Parent as DataControlFieldCell); int taskId = ValidationHelper.GetInteger(drv["TaskID"], 0); string detailUrl = ResolveUrl("~/CMSModules/Integration/Pages/Administration/View.aspx?taskid=") + taskId; viewButton.OnClientClick = "modalDialog('" + detailUrl + "', 'tasklog', 1400, 1200); return false;"; return(viewButton); } return(parameter); case "run": if (sender is CMSGridActionButton) { CMSGridActionButton runButton = sender as CMSGridActionButton; drv = UniGridFunctions.GetDataRowView(runButton.Parent as DataControlFieldCell); int connectorId = ValidationHelper.GetInteger(drv["SynchronizationConnectorID"], 0); var connector = IntegrationConnectorInfoProvider.GetIntegrationConnectorInfo(connectorId); bool processingDisabled = TasksAreInbound ? !IntegrationHelper.IntegrationProcessExternal : !IntegrationHelper.IntegrationProcessInternal; if (processingDisabled || (connector == null) || !connector.ConnectorEnabled) { // Set appropriate tooltip if (processingDisabled) { runButton.ToolTip = GetString("integration.processingdisabled"); } else { if ((connector != null) && !connector.ConnectorEnabled) { runButton.ToolTip = String.Format(GetString("integration.connectordisabled"), HTMLHelper.HTMLEncode(connector.ConnectorDisplayName)); } else { runButton.ToolTip = GetString("integration.connectorunavailable"); } } runButton.Enabled = false; runButton.OnClientClick = "return false;"; runButton.Style.Add(HtmlTextWriterStyle.Cursor, "default"); return(runButton); } } break; } return(parameter); }