示例#1
0
        /// <summary>
        /// 获取服务购买列表
        /// </summary>
        /// <param name="shopName"></param>
        /// <param name="page"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public static QueryPageModel <MarketServiceBuyRecordModel> GetMarketServiceBuyList(string shopName, int page = 1, int pagesize = 10)
        {
            QueryPageModel <MarketServiceBuyRecordModel> result = new QueryPageModel <MarketServiceBuyRecordModel>();
            var queryModel = new MarketBoughtQuery()
            {
                PageSize   = pagesize,
                PageNo     = page,
                ShopName   = shopName,
                MarketType = CurMarketType
            };

            ObsoletePageModel <MarketServiceRecordInfo> marketEntities = MarketApplication.GetBoughtShopList(queryModel);

            if (marketEntities.Total > 0)
            {
                result.Models = marketEntities.Models.Select(d => new MarketServiceBuyRecordModel
                {
                    Id              = d.Id,
                    EndTime         = d.EndTime,
                    MarketServiceId = d.MarketServiceId,
                    StartTime       = d.StartTime,
                    SettlementFlag  = d.SettlementFlag,
                    ShopName        = d.ActiveMarketServiceInfo.ShopName
                }).ToList();
            }
            if (result.Models == null)
            {
                result.Models = new List <MarketServiceBuyRecordModel>();
            }
            result.Total = marketEntities.Total;

            return(result);
        }
 /// <summary>
 /// 设置拼团营销活动费用设置
 /// </summary>
 /// <param name="price"></param>
 public static void SetMarketServicePrice(decimal price)
 {
     Entities.MarketSettingInfo marketser = new Entities.MarketSettingInfo()
     {
         TypeId = CurMarketType, Price = price
     };
     MarketApplication.AddOrUpdateServiceSetting(marketser);
 }
示例#3
0
        /// <summary>
        /// 设置满减营销活动费用设置
        /// </summary>
        /// <param name="price"></param>
        public static MarketSettingInfo SetMarketServicePrice(decimal price)
        {
            MarketSettingInfo marketser = new MarketSettingInfo()
            {
                TypeId = CurMarketType, Price = price
            };

            MarketApplication.AddOrUpdateServiceSetting(marketser);
            return(marketser);
        }
示例#4
0
        /// <summary>
        /// 满减营销活动费用设置
        /// </summary>
        /// <returns></returns>
        public static decimal GetMarketServicePrice()
        {
            var marketser = MarketApplication.GetServiceSetting(CurMarketType);

            if (marketser == null)
            {
                marketser = SetMarketServicePrice(0.00m);
            }
            return(marketser.Price);
        }
        /// <summary>
        /// 获取营销服务费用明细(需移至营销服务BLL但目前没有此BLL)
        /// </summary>
        /// <param name="query">营销费用购买Id</param>
        /// <returns></returns>
        public static MarketServicesRecord GetMarketServiceRecord(long Id, long?shopId = null)
        {
            var model = MarketApplication.GetShopMarketServiceRecordInfo(Id);

            if (shopId.HasValue && shopId.Value != model.ActiveMarketServiceInfo.ShopId)
            {
                throw new Core.HimallException("找不到诊所的购买明细");
            }
            var record = ConvertToMarketServicesRecord(model);

            return(record);
        }
示例#6
0
        /// <summary>
        /// 是否已开启满减营销
        /// </summary>
        /// <returns></returns>
        public static bool IsOpenMarketService()
        {
            bool result    = false;
            var  marketser = MarketApplication.GetServiceSetting(CurMarketType);

            if (marketser != null)
            {
                if (marketser.Price >= 0)
                {
                    result = true;
                }
            }
            return(result);
        }
        /// <summary>
        /// 拼团营销活动费用设置
        /// </summary>
        /// <returns></returns>
        public static decimal GetMarketServicePrice()
        {
            var marketser = MarketApplication.GetServiceSetting(CurMarketType);

            if (marketser == null)
            {
                marketser = new Entities.MarketSettingInfo()
                {
                    TypeId = CurMarketType, Price = 0
                };
                MarketApplication.AddOrUpdateServiceSetting(marketser);
            }
            return(marketser.Price);
        }
示例#8
0
 /// <summary>
 /// 购买满减服务
 /// </summary>
 /// <param name="month">数量(月)</param>
 /// <param name="shopId">诊所编号</param>
 public static void BuyMarketService(int month, long shopId)
 {
     if (shopId <= 0)
     {
         throw new HimallException("错误的诊所编号");
     }
     if (month <= 0)
     {
         throw new HimallException("错误的购买数量(月)");
     }
     if (month > 120)
     {
         throw new HimallException("购买数量(月)过大");
     }
     MarketApplication.OrderMarketService(month, shopId, CurMarketType);
 }
示例#9
0
        /// <summary>
        /// 获取满减营销服务
        /// </summary>
        /// <param name="shopId"></param>
        /// <returns></returns>
        public static MarketServiceModel GetMarketService(long shopId)
        {
            MarketServiceModel result = null;
            var market    = MarketApplication.GetMarketService(shopId, CurMarketType);
            var marketser = MarketApplication.GetServiceSetting(CurMarketType);

            if (marketser != null)
            {
                if (marketser.Price >= 0)
                {
                    result            = new MarketServiceModel();
                    result.ShopId     = shopId;
                    result.Price      = marketser.Price;
                    result.MarketType = CurMarketType;
                    if (market != null)
                    {
                        result.EndTime = market.ServiceEndTime;
                    }
                }
            }
            return(result);
        }
        /// <summary>
        /// 获取服务购买列表
        /// </summary>
        /// <param name="shopName"></param>
        /// <param name="page"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public static QueryPageModel <MarketServiceBuyRecordModel> GetMarketServiceBuyList(MarketBoughtQuery query)
        {
            var data = MarketApplication.GetBoughtShopList(query);
            var list = data.Models.Select(d => {
                var market = MarketApplication.GetMarketService(d.MarketServiceId);
                return(new MarketServiceBuyRecordModel
                {
                    Id = d.Id,
                    EndTime = d.EndTime,
                    MarketServiceId = d.MarketServiceId,
                    StartTime = d.StartTime,
                    SettlementFlag = d.SettlementFlag,
                    ShopName = market.ShopName
                });
            }).ToList();

            return(new QueryPageModel <MarketServiceBuyRecordModel>
            {
                Models = list,
                Total = data.Total
            });
        }