private void Update( IEnumerable<GSBUrlDTO> dtos ) { foreach( GSBUrlDTO dto in dtos ) { GSBResultType gsbResultType = GSBResultType.Unknown; try { gsbResultType = new GSBRequest( dto.Url ).Execute(); } catch( GSBBackOffException e ) { // Backoff for 2 hours var backOffTime = 2 * 60 * 60 * 1000; System.Threading.Thread.Sleep( backOffTime ); } if( gsbResultType != GSBResultType.Unknown ) { GSBResultDTO gsbResultDTO = new GSBResultDTO( dto.Id, gsbResultType == GSBResultType.Malware || gsbResultType == GSBResultType.BothPhishingAndMalware, gsbResultType == GSBResultType.Phishing || gsbResultType == GSBResultType.BothPhishingAndMalware ); m_dp.Update( gsbResultDTO ); } else { //TODO: Log } } }
public void Update( GSBResultDTO result ) { SqlConnection conn = SW.Foundation.Data.DatabaseServer.SqlConnection; SqlCommand cmd = new SqlCommand( "s_URLS_GOOGLE_SAFE_BROWSING_Add", conn ); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue( "@Id", result.Id ); cmd.Parameters.AddWithValue( "@Malware", result.Malware ); cmd.Parameters.AddWithValue( "@Phishing", result.Phishing ); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); }