private async Task <ActivityPayload> ConfigureSecondChildActivity(ReconfigurationContext context) { var curActivityTemplates = (await HubCommunicator.GetActivityTemplates(null, true)) .ToList(); var selectedReceiver = curActivityTemplates.Single(x => x.Name == _dataSourceValue); ActivityPayload parentActivity; int activityIndex; if (DoesActivityTemplateGenerateTableData(selectedReceiver)) { var loopActivity = context.SolutionActivity.ChildrenActivities .OfType <ActivityPayload>() .SingleOrDefault(x => x.ActivityTemplate.Name == "Loop" && x.Ordering == 2); if (loopActivity == null) { throw new ApplicationException("Invalid solution structure, no Loop activity found."); } loopActivity = await HubCommunicator.ConfigureChildActivity(context.SolutionActivity, loopActivity); var crateChooser = ActivityConfigurator.GetControl <CrateChooser>(loopActivity, "Available_Crates"); var tableDescription = crateChooser.CrateDescriptions.FirstOrDefault(c => c.ManifestId == (int)MT.StandardTableData); if (tableDescription != null) { tableDescription.Selected = true; } parentActivity = loopActivity; activityIndex = 1; } else { parentActivity = context.SolutionActivity; activityIndex = 2; } var sendDocuSignEnvelope = parentActivity.ChildrenActivities .OfType <ActivityPayload>() .Single(x => x.ActivityTemplate.Name == "Send_DocuSign_Envelope" && x.Ordering == activityIndex ); sendDocuSignEnvelope.CrateStorage = new CrateStorage(); sendDocuSignEnvelope = await HubCommunicator.ConfigureChildActivity(parentActivity, sendDocuSignEnvelope); ActivityConfigurator.SetControlValue( sendDocuSignEnvelope, "target_docusign_template", _docuSignTemplate.ListItems .FirstOrDefault(a => a.Key == _docuSignTemplate.selectedKey) ); sendDocuSignEnvelope = await HubCommunicator.ConfigureChildActivity(parentActivity, sendDocuSignEnvelope); return(sendDocuSignEnvelope); }
private async Task <ActivityPayload> ConfigureFirstChildActivity(ReconfigurationContext context) { var activity = context.SolutionActivity.ChildrenActivities .OfType <ActivityPayload>() .Single(x => x.Ordering == 1); activity.CrateStorage = new CrateStorage(); activity = await HubCommunicator.ConfigureChildActivity(context.SolutionActivity, activity); return(activity); }
private async Task <ActivityPayload> CreateSecondChildActivity(ReconfigurationContext context) { var curActivityTemplates = (await HubCommunicator.GetActivityTemplates(null, true)) .ToList(); var selectedReceiver = curActivityTemplates.Single(x => x.Name == _dataSourceValue); ActivityPayload parentActivity; int activityIndex; if (DoesActivityTemplateGenerateTableData(selectedReceiver)) { var loopAT = await HubCommunicator.GetActivityTemplate("terminalFr8Core", "Loop"); var loopActivity = await HubCommunicator.AddAndConfigureChildActivity(context.SolutionActivity, loopAT, "Loop", "Loop", 2); var crateChooser = ActivityConfigurator.GetControl <CrateChooser>(loopActivity, "Available_Crates"); var firstActivity = context.SolutionActivity.ChildrenActivities.OrderBy(x => x.Ordering).First(); var firstActivityCrates = firstActivity.CrateStorage.CrateContentsOfType <CrateDescriptionCM>().FirstOrDefault(); crateChooser.CrateDescriptions = firstActivityCrates?.CrateDescriptions; var tableDescription = crateChooser.CrateDescriptions?.FirstOrDefault(c => c.ManifestId == (int)MT.StandardTableData); if (tableDescription != null) { tableDescription.Selected = true; } parentActivity = loopActivity; activityIndex = 1; } else { parentActivity = context.SolutionActivity; activityIndex = 2; } var sendDocusignEnvelopeAT = await HubCommunicator.GetActivityTemplate("terminalDocuSign", "Send_DocuSign_Envelope", activityTemplateVersion : "2"); var sendDocuSignActivity = await HubCommunicator.AddAndConfigureChildActivity(parentActivity, sendDocusignEnvelopeAT, order : activityIndex); // Set docusign template ActivityConfigurator.SetControlValue(sendDocuSignActivity, "TemplateSelector", _docuSignTemplate.ListItems.FirstOrDefault(a => a.Key == _docuSignTemplate.selectedKey) ); await HubCommunicator.ConfigureChildActivity(parentActivity, sendDocuSignActivity); return(activityIndex == 1 ? sendDocuSignActivity : parentActivity); }
protected async Task GenerateSolutionActivities(string fr8ObjectID) { var queryFr8WarehouseAT = await HubCommunicator.GetActivityTemplate("terminalFr8Core", "Query_Fr8_Warehouse"); var queryFr8WarehouseAction = await HubCommunicator.AddAndConfigureChildActivity(ActivityPayload, queryFr8WarehouseAT); var crateStorage = queryFr8WarehouseAction.CrateStorage; // We insteady of using getConfiguration control used the same GetConfiguration control required actionDO var queryFr8configurationControls = crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().FirstOrDefault(); var radioButtonGroup = queryFr8configurationControls.FindByName <RadioButtonGroup>("QueryPicker"); DropDownList fr8ObjectDropDown = null; if (radioButtonGroup != null && radioButtonGroup.Radios.Count > 0 && radioButtonGroup.Radios[0].Controls.Count > 0) { fr8ObjectDropDown = radioButtonGroup.Radios[1].Controls[0] as DropDownList; radioButtonGroup.Radios[1].Selected = true; radioButtonGroup.Radios[0].Selected = false; } if (fr8ObjectDropDown != null) { fr8ObjectDropDown.Selected = true; fr8ObjectDropDown.Value = fr8ObjectID; fr8ObjectDropDown.selectedKey = fr8ObjectID; FilterPane upstreamCrateChooser1 = radioButtonGroup.Radios[1].Controls[1] as FilterPane; var queryBuilderControl = GetControl <QueryBuilder>("QueryBuilder"); var criteria = JsonConvert.DeserializeObject <List <FilterConditionDTO> >(queryBuilderControl.Value); FilterDataDTO filterPaneDTO = new FilterDataDTO(); filterPaneDTO.Conditions = criteria; filterPaneDTO.ExecutionType = FilterExecutionType.WithFilter; upstreamCrateChooser1.Value = JsonConvert.SerializeObject(filterPaneDTO); upstreamCrateChooser1.Selected = true; } queryFr8WarehouseAction = await HubCommunicator.ConfigureChildActivity( ActivityContext.ActivityPayload, queryFr8WarehouseAction ); }
private async Task <ActivityPayload> CreateSalesforceDataActivity(ReconfigurationContext context) { var getSalesforceDataActivityTemplate = (await HubCommunicator.GetActivityTemplates(null)) .First(x => x.Name == "Get_Data" && x.Terminal.Name == TerminalName && x.Version == "1"); var dataSourceActivity = await HubCommunicator.AddAndConfigureChildActivity( context.SolutionActivity, getSalesforceDataActivityTemplate, order : 1); if (dataSourceActivity.CrateStorage.Where(a => a.ManifestType.Id == (int)MT.StandardAuthentication).FirstOrDefault() != null) { await HubCommunicator.ApplyNewToken(dataSourceActivity.Id, Guid.Parse(AuthorizationToken.Id)); dataSourceActivity = await HubCommunicator.ConfigureActivity(dataSourceActivity); } //This config call will make SF Get_Data activity to load properties of the selected object (and removes filter) CopySolutionUiValuesToSalesforceActivity(context.SolutionActivity, dataSourceActivity); dataSourceActivity = await HubCommunicator.ConfigureChildActivity(context.SolutionActivity, dataSourceActivity); //This config call will set the proper filter value for the selected object CopySolutionUiValuesToSalesforceActivity(context.SolutionActivity, dataSourceActivity); return(await HubCommunicator.ConfigureChildActivity(context.SolutionActivity, dataSourceActivity)); }
public override async Task FollowUp() { var activityTemplates = (await HubCommunicator.GetActivityTemplates(null, true)) .Select(Mapper.Map <ActivityTemplateDO>) .ToList(); try { var continueClicked = false; Storage.Remove <StandardQueryCM>(); await UpdatePlanName(); var queryCrate = ExtractQueryCrate(Storage); Storage.Add(queryCrate); var continueButton = GetControl <Button>("Continue"); if (continueButton != null) { continueClicked = continueButton.Clicked; if (continueButton.Clicked) { continueButton.Clicked = false; } } if (continueClicked) { ActivityPayload.ChildrenActivities.Clear(); var queryFr8WarehouseActivityTemplate = activityTemplates .FirstOrDefault(x => x.Name == "Query_Fr8_Warehouse"); if (queryFr8WarehouseActivityTemplate == null) { return; } var queryFr8WarehouseTemplate = await HubCommunicator.GetActivityTemplate("terminalFr8Core", "Query_Fr8_Warehouse"); var queryFr8WarehouseAction = await HubCommunicator.AddAndConfigureChildActivity(ActivityPayload, queryFr8WarehouseTemplate); var crateStorage = queryFr8WarehouseAction.CrateStorage; var upstreamManifestTypes = crateStorage .CrateContentsOfType <KeyValueListCM>(x => x.Label == "Upstream Crate ManifestType List") .FirstOrDefault(); var controls = crateStorage .CrateContentsOfType <StandardConfigurationControlsCM>() .FirstOrDefault(); var radioButtonGroup = controls .FindByName <RadioButtonGroup>("QueryPicker"); UpstreamCrateChooser upstreamCrateChooser = null; if (radioButtonGroup != null && radioButtonGroup.Radios.Count > 0 && radioButtonGroup.Radios[0].Controls.Count > 0) { upstreamCrateChooser = radioButtonGroup.Radios[0].Controls[0] as UpstreamCrateChooser; } if (upstreamCrateChooser != null) { if (upstreamManifestTypes != null) { upstreamCrateChooser.SelectedCrates[0].ManifestType.selectedKey = upstreamManifestTypes.Values[0].Key; upstreamCrateChooser.SelectedCrates[0].ManifestType.Value = upstreamManifestTypes.Values[0].Value; } upstreamCrateChooser.SelectedCrates[0].Label.selectedKey = QueryCrateLabel; upstreamCrateChooser.SelectedCrates[0].Label.Value = QueryCrateLabel; } queryFr8WarehouseAction = await HubCommunicator.ConfigureChildActivity( ActivityPayload, queryFr8WarehouseAction ); Storage.RemoveByManifestId((int)MT.OperationalStatus); var operationalStatus = new OperationalStateCM(); operationalStatus.CurrentActivityResponse = ActivityResponseDTO.Create(ActivityResponse.ExecuteClientActivity); operationalStatus.CurrentActivityResponse.Body = "RunImmediately"; var operationsCrate = Crate.FromContent("Operational Status", operationalStatus); Storage.Add(operationsCrate); } } catch (Exception) { } }