Example #1
0
 public Staff()
 {
     _login_id = String.Empty;
     _password = String.Empty;
     _code = String.Empty;
     _name = String.Empty;
     _sex = null;
     _married = null;
     _id_card = String.Empty;
     _country_tag = String.Empty;
     _nation_tag = String.Empty;
     _position_tag = String.Empty;
     _title_tag = String.Empty;
     _political_appearance_tag = String.Empty;
     _degree_tag = String.Empty;
     _birthday = null;
     _enters_day = null;
     _leaves_day = null;
     _office_phone = String.Empty;
     _ext_number = String.Empty;
     _family_phone = String.Empty;
     _cell_phone = String.Empty;
     _email = String.Empty;
     _address = String.Empty;
     _zip_code = String.Empty;
     _remark = String.Empty;
     _is_inner_user = 0;
     _disabled = 0;
     _order_id = 0;
     _department = null;
     _roles = new HashedSet();
     _module_rights_grant = new HashedSet();
     _module_rights_deny = new HashedSet();
 }
Example #2
0
 public Department()
 {
     _id = String.Empty;
     _name = String.Empty;
     _phone = String.Empty;
     _ext_number = String.Empty;
     _fax = String.Empty;
     _remark = String.Empty;
     _order_id = 0;
     _parent_department = null;
     _staff = new ArrayList();
     _sub_departments = new ArrayList();
 }
Example #3
0
        /// <summary>
        /// 新增部门。
        /// </summary>
        /// <param name="dto">待新增部门的信息。</param>
        /// <returns>新部门的Id。</returns>
        public static string InsertDepartment(DepartmentDTO dto)
        {
            Db.SessionFactory.EvictQueries("Department");

            Department d = new Department();
            d.Id = IdGen.GetNextId(typeof(Department));
            d.Name = dto.Name;
            d.Phone = dto.Phone;
            d.ExtNumber = dto.ExtNumber;
            d.Fax = dto.Fax;
            d.Remark = dto.Remark;
            d.OrderId = dto.OrderId;

            if (dto.ParentDepartmentId != null && dto.ParentDepartmentId.Length > 0)
            {
                Department pd = Db.Session.Load(typeof(Department), dto.ParentDepartmentId) as Department;
                pd.AddSubDepartment(d);
            }

            Db.TransInsert(d);

            return d.Id;
        }
Example #4
0
        /// <summary>
        /// 移动职员。
        /// </summary>
        /// <param name="newParent">新的部门。</param>
        public void MoveTo(Department newParent)
        {
            Department oldParent = this.Department;
            oldParent.Staff.Remove(this);

            newParent.Staff.Add(this);
            this.Department = newParent;
        }
Example #5
0
        /// <summary>
        /// 移动部门。
        /// </summary>
        /// <param name="newParent">新的父部门。</param>
        public void MoveTo(Department newParent)
        {
            if (this.ParentDepartment != null)
            {
                Department oldParent = this.ParentDepartment;
                oldParent.SubDepartments.Remove(this);
            }

            if (newParent != null)
            {
                newParent.SubDepartments.Add(this);
                this.ParentDepartment = newParent;
            }
            else
            {
                this.ParentDepartment = null;
            }
        }
Example #6
0
 /// <summary>
 /// 增加一个子部门。
 /// </summary>
 /// <param name="subDepartment">子部门。</param>
 public void AddSubDepartment(Department subDepartment)
 {
     this.SubDepartments.Add(subDepartment);
     subDepartment.ParentDepartment = this;
 }