コード例 #1
0
ファイル: DashboardService.cs プロジェクト: zenit1/beame-lfe
        public List <DbSubscriptionDetailToken> GetActiveSubscribers(int userId)
        {
            try
            {
                var result = OrderLinesViewRepository.GetMany(x => x.SellerUserId == userId && x.LineTypeId == (byte)BillingEnums.eOrderLineTypes.SUBSCRIPTION && x.OrderStatusId == (byte)BillingEnums.eOrderStatuses.ACTIVE).ToList();
                var lines  = result.Select(x => x.Entity2DbSubscriptionDetailToken()).OrderByDescending(x => x.OrderNumber).ToList();

                return(lines);
            }
            catch (Exception ex)
            {
                Logger.Error("GetActiveSubscribers", ex, CommonEnums.LoggerObjectTypes.Dashboard);

                return(new List <DbSubscriptionDetailToken>());
            }
        }
コード例 #2
0
        public void FixBundleCourseAccessProblem(out string emails)
        {
            emails = string.Empty;
            var from            = DateTime.Now.AddDays(-3);
            var bundlePurchases = OrderLinesViewRepository.GetMany(x => x.BundleId != null && x.OrderDate > from).OrderByDescending(x => x.OrderDate).ToList();

            foreach (var orderLine in bundlePurchases)
            {
                var line          = orderLine;
                var bundleCourses = BundleCourseRepository.Count(x => x.BundleId == line.BundleId);
                var userCourses   = UserCourseRepository.Count(x => x.UserId == line.BuyerUserId && x.OrderLineId == line.LineId);

                if (bundleCourses == userCourses)
                {
                    continue;
                }

                string error;
                AttachCourseOrBundle2User(line.BuyerUserId, line.LineId, null, line.BundleId, null, out error);
                emails += String.Format("{0}-{1}-{2}-{3}-{4},", line.BuyerEmail, line.SellerFirstName + " " + line.SellerLastName, line.OrderDate, bundleCourses, userCourses);
            }
        }