Exemple #1
0
        public List <OrderDTO> SearchReceiptStatement(Guid accountId, string orderno, int pageIndex, int pageSize)
        {
            var orderDac = new OrderDAC();

            var orderList = orderDac.GetMerchantOrderByOrderNo(accountId, orderno, pageIndex, pageSize);

            var coinList = new CryptocurrencyDAC().GetAll();

            var result = new List <OrderDTO>();

            foreach (var order in orderList)
            {
                var coin     = coinList.FirstOrDefault(e => e.Id == order.CryptoId);
                var orderDTO = new OrderDTO
                {
                    Id                 = order.Id,
                    OrderNo            = order.OrderNo,
                    OrderStatus        = order.Status,
                    Timestamp          = order.Timestamp.ToUnixTime(),
                    CryptoCode         = coin?.Code,
                    CryptoAmount       = order.CryptoAmount.ToString(coin?.DecimalPlace ?? 0),
                    FiatCurrency       = order.FiatCurrency,
                    FiatAmount         = order.FiatAmount.ToString("F", CultureInfo.InvariantCulture),
                    UserAccount        = order.UserAccountId.HasValue ? GetUserMastMaskedCellphone(order.UserAccountId.Value) : string.Empty,
                    ActualCryptoAmount = order.ActualCryptoAmount.ToString(coin?.DecimalPlace ?? 0)
                };
                result.Add(orderDTO);
            }

            return(result);
        }