public static void InsertIfNotExist(MySqlConnection connection, OTContract_Holding_OfferCreated model) { var count = connection.QueryFirstOrDefault <Int32>("SELECT COUNT(*) FROM OTContract_Holding_OfferCreated WHERE OfferID = @offerID AND BlockchainID = blockchainID", new { offerID = model.OfferID, blockchainID = model.BlockchainID }); if (count == 0) { connection.Execute( @"INSERT INTO OTContract_Holding_OfferCreated (OfferID,DCNodeId, DataSetId, TransactionIndex, Timestamp, BlockNumber, TransactionHash, DataSetSizeInBytes, TokenAmountPerHolder, HoldingTimeInMinutes, LitigationIntervalInMinutes, ContractAddress, GasUsed, Processed, Data, GasPrice, BlockchainID) VALUES(@OfferID, @DCNodeId, @DataSetId, @TransactionIndex, @Timestamp, @BlockNumber, @TransactionHash, @DataSetSizeInBytes, @TokenAmountPerHolder, @HoldingTimeInMinutes, @LitigationIntervalInMinutes, @ContractAddress, @GasUsed, 0, @Data, @GasPrice, @BlockchainID)", new { model.OfferID, model.DCNodeId, model.DataSetId, model.TransactionIndex, model.Timestamp, model.BlockNumber, model.TransactionHash, model.DataSetSizeInBytes, model.TokenAmountPerHolder, model.HoldingTimeInMinutes, model.LitigationIntervalInMinutes, model.ContractAddress, model.GasUsed, model.Data, model.GasPrice, model.BlockchainID }); } }
public static void SetProcessed(MySqlConnection connection, OTContract_Holding_OfferCreated offerToAdd) { connection.Execute(@"UPDATE OTContract_Holding_OfferCreated SET Processed = 1 WHERE OfferID = @offerID AND BlockchainID = @blockchainID", new { offerID = offerToAdd.OfferID, blockchainID = offerToAdd.BlockchainID }); }