Beispiel #1
0
 /// <summary>
 /// 从IDataReader创建BuySendPromotionInfo
 /// </summary>
 public static BuySendPromotionInfo BuildBuySendPromotionFromReader(IDataReader reader)
 {
     BuySendPromotionInfo buySendPromotionInfo = new BuySendPromotionInfo();
     buySendPromotionInfo.PmId = TypeHelper.ObjectToInt(reader["pmid"]);
     buySendPromotionInfo.StoreId = TypeHelper.ObjectToInt(reader["storeid"]);
     buySendPromotionInfo.StartTime = TypeHelper.ObjectToDateTime(reader["starttime"]);
     buySendPromotionInfo.EndTime = TypeHelper.ObjectToDateTime(reader["endtime"]);
     buySendPromotionInfo.UserRankLower = TypeHelper.ObjectToInt(reader["userranklower"]);
     buySendPromotionInfo.State = TypeHelper.ObjectToInt(reader["state"]);
     buySendPromotionInfo.Name = reader["name"].ToString();
     buySendPromotionInfo.Type = TypeHelper.ObjectToInt(reader["type"]);
     buySendPromotionInfo.BuyCount = TypeHelper.ObjectToInt(reader["buycount"]);
     buySendPromotionInfo.SendCount = TypeHelper.ObjectToInt(reader["sendcount"]);
     return buySendPromotionInfo;
 }
