예제 #1
0
 /// <summary>
 /// 创建满赠促销活动
 /// </summary>
 public void CreateFullSendPromotion(FullSendPromotionInfo fullSendPromotionInfo)
 {
     DbParameter[] parms = {
                                 GenerateInParam("@starttime", SqlDbType.DateTime,8,fullSendPromotionInfo.StartTime),
                                 GenerateInParam("@endtime", SqlDbType.DateTime,8,fullSendPromotionInfo.EndTime),
                                 GenerateInParam("@userranklower", SqlDbType.SmallInt,2,fullSendPromotionInfo.UserRankLower),
                                 GenerateInParam("@state", SqlDbType.TinyInt,1,fullSendPromotionInfo.State),
                                 GenerateInParam("@name", SqlDbType.NVarChar,50,fullSendPromotionInfo.Name),
                                 GenerateInParam("@limitmoney", SqlDbType.Int, 4, fullSendPromotionInfo.LimitMoney),
                                 GenerateInParam("@addmoney", SqlDbType.Int, 4, fullSendPromotionInfo.AddMoney)
                             };
     string commandText = string.Format("INSERT INTO [{0}fullsendpromotions]([starttime],[endtime],[userranklower],[state],[name],[limitmoney],[addmoney]) VALUES(@starttime,@endtime,@userranklower,@state,@name,@limitmoney,@addmoney)",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
예제 #2
0
 /// <summary>
 /// 更新满赠促销活动
 /// </summary>
 public void UpdateFullSendPromotion(FullSendPromotionInfo fullSendPromotionInfo)
 {
     DbParameter[] parms = {
                                 GenerateInParam("@starttime", SqlDbType.DateTime,8,fullSendPromotionInfo.StartTime),
                                 GenerateInParam("@endtime", SqlDbType.DateTime,8,fullSendPromotionInfo.EndTime),
                                 GenerateInParam("@userranklower", SqlDbType.SmallInt,2,fullSendPromotionInfo.UserRankLower),
                                 GenerateInParam("@state", SqlDbType.TinyInt,1,fullSendPromotionInfo.State),
                                 GenerateInParam("@name", SqlDbType.NVarChar,50,fullSendPromotionInfo.Name),
                                 GenerateInParam("@limitmoney", SqlDbType.Int, 4, fullSendPromotionInfo.LimitMoney),
                                 GenerateInParam("@addmoney", SqlDbType.Int, 4, fullSendPromotionInfo.AddMoney),
                                 GenerateInParam("@pmid", SqlDbType.Int,4,fullSendPromotionInfo.PmId)
                             };
     string commandText = string.Format("UPDATE [{0}fullsendpromotions] SET [starttime]=@starttime,[endtime]=@endtime,[userranklower]=@userranklower,[state]=@state,[name]=@name,[limitmoney]=@limitmoney,[addmoney]=@addmoney WHERE [pmid]=@pmid",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
예제 #3
0
        public ActionResult AddFullSendPromotion(FullSendPromotionModel model)
        {
            if (ModelState.IsValid)
            {
                FullSendPromotionInfo fullSendPromotionInfo = new FullSendPromotionInfo()
                {
                    Name = model.PromotionName,
                    StartTime = model.StartTime,
                    EndTime = model.EndTime,
                    UserRankLower = model.UserRankLower,
                    State = model.State,
                    LimitMoney = model.LimitMoney,
                    AddMoney = model.AddMoney
                };

                AdminPromotions.CreateFullSendPromotion(fullSendPromotionInfo);
                AddAdminOperateLog("添加满赠促销活动", "添加满赠促销活动,满赠促销活动为:" + model.PromotionName);
                return PromptView("满赠促销活动添加成功");
            }

            LoadFullSendPromotion();
            return View(model);
        }
예제 #4
0
        /// <summary>
        /// 生成商品的促销信息
        /// </summary>
        /// <param name="singlePromotionInfo">单品促销活动</param>
        /// <param name="buySendPromotionList">买送促销活动列表</param>
        /// <param name="fullSendPromotionInfo">满赠促销活动</param>
        /// <param name="fullCutPromotionInfo">满减促销活动</param>
        /// <returns></returns>
        public static string GeneratePromotionMsg(SinglePromotionInfo singlePromotionInfo, List<BuySendPromotionInfo> buySendPromotionList, FullSendPromotionInfo fullSendPromotionInfo, FullCutPromotionInfo fullCutPromotionInfo)
        {
            StringBuilder promotionMsg = new StringBuilder();
            //单品促销
            if (singlePromotionInfo != null)
            {
                //折扣类别
                switch (singlePromotionInfo.DiscountType)
                {
                    case 0://折扣
                        promotionMsg.AppendFormat("折扣:{0}折<br/>", singlePromotionInfo.DiscountValue);
                        break;
                    case 1://直降
                        promotionMsg.AppendFormat("直降:{0}元<br/>", singlePromotionInfo.DiscountValue);
                        break;
                    case 2://折后价
                        promotionMsg.AppendFormat("折后价:{0}元<br/>", singlePromotionInfo.DiscountValue);
                        break;
                }

                //积分
                if (singlePromotionInfo.PayCredits > 0)
                    promotionMsg.AppendFormat("赠送{0}:{1}<br/>", Credits.PayCreditName, singlePromotionInfo.PayCredits);

                //优惠劵
                if (singlePromotionInfo.CouponTypeId > 0)
                {
                    CouponTypeInfo couponTypeInfo = Coupons.GetCouponTypeById(singlePromotionInfo.CouponTypeId);
                    if (couponTypeInfo != null)
                        promotionMsg.AppendFormat("赠送优惠劵:{0}<br/>", couponTypeInfo.Name);
                }
            }
            //买送促销
            if (buySendPromotionList != null && buySendPromotionList.Count > 0)
            {
                promotionMsg.Append("买送促销:");
                foreach (BuySendPromotionInfo buySendPromotionInfo in buySendPromotionList)
                    promotionMsg.AppendFormat("买{0}送{1},", buySendPromotionInfo.BuyCount, buySendPromotionInfo.SendCount);
                promotionMsg.Remove(promotionMsg.Length - 1, 1);
                promotionMsg.Append("<br/>");
            }
            //满赠促销
            if (fullSendPromotionInfo != null)
            {
                promotionMsg.Append("满赠促销:");
                promotionMsg.AppendFormat("满{0}元加{1}元<br/>", fullSendPromotionInfo.LimitMoney, fullSendPromotionInfo.AddMoney);
            }
            //满减促销
            if (fullCutPromotionInfo != null)
            {
                promotionMsg.Append("满减促销:");
                promotionMsg.AppendFormat("满{0}元减{1}元,", fullCutPromotionInfo.LimitMoney1, fullCutPromotionInfo.CutMoney1);
                if (fullCutPromotionInfo.LimitMoney2 > 0 && fullCutPromotionInfo.CutMoney2 > 0)
                    promotionMsg.AppendFormat("满{0}元减{1}元,", fullCutPromotionInfo.LimitMoney2, fullCutPromotionInfo.CutMoney2);
                if (fullCutPromotionInfo.LimitMoney3 > 0 && fullCutPromotionInfo.CutMoney3 > 0)
                    promotionMsg.AppendFormat("满{0}元减{1}元,", fullCutPromotionInfo.LimitMoney3, fullCutPromotionInfo.CutMoney3);
                promotionMsg.Remove(promotionMsg.Length - 1, 1);
                promotionMsg.Append("<br/>");
            }

            return promotionMsg.Length > 0 ? promotionMsg.Remove(promotionMsg.Length - 5, 5).ToString() : "";
        }
예제 #5
0
 /// <summary>
 /// 创建满赠促销活动
 /// </summary>
 public static void CreateFullSendPromotion(FullSendPromotionInfo fullSendPromotionInfo)
 {
     BrnShop.Core.BSPData.RDBS.CreateFullSendPromotion(fullSendPromotionInfo);
 }
예제 #6
0
 /// <summary>
 /// 从IDataReader创建FullSendPromotionInfo
 /// </summary>
 public static FullSendPromotionInfo BuildFullSendPromotionFromReader(IDataReader reader)
 {
     FullSendPromotionInfo fullSendPromotionInfo = new FullSendPromotionInfo();
     fullSendPromotionInfo.PmId = TypeHelper.ObjectToInt(reader["pmid"]);
     fullSendPromotionInfo.StartTime = TypeHelper.ObjectToDateTime(reader["starttime"]);
     fullSendPromotionInfo.EndTime = TypeHelper.ObjectToDateTime(reader["endtime"]);
     fullSendPromotionInfo.UserRankLower = TypeHelper.ObjectToInt(reader["userranklower"]);
     fullSendPromotionInfo.State = TypeHelper.ObjectToInt(reader["state"]);
     fullSendPromotionInfo.Name = reader["name"].ToString();
     fullSendPromotionInfo.LimitMoney = TypeHelper.ObjectToInt(reader["limitmoney"]);
     fullSendPromotionInfo.AddMoney = TypeHelper.ObjectToInt(reader["addmoney"]);
     return fullSendPromotionInfo;
 }
예제 #7
0
 /// <summary>
 /// 更新满赠促销活动
 /// </summary>
 public static void UpdateFullSendPromotion(FullSendPromotionInfo fullSendPromotionInfo)
 {
     BrnShop.Core.BSPData.RDBS.UpdateFullSendPromotion(fullSendPromotionInfo);
     if (_promotionnosql != null)
         _promotionnosql.DeleteFullSendPromotion(fullSendPromotionInfo.PmId);
 }