不需要什么关系类...1.树形分级部门类...
2.根据需要设计职系、职等、职级等类...
3.员工类增加一个部门属性和相应的职系、职等、职级等属性...你应该去和HR部门谈谈,没有HR部门就和行政部门谈...业务上的事以用户实际需要为准...

解决方案 »

  1.   

    建个表 字段有 ID  名称  父ID  职务  归属部门例如:  01  张三  ''  部门主管  软件部
           02  李四   01  程序员   软件部这样,根据父ID你就可以查出下属员工,其他的你自己看着查就可以了
      

  2.   

    LZ说的是关系类..不是数据库关系.
    ------------
    树...重写Tree是最好的解决方法.
      

  3.   

    为什么要建立员工关系类呢?
    后台数据库:
    员工表(员工ID,员工职位ID,员工姓名...)
    职位等级表(员工职位ID,职位名称...)
    部门表(部门ID,部门名称...)
    员工部门表(员工ID,部门ID)业务逻辑层
    准备几个方法,可是实现你的需要
    1.能够确定员工在公司所处的级别 
     能够确定确定某员工的主管 
      能够找出某职员的下属 
      
    传入员工ID,返回信息4、能够确定任意两人间的关系(是否同一部门,上下属关系等) 传入两个员工ID,返回关系
    5、可以查找某部门的最高主管
    传入部门ID,返回信息
      

  4.   

    使用合成模式可解决此问题。
      一个抽象员工类,
      员工或管理人员都继承此类,之间关系为树目录结构关系,这样就很容易清淅分出来。具体例子可以发邮件找我要。[email protected]
      

  5.   

    员工抽象类
    abstract class AbstractEmployee:IComparable<AbstractEmployee>
        {
           protected AbstractEmployee _Parent = null;
            /// <summary>
            /// 父级
            /// </summary>
            internal AbstractEmployee Parent
            {
                get { return _Parent; }
                set {
                    if (value != null)
                        value.AddChild(this);
                    _Parent = value; 
                }
            }
           protected string _name;
            /// <summary>
            /// 名字
            /// </summary>
            public string Name
            {
                get { return _name; }
                set { _name = value; }
            }
           protected string _EmployyeeId = string.Empty;
            /// <summary>
            /// 员工编号
            /// </summary>
            public string EmployyeeId
            {
                get { return _EmployyeeId; }
                set { _EmployyeeId = value; }
            }
            /// <summary>
            /// 下属
            /// </summary>
            protected Dictionary<string, AbstractEmployee> _children = new Dictionary<string, AbstractEmployee>();
           protected string _part;
            /// <summary>
            /// 所属部门
            /// </summary>
            public string Part
            {
                get { return _part; }
                set { _part = value; }
            }       
            /// <summary>
            /// 获取员工树目录结构
            /// </summary>
            /// <returns></returns>
            public virtual TreeNode GetEmployeeNode()
            {
                TreeNode Root = new TreeNode();
                Root.Tag = _part;
                Root.Name = _EmployyeeId;
                Root.Text = _name;
                foreach (AbstractEmployee e in _children.Values)
                {
                    TreeNode node  = e.GetEmployeeNode();
                    Root.Nodes.Add(node);
                }            return Root;
            }
            /// <summary>
            /// 增加下属
            /// </summary>
            /// <param name="e"></param>
            public void AddChild(AbstractEmployee e)
            {
                if (e != null)
                    _children.Add(e.EmployyeeId, e);
            }        public  void DelChild(AbstractEmployee e)
            {
                if (e != null)
                    DelChild(e.EmployyeeId);
            }        public void DelChild(string id)
            {
                _children.Remove(id);
            }
            /// <summary>
            /// 是否同一部门
            /// </summary>
            /// <param name="e"></param>
            /// <returns></returns>
            public  bool isSamePart(AbstractEmployee e)
            {
                return this.Part.Equals(e.Part);
            }
            /// <summary>
            /// 部门最高主管
            /// </summary>
            /// <returns></returns>
            public virtual AbstractEmployee FindBigManager()
            {
                if (_Parent.Parent != null)
                    return _Parent.Parent;
                else
                    return _Parent;
            }
            /// <summary>
            /// 所有下属列表
            /// </summary>
            /// <returns></returns>
            public virtual Dictionary<string,AbstractEmployee> GetChild()
            {
                return _children;
            }        public AbstractEmployee FindChild(AbstractEmployee e)
            {
                return _children[e.EmployyeeId];
            }        #region IComparable<AbstractEmployee> 成员
            /// <summary>
            /// 比较上下级关系,0平级,1 other是我的上级  2 other是我的下级
            /// </summary>
            /// <param name="other"></param>
            /// <returns></returns>
            public virtual int CompareTo(AbstractEmployee other)
            {
                if (other.FindChild(this) != null)
                    return 1;
                else if (FindChild(other) != null)
                    return 2;
                else
                    return 0;
            }        #endregion
        }员工类
     class Employee:AbstractEmployee 
        {
            public Employee(AbstractEmployee parent, string part, string name)
            {
                EmployyeeId = Guid.NewGuid().ToString();
                this.Parent = parent;
                Part = part;
                Name = name;
            }
            public override System.Windows.Forms.TreeNode GetEmployeeNode()
            {
                return base.GetEmployeeNode();
            }
            public override int CompareTo(AbstractEmployee other)
            {
                return base.CompareTo(other);
            }
            public override AbstractEmployee FindBigManager()
            {
                return base.FindBigManager();
            }        public override Dictionary<string, AbstractEmployee> GetChild()
            {
                return base.GetChild();
            }
        }
    主窗口调用例子
     private void button1_Click(object sender, EventArgs e)
            {
                model.Employee Manager = new Employee.model.Employee(null, "事业部", "刘M");
                model.Employee M1 = new Employee.model.Employee(Manager, "运营部", "LY");
                model.Employee Em1 = new Employee.model.Employee(Manager, "事业部", "李y山");
                model.Employee Em2 = new Employee.model.Employee(Em1, "事业部", "san");
                model.Employee Em3 = new Employee.model.Employee(Em1, "企业部", "Mylist");
                model.Employee Em4 = new Employee.model.Employee(M1, "运营部", "张三");
                treeView1.Nodes.Add(Manager.GetEmployeeNode());
            }