Example #1
0
        public BaseResponse TotalReport()
        {
            var response = new BaseSingleResponse <TotalReportVM>();

            try
            {
                var vm = new TotalReportVM();
                BTCStoreTransactionRepository btcRepo      = new BTCStoreTransactionRepository();
                HistoryBTCWithDrawRepository  withdrawRepo = new HistoryBTCWithDrawRepository();

                vm.TotalDeposit = btcRepo.GetTable().Where(x => x.Type == (int)BTCStoreTransactionTypeEnum.DEPOSIT &&
                                                           x.Status == (int)BTCStoreTransactionStatusEnum.CONFIRMED)
                                  .Sum(x => x.Amount);
                vm.TotalWithDraw = withdrawRepo.GetTable().Where(x => x.Status == (int)HistoryBTCWithDrawStatusEnum.CONFIRMED_WITHDRAW_OK ||
                                                                 x.Status == (int)HistoryBTCWithDrawStatusEnum.CONFIRMED_AND_WAITING_BLOCKCHAIN)
                                   .Sum(x => x.Amount);
                vm.TotalDeposit  = CommonUtils.FoatBTCAmount(vm.TotalDeposit);
                vm.TotalWithDraw = CommonUtils.FoatBTCAmount(vm.TotalWithDraw);

                response.Value = vm;
            }
            catch (Exception ex)
            {
                response.IsSuccess = false;
            }
            return(response);
        }
Example #2
0
 public BTCStoreService()
 {
     _btcStoreRepository            = new BTCStoreRepository();
     _btcStoreTransactionRepository = new BTCStoreTransactionRepository();
 }