コード例 #1
0
        //删除菜单按钮点击事件
        protected void btnDel_Click(object sender, EventArgs e)
        {
            FineUI.CheckBoxField chkFild = (FineUI.CheckBoxField)GridSysMenu.FindColumn("CheckBoxField1");
            SeatManage.ClassModel.SysMenuInfo modelSysMenuInfo = new SeatManage.ClassModel.SysMenuInfo();
            int selectCount = GridSysMenu.SelectedRowIndexArray.Length;

            if (selectCount > 0)
            {
                for (int i = 0; i < selectCount; i++)
                {
                    int            rowIndex = GridSysMenu.SelectedRowIndexArray[i];
                    FineUI.GridRow row      = GridSysMenu.Rows[rowIndex] as FineUI.GridRow;
                    modelSysMenuInfo.MenuID = int.Parse(row.DataKeys[0].ToString());
                    if (row.DataKeys[1].ToString() == "一级菜单")
                    {
                        List <SeatManage.ClassModel.SysMenuInfo> listSysMenu = SeatManage.Bll.SysMenu.GetMenusList();
                        foreach (SeatManage.ClassModel.SysMenuInfo selectmenu in listSysMenu)
                        {
                            if (selectmenu.MenuID == modelSysMenuInfo.MenuID)
                            {
                                modelSysMenuInfo = selectmenu;
                                break;
                            }
                        }
                        foreach (SeatManage.ClassModel.SysMenuInfo childmenu in modelSysMenuInfo.ChildMenu)
                        {
                            if (!SeatManage.Bll.SysMenu.DeleteMenus(childmenu))
                            {
                                FineUI.Alert.ShowInTop("删除子菜单失败!");
                                BindSysMenu();
                                return;
                            }
                        }
                        if (SeatManage.Bll.SysMenu.DeleteMenus(modelSysMenuInfo))
                        {
                            FineUI.Alert.ShowInTop("删除成功!");
                            BindSysMenu();
                        }
                        else
                        {
                            FineUI.Alert.ShowInTop("删除失败!");
                            BindSysMenu();
                        }
                    }
                    else
                    {
                        if (SeatManage.Bll.SysMenu.DeleteMenus(modelSysMenuInfo))
                        {
                            FineUI.Alert.ShowInTop("删除成功!");
                        }
                        else
                        {
                            FineUI.Alert.ShowInTop("删除失败!");
                        }
                    }
                }
                BindSysMenu();
            }
        }
コード例 #2
0
 /// <summary>
 /// 绑定系统所有菜单到gird
 /// </summary>
 private void BindSysMenu()
 {
     GridSysMenu.DataSource = GetSysMenu();
     GridSysMenu.DataBind();
 }