public List <GetMerchantInfoOM> GetMerchantInfoList(GetMerchantInfoListIM im)
        {
            if (im.PageSize > 20)
            {
                im.PageSize = 20;
            }
            List <MerchantBriefInformation> list;

            if (im.Location == null)
            {
                list = new MerchantInformationDAC().QueryMerchantListByCountryId(im.Filter.CountryId, im.PageIndex, im.PageSize, im.Filter.KeyWord,
                                                                                 im.Filter.Category);
            }
            else
            {
                list = new MerchantInformationDAC().QueryNearbyMerchantList(im.Location.Latitude, im.Location.Longitude, im.Filter.CountryId, im.PageSize, im.PageIndex, im.Filter.KeyWord, im.Filter.Category);
            }

            var mwDAC      = new MerchantWalletDAC();
            var mscDAC     = new MerchantSupportCryptoDAC();
            var cryptoList = new CryptoComponent().GetList();

            return(list.Select(item =>
            {
                List <int> supportCryptoIdList = new List <int>();
                if (item.AccountType == (byte)AccountType.Merchant)
                {
                    supportCryptoIdList = mwDAC.SupportReceiptList(item.MerchantAccountId).Select(t => t.CryptoId).ToList();
                }
                else
                {
                    supportCryptoIdList = mscDAC.GetList(item.Id).Select(t => t.CryptoId).ToList();
                }

                return new GetMerchantInfoOM()
                {
                    AccountType = item.AccountType,
                    IsAllowExpense = item.IsAllowExpense,
                    Address = item.Address,
                    AvailableCryptoIconList = cryptoList.Where(c => supportCryptoIdList.Contains(c.Id)).Select(t => t.IconURL.ToString()).ToList(),
                    Distance = item.Distance.ToSpecificDecimal(2).ToString(CultureInfo.InvariantCulture),
                    OriginIconId = item.FileId,
                    CompressIconId = item.ThumbnailId ?? Guid.Empty,
                    Id = item.MerchantInformationId,
                    Location = new Location()
                    {
                        Longitude = item.Lng, Latitude = item.Lat
                    },
                    Tags = item.Tags.Split(',').ToList(),
                    Title = item.MerchantName
                };
            }).ToList());
        }
Beispiel #2
0
        public ServiceResult <DataListWithPageResultModel <OrderRecordListOutModel> > GetOrderRecordList(OrderRecordListInModel model)
        {
            DataListWithPageResultModel <OrderRecordListOutModel> outputModel = new DataListWithPageResultModel <OrderRecordListOutModel>();

            int count;
            List <OrderByPage> list = new OrderComponent().GetOrderRecordList(WorkContext.MerchantId, model.OrderNo, model.States, model.StartDate, model.EndDate, model.PageIndex, model.PageSize, out count);
            var cryptoList          = new CryptoComponent().GetList();
            List <OrderRecordListOutModel> outputList = new List <OrderRecordListOutModel>();

            foreach (OrderByPage order in list)
            {
                outputList.Add(new OrderRecordListOutModel
                {
                    Id                   = order.Id,
                    OrderNo              = order.OrderNo,
                    PostSN               = order.PostSN,
                    Cellphone            = order.Cellphone,
                    FiatCurrency         = order.FiatCurrency,
                    FiatAmount           = order.FiatAmount,
                    Markup               = order.Markup,
                    ActualCryptoAmount   = order.ActualCryptoAmount,
                    CryptoName           = order.CryptoName,
                    ExchangeRate         = order.ExchangeRate,
                    CryptoAmount         = order.CryptoAmount,
                    TransactionFee       = order.TransactionFee.ToString(),
                    ActualFiatAmount     = order.ActualFiatAmount,
                    Status               = order.Status,
                    Timestamp            = order.Timestamp.ToLocalTime().ToUnixTime(),
                    CurrentExchangeRate  = order.CurrentExchangeRate,
                    IncreaseRate         = order.IncreaseRate,
                    WithdrawalFee        = order.WithdrawalFee,
                    WithdrawalCryptoCode = cryptoList.Where(t => t.Id == order.WithdrawalCryptoId).Select(t => t.Code).FirstOrDefault()
                });
            }

            outputModel.TotalCount = count;
            outputModel.DataList   = outputList;

            return(Result_OK(outputModel));
        }