private void InitDepart() { DataTable dt = DepartMgr.GetAll(); if (dt != null) { this.cbxDepart.Items.Clear(); this.cbxDepart.DataSource = dt; this.cbxDepart.DisplayMember = dt.Columns[1].ToString(); this.cbxDepart.ValueMember = dt.Columns[0].ToString(); } }
/// <summary> /// 初始化部门列表 /// </summary> private void InitDepaert() { DataTable dt = DepartMgr.GetAll(); if (dt != null) { //初始化新员工注册界面的部门列表 this.cbxNewDepart.Items.Clear(); this.cbxNewDepart.DataSource = dt; this.cbxNewDepart.DisplayMember = dt.Columns[1].ToString(); this.cbxNewDepart.ValueMember = dt.Columns[0].ToString(); //初始化修改信息界面的部门列表 this.cbxDepart.Items.Clear(); this.cbxDepart.DataSource = dt; this.cbxDepart.DisplayMember = dt.Columns[1].ToString(); this.cbxDepart.ValueMember = dt.Columns[0].ToString(); } }
/// <summary> /// 构造本单位树的部门节点 /// </summary> /// <param name="parent"></param> /// private void BuildNodesDepart(TreeNode parent) { DataTable dt = DepartMgr.GetAll(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { TreeNode depart = new TreeNode(); depart.Text = dt.Rows[i][1].ToString(); depart.Tag = dt.Rows[i][0].ToString(); depart.ImageIndex = 1; depart.SelectedImageIndex = 1; parent.Nodes.Add(depart); } tvwDepart.ExpandAll(); } }
/// <summary> /// 出示化部门节点 /// </summary> /// <param name="parent">父节点</param> private void InitTreeDepart(TreeNode parent) { DataTable dt = DepartMgr.GetAll(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { TreeNode deprt = new TreeNode(); deprt.Text = dt.Rows[i][1].ToString(); deprt.Tag = dt.Rows[i][0].ToString(); deprt.ImageIndex = 1; deprt.SelectedImageIndex = 1; parent.Nodes.Add(deprt); this.InitEmp(int.Parse(deprt.Tag.ToString()), deprt);//加载树员工节点 } } }