Example #1
0
        public void TrackAfterPayment(ReceiptViewModel model)
        {
            // Track Analytics
            var tracking = new GoogleAnalyticsTracking(_contextProvider.GetContext());

            // Add the products
            int i = 1;

            foreach (var orderLine in model.Order.OrderLines)
            {
                if (string.IsNullOrEmpty(orderLine.Code) == false)
                {
                    tracking.ProductAdd(code: orderLine.Code,
                                        name: orderLine.Name,
                                        quantity: orderLine.Quantity,
                                        price: (double)orderLine.Price,
                                        position: i
                                        );
                    i++;
                }
            }

            // And the transaction itself
            tracking.Purchase(model.Order.OrderNumber,
                              null, (double)model.Order.TotalAmount, (double)model.Order.Tax, (double)model.Order.Shipping);
        }
        public IList <Entity> GetFriends()
        {
            var friends = _httpContextProvider.GetContext().Cache.Get(FriendsCacheKey) as IList <Entity>;

            if (friends != null && friends.Any())
            {
                return(friends);
            }

            friends = GetNetwork();

            CacheEntityNetwork(friends);

            return(friends);
        }