本文整理汇总了C#中Purchase.Any方法的典型用法代码示例。如果您正苦于以下问题:C# Purchase.Any方法的具体用法?C# Purchase.Any怎么用?C# Purchase.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Purchase
的用法示例。
在下文中一共展示了Purchase.Any方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetCoupons
private void SetCoupons(Coupon[] userCoupons, Purchase[] userPurchases, CurrencyDto currencyDto, IMyMentorRepository repository, CheckoutViewModel model)
{
var coupnIdToContentId = userCoupons.ToDictionary(x => x.ObjectId, x => x.Bundle != null ? x.Bundle.ObjectId : x.Clip.ObjectId);
var unUsedCouponids = coupnIdToContentId
.Where(x => !userPurchases.Any(p => p.BundleKey != null ? p.BundleKey.ObjectId == x.Value : p.ClipKey.ObjectId == x.Value))
.Select(x => x.Key);
var unUsedCoupons = userCoupons.Where(x => unUsedCouponids.Contains(x.ObjectId)).Union(userCoupons.Where(x => x.State == CouponStates.UnUsed.ToString()));
var couponNameTemplate = MyMentorResources.checkoutCouponTitleTemplate;
foreach (var coupon in unUsedCoupons)
{
var lessonOrBundle = coupon.Bundle != null ? MyMentorResources.checkoutBundle : MyMentorResources.checkoutLesson;
var itemName = coupon.Bundle != null
? coupon.Bundle.GetLocalizedField("bundleName")
: coupon.Clip.GetLocalizedField("name");
var originalPrice = CurrencyConverter.ConvertFromNis(coupon.OriginalPriceNIS, currencyDto, repository).ToCurrency(currencyDto);
var yourPrice = CurrencyConverter.ConvertFromNis(coupon.SiteCouponFeeNIS + coupon.TeacherCouponFeeNIS, currencyDto, repository).ToCurrency(currencyDto);
var expiration = coupon.IssueDate.AddDays(10).ToString("dd/MM/yyyy");
model.CouponsForUser.Add(coupon.ObjectId, string.Format(couponNameTemplate, lessonOrBundle, itemName, originalPrice, yourPrice, expiration));
}
}