Beispiel #1
0
        public TransportEntity GetStatement(Guid CheckingAccountID)
        {
            try
            {
                ObjReturn.Sucess = true;
                ObjReturn.Data   = checkingAccountTransactionRepository
                                   .Where(w => w.CheckingAccountID.Equals(CheckingAccountID) && w.CheckingAccountTransactionStatus.Code.Equals((int)CheckingAccountTransactionStatusEnum.Authorized), true, i => i.CheckingAccountTransactionStatus)
                                   .Select(s => new { s.ID, s.Value, s.CurrencyType.Symbol, s.Created, s.CheckingAccountTransactionType.Description, s.TracedID })
                                   .OrderBy(o => o.Created);

                return(ObjReturn);
            }
            catch (Exception ex)
            {
                ObjReturn.Sucess = false;
                ObjReturn.Messages.Add(ex.Message);
                return(ObjReturn);
            }
        }
Beispiel #2
0
        private async Task <double> GetBalance(Guid CheckingAccountID, Guid CurrencyTypeID)
        {
            IDatabase db = connectionMultiplexer.GetDatabase(0);

            RedisValue resultado = await db.HashGetAsync($"CheckingAccountBalance:{CheckingAccountID}", $"CurrencyType:{CurrencyTypeID}");

            if (resultado.IsNull)
            {
                double BalanceByCurrencyType = checkingAccountTransactionRepository
                                               .Where(w => w.CheckingAccountID.Equals(CheckingAccountID) && w.CurrencyTypeID.Equals(CurrencyTypeID))
                                               .Sum(s => s.TransactionValue);

                await db.HashSetAsync($"CheckingAccountBalance:{CheckingAccountID}", $"CurrencyType:{CurrencyTypeID}", MessagePackSerializer.Serialize <double?>(BalanceByCurrencyType));

                return(BalanceByCurrencyType);
            }

            return(MessagePackSerializer.Deserialize <double>(resultado));
        }