internal string GetDismissVehicleOwnerShipText(Customer customer, DismissVehicleOwnershipRequest request, string registrationNo)
 {
     return
         ($"Hi,<br/><br/>We would like to inform you that the customer {customer.FirstName} {customer.Surname}," +
          $" CustomerNo {customer.CustomerNo}, does not own the vehicle with the registration number" +
          $" {registrationNo} and VehicleNo {request.VehicleNo} anymore. Please update your records." +
          $"<br/><br/>Best Regards<br/><br/>Service Booking Team");
 }
示例#2
0
        public async Task DismissVehicleOwnership(DismissVehicleOwnershipRequest request, DealerConfigurationResponse dealerConfigResponse)
        {
            if (dealerConfigResponse == null)
            {
                throw new ArgumentNullException(nameof(dealerConfigResponse));
            }
            if (request.CustomerNo <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(request.CustomerNo));
            }
            if (request.VehicleNo <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(request.VehicleNo));
            }
            if (request.DealerId <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(request.DealerId));
            }

            var customer = _customerVehicleDal.GetCustomer(request.CustomerNo, dealerConfigResponse.RooftopId, dealerConfigResponse.CommunityId);

            if (customer == null)
            {
                throw new InvalidCustomerException(ExceptionMessages.InvalidCustomer);
            }
            var customerVehicle = _customerVehicleDal.GetCustomerVehicle(customer.Id, request.VehicleNo);

            if (customerVehicle == null)
            {
                throw new InvalidCustomerException(ExceptionMessages.InvalidCustomerVehicle);
            }

            await _customerVehicleDal.DeleteCustomerVehicle(customer.Id, customerVehicle.VehicleNo);

            await _emailService.SendDismissVehicleOwnerShipEmail(customer, request, dealerConfigResponse.EmailAddress, customerVehicle.RegistrationNo);
        }
 public async Task SendDismissVehicleOwnerShipEmail(Customer customer, DismissVehicleOwnershipRequest request, string dealerEmail, string registrationNo)
 {
     var subject     = $"{customer.FirstName} {customer.Surname} does not own the vehicle {registrationNo} anymore";
     var contentBody = GetDismissVehicleOwnerShipText(customer, request, registrationNo);
     await _emailGatewayClient.SendHtmlEmail(_serviceBookingEmail, dealerEmail, subject, contentBody);
 }