Пример #1
0
 /// <summary>
 /// 从IDataReader创建GiftPromotionInfo
 /// </summary>
 public static GiftPromotionInfo BuildGiftPromotionFromReader(IDataReader reader)
 {
     GiftPromotionInfo giftPromotionInfo = new GiftPromotionInfo();
     giftPromotionInfo.PmId = TypeHelper.ObjectToInt(reader["pmid"]);
     giftPromotionInfo.Pid = TypeHelper.ObjectToInt(reader["pid"]);
     giftPromotionInfo.StoreId = TypeHelper.ObjectToInt(reader["storeid"]);
     giftPromotionInfo.StartTime1 = TypeHelper.ObjectToDateTime(reader["starttime1"]);
     giftPromotionInfo.EndTime1 = TypeHelper.ObjectToDateTime(reader["endtime1"]);
     giftPromotionInfo.StartTime2 = TypeHelper.ObjectToDateTime(reader["starttime2"]);
     giftPromotionInfo.EndTime2 = TypeHelper.ObjectToDateTime(reader["endtime2"]);
     giftPromotionInfo.StartTime3 = TypeHelper.ObjectToDateTime(reader["starttime3"]);
     giftPromotionInfo.EndTime3 = TypeHelper.ObjectToDateTime(reader["endtime3"]);
     giftPromotionInfo.UserRankLower = TypeHelper.ObjectToInt(reader["userranklower"]);
     giftPromotionInfo.State = TypeHelper.ObjectToInt(reader["state"]);
     giftPromotionInfo.Name = reader["name"].ToString();
     giftPromotionInfo.QuotaUpper = TypeHelper.ObjectToInt(reader["quotaupper"]);
     return giftPromotionInfo;
 }
Пример #2
0
 /// <summary>
 /// 更新赠品促销活动
 /// </summary>
 public static void UpdateGiftPromotion(GiftPromotionInfo giftPromotionInfo)
 {
     BrnMall.Data.Promotions.UpdateGiftPromotion(giftPromotionInfo);
 }
Пример #3
0
        public ActionResult AddGiftPromotion(GiftPromotionModel model)
        {
            PartProductInfo partProductInfo = AdminProducts.AdminGetPartProductById(model.Pid);
            if (partProductInfo == null)
            {
                ModelState.AddModelError("Pid", "请选择商品");
            }
            else if (partProductInfo.StoreId != WorkContext.StoreId)
            {
                ModelState.AddModelError("Pid", "不能操作其它店铺的商品");
            }
            else
            {
                if (AdminPromotions.AdminIsExistGiftPromotion(model.Pid, model.StartTime1, model.EndTime1) > 0)
                    ModelState.AddModelError("EndTime1", "此时间段内已经存在赠品促销活动");

                if (model.StartTime2 != null && AdminPromotions.AdminIsExistGiftPromotion(model.Pid, model.StartTime2.Value, model.EndTime2.Value) > 0)
                    ModelState.AddModelError("EndTime2", "此时间段内已经存在赠品促销活动");

                if (model.StartTime3 != null && AdminPromotions.AdminIsExistGiftPromotion(model.Pid, model.StartTime3.Value, model.EndTime3.Value) > 0)
                    ModelState.AddModelError("EndTime3", "此时间段内已经存在赠品促销活动");
            }

            if (ModelState.IsValid)
            {
                DateTime noTime = new DateTime(1900, 1, 1);

                GiftPromotionInfo giftPromotionInfo = new GiftPromotionInfo()
                {
                    Pid = model.Pid,
                    StoreId = WorkContext.StoreId,
                    StartTime1 = model.StartTime1,
                    EndTime1 = model.EndTime1,
                    StartTime2 = model.StartTime2.HasValue ? model.StartTime2.Value : noTime,
                    EndTime2 = model.EndTime2.HasValue ? model.EndTime2.Value : noTime,
                    StartTime3 = model.StartTime3.HasValue ? model.StartTime3.Value : noTime,
                    EndTime3 = model.EndTime3.HasValue ? model.EndTime3.Value : noTime,
                    UserRankLower = model.UserRankLower,
                    State = model.State,
                    Name = model.PromotionName,
                    QuotaUpper = model.QuotaUpper
                };

                AdminPromotions.CreateGiftPromotion(giftPromotionInfo);
                AddStoreAdminLog("添加赠品促销活动", "添加赠品促销活动,赠品促销活动为:" + model.PromotionName);
                return PromptView("赠品促销活动添加成功");
            }

            LoadGiftPromotion();
            return View(model);
        }
