예제 #1
0
        /// <summary>
        /// 获取所有部门树
        /// </summary>
        /// <returns></returns>
        public List <TreeData> GetDepartments()
        {
            var departmentData = dal.Get().ToList();

            var departmentTree = Recursion(departmentData, Guid.Empty);

            return(departmentTree);
        }
예제 #2
0
        /// <summary>
        /// 保存部门信息和角色权限
        /// </summary>
        /// <param name="sessionModel"></param>
        /// <param name="employee"></param>
        /// <returns></returns>
        private IEnumerable <string> GetDepartmentSession(ref LoginSessionModel sessionModel, Employee employee)
        {
            List <string> list = new List <string>();

            if (employee.DepartmentId.IsNullOrEmpty())
            {
                return(list);
            }
            else
            {
                var dept = DepartmentDAL.Get(u => u.DepartmentId == employee.DepartmentId);
                if (dept != null)
                {
                    sessionModel.Department = dept;
                    var appList = DepartmentApplicationDAL.GetModels(u => u.Enable && u.DepartmentId == employee.DepartmentId).Select(u => u.ApplicationId);
                    if (!appList.IsNullOrEmpty())
                    {
                        list = appList.ToList();
                    }
                }
                return(list);
            }
        }
        /// <summary>
        /// 获取所有部门
        /// </summary>
        /// <param name="sort">cDepName</param>
        /// <param name="ordering">desc</param>
        /// <param name="num">20</param>
        /// <param name="page">1</param>
        /// <returns></returns>
        public MessageEntity Get(string sort = "cDepName", string ordering = "desc", int num = 20, int page = 1)
        {
            var result = _departmentDAL.Get(sort, ordering, num, page);

            return(result);
        }