Ejemplo n.º 1
0
        public ExcuteResultEnum DeleteSysMenu(int menuId)
        {
            if (GetCountByFatherNode(menuId) > 0)
                return ExcuteResultEnum.IsOccupied;

            SysMenuEntity entity = new SysMenuEntity() { MenuId = menuId, DeleteFlag = true };
            EntityExecution.UpdateEntity(entity);
            return ExcuteResultEnum.Success;
        }
Ejemplo n.º 2
0
 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;
     EntityExecution.InsertEntity(entity);
 }
        private SysMenuEntity PrepareFormData()
        {
            //校验参数的合法性
            this.txtMenuName.Text.InitValidation("菜单名称").NotEmpty().ShorterThan(25);
            this.txtMenuDescription.Text.InitValidation("菜单说明").ShorterThan(250);
            this.txtUrlParameter.Text.InitValidation("菜单参数").ShorterThan(250);

            var entity = new SysMenuEntity();
            entity.MenuId = int.Parse(this.hdMenuId.Value);
            entity.MenuName = this.txtMenuName.Text;
            entity.FatherNode = int.Parse(this.ddlMenuTree.SelectedValue);
            entity.Description = this.txtMenuDescription.Text;
            entity.UrlParameter = this.txtUrlParameter.Text;
            entity.PageUrl = this.ddlPageUrl.Items.Count > 0 ? this.ddlPageUrl.SelectedItem.Text : string.Empty;
            entity.ActivityFlag = this.cbMenuStatus.Checked;
            return entity;
        }
Ejemplo n.º 4
0
 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;
     }
     EntityExecution.UpdateEntity(entity);
     if (entity.FatherNode != orgFatherNode)
     {
         Dao.SeqRecal();
     }
 }