Пример #4
0
 /// <summary>
 /// 更新赠品促销活动
 /// </summary>
 public void UpdateGiftPromotion(GiftPromotionInfo giftPromotionInfo)
 {
     DbParameter[] parms = {
                                 GenerateInParam("@pid", SqlDbType.Int, 4, giftPromotionInfo.Pid),
                                 GenerateInParam("@storeid", SqlDbType.Int, 4, giftPromotionInfo.StoreId),
                                 GenerateInParam("@starttime1", SqlDbType.DateTime,8,giftPromotionInfo.StartTime1),
                                 GenerateInParam("@endtime1", SqlDbType.DateTime,8,giftPromotionInfo.EndTime1),
                                 GenerateInParam("@starttime2", SqlDbType.DateTime,8,giftPromotionInfo.StartTime2),
                                 GenerateInParam("@endtime2", SqlDbType.DateTime,8,giftPromotionInfo.EndTime2),
                                 GenerateInParam("@starttime3", SqlDbType.DateTime,8,giftPromotionInfo.StartTime3),
                                 GenerateInParam("@endtime3", SqlDbType.DateTime,8,giftPromotionInfo.EndTime3),
                                 GenerateInParam("@userranklower", SqlDbType.SmallInt,2,giftPromotionInfo.UserRankLower),
                                 GenerateInParam("@state", SqlDbType.TinyInt,1,giftPromotionInfo.State),
                                 GenerateInParam("@name", SqlDbType.NVarChar,50,giftPromotionInfo.Name),
                                 GenerateInParam("@quotaupper", SqlDbType.Int,4,giftPromotionInfo.QuotaUpper),
                                 GenerateInParam("@pmid", SqlDbType.Int,4,giftPromotionInfo.PmId)
                             };
     string commandText = string.Format("UPDATE [{0}giftpromotions] SET [pid]=@pid,[storeid]=@storeid,[starttime1]=@starttime1,[endtime1]=@endtime1,[starttime2]=@starttime2,[endtime2]=@endtime2,[starttime3]=@starttime3,[endtime3]=@endtime3,[userranklower]=@userranklower,[state]=@state,[name]=@name,[quotaupper]=@quotaupper WHERE [pmid]=@pmid",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
Пример #5
0
 /// <summary>
 /// 创建赠品促销活动
 /// </summary>
 public void CreateGiftPromotion(GiftPromotionInfo giftPromotionInfo)
 {
     DbParameter[] parms = {
                                 GenerateInParam("@pid", SqlDbType.Int, 4, giftPromotionInfo.Pid),
                                 GenerateInParam("@storeid", SqlDbType.Int, 4, giftPromotionInfo.StoreId),
                                 GenerateInParam("@starttime1", SqlDbType.DateTime,8,giftPromotionInfo.StartTime1),
                                 GenerateInParam("@endtime1", SqlDbType.DateTime,8,giftPromotionInfo.EndTime1),
                                 GenerateInParam("@starttime2", SqlDbType.DateTime,8,giftPromotionInfo.StartTime2),
                                 GenerateInParam("@endtime2", SqlDbType.DateTime,8,giftPromotionInfo.EndTime2),
                                 GenerateInParam("@starttime3", SqlDbType.DateTime,8,giftPromotionInfo.StartTime3),
                                 GenerateInParam("@endtime3", SqlDbType.DateTime,8,giftPromotionInfo.EndTime3),
                                 GenerateInParam("@userranklower", SqlDbType.SmallInt,2,giftPromotionInfo.UserRankLower),
                                 GenerateInParam("@state", SqlDbType.TinyInt,1,giftPromotionInfo.State),
                                 GenerateInParam("@name", SqlDbType.NVarChar,50,giftPromotionInfo.Name),
                                 GenerateInParam("@quotaupper", SqlDbType.Int,4,giftPromotionInfo.QuotaUpper)
                             };
     string commandText = string.Format("INSERT INTO [{0}giftpromotions]([pid],[storeid],[starttime1],[endtime1],[starttime2],[endtime2],[starttime3],[endtime3],[userranklower],[state],[name],[quotaupper]) VALUES(@pid,@storeid,@starttime1,@endtime1,@starttime2,@endtime2,@starttime3,@endtime3,@userranklower,@state,@name,@quotaupper)",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
Пример #6
0
 /// <summary>
 /// 更新赠品促销活动
 /// </summary>
 public static void UpdateGiftPromotion(GiftPromotionInfo giftPromotionInfo)
 {
     BrnMall.Core.BMAData.RDBS.UpdateGiftPromotion(giftPromotionInfo);
     if (_promotionnosql != null)
         _promotionnosql.DeleteProductGiftPromotion(giftPromotionInfo.Pid);
 }