Exemplo n.º 1
0
        public ActionResult AddCouponType(CouponTypeModel model)
        {
            if (ModelState.IsValid)
            {
                DateTime nullTime = new DateTime(1970, 1, 1);

                if (model.SendModel == 1 || model.SendModel == 2)
                {
                    model.GetModel = 0;
                    model.SendStartTime = nullTime;
                    model.SendEndTime = nullTime;
                }

                if (model.UseTimeType == 1)
                {
                    model.UseStartTime = nullTime;
                    model.UseEndTime = nullTime;
                }
                else
                {
                    model.UseExpireTime = 0;
                }

                CouponTypeInfo couponTypeInfo = new CouponTypeInfo()
                {
                    StoreId = WorkContext.StoreId,
                    Name = model.CouponTypeName,
                    Money = model.Money,
                    Count = model.Count,
                    SendMode = model.SendModel,
                    GetMode = model.GetModel,
                    UseMode = model.UseModel,
                    UserRankLower = model.UserRankLower,
                    OrderAmountLower = model.OrderAmountLower,
                    LimitStoreCid = model.LimitStoreCid,
                    LimitProduct = model.LimitProduct,
                    SendStartTime = model.SendStartTime.Value,
                    SendEndTime = model.SendEndTime.Value,
                    UseExpireTime = model.UseExpireTime,
                    UseStartTime = model.UseStartTime.Value,
                    UseEndTime = model.UseEndTime.Value,
                    State = model.State
                };
                AdminCoupons.CreateCouponType(couponTypeInfo);
                AddStoreAdminLog("添加优惠劵类型", "添加优惠劵类型,优惠劵类型为:" + model.CouponTypeName);
                return PromptView("优惠劵类型添加成功");
            }
            LoadCouponType();
            return View(model);
        }
Exemplo n.º 2
0
 public ActionResult AddCouponType()
 {
     CouponTypeModel model = new CouponTypeModel();
     LoadCouponType();
     return View(model);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 展示优惠劵类型
        /// </summary>
        /// <param name="couponTypeId">优惠劵类型id</param>
        public ActionResult ShowCouponType(int couponTypeId = -1)
        {
            CouponTypeInfo couponTypeInfo = AdminCoupons.AdminGetCouponTypeById(couponTypeId);
            if (couponTypeInfo == null)
                return PromptView("优惠劵类型不存在");
            if (couponTypeInfo.StoreId != WorkContext.StoreId)
                return PromptView("不能访问其它店铺的优惠劵");

            CouponTypeModel model = new CouponTypeModel();
            model.CouponTypeName = couponTypeInfo.Name;
            model.Money = couponTypeInfo.Money;
            model.Count = couponTypeInfo.Count;
            model.SendModel = couponTypeInfo.SendMode;
            model.GetModel = couponTypeInfo.GetMode;
            model.UseModel = couponTypeInfo.UseMode;
            model.UserRankLower = couponTypeInfo.UserRankLower;
            model.OrderAmountLower = couponTypeInfo.OrderAmountLower;
            model.LimitStoreCid = couponTypeInfo.LimitStoreCid;
            model.LimitProduct = couponTypeInfo.LimitProduct;
            model.UseExpireTime = couponTypeInfo.UseExpireTime;
            model.SendStartTime = couponTypeInfo.SendStartTime;
            model.SendEndTime = couponTypeInfo.SendEndTime;
            model.UseStartTime = couponTypeInfo.UseStartTime;
            model.UseEndTime = couponTypeInfo.UseEndTime;
            model.State = couponTypeInfo.State;

            LoadCouponType();
            return View(model);
        }