コード例 #1
0
        public List <UserTranscationInfo> GetUserMonthSTT(int userId, int month)
        {
            var trans = _transactionRepository.GetAll().Where(t => (t.SenderId == userId || t.ReceiverId == userId) && t.Time.Month == month);
            List <UserTranscationInfo> listUti = new List <UserTranscationInfo>();
            UserTranscationInfo        uti     = null;

            foreach (var tran in trans)
            {
                uti = new UserTranscationInfo()
                {
                    Amount = tran.Amount,
                    Detail = tran.Detail,
                    State  = tran.State,
                    Time   = tran.Time,
                    Type   = tran.Type
                };
                listUti.Add(uti);
            }

            return(listUti);
        }
コード例 #2
0
        public List <UserTranscationInfo> GetCompanyMonthSTT(int month)
        {
            var trans = _transactionRepository.GetAll().Where(t => t.Type == PaymentConstants.PAYMENT_TYPE_PAY && t.Time.Month == month);
            List <UserTranscationInfo> listUti = new List <UserTranscationInfo>();
            UserTranscationInfo        uti     = null;

            foreach (var tran in trans)
            {
                uti = new UserTranscationInfo()
                {
                    Amount = tran.Amount,
                    Detail = tran.Detail,
                    State  = tran.State,
                    Time   = tran.Time,
                    Type   = tran.Type
                };
                listUti.Add(uti);
            }

            return(listUti);
        }
コード例 #3
0
ファイル: IWalletService.cs プロジェクト: neoandeson/bustap
        public UserWalletInfo GetWallet(int userId)
        {
            UserWalletInfo userWalletInfo = null;

            Wallet wallet = _walletRepository
                            .GetAll()
                            .Where(w => w.UserId == userId)
                            .FirstOrDefault();

            if (wallet != null)
            {
                userWalletInfo = new UserWalletInfo()
                {
                    Id      = wallet.Id,
                    Balance = wallet.Balance,
                    UserId  = wallet.UserId
                };

                List <Transaction> transactions = _transactionRepository.GetAll().Where(t => t.SenderId == userId || t.ReceiverId == userId).ToList();

                UserTranscationInfo uti = null;
                foreach (var transaction in transactions)
                {
                    uti = new UserTranscationInfo()
                    {
                        Amount = transaction.Amount,
                        Detail = transaction.Detail,
                        State  = transaction.State,
                        Time   = transaction.Time,
                        Type   = transaction.Type
                    };
                    userWalletInfo.Transactions.Add(uti);
                }

                userWalletInfo.Transactions.OrderBy(t => t.Time);
            }

            return(userWalletInfo);
        }