internal LotteryDTO(lottery item)
            : base(new sportEvent
        {
            id   = item == null ? "wns:lottery:1" : item.id,
            name = item.name,
            scheduledSpecified = false,
            scheduled          = DateTime.MinValue,
            tournament         = item.sport == null
                    ? null
                    : new tournament
            {
                sport = item.sport
            }
        })
        {
            Guard.Argument(item, nameof(item)).NotNull();

            if (item.sport != null)
            {
                Sport = new SportDTO(item.sport.id, item.sport.name, (IEnumerable <tournamentExtended>)null);
            }
            if (item.category != null)
            {
                Category = new CategorySummaryDTO(item.category);
            }
            if (item.bonus_info != null)
            {
                BonusInfo = new BonusInfoDTO(item.bonus_info);
            }
            if (item.draw_info != null)
            {
                DrawInfo = new DrawInfoDTO(item.draw_info);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CategoryCI"/> class.
        /// </summary>
        /// <param name="data">A <see cref="CategoryDTO"/> containing the category data</param>
        /// <param name="culture">A <see cref="CultureInfo"/> specifying the language of the provided data</param>
        /// <param name="sportId">The id of the parent sport</param>
        /// <param name="tournamentIds">The list of tournament ids</param>
        public CategoryCI(CategorySummaryDTO data, CultureInfo culture, URN sportId, IEnumerable <URN> tournamentIds)
            : base(data.Id, data.Name, culture)
        {
            Contract.Requires(sportId != null);

            TournamentIds = tournamentIds == null ? null : new ReadOnlyCollection <URN>(tournamentIds.ToList());
            SportId       = sportId;
            CountryCode   = data.CountryCode;
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CategoryCI"/> class.
        /// </summary>
        /// <param name="data">A <see cref="CategoryDTO"/> containing the category data</param>
        /// <param name="culture">A <see cref="CultureInfo"/> specifying the language of the provided data</param>
        /// <param name="sportId">The id of the parent sport</param>
        /// <param name="tournamentIds">The list of tournament ids</param>
        public CategoryCI(CategorySummaryDTO data, CultureInfo culture, URN sportId, IEnumerable <URN> tournamentIds)
            : base(data.Id, data.Name, culture)
        {
            Guard.Argument(sportId, nameof(sportId)).NotNull();

            TournamentIds = tournamentIds == null ? null : new ReadOnlyCollection <URN>(tournamentIds.ToList());
            SportId       = sportId;
            CountryCode   = data.CountryCode;
        }
Esempio n. 4
0
 private void AddCategory(URN id, CategorySummaryDTO item, URN sportId, IEnumerable <URN> tournamentIds, CultureInfo culture)
 {
     lock (_mergeLock)
     {
         try
         {
             if (Categories.ContainsKey(id))
             {
                 CategoryCI ci;
                 Categories.TryGetValue(id, out ci);
                 ci?.Merge(new CategoryCI(item, culture, sportId, tournamentIds), culture);
             }
             else
             {
                 Categories.Add(id, new CategoryCI(item, culture, sportId, tournamentIds));
             }
         }
         catch (Exception e)
         {
             ExecutionLog.Error($"Error saving CategorySummaryDTO for {id} and lang={culture.TwoLetterISOLanguageName}.", e);
         }
     }
 }