static void ProcessOutputMapping(DataTable executeService, IExecutionEnvironment environment, int update, ref bool started, ref int rowIdx, DataRow row, IServiceOutputMapping serviceOutputMapping) { var rsType = DataListUtil.GetRecordsetIndexType(serviceOutputMapping.MappedTo); var rowIndex = DataListUtil.ExtractIndexRegionFromRecordset(serviceOutputMapping.MappedTo); var rs = serviceOutputMapping.RecordSetName; if (!string.IsNullOrEmpty(rs) && environment.HasRecordSet(rs)) { if (started) { rowIdx = environment.GetLength(rs) + 1; started = false; } } else { try { environment.AssignDataShape(serviceOutputMapping.MappedTo); } catch (Exception e) { Dev2Logger.Error(e, GlobalConstants.WarewolfError); } } GetRowIndex(ref started, ref rowIdx, rsType, rowIndex); if (!executeService.Columns.Contains(serviceOutputMapping.MappedFrom) && !executeService.Columns.Contains("ReadForXml")) { return; } var value = GetColumnValue(executeService, row, serviceOutputMapping); if (update != 0) { rowIdx = update; } var displayExpression = DataListUtil.ReplaceRecordsetBlankWithIndex(DataListUtil.AddBracketsToValueIfNotExist(serviceOutputMapping.MappedTo), rowIdx); if (rsType == enRecordsetIndexType.Star) { displayExpression = DataListUtil.ReplaceStarWithFixedIndex(displayExpression, rowIdx); } environment.Assign(displayExpression, value.ToString(), update); }
static object GetColumnValue(DataTable executeService, DataRow row, IServiceOutputMapping serviceOutputMapping) => executeService.Columns.Contains("ReadForXml") ? row["ReadForXml"] : row[serviceOutputMapping.MappedFrom];
public static void ProcessOutputMapping(IExecutionEnvironment environment, int update, ref bool started, ref int rowIdx, DataRow row, IServiceOutputMapping serviceOutputMapping) { var rsType = DataListUtil.GetRecordsetIndexType(serviceOutputMapping.MappedTo); var rowIndex = DataListUtil.ExtractIndexRegionFromRecordset(serviceOutputMapping.MappedTo); var rs = serviceOutputMapping.RecordSetName; if (!string.IsNullOrEmpty(rs) && environment.HasRecordSet(DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.MakeValueIntoHighLevelRecordset(rs, rsType == enRecordsetIndexType.Star)))) { if (started) { rowIdx = environment.GetLength(rs) + 1; started = false; } } else { try { environment.AssignDataShape(serviceOutputMapping.MappedTo); } catch (Exception e) { Dev2Logger.Error(e, GlobalConstants.WarewolfError); } } GetRowIndex(ref started, ref rowIdx, rsType, rowIndex); if (!row.Table.Columns.Contains(serviceOutputMapping.MappedFrom)) { return; } var value = row[serviceOutputMapping.MappedFrom]; var colDataType = row.Table.Columns[serviceOutputMapping.MappedFrom].DataType; if (colDataType.Name == "Byte[]") { value = Encoding.UTF8.GetString(value as byte[]); } if (update != 0) { rowIdx = update; } var displayExpression = DataListUtil.ReplaceRecordsetBlankWithIndex(DataListUtil.AddBracketsToValueIfNotExist(serviceOutputMapping.MappedTo), rowIdx); if (rsType == enRecordsetIndexType.Star) { displayExpression = DataListUtil.ReplaceStarWithFixedIndex(displayExpression, rowIdx); } environment.Assign(displayExpression, value.ToString(), update); }