Example #1
0
 public HomeController(EventLoggerService eventLogger)
 {
     _eventLogger = eventLogger;
     _eventLogger.AddClass <HomeController>();
 }
Example #2
0
        private ItemPurchaseDataToken _GetPurchaseDataToken(int?id, string trackingId)
        {
            if (id == null)
            {
                var token = new ItemPurchaseDataToken
                {
                    IsValid   = false
                    , Message = "Required param ID missing"
                };

                return(token);
            }
            string error;

            var dto = _widgetCourseServices.GetItemPurchaseDtoByPriceLineId((int)id, out error);

            if (dto == null)
            {
                var token = new ItemPurchaseDataToken
                {
                    IsValid   = false
                    , Message = String.IsNullOrEmpty(error) ? "Item not found" : error
                };

                return(token);
            }

            ItemAccessStateToken itemState;

            switch (dto.Type)
            {
            case BillingEnums.ePurchaseItemTypes.COURSE:
                itemState = _widgetCourseServices.GetCourseAccessState4User(CurrentUserId, dto.ItemId);
                break;

            case BillingEnums.ePurchaseItemTypes.BUNDLE:
                itemState = _widgetCourseServices.GetBundleAccessState4User(CurrentUserId, dto.ItemId);
                break;

            default:
                var token = new ItemPurchaseDataToken
                {
                    IsValid   = false
                    , Message = "Unknown Item type"
                };

                return(token);
            }

            //var itemState = !String.IsNullOrEmpty(courseName) ? _courseServices.GetCourseAccessState4User(CurrentUserId, dto.ItemId) : _courseServices.GetBundleAccessState4User(CurrentUserId, dto.ItemId);

            dto.IsPurchased = itemState.IsAccessAllowed || itemState.IsOwnedByUser;
            dto.TrackingID  = trackingId;

            dto.BillingAddresses = _userAccountServices.GetUserBillingAddresses(CurrentUserId).Where(x => x.IsActive).ToList();
            dto.UserSavedCards   = _userAccountServices.GetUserSavedCardsLOV(CurrentUserId);

            EventLoggerService.Report(new ReportToken
            {
                UserId             = CurrentUserId,
                EventType          = CommonEnums.eUserEvents.BUY_PAGE_ENTERED,
                NetSessionId       = Session.SessionID,
                AdditionalMiscData = string.Format("item ID: {0}, itemType {1}", dto.ItemId, dto.Type == BillingEnums.ePurchaseItemTypes.BUNDLE ? "Bundle" : "Course"),
                TrackingID         = trackingId,
                CourseId           = dto.Type == BillingEnums.ePurchaseItemTypes.COURSE ? dto.ItemId : (int?)null,
                BundleId           = dto.Type == BillingEnums.ePurchaseItemTypes.BUNDLE ? dto.ItemId : (int?)null,
                HostName           = GetReferrer()
            });

            return(dto);
        }
Example #3
0
 public Parser(EventLoggerService eventLogger)
 {
     _eventLogger = eventLogger;
     _eventLogger.AddClass <Parser>();
 }