Example #1
0
        public static async Task InsertIfNotExist(MySqlConnection connection, OTIdentity model)
        {
            var count = await GetCount(connection, model.Identity);

            if (count == 0)
            {
                await Insert(connection, model);
            }
        }
Example #2
0
        public static async Task Insert(MySqlConnection connection, OTIdentity model)
        {
            await connection.ExecuteAsync(
                @"INSERT INTO OTIdentity(Identity, TransactionHash, Version, BlockchainID)
VALUES(@Identity, @TransactionHash, @Version, @BlockchainID)",
                new
            {
                model.Identity,
                model.TransactionHash,
                model.Version,
                model.BlockchainID
            });
        }
Example #3
0
        public static async Task UpdateLastSyncedTimestamp(MySqlConnection connection, OTIdentity model)
        {
            await connection.ExecuteAsync(@"UPDATE OTIdentity
SET LastSyncedTimestamp = @LastSyncedTimestamp
WHERE Identity = @Identity AND BlockchainID = @BlockchainID", new
            {
                model.Identity,
                model.LastSyncedTimestamp,
                model.BlockchainID
            });
        }
Example #4
0
        public static async Task UpdateFromPaidoutAndApprovedCalculation(MySqlConnection connection, OTIdentity model)
        {
            await connection.ExecuteAsync(@"UPDATE OTIdentity
SET Paidout = @Paidout, Approved = @Approved, ActiveOffers = @ActiveOffers, OffersLast7Days = @OffersLast7Days, TotalOffers = @TotalOffers, ManagementWallet = @ManagementWallet, LastActivityTimestamp = @LastActivityTimestamp
WHERE Identity = @Identity AND BlockchainID = @BlockchainID", new
            {
                model.Identity,
                Paidout          = model.Paidout ?? 0,
                Approved         = model.Approved ?? false,
                ActiveOffers     = model.ActiveOffers ?? 0,
                OffersLast7Days  = model.OffersLast7Days ?? 0,
                TotalOffers      = model.TotalOffers ?? 0,
                ManagementWallet = model.ManagementWallet,
                model.BlockchainID,
                model.LastActivityTimestamp
            });
        }
Example #5
0
        public static async Task UpdateFromProfileFunction(MySqlConnection connection, OTIdentity model)
        {
            await connection.ExecuteAsync(@"UPDATE OTIdentity
SET Stake = @Stake, StakeReserved = @StakeReserved, Reputation = @Reputation, WithdrawalPending = @WithdrawalPending, WithdrawalTimestamp = @WithdrawalTimestamp, WithdrawalAmount = @WithdrawalAmount, NodeId = @NodeId, LastSyncedTimestamp = @LastSyncedTimestamp
WHERE Identity = @Identity AND BlockchainID = @BlockchainID", new
            {
                model.Identity,
                Stake         = model.Stake ?? 0,
                StakeReserved = model.StakeReserved ?? 0,
                model.Reputation,
                model.WithdrawalAmount,
                model.WithdrawalPending,
                model.WithdrawalTimestamp,
                model.NodeId,
                model.LastSyncedTimestamp,
                model.BlockchainID
            });
        }