public void AddNewSysMenu(SysMenuEntity entity) { //获取目标目录下菜单的数量 if (entity.FatherNode == 0) entity.MenuLevel = 1; else { SysMenuEntity fatherNode = GetSysMenuEntity(entity.FatherNode); entity.MenuLevel = fatherNode.MenuLevel + 1; } entity.MenuId = null; entity.Seq = GetCountByFatherNode(entity.FatherNode) + 1; entity.DeleteFlag = false; entity.Insert(); }
public void UpdateSysMenu(SysMenuEntity entity, int orgFatherNode) { if (entity.FatherNode != orgFatherNode) { if (entity.FatherNode == 0) entity.MenuLevel = 1; else { SysMenuEntity fatherNode = GetSysMenuEntity(entity.FatherNode); entity.MenuLevel = fatherNode.MenuLevel + 1; } entity.Seq = GetCountByFatherNode(entity.FatherNode) + 1; } entity.Update(); if (entity.FatherNode != orgFatherNode) { SeqRecal(); } }
private SysMenuEntity PrepareFormData() { //校验参数的合法性 txtMenuName.Text.InitValidation("菜单名称").NotEmpty().ShorterThan(25); txtMenuDescription.Text.InitValidation("菜单说明").ShorterThan(250); txtUrlParameter.Text.InitValidation("菜单参数").ShorterThan(250); var entity = new SysMenuEntity(); entity.MenuId = int.Parse(hdMenuId.Value); entity.MenuName = txtMenuName.Text; entity.FatherNode = int.Parse(ddlMenuTree.SelectedValue); entity.Description = txtMenuDescription.Text; entity.UrlParameter = txtUrlParameter.Text; entity.PageUrl = ddlPageUrl.Items.Count > 0 ? ddlPageUrl.SelectedItem.Text : string.Empty; entity.ActivityFlag = cbMenuStatus.Checked; return entity; }
public ExcuteResultEnum DeleteSysMenu(int menuId) { if (GetCountByFatherNode(menuId) > 0) return ExcuteResultEnum.IsOccupied; SysMenuEntity entity = new SysMenuEntity() { MenuId = menuId, DeleteFlag = true }; entity.Update(); return ExcuteResultEnum.Success; }