コード例 #1
0
		public QueryCancelOrderWarningsResponse QueryCancelOrderWarnings(QueryCancelOrderWarningsRequest request)
		{
			Platform.CheckForNullReference(request, "request");
			Platform.CheckMemberIsSet(request.OrderRef, "OrderRef");

			var order = this.PersistenceContext.Load<Order>(request.OrderRef);
			var warnings = new List<string>();
			var errors = new List<string>();

			if(order.IsTerminated)
			{
				errors.Add("This order cannot be cancelled because it has already been completed or otherwise terminated.");
				return new QueryCancelOrderWarningsResponse(warnings, errors);
			}

			var hasActiveReportingSteps = CollectionUtils.Contains(
				order.Procedures,
				p => CollectionUtils.Contains(p.ReportingProcedureSteps, ps => !ps.IsTerminated));

			if (hasActiveReportingSteps)
			{
				warnings.Add("This order has been performed and may have reports in progress.");
			}

			return new QueryCancelOrderWarningsResponse(warnings, errors);
		}
コード例 #2
0
		public QueryCancelOrderWarningsResponse QueryCancelOrderWarnings(QueryCancelOrderWarningsRequest request)
		{
			Platform.CheckForNullReference(request, "request");
			Platform.CheckMemberIsSet(request.OrderRef, "OrderRef");

			var order = this.PersistenceContext.Load<Order>(request.OrderRef);
			var warnings = new List<string>();
			var errors = new List<string>();

			if(order.IsTerminated)
			{
				errors.Add(SR.CancelOrderWarning_OrderAlreadyTerminated);
				return new QueryCancelOrderWarningsResponse(warnings, errors);
			}

			var hasActiveReportingSteps = CollectionUtils.Contains(
				order.Procedures,
				p => CollectionUtils.Contains(p.ReportingProcedureSteps, ps => !ps.IsTerminated));

			if (hasActiveReportingSteps)
			{
				warnings.Add(SR.CancelOrderWarning_OrderPerformedMayHaveInProgressReports);
			}

			return new QueryCancelOrderWarningsResponse(warnings, errors);
		}