/// <summary> /// Contains the information that should be sent to the customer about missing match /// </summary> /// <param name="expiredRide">Ride which did not find a match</param> /// <returns></returns> private async Task NotifyCustomerAboutMatchNotFound(Ride expiredRide) { var notification = _pushNotificationFactory.GetPushNotification(); notification.Name = "Ingen match"; notification.Title = "Ingen match"; notification.Body = $"Din dele-tur kl. {expiredRide.DepartureTime.Hour}:{expiredRide.DepartureTime.Minute} til {expiredRide.EndDestination.StreetName} fandt ingen match. Prøv en solotur. "; notification.Devices.Add(expiredRide.DeviceId); notification.CustomData.Add("Type", "NoMatch"); notification.CustomData.Add("RideId", expiredRide.Id.ToString()); await _pushNotificationService.SendAsync(notification); }
/// <summary> /// Notify all customers related to the order that their ride has been accepted. /// </summary> /// <param name="order">The order containing the customers that should be notified</param> /// <returns></returns> private async Task NotifyCustomersAsync(Order order) { try { foreach (var ride in order.Rides) { var notification = _pushNotificationFactory.GetPushNotification(); notification.Name = "Accept"; notification.Title = "Tur accepteret"; notification.Body = $"Din tur kl. {ride.DepartureTime.Hour}:{ride.DepartureTime.Minute} til {ride.EndDestination.StreetName} er accepteret af {order.TaxiCompany.Name}"; notification.Devices.Add(ride.DeviceId); notification.CustomData.Add("rideId", ride.Id.ToString()); await _pushNotificationService.SendAsync(notification); } } catch (Exception e) { Debug.WriteLine(e); } }