예제 #1
0
 public ActionResult EditParameter(int id)
 {
     if (id == 0)
     {
         return(View(new RouterParameter()));
     }
     else
     {
         RouterConfigManager manager = new RouterConfigManager();
         return(View(manager.GetParameter(id)));
     }
 }
예제 #2
0
        /// <summary>
        /// 删除选中的参数
        /// </summary>
        public ActionResult DeleteParameter(int id)
        {
            RouterConfigManager manager = new RouterConfigManager();
            var before = manager.GetParameter(id);

            if (manager.DeleteParameter(id))
            {
                LoggerManager.InsertOplog(new ConfigHistory()
                {
                    AfterValue     = "",
                    Author         = User.Identity.Name,
                    BeforeValue    = JsonConvert.SerializeObject(before),
                    ChangeDatetime = DateTime.Now,
                    ObjectID       = id.ToString(),
                    ObjectType     = "Parameter",
                    Operation      = "删除参数配置-" + before.Discription + "-" + before.Content
                });
                return(Json(1));
            }

            return(Json(0));
        }
예제 #3
0
        /// <summary>
        /// 保存参数的新增或修改操作
        /// </summary>
        public ActionResult ParameterSave(RouterParameter model)
        {
            RouterConfigManager manger = new RouterConfigManager();

            if (model.PKID == 0)
            {
                if (manger.AddParameter(model))
                {
                    LoggerManager.InsertOplog(new ConfigHistory()
                    {
                        AfterValue = JsonConvert.SerializeObject(model), Author = User.Identity.Name, BeforeValue = "", ChangeDatetime = DateTime.Now, ObjectID = model.PKID.ToString(), ObjectType = "Parameter", Operation = "新增参数配置" + model.Discription
                    });
                    return(Json(1));
                }
                else
                {
                    return(Json(0));
                }
            }
            else
            {
                var before = manger.GetParameter(model.PKID);
                if (manger.UpdateParameter(model))
                {
                    LoggerManager.InsertOplog(new ConfigHistory()
                    {
                        AfterValue = JsonConvert.SerializeObject(model), Author = User.Identity.Name, BeforeValue = JsonConvert.SerializeObject(before), ChangeDatetime = DateTime.Now, ObjectID = model.PKID.ToString(), ObjectType = "Parameter", Operation = "编辑参数配置" + model.Discription
                    });
                    return(Json(1));
                }
                else
                {
                    return(Json(0));
                }
            }
        }