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 FrenoySync(FrenoySyncOptions options, bool isVttl = true) { _db = new TtcDbContext(); #region Switch between VTTL and Sporta here // TODO: Pointless to use the EF logging: Parameter values are not part of the output... //_logFileInfo = new FileInfo(@"C:\temp\log" + DateTime.Now.ToString("hh:mm:ss").Replace(":", "") + ".txt"); //_logFile = new StreamWriter(_logFileInfo.FullName); //_db.Database.Log = message => _log.AppendLine(message); // TODO: The logs contain parameters without the values, so the queries are useless // -> Perhaps Glimpse can help here? It got some parameter replacement thingie _options = options; //CheckPlayers(); _isVttl = isVttl; //string wsdl; if (isVttl) { _thuisClubId = _db.Clubs.Single(x => x.CodeVttl == options.FrenoyClub).Id; //wsdl = FrenoyVttlWsdlUrl; } else { // Sporta _thuisClubId = _db.Clubs.Single(x => x.CodeSporta == options.FrenoyClub).Id; //wsdl = FrenoySportaWsdlUrl; } // Aparently the signatures for VTTL and Sporta are not identical // Problem is probably stuff like: xmlns="http://api.frenoy.net/TabTAPI" in the body //var binding = new BasicHttpBinding(); //binding.Security.Mode = BasicHttpSecurityMode.None; //var endpoint = new EndpointAddress(wsdl); //_frenoy = new TabTAPI_PortTypeClient(binding, endpoint); #endregion // Right click the Service Reference and update with different Url... _frenoy = new FrenoyVttl.TabTAPI_PortTypeClient(); }
public FrenoySync(FrenoySyncOptions options, bool isVttl = true) { _db = new TtcDbContext(); #region Switch between VTTL and Sporta here // TODO: Pointless to use the EF logging: Parameter values are not part of the output... //_logFileInfo = new FileInfo(@"C:\temp\log" + DateTime.Now.ToString("hh:mm:ss").Replace(":", "") + ".txt"); //_logFile = new StreamWriter(_logFileInfo.FullName); //_db.Database.Log = message => _log.AppendLine(message); // TODO: The logs contain parameters without the values, so the queries are useless // -> Perhaps Glimpse can help here? It got some parameter replacement thingie _options = options; //CheckPlayers(); _isVttl = isVttl; //string wsdl; if (isVttl) { _thuisClubId = _db.Clubs.Single(x => x.CodeVttl == options.FrenoyClub).Id; //wsdl = FrenoyVttlWsdlUrl; } else { // Sporta _thuisClubId = _db.Clubs.Single(x => x.CodeSporta == options.FrenoyClub).Id; //wsdl = FrenoySportaWsdlUrl; } // Aparently the signatures for VTTL and Sporta are not identical // Problem is probably stuff like: xmlns="http://api.frenoy.net/TabTAPI" in the body //var binding = new BasicHttpBinding(); //binding.Security.Mode = BasicHttpSecurityMode.None; //var endpoint = new EndpointAddress(wsdl); //_frenoy = new TabTAPI_PortTypeClient(binding, endpoint); #endregion // Right click the Service Reference and update with different Url... _frenoy = new FrenoyVttl.TabTAPI_PortTypeClient(); }
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); } }