コード例 #1
0
        public async Task UpdateManifestManagement(Guid manifestManagementId, ManifestDTO manifestManagement)
        {
            var existingManifestManagement = await _repository.GetAsync(manifestManagementId);

            if (existingManifestManagement == null)
            {
                throw await _serviceHelper.GetExceptionAsync(ErrorConstants.MANIFEST_MANAGEMENT_NOT_EXIST);
            }
            var listOfSeat =
                await _seatManagemengtSvc.GetByVehicleTripIdAsync(
                    existingManifestManagement.VehicleTripRegistrationId);

            existingManifestManagement.NumberOfSeats = listOfSeat.Count;

            //existingManifestManagement.IsPrinted = manifestManagement.IsPrinted;


            var tripRegistration = await _vehicleTripRepo.GetAsync(existingManifestManagement.VehicleTripRegistrationId);

            if (manifestManagement.IsPrinted)
            {
                await _journeyMgtSvc.AddJourneyManagementFromManifest(existingManifestManagement.VehicleTripRegistrationId, JourneyType.Loaded);
            }

            await _unitOfWork.SaveChangesAsync();
        }
コード例 #2
0
        public async Task <IServiceResponse <bool> > OpenManifest(ManifestDTO query)
        {
            return(await HandleApiOperationAsync(async() => {
                await _service.UpdateOpenManifest(query.VehicleTripRegistrationId);

                return new ServiceResponse <bool>(true);
            }));
        }
コード例 #3
0
        public async Task <IServiceResponse <bool> > AddManifestManagement(ManifestDTO manifestManagement)
        {
            return(await HandleApiOperationAsync(async() => {
                await _service.AddManifest(manifestManagement);

                return new ServiceResponse <bool>(true);
            }));
        }
コード例 #4
0
        public async Task AddManifest(ManifestDTO manifest)
        {
            var existingManifestManagement = await GetManifestManagementsByVehicleTripIdAsync(manifest.VehicleTripRegistrationId);

            var vehicleTripReg = await _vehicleTripRepo.GetAsync(manifest.VehicleTripRegistrationId);

            if (existingManifestManagement != null)
            {
                existingManifestManagement.IsPrinted       = manifest.IsPrinted;
                existingManifestManagement.ManifestPrinted = manifest.ManifestPrinted;
                await UpdateManifestManagement(existingManifestManagement.Id, existingManifestManagement);
            }
            else
            {
                var listOfSeat = await _seatManagemengtSvc.GetByVehicleTripIdAsync(
                    manifest.VehicleTripRegistrationId);

                var fare =
                    await GetTripFare(manifest.VehicleTripRegistrationId);

                decimal?amount = fare?.Amount;

                _repository.Insert(new Manifest
                {
                    NumberOfSeats             = listOfSeat.Count,
                    Employee                  = _serviceHelper.GetCurrentUserEmail(),
                    VehicleTripRegistrationId = manifest.VehicleTripRegistrationId,
                    Amount         = amount,
                    VehicleModelId = vehicleTripReg.VehicleModelId
                });



                await _unitOfWork.SaveChangesAsync();
            }
        }