public override async Task FollowUp() { var control = GetControl <TextSource>("EnvelopeIdSelector"); var envelope_crate = CrateSignaller.MarkAvailableAtRuntime <DocuSignEnvelopeCM_v2>(AllFieldsCrateName, false); var availlable_crates = await HubCommunicator.GetCratesByDirection(this.ActivityId, CrateDirection.Upstream); }
/// <summary> /// Returns list of FieldDTO from upper crate from ConnectToSql action. /// </summary> private async Task <List <KeyValueDTO> > ExtractColumnDefinitions() { var upstreamCrates = await HubCommunicator.GetCratesByDirection <KeyValueListCM>(ActivityId, CrateDirection.Upstream); var tablesDefinitionCrate = upstreamCrates?.FirstOrDefault(x => x.Label == "Sql Table Definitions"); var tablesDefinition = tablesDefinitionCrate?.Content; return(tablesDefinition?.Values); }
private async Task <string> ExtractConnectionString() { var upstreamCrates = await HubCommunicator.GetCratesByDirection <KeyValueListCM>(ActivityId, CrateDirection.Upstream); var connectionStringCrate = upstreamCrates?.FirstOrDefault(x => x.Label == "Sql Connection String"); var connectionStringCM = connectionStringCrate?.Content; var connectionStringFields = connectionStringCM?.Values; if (connectionStringFields == null || connectionStringFields.Count == 0) { return(null); } return(connectionStringFields[0].Key); }
public override async Task FollowUp() { var tableChooser = GetControl <CrateChooser>("TableChooser"); var selectedCrateDescription = tableChooser.CrateDescriptions?.FirstOrDefault(c => c.Selected); if (selectedCrateDescription == null) { return; } if (selectedCrateDescription.ManifestType != CrateManifestTypes.StandardTableData) { AddErrorText("This activity only supports StandardTableCM Manifests"); return; } //let's get upstream crates to find this one var upstreamTableCrates = await HubCommunicator.GetCratesByDirection <StandardTableDataCM>(ActivityId, CrateDirection.Upstream); var selectedCrate = upstreamTableCrates.FirstOrDefault(c => c.ManifestType.Type == selectedCrateDescription.ManifestType && c.Label == selectedCrateDescription.Label); if (selectedCrate == null) { AddErrorText("Unable to find selected crate on an upstream activity"); return; } RemoveErrorText(); var table = selectedCrate.Content; double temp; var tableFields = table.Table.SelectMany(c => c.Row).Select(r => r.Cell) .Where(c => !string.IsNullOrEmpty(c.Value) && !double.TryParse(c.Value, out temp)); var tempChosenCellList = GetControl <ControlList>("extractor_list"); List <ListItem> listItems; if (table.FirstRowHeaders) { listItems = tableFields.Where(c => c.Key.Equals(c.Value)).Select(c => new ListItem { Key = c.Key, Value = c.Value }).ToList(); } else { listItems = tableFields.Select(c => new ListItem { Key = c.Value, Value = c.Value }).ToList(); } foreach (var cGroup in tempChosenCellList.ControlGroups) { var chosenCellDd = (DropDownList)cGroup.First(); chosenCellDd.ListItems = listItems; } ((DropDownList)tempChosenCellList.TemplateContainer.Template.First()).ListItems = listItems; var chosenCellList = GetControl <ControlList>("extractor_list"); //let's publish our data - that this will be available during runtime var extractedFields = new List <FieldDTO>(); foreach (var cGroup in chosenCellList.ControlGroups) { var chosenCell = (DropDownList)cGroup.FirstOrDefault(c => c.Name == "cellChooser"); var position = (DropDownList)cGroup.FirstOrDefault(c => c.Name == "extractValueFrom"); if (AreValuesSelected(chosenCell, position)) { var field = GetChosenField(chosenCell, position); extractedFields.Add(field); } } CrateSignaller.MarkAvailableAtRuntime <StandardPayloadDataCM>("Extracted Field From Table").AddFields(extractedFields); }