Пример #1
0
        private void TryAddUser(Profiler.User user)
        {
            if (UserKey.IsInvalid(user))
            {
                return;
            }

            User.Add(new UserKey(user));
        }
Пример #2
0
        private Entity.tUser TryGetUser(Profiler.User user)
        {
            if (UserKey.IsInvalid(user))
            {
                return(null);
            }

            var result = _baseData.User[new UserKey(user)];

            return(result);
        }
Пример #3
0
        private void FillUserHashFromEvents(IEnumerable <Profiler.Event> events)
        {
            if (events == null)
            {
                return;
            }

            var valid = events.Where(IsNotNull);

            foreach (var anEvent in valid)
            {
                var user = anEvent.User;

                if (UserKey.IsInvalid(user))
                {
                    throw new ArgumentNullException(nameof(user), "An event has no user assigned.");
                }

                User.Add(new UserKey(user));
            }
        }
Пример #4
0
        private void InsertPurchase(Profiler.PurchaseInfo purchaseInfo)
        {
            if (purchaseInfo == null)
            {
                return;
            }

            IncreaseMax();

            var entity = new Entity.tPurchase()
            {
                tDVD = _currentDVDEntity,
                Date = purchaseInfo.DateSpecified ? purchaseInfo.Date : (DateTime?)null,
                PriceDenomination = purchaseInfo.Price?.Value != 0 ? purchaseInfo.Price.DenominationType : null,
                PriceValue        = purchaseInfo.Price?.Value != 0 ? (decimal)purchaseInfo.Price.Value : (decimal?)null,
                ReceivedAsGift    = purchaseInfo.ReceivedAsGift,
                tPurchasePlace    = !string.IsNullOrEmpty(purchaseInfo.Place) ? _baseData.PurchasePlace[new PurchasePlaceKey(purchaseInfo)] : null,
                tUser             = purchaseInfo.ReceivedAsGift && UserKey.IsValid(purchaseInfo.GiftFrom) ? _baseData.User[new UserKey(purchaseInfo.GiftFrom)] : null,
            };

            _context.tPurchase.Add(entity);

            IncreaseCurrent();
        }