/// <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; } } } }
//treeview1 节点 public void bindDataNowdayTreeView() { string checkday = DateTime.Now.ToString("yyyy-MM-dd"); string isjiuzhen = null; try { TreeNode tn; isjiuzhen = "未就诊"; IList <TB_CHILDBASE> list = basebll.GetListByCheckDoc(checkday, isjiuzhen, -1); if (list != null) { treeView1.Nodes[0].Nodes.Clear(); foreach (TB_CHILDBASE obj in list) { if (obj == null) { continue; } tn = new TreeNode(); //DataGridViewRow row = new DataGridViewRow(); //row.CreateCells(dataGridView1, obj.healthcardno, obj.childname, obj.ID.ToString(), obj.childgender, obj.childbirthday);// //dataGridView1.Rows.Add(row); tn.Text = obj.CHILDNAME; tn.Tag = obj; treeView1.Nodes[0].Nodes.Add(tn); if (obj.ID == this.cd_id) { tn.Checked = true; treeView1.SelectedNode = tn; treeView1.Focus(); } } } isjiuzhen = "已就诊"; list = basebll.GetListByCheckDoc(checkday, isjiuzhen, -1); if (list != null) { treeView1.Nodes[1].Nodes.Clear(); foreach (TB_CHILDBASE obj in list) { if (obj == null) { continue; } tn = new TreeNode(); //DataGridViewRow row = new DataGridViewRow(); //row.CreateCells(dataGridView1, obj.healthcardno, obj.childname, obj.ID.ToString(), obj.childgender, obj.childbirthday);// //dataGridView1.Rows.Add(row); tn.Text = obj.CHILDNAME; tn.Tag = obj; treeView1.Nodes[1].Nodes.Add(tn); if (obj.ID == this.cd_id) { tn.Checked = true; treeView1.SelectedNode = tn; treeView1.Focus(); } } } } catch (Exception ex) { throw ex; } finally { Cursor.Current = Cursors.Default; treeView1.Nodes[0].Expand(); treeView1.Nodes[1].Expand(); //if (treeView1.SelectedNode==null&& treeView1.Nodes[0].Nodes.Count>0) //{ // treeView1.Nodes[0].Nodes[0].Checked = true; // treeView1.SelectedNode = treeView1.Nodes[0].Nodes[0]; // treeView1.Focus(); //} } }