public static ActivityUpsertTO CreateEntriesFromOutputTOs(IList<OutputTO> outputToList, IDataListCompiler compiler, Guid dlId, out ErrorResultTO errors) { errors = new ErrorResultTO(); ActivityUpsertTO result = new ActivityUpsertTO(); foreach(OutputTO outputTo in outputToList) { // I first need to detect if the entry is a recordset!!!!!!!!!!! // Then if scalar upsert scalar else upsert a recordset-- how was this to ever work?!?! // Break into parts so we can correctly create the required entry...... IBinaryDataListEntry entry = Dev2BinaryDataListFactory.CreateEntry(RecsetName, string.Empty, dlId); int idx = 1; foreach(string output in outputTo.OutputStrings) { IBinaryDataListItem itemToAdd = Dev2BinaryDataListFactory.CreateBinaryItem(output, RecsetName, FieldName, idx); idx++; string error; entry.TryAppendRecordItem(itemToAdd, out error); if(error != string.Empty) { errors.AddError(error); } } // push entry one time, no looping ;) result.AddEntry(entry, outputTo.OutPutDescription); } return result; }
public static ActivityUpsertTO CreateEntriesFromOutputTOs(IList <OutputTO> outputToList, IDataListCompiler compiler, Guid dlId, out ErrorResultTO errors) { errors = new ErrorResultTO(); ActivityUpsertTO result = new ActivityUpsertTO(); foreach (OutputTO outputTo in outputToList) { // I first need to detect if the entry is a recordset!!!!!!!!!!! // Then if scalar upsert scalar else upsert a recordset-- how was this to ever work?!?! // Break into parts so we can correctly create the required entry...... IBinaryDataListEntry entry = Dev2BinaryDataListFactory.CreateEntry(RecsetName, string.Empty, dlId); int idx = 1; foreach (string output in outputTo.OutputStrings) { IBinaryDataListItem itemToAdd = Dev2BinaryDataListFactory.CreateBinaryItem(output, RecsetName, FieldName, idx); idx++; string error; entry.TryAppendRecordItem(itemToAdd, out error); if (error != string.Empty) { errors.AddError(error); } } // push entry one time, no looping ;) result.AddEntry(entry, outputTo.OutPutDescription); } return(result); }
/// <summary> /// this method exist for the datalist server port /// it is a crap way to upserting since it replicates all the existing functionality of the server, but it is the quickest /// and with an activity re-write coming, it is as good as it needs to be... /// </summary> /// <param name="outputs">The outputs.</param> /// <param name="dataListID">The data list unique identifier.</param> /// <param name="compiler">The compiler.</param> /// <param name="errors">The errors.</param> /// <returns></returns> public Guid UpsertOutputs(IList <OutputTO> outputs, Guid dataListID, IDataListCompiler compiler, out ErrorResultTO errors) { ErrorResultTO allErrors = new ErrorResultTO(); ActivityUpsertTO toUpsert = BinaryDataListEntryBuilder.CreateEntriesFromOutputTOs(outputs, compiler, dataListID, out errors); if (errors.HasErrors()) { allErrors.MergeErrors(errors); } Guid result = compiler.Upsert(dataListID, toUpsert.FetchExpressions(), toUpsert.FetchBinaryEntries(), out errors); if (errors.HasErrors()) { allErrors.MergeErrors(errors); } errors = allErrors; return(result); }