示例#1
0
        private void DeleteDetailsModel(TreeNode treeNode)
        {
            if (treeNode.Nodes != null && treeNode.Nodes.Count >= 1)
            {
                Common.Common_Func.ErrorMessage("请先删除下级菜单", "删除失败");
                return;
            }

            MenuInfo menu = GetDetailRowModel(treeNode);

            if (menu == null)
            {
                return;
            }
            if (menu.ID <= 0)
            {
                return;
            }

            if (MessageBox.Show(string.Format("是否确认删除菜单【{0}】?", menu.MenuName), "确认删除", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No)
            {
                return;
            }

            try
            {
                if (menu.IsDel != 2)
                {
                    string strErr = string.Empty;
                    if (!Basic_Func.DeleteMenuByID(menu, ref strErr))
                    {
                        Common.Common_Func.ErrorMessage(strErr, "删除失败");
                        return;
                    }
                }

                Common.Common_Func.ErrorMessage("删除菜单成功", "删除成功");
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message);
            }
            finally
            {
                GetDetailsQueryData();
            }
        }