示例#1
0
        public ActionResult EditModel(string id)
        {
            List <blog_tb_menu> list        = Utility.MenuBll.GetTreeData(UserInfo.BlogID);
            blog_tb_menu        insertmodel = new blog_tb_menu();

            insertmodel.menuID            = "";
            insertmodel.TextWithTreeSpace = "--请选择--";
            list.Insert(0, insertmodel);

            blog_tb_menu model = new blog_tb_menu {
                ADD_DATE = DateTime.Now, UPDATE_DATE = DateTime.Now
            };

            if ((!String.IsNullOrEmpty(id)) && id.ToString() != "0")
            {
                model             = Utility.MenuBll.GetEntity(id);
                model.UPDATE_DATE = DateTime.Now;
            }

            List <object> targetList = new List <object> {
                new { Text = "当前页", Value = "_self" },
                new { Text = "新窗口", Value = "_blank" }
            };

            return(new JsonNetResult(new { code = 1, message = "ok", data = model, catelist = list, targetList = targetList }));
        }
示例#2
0
        public JsonResult Edit(blog_tb_menu model)
        {
            if (ModelState.IsValid)
            {
                if (String.IsNullOrEmpty(model.menuID) || model.menuID == "0")
                {
                    UpdateModel(model);
                    model.menuID      = Utility.MenuBll.NewID().ToString();
                    model.blogID      = Convert.ToInt32(UserInfo.BlogID);
                    model.ADD_DATE    = DateTime.Now;
                    model.UPDATE_DATE = DateTime.Now;
                    model.menuTarget  = Request["menuTarget"];
                    Utility.MenuBll.Insert(model);
                }
                else
                {
                    model = Utility.MenuBll.GetEntity(model.menuID);
                    UpdateModel(model);
                    model.UPDATE_DATE = DateTime.Now;
                    model.menuTarget  = Request["menuTarget"];
                    Utility.MenuBll.Update(model);
                }

                return(Json(new { code = 1, message = "操作成功" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { code = -1, message = "验证失败," + Utility.GetModelValidateError(ModelState) }, JsonRequestBehavior.AllowGet));
            }
        }
示例#3
0
 private void LoadTreeGridData(blog_tb_menu parent, List <blog_tb_menu> total)
 {
     parent.children = total.Where(x => x.parentID == parent.menuID).ToArray();
     foreach (var item in parent.children)
     {
         if (item.rowcount > 0)
         {
             LoadTreeGridData(item, total);
         }
     }
 }
示例#4
0
 private void LoadTreeData(blog_tb_menu parent, List <blog_tb_menu> total, List <blog_tb_menu> result)
 {
     foreach (var item in total.Where(x => x.parentID == parent.menuID))
     {
         item.treeDeep          = parent.treeDeep + 1;
         item.TextWithTreeSpace = DeepSpace(item.treeDeep) + item.menuDisplay;
         result.Add(item);
         if (item.rowcount > 0)
         {
             LoadTreeData(item, total, result);
         }
     }
 }
示例#5
0
        public ActionResult Edit(string id)
        {
            Menu m = new Menu {
                ADD_DATE = DateTime.Now, UPDATE_DATE = DateTime.Now
            };

            if ((!String.IsNullOrEmpty(id)) && id.ToString() != "0")
            {
                blog_tb_menu model = Utility.MenuBll.GetEntity(id);
                m = ObjectHelper.CloneProperties <Menu>(model);
            }

            return(View("~/Views/" + Utility.Version + "/Menu/Edit.cshtml", m));
        }