示例#1
0
        public StoreInfoResponse StoreResponseMapping(StoreInfoResponse source, CoordinateInfo coordinateInfo)
        {
            if (coordinateInfo == null)
            {
                return source;
            }

            source.Distance = Distance(coordinateInfo, new CoordinateInfo((double)source.Longitude, (double)source.Latitude));

            return source;
        }
示例#2
0
        private static ItemsInfoResponse ItemsInfoResponseMapping(PromotionEntity source, StoreInfoResponse store, List<ResourceInfoResponse> resources, PromotionInfo info)
        {
            var target = Mapper.Map<PromotionEntity, ItemsInfoResponse>(source);

            target.SType = SourceType.Promotion;
            target.Store = store;
            target.Resources = resources;

            if (info != null)
            {
                target.Promotions = new List<PromotionInfo> { info };
            }

            return target;
        }
示例#3
0
 private ItemsInfoResponse ItemsInfoResponseMapping(PromotionEntity source, StoreInfoResponse store, List<ResourceInfoResponse> resources)
 {
     return ItemsInfoResponseMapping(source, store, resources, null);
 }
示例#4
0
        private static ItemsInfoResponse ItemsInfoResponseMapping(ProductEntity source, StoreInfoResponse store, List<ResourceInfoResponse> resources, List<PromotionInfo> promotionInfos)
        {
            var target = Mapper.Map<ProductEntity, ItemsInfoResponse>(source);

            target.SType = SourceType.Product;
            target.Store = store;
            target.Resources = resources;
            target.Promotions = promotionInfos;

            return target;
        }
示例#5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <param name="brandInfo"></param>
        /// <param name="storeInfo"></param>
        /// <param name="showCustomerInfo"></param>
        /// <param name="tagInfoResponse"></param>
        /// <param name="resourceInfoResponses"></param>
        /// <param name="promotions"></param>
        /// <returns></returns>
        public ProductInfoResponse ProductInfoResponseMapping(ProductEntity source, BrandInfoResponse brandInfo,
                                                                     StoreInfoResponse storeInfo,
                                                                     ShowCustomerInfoResponse showCustomerInfo,
                                                                     TagInfoResponse tagInfoResponse, List<ResourceInfoResponse> resourceInfoResponses, List<PromotionInfo> promotions = null)
        {
            if (source == null)
            {
                return null;
            }

            var target = Mapper.Map<ProductEntity, ProductInfoResponse>(source);

            target.BrandInfoResponse = brandInfo;
            target.StoreInfoResponse = storeInfo;
            target.RecommendUserInfoResponse = showCustomerInfo;
            target.TagInfoResponse = tagInfoResponse;
            target.ResourceInfoResponses = resourceInfoResponses;
            target.Promotions = promotions;

            return target;
        }
示例#6
0
        public PromotionInfoResponse PromotionResponseMapping(PromotionEntity source, CoordinateInfo coordinateInfo, List<int> brandIds, List<ResourceInfoResponse> resourceInfoResponses, StoreInfoResponse storeInfoResponse, ShowCustomerInfoResponse showCustomerInfoResponse)
        {
            if (source == null)
            {
                return null;
            }

            var target = PromotionInfoResponseMapping(source);

            if (showCustomerInfoResponse != null)
            {
                target.ShowCustomer = showCustomerInfoResponse;
            }

            if (storeInfoResponse != null)
            {
                target.StoreInfoResponse = storeInfoResponse;
            }

            if (resourceInfoResponses != null)
            {
                target.ResourceInfoResponses = resourceInfoResponses;
            }

            if (brandIds != null)
            {
                target.BrandIds = brandIds;
            }

            return target;
        }