Beispiel #1
0
 private void biAddSubDept_Click(object sender, EventArgs e)
 {
     Maticsoft.Model.SMT_ORG_INFO orgInfo = GetSelectOrg();
     if (orgInfo == null)
     {
         WinInfoHelper.ShowInfoWindow(this, "请选择一个节点!");
         return;
     }
     else
     {
         FrmAddOrModifyDept frmDept = new FrmAddOrModifyDept(orgInfo.ID);
         if (frmDept.ShowDialog(this) == DialogResult.OK)
         {
             var node = DeptDataHelper.CreateNode(frmDept.OrgInfo, null);
             if (this.deptTree.Tree.SelectedNode == null)
             {
                 this.deptTree.Tree.Nodes.Add(node);
             }
             else
             {
                 this.deptTree.Tree.SelectedNode.Nodes.Add(node);
                 this.deptTree.Tree.SelectedNode.Expand();
             }
         }
     }
 }
Beispiel #2
0
 private void biModifyDept_Click(object sender, EventArgs e)
 {
     Maticsoft.Model.SMT_ORG_INFO orgInfo = GetSelectOrg();
     if (orgInfo == null)
     {
         WinInfoHelper.ShowInfoWindow(this, "请选择一个节点!");
         return;
     }
     else
     {
         FrmAddOrModifyDept frmDept = new FrmAddOrModifyDept(orgInfo);
         if (frmDept.ShowDialog(this) == DialogResult.OK)
         {
             string text = frmDept.OrgInfo.ORG_NAME + " [" + frmDept.OrgInfo.ORG_CODE + "]";
             this.deptTree.Tree.SelectedNode.Text    = text;
             this.deptTree.Tree.SelectedNode.Tooltip = text;
         }
     }
 }
Beispiel #3
0
        private void DoAddDept(Maticsoft.Model.SMT_ORG_INFO orgInfo)
        {
            decimal parId = -1;

            if (orgInfo != null)
            {
                parId = orgInfo.PAR_ID;
            }
            FrmAddOrModifyDept frmDept = new FrmAddOrModifyDept(parId);

            if (frmDept.ShowDialog(this) == DialogResult.OK)
            {
                var node = DeptDataHelper.CreateNode(frmDept.OrgInfo, null);
                if (this.deptTree.Tree.SelectedNode == null || this.deptTree.Tree.SelectedNode.Parent == null)
                {
                    this.deptTree.Tree.Nodes.Add(node);
                }
                else
                {
                    this.deptTree.Tree.SelectedNode.Parent.Nodes.Add(node);
                    this.deptTree.Tree.SelectedNode.Parent.Expand();
                }
            }
        }