Exemple #1
0
        public ActionResult Save(SE_GiftManageConfigModel model)
        {
            model.ActivityType = 2;
            var dataSource = model;

            if (model.Id <= 0)
            {
                dataSource.Creater    = User.Identity.Name;
                dataSource.CreateTime = DateTime.Now;
                DiscountManageConfigManage.Insert(dataSource, new SE_DictionaryConfigModel
                {
                    ParentId   = dataSource.Id,
                    Key        = "SE_GiftManageConfig",
                    Extend1    = _CreateLogs != null ? JsonConvert.SerializeObject(_CreateLogs) : "",
                    Extend2    = dataSource != null ? JsonConvert.SerializeObject(dataSource) : "",
                    Extend3    = dataSource.Mender,
                    Extend4    = "新增",
                    CreateTime = DateTime.Now,
                    UpdateTime = DateTime.Now
                });
                //Logs(dataSource, "新增");
            }
            else
            {
                dataSource.Mender     = User.Identity.Name;
                dataSource.UpdateTime = DateTime.Now;
                if (DiscountManageConfigManage.Update(dataSource))
                {
                    Logs(dataSource, "更新");
                }
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Save(SE_GiftManageConfigModel model)
        {
            model.ActivityType = 2;
            var dataSource = model;

            if (model.Id <= 0)
            {
                dataSource.Creater    = User.Identity.Name;
                dataSource.CreateTime = DateTime.Now;
                DiscountManageConfigManage.Insert(dataSource, new SE_DictionaryConfigModel
                {
                    ParentId   = dataSource.Id,
                    Key        = "SE_GiftManageConfig",
                    Extend1    = _CreateLogs != null ? JsonConvert.SerializeObject(_CreateLogs) : "",
                    Extend2    = dataSource != null ? JsonConvert.SerializeObject(dataSource) : "",
                    Extend3    = dataSource.Mender,
                    Extend4    = "新增",
                    CreateTime = DateTime.Now,
                    UpdateTime = DateTime.Now
                });
                //Logs(dataSource, "新增");
            }
            else
            {
                dataSource.Mender     = User.Identity.Name;
                dataSource.UpdateTime = DateTime.Now;
                if (DiscountManageConfigManage.Update(dataSource))
                {
                    Logs(dataSource, "更新");
                }
            }
            RefreshCache();
            if (dataSource.P_PID != null)
            {
                var pidModel = JsonConvert.DeserializeObject <List <PidModel> >(dataSource.P_PID);
                var pids     = pidModel.Select(r => r.Pid).ToList();
                if (pids.Any())
                {
                    Thread.Sleep(50);
                    TuhuNotification.SendNotification("notification.productModify.ProductCommonTag", new
                    {
                        type = "RebuildCache",
                        pids,
                        tag = ProductCommonTag.Discount
                    });
                }
            }
            return(RedirectToAction("Index"));
        }