示例#1
0
        private GetMerchantDetailOM GetFiiiPosMerchantDetail(MerchantInformation merchantDetail)
        {
            var weekArray = Enum.GetValues(typeof(Week));

            var weekList = new List <int>();

            foreach (var item in weekArray)
            {
                if (merchantDetail.Week.HasFlag((Enum)item))
                {
                    weekList.Add((int)Math.Log((int)item, 2) + 1);
                }
            }

            var currencyList  = new MerchantWalletDAC().SupportReceiptList(merchantDetail.MerchantAccountId);
            var cryptoDict    = new CryptocurrencyDAC().GetAll().ToDictionary(item => item.Code);
            var imageList     = new MerchantOwnersFigureDAC().GetOwnersFiguresById(merchantDetail.Id);
            var recommendList = new MerchantRecommendDAC().GetRecommendsById(merchantDetail.Id);

            var result = new GetMerchantDetailOM()
            {
                AccountType             = (int)Entities.Enums.AccountType.Merchant,
                IsAllowExpense          = merchantDetail.IsAllowExpense,
                AvailableCryptoCodeList = currencyList.Select(item => item.CryptoCode).ToList(),
                AvailableCryptoIconList = currencyList.Select(item =>
                {
                    if (cryptoDict.ContainsKey(item.CryptoCode))
                    {
                        return(cryptoDict[item.CryptoCode].IconURL.ToString());
                    }
                    return(string.Empty);
                }).Where(item => !string.IsNullOrEmpty(item)).ToList(),
                Address       = merchantDetail.Address,
                EndDate       = merchantDetail.EndTime,
                StartDate     = merchantDetail.StartTime,
                BussinessHour = merchantDetail.WeekTxt,
                ImageUrls     = imageList.Select(item => item.FileId).ToList(),
                Location      = new Location()
                {
                    Longitude = merchantDetail.Lng, Latitude = merchantDetail.Lat
                },
                Introduce      = merchantDetail.Introduce,
                RecommendGoods = recommendList.Select(item => new Goods()
                {
                    Content = item.RecommendContent, Image = new ImageWithCompressImage()
                    {
                        Compress = item.ThumbnailId, Origin = item.RecommendPicture
                    }
                }).ToList(),
                Tags      = merchantDetail.Tags.Split(','),
                Title     = merchantDetail.MerchantName,
                Phone     = merchantDetail.Phone,
                PhoneCode = merchantDetail.PhoneCode,
                Weeks     = weekList
            };

            return(result);
        }
示例#2
0
        private GetMerchantDetailOM GetFiiiPayMerchantDetail(MerchantInformation merchantDetail)
        {
            var weekArray = Enum.GetValues(typeof(Week));

            var weekList = new List <int>();

            foreach (var item in weekArray)
            {
                if (merchantDetail.Week.HasFlag((Enum)item))
                {
                    weekList.Add((int)Math.Log((int)item, 2) + 1);
                }
            }

            var supportCurrencyList = new MerchantSupportCryptoDAC().GetList(merchantDetail.Id);
            var supportCryptoIdList = supportCurrencyList.Select(t => t.CryptoId).ToList();
            var cryptoList          = new CryptocurrencyDAC().GetAll();
            var imageList           = new MerchantOwnersFigureDAC().GetOwnersFiguresById(merchantDetail.Id);
            var recommendList       = new MerchantRecommendDAC().GetRecommendsById(merchantDetail.Id);

            var result = new GetMerchantDetailOM()
            {
                AccountType             = (int)AccountType.User,
                IsAllowExpense          = merchantDetail.IsAllowExpense,
                AvailableCryptoCodeList = supportCurrencyList.Select(item => item.CryptoCode).ToList(),
                AvailableCryptoIconList = cryptoList.Where(c => supportCryptoIdList.Contains(c.Id)).Select(t => t.IconURL.ToString()).ToList(),
                Address       = merchantDetail.Address,
                BussinessHour = merchantDetail.WeekTxt,
                ImageUrls     = imageList.Select(item => item.FileId).ToList(),
                Location      = new Location()
                {
                    Longitude = merchantDetail.Lng, Latitude = merchantDetail.Lat
                },
                Introduce      = merchantDetail.Introduce,
                RecommendGoods = recommendList.Select(item => new Goods()
                {
                    Content = item.RecommendContent, Image = new ImageWithCompressImage()
                    {
                        Compress = item.ThumbnailId, Origin = item.RecommendPicture
                    }
                }).ToList(),
                Tags      = merchantDetail.Tags.Split(','),
                Title     = merchantDetail.MerchantName,
                Phone     = merchantDetail.Phone,
                PhoneCode = merchantDetail.PhoneCode
            };

            return(result);
        }