Example #1
0
 private List<RecurringBillingDisplay> GetRecurringBillingsForUser(User user, IPTV2Entities context)
 {
     List<RecurringBillingDisplay> list = null;
     try
     {
         var recurringBillings = context.RecurringBillings.Where(r => r.UserId == user.UserId && r.StatusId == GlobalConfig.Visible);
         if (recurringBillings != null)
         {
             list = new List<RecurringBillingDisplay>();
             foreach (var item in recurringBillings)
             {
                 RecurringBillingDisplay disp = new RecurringBillingDisplay()
                 {
                     EndDate = (DateTime)item.EndDate,
                     EndDateStr = item.EndDate.Value.ToShortDateString(),
                     NextRun = (DateTime)item.NextRun,
                     NextRunStr = item.NextRun.Value.ToShortDateString(),
                     PackageId = item.PackageId,
                     PackageName = item.Package.Description,
                     ProductId = item.ProductId,
                     ProductName = item.Product.Description,
                     RecurringBillingId = item.RecurringBillingId,
                     StatusId = item.StatusId,
                     UserId = item.UserId,
                     isDisabled = false,
                     PaymentType = item is CreditCardRecurringBilling ? "Credit Card" : "Paypal"
                 };
                 list.Add(disp);
             }
         }
     }
     catch (Exception) { }
     return list;
 }
Example #2
0
        private List<RecurringBillingDisplay> ShowRecurringBillings()
        {
            List<RecurringBillingDisplay> display = new List<RecurringBillingDisplay>();
            if (MyUtility.isUserLoggedIn())
            {
                System.Guid userId = new System.Guid(User.Identity.Name);
                var context = new IPTV2Entities();
                User user = context.Users.FirstOrDefault(u => u.UserId == userId);
                if (user != null)
                {
                    var recurringBillings = context.RecurringBillings.Where(t => t.UserId == user.UserId && t.OfferingId == GlobalConfig.offeringId && t.StatusId == GlobalConfig.Visible).OrderByDescending(t => t.RecurringBillingId);
                    if (recurringBillings != null)
                    {
                        foreach (var item in recurringBillings)
                        {

                            RecurringBillingDisplay disp = new RecurringBillingDisplay()
                            {
                                EndDate = (DateTime)item.EndDate,
                                EndDateStr = item.EndDate.Value.ToShortDateString(),
                                NextRun = (DateTime)item.NextRun,
                                NextRunStr = item.NextRun.Value.ToShortDateString(),
                                PackageId = item.PackageId,
                                PackageName = item.Package.Description,
                                ProductId = item.ProductId,
                                ProductName = item.Product.Description,
                                RecurringBillingId = item.RecurringBillingId,
                                StatusId = item.StatusId,
                                UserId = item.UserId,
                                //isDisabled = ((DateTime)item.NextRun).Date.Subtract(DateTime.Now.Date).Days < 2 ? true : false
                                isDisabled = false,
                                PaymentType = item is CreditCardRecurringBilling ? "Credit Card" : "Paypal"


                            };
                            display.Add(disp);
                        }
                    }
                }
            }
            return display;
        }