public async Task Update(ISqlTransactionHandler transactionHandler, ClientCredentialData clientCredentialData)
        {
            if (clientCredentialData.Manager.GetState(clientCredentialData) == DataState.Updated)
            {
                await _providerFactory.EstablishTransaction(transactionHandler, clientCredentialData);

                using (DbCommand command = transactionHandler.Connection.CreateCommand())
                {
                    command.CommandText = "[bla].[UpdateClientCredential]";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Transaction = transactionHandler.Transaction.InnerTransaction;

                    IDataParameter timestamp = DataUtil.CreateParameter(_providerFactory, "timestamp", DbType.DateTime2);
                    timestamp.Direction = ParameterDirection.Output;
                    command.Parameters.Add(timestamp);

                    DataUtil.AddParameter(_providerFactory, command.Parameters, "id", DbType.Guid, DataUtil.GetParameterValue(clientCredentialData.ClientCredentialId));
                    DataUtil.AddParameter(_providerFactory, command.Parameters, "isActive", DbType.Boolean, DataUtil.GetParameterValue(clientCredentialData.IsActive));

                    await command.ExecuteNonQueryAsync();

                    clientCredentialData.UpdateTimestamp = (DateTime)timestamp.Value;
                }
            }
        }
Example #2
0
 public ClientCredential(IClient client,
                         ClientCredentialData data,
                         IClientCredentialDataSaver dataSaver)
 {
     _client    = client;
     _data      = data;
     _dataSaver = dataSaver;
 }