Beispiel #1
0
        private void AddMenu()
        {
            MenuInfo menu = new MenuInfo()
            {
                ID = 0
            };
            MenuInfo parent = GetCurrentMenu();

            if (parent.IsEnd == 1)
            {
                Common.Common_Func.ErrorMessage("当前菜单已经是末级节点", "新增失败");
                return;
            }
            menu.ParentID = parent.ID;
            if (SelectNode())
            {
                if (curNode.Nodes == null || curNode.Nodes.Count <= 0)
                {
                    menu.NodeSort = 1;
                }
                else
                {
                    menu.NodeSort = (curNode.Nodes[curNode.Nodes.Count - 1].Tag as MenuInfo).NodeSort + 1;
                }
            }
            else
            {
                menu.NodeSort = 1;
            }

            string strError = string.Empty;

            Basic_Func.GetMenuNo(ref menu, ref strError);
            ShowFileForm(menu);
        }
Beispiel #2
0
        private void ClearForm()
        {
            try
            {
                isInit = true;
                _menu  = new MenuInfo();
                SetNewModel();

                BindUrlComboBox();

                string strError = string.Empty;
                Basic_Func.GetMenuNo(ref _menu, ref strError);
                _menu.ParentID = _back.ParentID;
                _menu.NodeUrl  = _parent.NodeUrl;
                _menu.NodeSort = _back.NodeSort + 1;
                _menu.IsEnd    = _back.IsEnd;
                _menu.MenuType = _back.MenuType;

                SetMenuUrl();

                bsMenu.DataSource = _menu;
                bsMenu.ResetBindings(false);
                bsMenu.EndEdit();
            }
            catch
            {
            }
            finally
            {
                isInit = false;
                txtMenuName.Focus();
            }
        }