Beispiel #1
0
        public static ISenderBuilder Create(int bookmakerId       = 0,
                                            int limitId           = 0,
                                            string currency       = null,
                                            SenderChannel?channel = null)
        {
            var tempChannel = SenderChannel.Internet;

            try
            {
                if (!_sectionLoaded)
                {
                    SdkConfigurationSection.TryGetSection(out _section);
                    _sectionLoaded = true;
                }

                if (_section != null)
                {
                    if (bookmakerId == 0)
                    {
                        bookmakerId = _section.BookmakerId;
                    }
                    if (limitId == 0)
                    {
                        limitId = _section.LimitId;
                    }
                    if (string.IsNullOrEmpty(currency))
                    {
                        currency = _section.Currency;
                    }
                    if (_section.Channel != null)
                    {
                        tempChannel = (SenderChannel)_section.Channel;
                    }
                }
                if (channel != null)
                {
                    tempChannel = (SenderChannel)channel;
                }
            }
            catch (Exception)
            {
                // ignored
            }
            return(new SenderBuilder(bookmakerId, limitId, currency, tempChannel));
        }
        public static ITicketCashoutBuilder Create(int bookmakerId = 0)
        {
            if (!_sectionLoaded)
            {
                SdkConfigurationSection.TryGetSection(out _section);
                _sectionLoaded = true;
            }

            if (_section != null && bookmakerId == 0)
            {
                try
                {
                    var config = SdkConfigurationSection.GetSection();
                    bookmakerId = config.BookmakerId;
                }
                catch (Exception)
                {
                    // if exists, try to load, otherwise user must explicitly set it
                }
            }
            return(new TicketCashoutBuilder(bookmakerId));
        }