コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 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;
 }
コード例 #4
0
        public static List<string> GetPackageFeatures(string CountryCode, ProductPackage package)
        {
            List<string> list = null;
            string jsonString = String.Empty;
            try
            {
                var cache = DataCache.Cache;
                //modify cache duration
                var CacheDuration = new TimeSpan(0, GlobalConfig.PackageAndProductCacheDuration, 0);
                string cacheKey = "GPKGFEAT:P:" + package.PackageId + ";C:" + CountryCode;
                try { jsonString = (string)cache[cacheKey]; }
                catch (Exception) { }
                if (String.IsNullOrEmpty(jsonString))
                {
                    list = new List<string>();
                    var context = new IPTV2Entities();
                    var offering = context.Offerings.Find(GlobalConfig.offeringId);
                    var service = offering.Services.FirstOrDefault(o => o.PackageId == GlobalConfig.serviceId);
                    SortedSet<int> listOfShowIds = new SortedSet<int>();

                    foreach (var category in package.Package.Categories)
                    {
                        listOfShowIds.UnionWith(service.GetAllOnlineShowIds(CountryCode, category.Category));
                        if (category.Category is Category)
                        {
                            var item = (Category)category.Category;
                            var CategoryShowIds = service.GetAllOnlineShowIds(CountryCode, item);
                            if (CategoryShowIds.Count() > 1000)
                                list.Add(String.Format("{0}+ in {1}", CategoryShowIds.Count().Floor(100), item.Description));
                            else if (CategoryShowIds.Count() > 100)
                                list.Add(String.Format("{0}+ in {1}", CategoryShowIds.Count().Floor(10), item.Description));
                            else if (CategoryShowIds.Count() > 10)
                                list.Add(String.Format("{0}+ in {1}", CategoryShowIds.Count().Floor(10), item.Description));
                            else
                                list.Add(String.Format("{0} in {1}", CategoryShowIds.Count(), item.Description));
                        }
                    }
                    list.Add(String.Format("{0}+ Titles", listOfShowIds.Count().Floor(10)));
                    jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(list);
                    cache.Put(cacheKey, jsonString, CacheDuration);
                }
                else
                    list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(jsonString);
            }
            catch (Exception e) { MyUtility.LogException(e); }
            return list;
        }