Exemplo n.º 1
0
        private void btnEditDept_Click(object sender, System.EventArgs e)
        {
            if (this.tvwDept.SelectedNode == null)
            {
                return;
            }
            DeptInfo        deptInfo = (DeptInfo)tvwDept.SelectedNode.Tag;
            FrmDeptProperty fDept    = new FrmDeptProperty(deptInfo.Level, deptInfo.DeptId);

            fDept.ShowDialog();
            if (fDept.ReturnDepartment != null)
            {
                tvwDept.SelectedNode.Text = fDept.ReturnDepartment.DeptName;
            }
        }
Exemplo n.º 2
0
        private void lvwWarddept_DoubleClick(object sender, System.EventArgs e)
        {
            if (lvwWarddept.SelectedItems.Count == 0)
            {
                return;
            }
            DeptInfo        deptInfo = (DeptInfo)lvwWarddept.SelectedItems[0].Tag;
            FrmDeptProperty fDept    = new FrmDeptProperty(deptInfo.Level, deptInfo.DeptId);

            fDept.ShowDialog();
            if (fDept.ReturnDepartment != null)
            {
                lvwWarddept.SelectedItems[0].Text = fDept.ReturnDepartment.DeptName;
            }
        }
Exemplo n.º 3
0
        private void btnAddDept_Click(object sender, System.EventArgs e)
        {
            FrmDeptProperty fDept = new FrmDeptProperty();

            fDept.ShowDialog();
            if (fDept.ReturnDepartment != null)
            {
                DataRow  dr   = InstanceForm.BDatabase.GetDataRow("select * from jc_dept_property where dept_id=" + fDept.ReturnDepartment.DeptId);
                TreeNode node = new TreeNode();
                node.Text = fDept.ReturnDepartment.DeptName;
                DeptInfo deptInfo = new DeptInfo();
                deptInfo.DeptId = fDept.ReturnDepartment.DeptId;
                deptInfo.Level  = Convert.ToInt32(dr["layer"]);
                node.Tag        = deptInfo;
                bool addSub = false;

                foreach (TreeNode node1 in this.tvwDept.Nodes)
                {
                    DeptInfo deptInfo1 = (DeptInfo)node1.Tag;
                    if (deptInfo1.DeptId == Convert.ToInt32(dr["p_dept_id"]))
                    {
                        node1.Nodes.Add(node);
                        addSub = true;
                        break;
                    }
                    else
                    {
                        foreach (TreeNode node2 in node1.Nodes)
                        {
                            DeptInfo deptInfo2 = (DeptInfo)node2.Tag;
                            if (deptInfo2.DeptId == Convert.ToInt32(dr["p_dept_id"]))
                            {
                                node2.Nodes.Add(node);
                                addSub = true;
                                return;
                            }
                        }
                    }
                }
                if (addSub != true)
                {
                    this.tvwDept.Nodes.Add(node);
                }
            }
        }