/// <summary> /// 生成部门全名称. /// </summary> public void GenerNameOfPath() { string name = this.Name; //根目录不再处理 if (this.IsRoot == true) { this.NameOfPath = name; this.DirectUpdate(); this.GenerChildNameOfPath(this.No); return; } Dept dept = new Dept(); dept.No = this.ParentNo; if (dept.RetrieveFromDBSources() == 0) { return; } while (true) { if (dept.IsRoot) { break; } name = dept.Name + "\\" + name; dept = new Dept(dept.ParentNo); } //根目录 name = dept.Name + "\\" + name; this.NameOfPath = name; this.DirectUpdate(); this.GenerChildNameOfPath(this.No); //更新人员路径信息. BP.GPM.Emps emps = new Emps(); emps.Retrieve(EmpAttr.FK_Dept, this.No); foreach (BP.GPM.Emp emp in emps) { emp.Update(); } }
/// <summary> /// 处理子部门全名称 /// </summary> /// <param name="FK_Dept"></param> public void GenerChildNameOfPath(string deptNo) { Depts depts = new Depts(deptNo); if (depts != null && depts.Count > 0) { foreach (Dept dept in depts) { dept.GenerNameOfPath(); GenerChildNameOfPath(dept.No); //更新人员路径信息. BP.GPM.Emps emps = new Emps(); emps.Retrieve(EmpAttr.FK_Dept, this.No); foreach (BP.GPM.Emp emp in emps) { emp.Update(); } } } }