Get() public method

public Get ( Movement movement ) : Task
movement Movement
return Task
コード例 #1
0
        public async Task EnsureDateValid(Movement movement, DateTime newDate)
        {
            if (movement.Status != MovementStatus.Submitted)
            {
                throw new MovementDateException(string.Format(
                                                    "Can't set new movement date {0} because the movement is not in the submitted state (state: {1})",
                                                    newDate,
                                                    movement.Status));
            }

            await movementDateValidator.EnsureDateValid(movement.NotificationId, newDate);

            var originalDate = await originalMovementDate.Get(movement);

            var notification = await notificationRepository.GetByMovementId(movement.Id);

            var includeStartDate = false;

            if (newDate > workingDayCalculator.AddWorkingDays(originalDate, 10, includeStartDate, notification.CompetentAuthority))
            {
                throw new MovementDateOutOfRangeOfOriginalDateException(string.Format(
                                                                            "Can't set new movement date {0} since it is more than 10 working days after the original shipment date {1}",
                                                                            newDate,
                                                                            originalDate));
            }
        }