Exemplo n.º 1
0
        public FrenoyApiBase(ITtcDbContext ttcDbContext, Competition comp, bool forceSync = false)
        {
            _forceSync = forceSync;
            _db        = ttcDbContext;

            bool isVttl = comp == Competition.Vttl;

            _currentSeason = _db.CurrentSeason;
            _settings      = isVttl ? FrenoySettings.VttlSettings(_currentSeason) : FrenoySettings.SportaSettings(_currentSeason);

            _isVttl = isVttl;
            if (isVttl)
            {
                _frenoy      = new FrenoyVttl.TabTAPI_PortTypeClient();
                _thuisClubId = _db.Clubs.Single(x => x.CodeVttl == _settings.FrenoyClub).Id;
            }
            else
            {
                // Sporta
                _thuisClubId = _db.Clubs.Single(x => x.CodeSporta == _settings.FrenoyClub).Id;

                var binding = new BasicHttpBinding("TabTAPI_Binding");
                binding.Security.Mode = BasicHttpSecurityMode.Transport;
                var endpoint = new EndpointAddress(FrenoySportaEndpoint);
                _frenoy = new TabTAPI_PortTypeClient(binding, endpoint);
            }

            //_frenoy.Endpoint.Binding.ReceiveTimeout = TimeSpan.FromMinutes(5);
            //_frenoy.Endpoint.Binding.CloseTimeout = TimeSpan.FromMinutes(5);
            //_frenoy.Endpoint.Binding.OpenTimeout = TimeSpan.FromMinutes(5);
            //_frenoy.Endpoint.Binding.SendTimeout = TimeSpan.FromMinutes(5);
        }
        public FrenoyApiBase(ITtcDbContext ttcDbContext, Competition comp)
        {
            _db = ttcDbContext;

            bool isVttl = comp == Competition.Vttl;
            _settings = isVttl ? FrenoySettings.VttlSettings : FrenoySettings.SportaSettings;

            _isVttl = isVttl;
            if (isVttl)
            {
                _frenoy = new FrenoyVttl.TabTAPI_PortTypeClient();
                _thuisClubId = _db.Clubs.Single(x => x.CodeVttl == _settings.FrenoyClub).Id;
            }
            else
            {
                // Sporta
                _thuisClubId = _db.Clubs.Single(x => x.CodeSporta == _settings.FrenoyClub).Id;

                var binding = new BasicHttpBinding("TabTAPI_Binding");
                binding.Security.Mode = BasicHttpSecurityMode.None;
                var endpoint = new EndpointAddress(FrenoySportaEndpoint);
                _frenoy = new TabTAPI_PortTypeClient(binding, endpoint);
            }
        }