public async Task BlowVehicle(VehicleTripRegistrationDTO blowVehicleDetails)
        {
            var BlowBus = new VehicleTripRegistration
            {
                PhysicalBusRegistrationNumber = blowVehicleDetails.PhysicalBusRegistrationNumber,
                DepartureDate   = DateTime.UtcNow.Date,
                DriverCode      = blowVehicleDetails.DriverCode,
                IsBlownBus      = true,
                IsVirtualBus    = false,
                JourneyType     = JourneyType.Blown,
                ManifestPrinted = true,
                TripId          = blowVehicleDetails.TripId
            };

            _repo.Insert(BlowBus);

            //await _unitOfWork.SaveChangesAsync();

            //var vehicleTrip = await GetVehicleTripRegistrationDTO(blowVehicleDetails.TripId);
            //this is blow
            var journeyManagement = new JourneyManagement
            {
                VehicleTripRegistrationId = BlowBus.Id,
                JourneyStatus             = JourneyStatus.InTransit,
                JourneyType = JourneyType.Blown,
                JourneyDate = BlowBus?.DepartureDate ?? Clock.Now
            };

            _journeyManagementRepo.Insert(journeyManagement);

            await _unitOfWork.SaveChangesAsync();
        }
示例#2
0
        public async Task AddJourneyManagementFromManifest(Guid vehicleTripRegistrationId, JourneyType journeyType)
        {
            if (!await _repo.ExistAsync(v => v.VehicleTripRegistrationId == vehicleTripRegistrationId))
            {
                var vehicleTrip = await _vehicleTripSvc.GetVehicleTripRegistrationDTO(vehicleTripRegistrationId);

                var journeyManagement = new JourneyManagement
                {
                    VehicleTripRegistrationId = vehicleTripRegistrationId,
                    JourneyStatus             = JourneyStatus.Pending,
                    JourneyType = JourneyType.Loaded,
                    JourneyDate = vehicleTrip?.DepartureDate ?? Clock.Now
                };

                _repo.Insert(journeyManagement);
            }
        }