private static PackageEntitlement CreatePackageEntitlement(EntitlementRequest request, PackageSubscriptionProduct subscription, ProductPackage package, DateTime registDt) { PackageEntitlement entitlement = new PackageEntitlement() { EndDate = GetEntitlementEndDate(subscription.Duration, subscription.DurationType, registDt), Package = (Package)package.Package, OfferingId = offeringId, LatestEntitlementRequest = request }; return entitlement; }
private static DateTime GetPackageEndDateIfAvailable(User user, PackageSubscriptionProduct subscription, DateTime registDt) { var listOfPackageIds = subscription.Packages.Select(p => p.PackageId).ToArray(); var entitlements = user.PackageEntitlements.Where(p => listOfPackageIds.Contains(p.PackageId)); if (entitlements != null) { foreach (var entitlement in entitlements) { if (entitlement.EndDate > registDt) registDt = entitlement.EndDate; } } return registDt; }
private static PackageEntitlement CreatePackageEntitlement(EntitlementRequest request, PackageSubscriptionProduct subscription, ProductPackage package, DateTime registDt) { var currentDt = registDt; if (subscription.BreakingDate != null) registDt = (DateTime)subscription.BreakingDate > currentDt ? (DateTime)subscription.BreakingDate : currentDt; PackageEntitlement entitlement = new PackageEntitlement() { EndDate = MyUtility.getEntitlementEndDate(subscription.Duration, subscription.DurationType, registDt), Package = (Package)package.Package, OfferingId = GlobalConfig.offeringId, LatestEntitlementRequest = request }; return entitlement; }
private static PackageEntitlement CreatePackageEntitlement(EntitlementRequest request, PackageSubscriptionProduct subscription, ProductPackage package, DateTime endDate, int offeringId) { PackageEntitlement entitlement = new PackageEntitlement() { EndDate = endDate, Package = (IPTV2_Model.Package)package.Package, OfferingId = offeringId, LatestEntitlementRequest = request }; return entitlement; }