public virtual async Task HandleEventAsync(OrderPaidEto eventData) { var occupyModels = new List <OccupyAssetInfoModel>(); var occupyByCategoryModels = new List <OccupyAssetByCategoryInfoModel>(); foreach (var orderLine in eventData.Order.OrderLines) { var assetId = orderLine.FindBookingAssetId(); var assetCategoryId = orderLine.FindBookingAssetCategoryId(); var volume = orderLine.FindBookingVolume(); var date = orderLine.FindBookingDate(); var startingTime = orderLine.FindBookingStartingTime(); var duration = orderLine.FindBookingDuration(); if (volume is null || date is null || startingTime is null || duration is null) { continue; } if (assetId.HasValue) { occupyModels.Add(new OccupyAssetInfoModel( assetId: assetId.Value, volume: volume.Value, date: date.Value, startingTime: startingTime.Value, duration: duration.Value )); } else if (assetCategoryId.HasValue) { occupyByCategoryModels.Add(new OccupyAssetByCategoryInfoModel( assetCategoryId: assetCategoryId.Value, volume: volume.Value, date: date.Value, startingTime: startingTime.Value, duration: duration.Value )); } } var eto = new BulkOccupyAssetEto(eventData.TenantId, eventData.Order.Id, eventData.Order.CustomerUserId, occupyModels, occupyByCategoryModels); eto.SetBookingOrderId(eventData.Order.Id); await _distributedEventBus.PublishAsync(eto); }
public static Guid?FindBookingOrderId(this BulkOccupyAssetEto eto) { return(eto.GetProperty <Guid?>(BulkOccupyAssetEtoProperties.BookingOrderId)); }
public static void SetBookingOrderId(this BulkOccupyAssetEto eto, Guid?value) { eto.SetProperty(BulkOccupyAssetEtoProperties.BookingOrderId, value); }