private QuoteServerEvent GetQuoteServerEventFromRecord(NpgsqlDataReader reader)
 {
     var quoteServerEvent = new QuoteServerEvent
     {
         StockSymbol = reader.GetString(9),
         Price = reader.GetDecimal(10),
         QuoteServerTime = reader.GetDateTime(14),
         CryptoKey = reader.GetString(15)
     };
     FillBaseEventPropertiesFromRecord(quoteServerEvent, reader);
     return quoteServerEvent;
 }
        public void LogQuoteServerEvent(QuoteServerEvent quoteServerEvent)
        {
            using (var command = new NpgsqlCommand("log_quote_server_event"))
            {
                Log.DebugFormat("Inserting quote server event {0} into databse...", quoteServerEvent.Id);

                command.CommandType = System.Data.CommandType.StoredProcedure;

                AddCommonEventPropertyParametersToCommand(command, quoteServerEvent);

                command.Parameters.Add(new NpgsqlParameter
                {
                    NpgsqlDbType = NpgsqlDbType.Char,
                    Value = quoteServerEvent.StockSymbol
                });

                command.Parameters.Add(new NpgsqlParameter
                {
                    NpgsqlDbType = NpgsqlDbType.Money,
                    Value = quoteServerEvent.Price
                });

                command.Parameters.Add(new NpgsqlParameter
                {
                    NpgsqlDbType = NpgsqlDbType.TimestampTZ,
                    Value = quoteServerEvent.QuoteServerTime
                });

                command.Parameters.Add(new NpgsqlParameter
                {
                    NpgsqlDbType = NpgsqlDbType.Varchar,
                    Value = quoteServerEvent.CryptoKey
                });

                int id = ExecuteInsertCommand(command);

                Log.DebugFormat(CultureInfo.InvariantCulture,
                    "Successfully inserted quote server event {0} (database id = {1}).", quoteServerEvent.Id, id);
            }
        }