コード例 #1
0
        /// <summary>
        /// 得到一个用户所在部门
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public MyCreek.Data.Model.Organize GetDeptByUserID(Guid userID)
        {
            Guid stationID = GetMainStation(userID);

            if (stationID == Guid.Empty)
            {
                return(null);
            }
            var parents = new MyCreek.Platform.Organize().GetAllParent(stationID);

            parents.Reverse();
            foreach (var parent in parents)
            {
                if (parent.Type == 2 || parent.Type == 1)
                {
                    return(parent);
                }
            }
            return(null);
        }