/// <summary>
                /// Builds the execute stored procedure operation.
                /// </summary>
                /// <param name="streamName">Name of the stream.</param>
                /// <param name="concern">The concern.</param>
                /// <param name="details">The details.</param>
                /// <param name="recordId">The record identifier.</param>
                /// <param name="newStatus">The new status.</param>
                /// <param name="acceptableCurrentStatuses">The acceptable current statuses.</param>
                /// <param name="tagIdsForEntryCsv">The tag identifiers as CSV.</param>
                /// <param name="inheritRecordTags">The tags on the record should also be on the handling entry.</param>
                /// <returns>Operation to execute stored procedure.</returns>
                public static ExecuteStoredProcedureOp BuildExecuteStoredProcedureOp(
                    string streamName,
                    string concern,
                    string details,
                    long recordId,
                    HandlingStatus newStatus,
                    IReadOnlyCollection <HandlingStatus> acceptableCurrentStatuses,
                    string tagIdsForEntryCsv,
                    bool inheritRecordTags)
                {
                    var sprocName = Invariant($"[{streamName}].{nameof(PutHandling)}");

                    var acceptableCurrentStatusesCsv = acceptableCurrentStatuses.Select(_ => _.ToString()).ToCsv();

                    var parameters = new List <ParameterDefinitionBase>()
                    {
                        new InputParameterDefinition <string>(nameof(InputParamName.Concern), Tables.Handling.Concern.SqlDataType, concern),
                        new InputParameterDefinition <string>(nameof(InputParamName.Details), Tables.Handling.Details.SqlDataType, details),
                        new InputParameterDefinition <long>(nameof(InputParamName.RecordId), Tables.Handling.RecordId.SqlDataType, recordId),
                        new InputParameterDefinition <string>(nameof(InputParamName.NewStatus), Tables.Handling.Status.SqlDataType, newStatus.ToString()),
                        new InputParameterDefinition <string>(nameof(InputParamName.AcceptableCurrentStatusesCsv), new StringSqlDataTypeRepresentation(false, StringSqlDataTypeRepresentation.MaxNonUnicodeLengthConstant), acceptableCurrentStatusesCsv),
                        new InputParameterDefinition <string>(nameof(InputParamName.TagIdsForEntryCsv), Tables.Record.TagIdsCsv.SqlDataType, tagIdsForEntryCsv),
                        new InputParameterDefinition <int>(nameof(InputParamName.InheritRecordTags), new IntSqlDataTypeRepresentation(), inheritRecordTags ? 1 : 0),
                        new InputParameterDefinition <int>(nameof(InputParamName.IsUnHandledRecord), new IntSqlDataTypeRepresentation(), 0),
                        new InputParameterDefinition <int>(nameof(InputParamName.IsClaimingRecordId), new IntSqlDataTypeRepresentation(), 0),
                        new OutputParameterDefinition <long>(nameof(OutputParamName.Id), Tables.Handling.Id.SqlDataType),
                    };

                    var result = new ExecuteStoredProcedureOp(sprocName, parameters);

                    return(result);
                }
예제 #2
0
 /// <summary/>
 public MongoRecord(string id, string messageName, object message, object?response, HandlingStatus status, Audit audit)
 {
     Id          = id;
     MessageName = messageName;
     Message     = message;
     Response    = response;
     Status      = status;
     Details     = audit.Details;
 }