Beispiel #1
0
 public static void Insert(MySqlConnection connection, OTContract_Profile_IdentityCreated model)
 {
     connection.Execute("INSERT INTO OTContract_Profile_IdentityCreated VALUES(@hash, @profile, @newIdentity, @contractAddress, @blockNumber, @GasPrice, @GasUsed, @BlockchainID)", new
     {
         hash            = model.TransactionHash,
         profile         = model.Profile,
         newIdentity     = model.NewIdentity,
         contractAddress = model.ContractAddress,
         blockNumber     = model.BlockNumber,
         model.GasUsed,
         model.GasPrice,
         model.BlockchainID
     });
 }
Beispiel #2
0
        public static void Update(MySqlConnection connection, OTContract_Profile_IdentityCreated model)
        {
            connection.Execute(@"UPDATE OTContract_Profile_IdentityCreated SET TransactionHash = @hash, BlockNumber = @blockNumber,
Profile = @profile, NewIdentity = @newIdentity, GasUsed = @GasUsed, GasPrice = @GasPrice,
ContractAddress = @contractAddress, BlockchainID = @BlockchainID WHERE TransactionHash = @hash AND BlockchainID = @BlockchainID", new
            {
                hash            = model.TransactionHash,
                profile         = model.Profile,
                newIdentity     = model.NewIdentity,
                contractAddress = model.ContractAddress,
                blockNumber     = model.BlockNumber,
                model.GasUsed,
                model.GasPrice,
                model.BlockchainID
            });
        }
Beispiel #3
0
        public static void InsertOrUpdate(MySqlConnection connection, OTContract_Profile_IdentityCreated model)
        {
            var count = connection.QueryFirstOrDefault <Int32>("SELECT COUNT(*) FROM OTContract_Profile_IdentityCreated WHERE TransactionHash = @hash AND BlockchainID = @BlockchainID", new
            {
                hash = model.TransactionHash,
                model.BlockchainID
            });

            if (count == 0)
            {
                Insert(connection, model);
            }
            else
            {
                Update(connection, model);
            }
        }