コード例 #1
0
ファイル: UserAction.cs プロジェクト: chenchunwei/NPC
        public SelectUserOptionsModel InitializeSelectUserOptionsModelWithUnit(Guid? unitId)
        {
            var model = new SelectUserOptionsModel();

            if (unitId.HasValue)
            {
                _unitRepository.GetSubUnit(unitId.Value).ToList().ForEach(o => model.SelectUserOptionsRows.Add(ConvertUnit2SelectUserOptionsRow(o)));
                _departmentRepository.GetRootDepartment(unitId.Value)
                    .ToList().ForEach(o => model.SelectUserOptionsRows.Add(ConvertDepartment2SelectUserOptionsRow(o)));
            }
            else
            {
                _unitRepository.GetRootUnit().ToList().ForEach(o => model.SelectUserOptionsRows.Add(ConvertUnit2SelectUserOptionsRow(o)));
            }
            return model;
        }
コード例 #2
0
ファイル: UserAction.cs プロジェクト: chenchunwei/NPC
 public SelectUserOptionsModel InitializeSelectUserOptionsModelWithUser(Guid departmentId)
 {
     var users = _userRepository.GetUserByDeparment(departmentId);
     var model = new SelectUserOptionsModel();
     users.ToList().ForEach(o => model.SelectUserOptionsRows.Add(ConvertUser2SelectUserOptionsRow(o)));
     return model;
 }
コード例 #3
0
ファイル: UserAction.cs プロジェクト: chenchunwei/NPC
        public SelectUserOptionsModel InitializeSelectUserOptionsModelWithDepartment(Guid? departmentId)
        {
            var model = new SelectUserOptionsModel();
            if (departmentId.HasValue)
            {
                _departmentRepository.GetSubDepartment(NpcContext.CurrentUser.Unit.Id, departmentId.Value)
                    .ToList().ForEach(o => model.SelectUserOptionsRows.Add(ConvertDepartment2SelectUserOptionsRow(o)));
                _userRepository.GetUserByDeparment(departmentId.Value)
                    .ToList().ForEach(o => model.SelectUserOptionsRows.Add(ConvertUser2SelectUserOptionsRow(o)));
            }
            else
            {
                _departmentRepository.GetRootDepartment(NpcContext.CurrentUser.Unit.Id)
                    .ToList().ForEach(o => model.SelectUserOptionsRows.Add(ConvertDepartment2SelectUserOptionsRow(o)));

            }
            return model;
        }