コード例 #1
0
    public virtual async Task <Money?> GetAssetCategoryBookingUnitPriceAsync(CreateOrderDto input,
                                                                             CreateOrderLineDto inputOrderLine, Currency effectiveCurrency)
    {
        var productAssetCategory = (await _productAssetCategoryAppService.GetListAsync(
                                        new GetProductAssetCategoryListDto
        {
            MaxResultCount = 1,
            StoreId = input.StoreId,
            ProductId = inputOrderLine.ProductId,
            ProductSkuId = inputOrderLine.ProductSkuId,
            AssetCategoryId = inputOrderLine.GetBookingAssetCategoryId(),
            PeriodSchemeId = inputOrderLine.GetBookingPeriodSchemeId()
        }
                                        )).Items.First();

        var productAssetCategoryPeriod =
            productAssetCategory.Periods.FirstOrDefault(x => x.PeriodId == inputOrderLine.GetBookingPeriodId());

        if (productAssetCategoryPeriod is not null)
        {
            await CheckCurrencyAsync(productAssetCategoryPeriod.Currency, effectiveCurrency);

            return(new Money(productAssetCategoryPeriod.Price, effectiveCurrency));
        }

        if (productAssetCategory.Price.HasValue)
        {
            await CheckCurrencyAsync(productAssetCategory.Currency, effectiveCurrency);

            return(new Money(productAssetCategory.Price.Value, effectiveCurrency));
        }

        return(null);
    }
コード例 #2
0
        protected virtual async Task <bool> IsPeriodInfoValidAsync(CreateOrderLineDto orderLine)
        {
            var periodSchemeId = orderLine.GetBookingPeriodSchemeId();
            var periodId       = orderLine.GetBookingPeriodId();

            var periodScheme = await _periodSchemeAppService.GetAsync(periodSchemeId);

            var period = periodScheme.Periods.Find(x => x.Id == periodId);

            return(period is not null);
        }