public override CreateVehicleResponseDto InsertPayment(GetAmountResponseDto getAmountResponseDto, decimal PaymentValue) { VehicleEntity oVehicle = getAmountResponseDto.Vehicle; oVehicle.TotalMinutesOfStay = 0; oVehicle.PaymentVehicleEntities = new List <PaymentVehicleEntity> { new PaymentVehicleEntity() { PaymentDate = DateTime.Now, PaymentValue = PaymentValue, CreationDate = DateTime.Now, CreationUser = UsersParkingLot.System } }; unitOfWork.VehicleRepository.Update(oVehicle); bool inserted = unitOfWork.Save() > 0; CreateVehicleResponseDto oResponse = new CreateVehicleResponseDto { Inserted = inserted, Message = inserted ? string.Format(GeneralMessages.RegisteredPayment, getAmountResponseDto.Vehicle.VehiclePlate) : GeneralMessages.ItemNoInserted }; return(oResponse); }
public IActionResult GetAmount(string VehiclePlate) { IActionResult oResponse; ResponseModel <object> oResponseModel; GetAmountResponseDto oResult = residentPaymentsService.GetAmount(VehiclePlate); oResponseModel = new ResponseModel <object>() { IsSuccess = true, Messages = string.Format(GeneralMessages.AmountToPay, VehiclePlate, oResult.Amount), Result = null }; oResponse = Ok(oResponseModel); return(oResponse); }
public GetAmountResponseDto GetAmount(string VehiclePlate) { GetAmountResponseDto oResponse = new GetAmountResponseDto { Vehicle = vehicleService.GetVehicle(VehiclePlate) }; if (oResponse.Vehicle == null) { throw new BusinessExeption(string.Format(GeneralMessages.VehicleNotFound, VehiclePlate)); } AVehicleBase aVehicle = GetVehicleBase(oResponse.Vehicle, (VehicleType)Enum.ToObject(typeof(VehicleType), oResponse.Vehicle.VehicleType)); oResponse.Amount = aVehicle.GetAmount(oResponse.Vehicle); return(oResponse); }
public CreateVehicleResponseDto InsertPayment(InsertPaymentRequestDto insertPaymentRequestDto) { if (insertPaymentRequestDto.PaymentValue == 0) { throw new BusinessExeption(GeneralMessages.PaymentGreaterThanZero); } GetAmountResponseDto oResponseGetAmount = GetAmount(insertPaymentRequestDto.VehiclePlate); if (oResponseGetAmount.Amount == 0) { throw new BusinessExeption(string.Format(GeneralMessages.VehicleADay, oResponseGetAmount.Vehicle.VehiclePlate, oResponseGetAmount.Vehicle.CutoffDate.Date)); } if (oResponseGetAmount.Amount > insertPaymentRequestDto.PaymentValue) { throw new BusinessExeption(string.Format(GeneralMessages.LowerPaymentValue, oResponseGetAmount.Vehicle.VehiclePlate, oResponseGetAmount.Amount)); } AVehicleBase aVehicle = GetVehicleBase(oResponseGetAmount.Vehicle, (VehicleType)Enum.ToObject(typeof(VehicleType), oResponseGetAmount.Vehicle.VehicleType)); return(aVehicle.InsertPayment(oResponseGetAmount, insertPaymentRequestDto.PaymentValue)); }
public override CreateVehicleResponseDto InsertPayment(GetAmountResponseDto getAmountResponseDto, decimal PaymentValue) { throw new BusinessExeption(string.Format(GeneralMessages.InvalidVehicleTypeForPaymentModule, VehicleType.Resident.GetDisplayName(), VehicleType.PostPaidResident.GetDisplayName())); }
public abstract CreateVehicleResponseDto InsertPayment(GetAmountResponseDto getAmountResponseDto, decimal PaymentValue);