Beispiel #2
0
        /// <summary>
        /// 获得买送促销活动
        /// </summary>
        /// <param name="buyCount">购买数量</param>
        /// <param name="pid">商品id</param>
        /// <param name="buyTime">购买时间</param>
        /// <returns></returns>
        public static BuySendPromotionInfo GetBuySendPromotion(int buyCount, int pid, DateTime buyTime)
        {
            BuySendPromotionInfo buySendPromotionInfo = null;
            //获得买送促销活动列表
            List <BuySendPromotionInfo> buySendPromotionList = GetBuySendPromotionList(pid, buyTime);

            //买送促销活动存在时
            if (buySendPromotionList.Count > 0)
            {
                foreach (BuySendPromotionInfo item in buySendPromotionList)
                {
                    if (item.BuyCount <= buyCount)
                    {
                        buySendPromotionInfo = item;
                    }
                }
            }
            return(buySendPromotionInfo);
        }
        public ActionResult AddBuySendPromotion(BuySendPromotionModel model)
        {
            if (ModelState.IsValid)
            {
                BuySendPromotionInfo buySendPromotionInfo = new BuySendPromotionInfo()
                {
                    StartTime = model.StartTime,
                    EndTime = model.EndTime,
                    UserRankLower = model.UserRankLower,
                    State = model.State,
                    Name = model.PromotionName,
                    Type = model.Type,
                    BuyCount = model.BuyCount,
                    SendCount = model.SendCount
                };

                AdminPromotions.CreateBuySendPromotion(buySendPromotionInfo);
                AddAdminOperateLog("添加买送促销", "添加买送促销,买送促销为:" + model.PromotionName);
                return PromptView("买送促销添加成功");
            }

            LoadBuySendPromotion();
            return View(model);
        }
 /// <summary>
 /// 更新买送促销活动
 /// </summary>
 public void UpdateBuySendPromotion(BuySendPromotionInfo buySendPromotionInfo)
 {
     DbParameter[] parms = {
                                 GenerateInParam("@starttime", SqlDbType.DateTime,8,buySendPromotionInfo.StartTime),
                                 GenerateInParam("@endtime", SqlDbType.DateTime,8,buySendPromotionInfo.EndTime),
                                 GenerateInParam("@userranklower", SqlDbType.SmallInt,2,buySendPromotionInfo.UserRankLower),
                                 GenerateInParam("@state", SqlDbType.TinyInt,1,buySendPromotionInfo.State),
                                 GenerateInParam("@name", SqlDbType.NVarChar,50,buySendPromotionInfo.Name),
                                 GenerateInParam("@type", SqlDbType.TinyInt,1,buySendPromotionInfo.Type),
                                 GenerateInParam("@buycount", SqlDbType.TinyInt, 1, buySendPromotionInfo.BuyCount),
                                 GenerateInParam("@sendcount", SqlDbType.TinyInt, 1, buySendPromotionInfo.SendCount),
                                 GenerateInParam("@pmid", SqlDbType.Int,4,buySendPromotionInfo.PmId)
                             };
     string commandText = string.Format("UPDATE [{0}buysendpromotions] SET [starttime]=@starttime,[endtime]=@endtime,[userranklower]=@userranklower,[state]=@state,[name]=@name,[type]=@type,[buycount]=@buycount,[sendcount]=@sendcount WHERE [pmid]=@pmid",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
 /// <summary>
 /// 创建买送促销活动
 /// </summary>
 public void CreateBuySendPromotion(BuySendPromotionInfo buySendPromotionInfo)
 {
     DbParameter[] parms = {
                                 GenerateInParam("@starttime", SqlDbType.DateTime,8,buySendPromotionInfo.StartTime),
                                 GenerateInParam("@endtime", SqlDbType.DateTime,8,buySendPromotionInfo.EndTime),
                                 GenerateInParam("@userranklower", SqlDbType.SmallInt,2,buySendPromotionInfo.UserRankLower),
                                 GenerateInParam("@state", SqlDbType.TinyInt,1,buySendPromotionInfo.State),
                                 GenerateInParam("@name", SqlDbType.NVarChar,50,buySendPromotionInfo.Name),
                                 GenerateInParam("@type", SqlDbType.TinyInt,1,buySendPromotionInfo.Type),
                                 GenerateInParam("@buycount", SqlDbType.TinyInt, 1, buySendPromotionInfo.BuyCount),
                                 GenerateInParam("@sendcount", SqlDbType.TinyInt, 1, buySendPromotionInfo.SendCount)
                             };
     string commandText = string.Format("INSERT INTO [{0}buysendpromotions]([starttime],[endtime],[userranklower],[state],[name],[type],[buycount],[sendcount]) VALUES(@starttime,@endtime,@userranklower,@state,@name,@type,@buycount,@sendcount)",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
Beispiel #6
0
 /// <summary>
 /// 更新买送促销活动
 /// </summary>
 public static void UpdateBuySendPromotion(BuySendPromotionInfo buySendPromotionInfo)
 {
     BrnMall.Data.Promotions.UpdateBuySendPromotion(buySendPromotionInfo);
 }
Beispiel #7
0
 /// <summary>
 /// 更新买送促销活动
 /// </summary>
 public static void UpdateBuySendPromotion(BuySendPromotionInfo buySendPromotionInfo)
 {
     BrnMall.Data.Promotions.UpdateBuySendPromotion(buySendPromotionInfo);
 }
Beispiel #8
0
 /// <summary>
 /// 设置订单商品的买送促销活动
 /// </summary>
 /// <param name="orderProductInfo">订单商品</param>
 /// <param name="buyCount">购买数量</param>
 /// <param name="buySendPromotionInfo">买送优惠活动</param>
 public static void SetBuySendPromotionOfOrderProduct(OrderProductInfo orderProductInfo, int buyCount, BuySendPromotionInfo buySendPromotionInfo)
 {
     orderProductInfo.RealCount = buyCount + (buyCount / buySendPromotionInfo.BuyCount) * buySendPromotionInfo.SendCount;
     orderProductInfo.BuyCount = buyCount;
     orderProductInfo.ExtCode2 = buySendPromotionInfo.PmId;
 }
Beispiel #9
0
 /// <summary>
 /// 创建买送促销活动
 /// </summary>
 public static void CreateBuySendPromotion(BuySendPromotionInfo buySendPromotionInfo)
 {
     BrnShop.Data.Promotions.CreateBuySendPromotion(buySendPromotionInfo);
 }
Beispiel #10
0
 /// <summary>
 /// 更新买送促销活动
 /// </summary>
 public static void UpdateBuySendPromotion(BuySendPromotionInfo buySendPromotionInfo)
 {
     BrnMall.Core.BMAData.RDBS.UpdateBuySendPromotion(buySendPromotionInfo);
     if (_promotionnosql != null)
         _promotionnosql.ClearAllBuySendPromotion(buySendPromotionInfo.StoreId);
 }
Beispiel #11
0
 /// <summary>
 /// 创建买送促销活动
 /// </summary>
 public static void CreateBuySendPromotion(BuySendPromotionInfo buySendPromotionInfo)
 {
     BrnShop.Core.BSPData.RDBS.CreateBuySendPromotion(buySendPromotionInfo);
     if (_promotionnosql != null)
         _promotionnosql.ClearAllBuySendPromotion();
 }
Beispiel #12
0
 /// <summary>
 /// 更新买送促销活动
 /// </summary>
 public static void UpdateBuySendPromotion(BuySendPromotionInfo buySendPromotionInfo)
 {
     NStore.Data.Promotions.UpdateBuySendPromotion(buySendPromotionInfo);
 }