/// <summary> /// 加载主页面,动态生成主菜单(门禁系统,考勤系统,停车场,消费系统) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmMain_Load(object sender, EventArgs e) { user = BindManager.getUser(); if (null == user.DsDeptRight || user.DsDeptRight.Tables.Count < 1) { return; } DataTable tab = user.DsDeptRight.Tables[0]; DataRow[] drs = tab.Select("ntype='操作集组' and level=2"); int indexPic = -1; foreach (DataRow dr in drs) { if ("系统配置".Equals(dr["name"])) { continue; } indexPic++; DevExpress.XtraBars.BarLargeButtonItem bar = new DevExpress.XtraBars.BarLargeButtonItem(); bar.Caption = Convert.ToString(dr["text"]); bar.CaptionAlignment = DevExpress.XtraBars.BarItemCaptionAlignment.Right; bar.Name = basefun.valtag(Convert.ToString(dr["ntag"]), "name"); bar.Tag = "@id=" + Convert.ToString(dr["ID"]) + "," + Convert.ToString(dr["ntag"]); bar.Id = this.barMgr.GetNewItemId(); bar.LargeGlyph = this.imageBar.Images[indexPic]; bar.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(barMenu_Click); this.barMain.AddItem(bar); this.barMgr.Items.Add(bar); } if (this.barMain.ItemLinks.Count > 0) { BarItem item = this.barMain.ItemLinks[0].Item; item.Enabled = false; BarMenuClick(item); } }
/// <summary> /// 加载主页面,动态生成主菜单(门禁系统,考勤系统,停车场,消费系统) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmMain_Load(object sender, EventArgs e) { user = BindManager.getUser(); if (null == user.DsDeptRight || user.DsDeptRight.Tables.Count < 1) return; DataTable tab = user.DsDeptRight.Tables[0]; DataRow[] drs = tab.Select("ntype='操作集组' and level=2"); int indexPic = -1; foreach (DataRow dr in drs) { if ("系统配置".Equals(dr["name"])) continue; indexPic++; DevExpress.XtraBars.BarLargeButtonItem bar = new DevExpress.XtraBars.BarLargeButtonItem(); bar.Caption = Convert.ToString(dr["text"]); bar.CaptionAlignment = DevExpress.XtraBars.BarItemCaptionAlignment.Right; bar.Name = basefun.valtag(Convert.ToString(dr["ntag"]), "name"); bar.Tag = "@id=" + Convert.ToString(dr["ID"]) + "," + Convert.ToString(dr["ntag"]); bar.Id = this.barMgr.GetNewItemId(); bar.LargeGlyph = this.imageBar.Images[indexPic]; bar.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(barMenu_Click); this.barMain.AddItem(bar); this.barMgr.Items.Add(bar); } if (this.barMain.ItemLinks.Count > 0) { BarItem item = this.barMain.ItemLinks[0].Item; item.Enabled = false; BarMenuClick(item); } }