Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GroupCI"/> class
        /// </summary>
        /// <param name="exportable">A <see cref="ExportableGroupCI"/> containing group information</param>
        internal GroupCI(ExportableGroupCI exportable)
        {
            if (exportable == null)
            {
                throw new ArgumentNullException(nameof(exportable));
            }

            Id   = exportable.Id;
            Name = exportable.Name;
            try
            {
                CompetitorsIds = exportable.Competitors?.Select(URN.Parse);
                if (!exportable.CompetitorsReferences.IsNullOrEmpty())
                {
                    CompetitorsReferences = new Dictionary <URN, ReferenceIdCI>();
                    foreach (var competitorsReference in exportable.CompetitorsReferences)
                    {
                        var referenceIds = new Dictionary <string, string>();
                        var refs         = competitorsReference.Value.Split(',');
                        foreach (var r in refs)
                        {
                            var refKeyValue = r.Split('=');
                            referenceIds.Add(refKeyValue[0], refKeyValue[1]);
                        }
                        CompetitorsReferences.Add(URN.Parse(competitorsReference.Key), new ReferenceIdCI(referenceIds));
                    }
                }
            }
            catch (Exception e)
            {
                SdkLoggerFactory.GetLoggerForExecution(typeof(GroupCI)).Error("Importing GroupCI", e);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GroupCI"/> class
        /// </summary>
        /// <param name="exportable">A <see cref="ExportableGroupCI"/> containing group information</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to fetch missing data</param>
        internal GroupCI(ExportableGroupCI exportable, IDataRouterManager dataRouterManager)
        {
            if (exportable == null)
            {
                throw new ArgumentNullException(nameof(exportable));
            }

            _dataRouterManager = dataRouterManager;
            Id          = exportable.Id;
            Name        = exportable.Name;
            Competitors = exportable.Competitors?.Select(c => new CompetitorCI(c, dataRouterManager)).ToList();
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GroupCI"/> class
        /// </summary>
        /// <param name="exportable">A <see cref="ExportableGroupCI"/> containing group information</param>
        internal GroupCI(ExportableGroupCI exportable)
        {
            if (exportable == null)
            {
                throw new ArgumentNullException(nameof(exportable));
            }

            Id                    = exportable.Id;
            Name                  = exportable.Name;
            CompetitorsIds        = exportable.Competitors?.Select(URN.Parse).ToList();
            CompetitorsReferences = exportable.CompetitorsReferences?.ToDictionary(c => URN.Parse(c.Key), c => new ReferenceIdCI(c.Value));
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GroupCI"/> class
        /// </summary>
        /// <param name="exportable">A <see cref="ExportableGroupCI"/> containing group information</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to fetch missing data</param>
        internal GroupCI(ExportableGroupCI exportable, IDataRouterManager dataRouterManager)
        {
            if (exportable == null)
            {
                throw new ArgumentNullException(nameof(exportable));
            }

            _dataRouterManager = dataRouterManager;
            Id                    = exportable.Id;
            Name                  = exportable.Name;
            Competitors           = exportable.Competitors?.Select(c => new CompetitorCI(c, dataRouterManager)).ToList();
            CompetitorsReferences = exportable.CompetitorsReferences?.ToDictionary(c => URN.Parse(c.Key), c => new ReferenceIdCI(c.Value));
        }