Exemplo n.º 1
0
        private void btnAddMenu_Click(object sender, EventArgs e)
        {
            frmAddMenu frm = new frmAddMenu();

            frm.username = this.Tag.ToString().Split(',')[0];
            frm.flag     = 0;
            frm.ShowDialog();
            if (frm.DialogResult == DialogResult.OK)
            {
                LoadMenuInfo(string.Empty);
            }
        }
Exemplo n.º 2
0
        private void btnUpdateMenu_Click(object sender, EventArgs e)
        {
            if (gdcInfo.Nodes.Count > 0)
            {
                lstChecked = new List <MenuInfo>();
                foreach (TreeListNode root in gdcInfo.Nodes)
                {
                    //获取根节点信息
                    if (root.CheckState == CheckState.Checked)
                    {
                        DataRowView drv      = gdcInfo.GetDataRecordByNode(root) as DataRowView;
                        MenuInfo    menuInfo = new MenuInfo();
                        if (drv != null)
                        {
                            menuInfo.menuid     = Convert.ToInt32(drv["menuid"]);
                            menuInfo.menuname   = drv["menuname"].ToString();
                            menuInfo.parentid   = Convert.ToInt32(drv["parentid"]);
                            menuInfo.sort       = Convert.ToInt32(drv["sort"]);
                            menuInfo.path       = drv["path"].ToString();
                            menuInfo.image_path = drv["image_path"].ToString();
                            lstChecked.Add(menuInfo);
                        }
                    }
                    GetCheckedID(root);
                }
            }
            if (lstChecked.Count() <= 0)
            {
                MessageBox.Show("请选择要选择的行!");
                return;
            }
            else if (lstChecked.Count() > 1)
            {
                MessageBox.Show("每次只能更新一个菜单!");
                return;
            }
            frmAddMenu frm = new frmAddMenu();

            frm.username   = this.Tag.ToString().Split(',')[0];
            frm.menuid     = Convert.ToInt32(lstChecked[0].menuid);
            frm.menuname   = lstChecked[0].menuname;
            frm.parentid   = lstChecked[0].parentid;
            frm.sort       = lstChecked[0].sort.ToString();
            frm.path       = lstChecked[0].path;
            frm.image_path = lstChecked[0].image_path;
            frm.flag       = 1;
            frm.ShowDialog();
            if (frm.DialogResult == DialogResult.OK)
            {
                LoadMenuInfo(string.Empty);
            }
        }