/// <summary> /// 绑定列表建档信息 /// ywj /// 2016.8.29 /// </summary> public void bindDataNowday() { dataGridView1.Rows.Clear(); string checkday = DateTime.Now.ToString("yyyy-MM-dd"); string isjiuzhen = CommonHelper.getcheckedValue(panel1); try { //得到测评工作权限集合 sysmenuBll menubll = new sysmenuBll(); IList <SYS_MENUS> mlist = menubll.GetListBySql("测评室工作站", globalInfoClass.User_Role); IList <TB_CHILDBASE> list = basebll.GetListByCheckDoc(checkday, isjiuzhen, cd_id, mlist); if (list != null) { foreach (TB_CHILDBASE obj in list) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dataGridView1, obj.HEALTHCARDNO, obj.CHILDNAME, obj.ID.ToString(), obj.CHILDGENDER, obj.CHILDBIRTHDAY);// dataGridView1.Rows.Add(row); if (obj.ID == this.cd_id) { row.Selected = true; } } } } catch (Exception ex) { throw ex; } finally { Cursor.Current = Cursors.Default; if (dataGridView1.Rows.Count >= 1) { if (dataGridView1.SelectedRows.Count <= 0) { dataGridView1.Rows[0].Selected = true; } } } }
//主窗体加载时自动打开基本信息的一般信息窗口 private void refreshInfo() { Cursor.Current = Cursors.WaitCursor; bindDataNowday();//绑定左边列表数据 try { //得到测评工作站下权限集合 sysmenuBll menubll = new sysmenuBll(); IList <SYS_MENUS> list = menubll.GetListBySql("测评室工作站", globalInfoClass.User_Role); foreach (SYS_MENUS obj in list) { if (obj.MENU_LEVER == "1") { if (String.IsNullOrEmpty(obj.MENU_URL)) { ToolStripDropDownButton tsdb = new ToolStripDropDownButton(); if (File.Exists(@Application.StartupPath + "\\" + obj.MENU_IMAGE)) { tsdb.Image = Image.FromFile(Application.StartupPath + "\\" + obj.MENU_IMAGE); } tsdb.Name = obj.MENU_CODE; tsdb.Size = new System.Drawing.Size(85, 29); tsdb.Text = obj.MENU_NAME; tsdb.Tag = obj; toolStrip2.Items.Add(tsdb); } else { ToolStripButton tsdb = new ToolStripButton(); if (File.Exists(@Application.StartupPath + "\\" + obj.MENU_IMAGE)) { tsdb.Image = Image.FromFile(Application.StartupPath + "\\" + obj.MENU_IMAGE); } tsdb.Name = obj.MENU_CODE; tsdb.Size = new System.Drawing.Size(85, 29); tsdb.Text = obj.MENU_NAME; tsdb.Tag = obj; if (obj.IS_CUSTOM == "2")//如果不是自定义的页面,调用已有的页面 { tsdb.Click += new System.EventHandler(this.tsdb_Click); } else//否则调用文书生成界面 { tsdb.Click += new System.EventHandler(this.tsdb_temp_Click); } toolStrip2.Items.Add(tsdb); if (obj.IS_DEFAULT == "1") { tsdb.PerformClick(); } } } else if (obj.MENU_LEVER == "2") { ToolStripMenuItem tsm = new ToolStripMenuItem(); if (File.Exists(@Application.StartupPath + "\\" + obj.MENU_IMAGE)) { tsm.Image = Image.FromFile(Application.StartupPath + "\\" + obj.MENU_IMAGE); } tsm.Name = obj.MENU_CODE; tsm.Size = new System.Drawing.Size(220, 22); tsm.Text = obj.MENU_NAME; tsm.Tag = obj; if (obj.IS_CUSTOM == "2")//如果不是自定义的页面,调用已有的页面 { tsm.Click += new System.EventHandler(this.tsm_Click); } else//否则调用文书生成界面 { tsm.Click += new System.EventHandler(this.tsm_temp_Click); } foreach (ToolStripItem tsdb in toolStrip2.Items) { if (tsdb.Name == obj.MENU_PARENT) { (tsdb as ToolStripDropDownButton).DropDownItems.Add(tsm); break; } } if (obj.IS_DEFAULT == "1") { tsm.PerformClick(); } } } } catch (Exception ex) { MessageBox.Show("系统异常,请联系管理员!"); throw ex; } finally { dataGridView1_CellEnter(null, null); Cursor.Current = Cursors.Default; } }
private void tongji_MainInfo_Load(object sender, EventArgs e) { try { sysmenuBll menubll = new sysmenuBll(); IList <SYS_MENUS> list = menubll.GetList("统计报表"); foreach (SYS_MENUS obj in list) { if (obj.MENU_LEVER == "1") { if (String.IsNullOrEmpty(obj.MENU_URL)) { ToolStripDropDownButton tsdb = new ToolStripDropDownButton(); if (File.Exists(@Application.StartupPath + "\\" + obj.MENU_IMAGE)) { tsdb.Image = Image.FromFile(Application.StartupPath + "\\" + obj.MENU_IMAGE); } tsdb.Name = obj.MENU_CODE; tsdb.Size = new System.Drawing.Size(85, 29); tsdb.Text = obj.MENU_NAME; tsdb.Tag = obj; toolStrip2.Items.Add(tsdb); } else { ToolStripButton tsdb = new ToolStripButton(); if (File.Exists(@Application.StartupPath + "\\" + obj.MENU_IMAGE)) { tsdb.Image = Image.FromFile(Application.StartupPath + "\\" + obj.MENU_IMAGE); } tsdb.Name = obj.MENU_CODE; tsdb.Size = new System.Drawing.Size(85, 29); tsdb.Text = obj.MENU_NAME; tsdb.Tag = obj; if (obj.IS_CUSTOM == "2")//如果不是自定义的页面,调用已有的页面 { tsdb.Click += new System.EventHandler(this.tsdb_Click); } else//否则调用文书生成界面 { tsdb.Click += new System.EventHandler(this.tsdb_temp_Click); } toolStrip2.Items.Add(tsdb); if (obj.IS_DEFAULT == "1") { tsdb.PerformClick(); } } } else if (obj.MENU_LEVER == "2") { ToolStripMenuItem tsm = new ToolStripMenuItem(); if (File.Exists(@Application.StartupPath + "\\" + obj.MENU_IMAGE)) { tsm.Image = Image.FromFile(Application.StartupPath + "\\" + obj.MENU_IMAGE); } tsm.Name = obj.MENU_CODE; tsm.Size = new System.Drawing.Size(220, 22); tsm.Text = obj.MENU_NAME; tsm.Tag = obj; if (obj.IS_CUSTOM == "2")//如果不是自定义的页面,调用已有的页面 { tsm.Click += new System.EventHandler(this.tsm_Click); } else//否则调用文书生成界面 { tsm.Click += new System.EventHandler(this.tsm_temp_Click); } foreach (ToolStripItem tsdb in toolStrip2.Items) { if (tsdb.Name == obj.MENU_PARENT) { (tsdb as ToolStripDropDownButton).DropDownItems.Add(tsm); break; } } if (obj.IS_DEFAULT == "1") { tsm.PerformClick(); } } } } catch (Exception ex) { MessageBox.Show("系统异常,请联系管理员!"); throw ex; } finally { Cursor.Current = Cursors.Default; } }