Esempio n. 1
0
        //页面(法律、新闻、消费知识)
        public ActionResult PageDynamic(string id)
        {
            BllEDynamic bllEDynamic = new BllEDynamic();
            var         mod         = bllEDynamic.LoadData(id);

            if (mod != null)
            {//修改阅读数
                mod.ReadNum++;
                bllEDynamic.Update(mod);
            }
            return(View(mod));
        }
Esempio n. 2
0
        public void SaveData(ModEDynamic t)
        {
            ModJsonResult json = new ModJsonResult();

            try
            {
                t.CreaterId  = CurrentMaster.Id;                   //添加人
                t.Content    = t.Content == null ? "" : t.Content; //广告内容
                t.ActionType = int.Parse(Request["ActionType"]);
                t.ShowType   = int.Parse(Request["ShowType"]);
                t.SysId      = CurrentMaster.Cid;

                if (t.ActionType == (int)NewsTypeEnum.内部新闻 || t.ActionType == (int)NewsTypeEnum.外部新闻)
                {
                    if (t.ActionType == (int)NewsTypeEnum.内部新闻)//外部广告
                    {
                        t.Content = Request["Content"];
                    }
                    else if (t.ActionType == (int)NewsTypeEnum.外部新闻)//外部广告
                    {
                        t.Content = Request["Link"];
                    }
                }
                if (t.ShowType == 2)                                                    //自动下架
                {
                    t.ActiveStartTime = Convert.ToDateTime(Request["ActiveStartTime"]); //开始时间
                    t.ActiveEndTime   = Convert.ToDateTime(Request["ActiveEndTime"]);   //结束时间
                }
                #region ===保存修改数据

                if (!string.IsNullOrEmpty(Request["modify"])) //修改
                {
                    var Category = Bll.LoadData(t.Id);
                    t.CreateTime = Category.CreateTime;
                    t.Status     = Category.Status;//数据状态
                    if (t.ActiveEndTime > DateTime.Now && t.Status != (int)StatusEnum.禁用)
                    {
                        t.Status = (int)StatusEnum.正常;
                    }
                    int result = Bll.Update(t);
                    if (result <= 0)
                    {
                        json.success = false;
                        json.msg     = "修改失败,请稍后再操作!";
                    }
                    else
                    {
                        //保存图片集合内容
                        SavaCombin(t, ref json, "modify");
                        LogInsert(OperationTypeEnum.操作, "新闻修改操作", "新闻修改操作成功");
                        json.msg = "/EDynamic/SaveData?Id='" + t.Id + "'&modify=1";
                    }
                }
                else
                {
                    t.Id         = Guid.NewGuid().ToString();
                    t.Status     = (int)StatusEnum.正常;//状态
                    t.CreateTime = DateTime.Now;
                    if (t.Img == null)
                    {
                        t.Img = "/Resource/img/null.jpg";
                    }
                    int result = Bll.Insert(t);
                    if (result <= 0)
                    {
                        json.success = false;
                        json.msg     = " 保存失败,请稍后再操作!";
                    }
                    else
                    {
                        //保存图片集合内容
                        SavaCombin(t, ref json, "Add");
                        json.msg = "/EDynamic/SaveData?ID='" + t.Id + "'&modify=1";
                    }
                    LogInsert(OperationTypeEnum.操作, "新闻保存操作", "新闻保存操作成功");
                }

                #endregion
            }
            catch (Exception ex)
            {
                LogInsert(OperationTypeEnum.异常, "新闻保存/修改操作", "操作异常信息:" + ex);
            }
            WriteJsonToPage(json.ToString());
        }