public async Task <string> InsertAsync(IForwardWithdrawal forwardWithdrawal) { var entity = ForwardWithdrawalEntity.Create(forwardWithdrawal); await _tableStorage.InsertAsync(entity); return(entity.Id); }
public static ForwardWithdrawalEntity Create(IForwardWithdrawal forwardWithdrawal) { var id = Guid.NewGuid().ToString(); return(new ForwardWithdrawalEntity { Amount = forwardWithdrawal.Amount, AssetId = forwardWithdrawal.AssetId, ClientId = forwardWithdrawal.ClientId, CashInId = forwardWithdrawal.CashInId, DateTime = DateTime.UtcNow, Id = id, PartitionKey = GeneratePartitionKey(forwardWithdrawal.ClientId), RowKey = GenerateRowKey(id) }); }
public static bool IsDue(this IForwardWithdrawal withdrawal, TimeSpan triggerSpan) { return(DateTime.UtcNow - withdrawal.DateTime > triggerSpan); }
//This method is used to raise awareness in case difference between DateTime and Timestamp is too big public static bool DateTimeTimestampDifferenceTooBig(this IForwardWithdrawal withdrawal, TimeSpan critical) { return(withdrawal.Timestamp.UtcDateTime >= withdrawal.DateTime ? withdrawal.Timestamp.UtcDateTime - withdrawal.DateTime > critical : withdrawal.DateTime - withdrawal.Timestamp.UtcDateTime > critical); }