Exemplo n.º 1
0
 /// <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);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 满减营销活动费用设置
        /// </summary>
        /// <returns></returns>
        public static decimal GetMarketServicePrice()
        {
            var marketser = MarketApplication.GetServiceSetting(CurMarketType);

            if (marketser == null)
            {
                marketser = SetMarketServicePrice(0.00m);
            }
            return(marketser.Price);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 购买拼团服务
 /// </summary>
 /// <param name="month">数量(月)</param>
 /// <param name="shopId">店铺编号</param>
 public static void BuyMarketService(int month, long shopId)
 {
     if (shopId <= 0)
     {
         throw new MallException("错误的商家编号");
     }
     if (month <= 0)
     {
         throw new MallException("错误的购买数量(月)");
     }
     if (month > 120)
     {
         throw new MallException("购买数量(月)过大");
     }
     MarketApplication.OrderMarketService(month, shopId, CurMarketType);
 }
Exemplo n.º 6
0
        /// <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
            });
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取拼团营销服务
        /// </summary>
        /// <param name="shopId"></param>
        /// <returns></returns>
        public static MarketServiceModel GetMarketService(long shopId)
        {
            MarketServiceModel result = new MarketServiceModel();
            var market    = MarketApplication.GetMarketService(shopId, CurMarketType);
            var marketser = MarketApplication.GetServiceSetting(CurMarketType);

            result.LastBuyPrice = -1;
            if (marketser != null)
            {
                if (marketser.Price >= 0)
                {
                    result.ShopId     = shopId;
                    result.Price      = marketser.Price;
                    result.MarketType = CurMarketType;
                    if (market != null && market.Id > 0)
                    {
                        result.EndTime      = MarketApplication.GetServiceEndTime(market.Id);
                        result.LastBuyPrice = MarketApplication.GetLastBuyPrice(market.Id);
                    }
                }
            }
            return(result);
        }
Exemplo n.º 8
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
            };

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

            if (marketEntities.Total > 0)
            {
                result.Models = marketEntities.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();
            }
            if (result.Models == null)
            {
                result.Models = new List <MarketServiceBuyRecordModel>();
            }
            result.Total = marketEntities.Total;

            return(result);
        }