コード例 #1
0
ファイル: F_UserService.cs プロジェクト: xudong114/CRM
        public F_UserDTOList GetBankUser(string bankcode = "", bool?isactive = null)
        {
            ISpecification <F_User> spec = Specification <F_User> .Eval(user => true);

            spec = new AndSpecification <F_User>(spec,
                                                 Specification <F_User> .Eval(user => isactive == null || user.IsActive == isactive.Value));

            spec = new AndSpecification <F_User>(spec,
                                                 Specification <F_User> .Eval(user => user.UserType == F_UserTypeEnum.BC ||
                                                                              user.UserType == F_UserTypeEnum.BM));

            var list = new F_UserDTOList();

            this._IF_UserRepository.GetAll(spec).ToList().ForEach(item => list.Add(Mapper.Map <F_User, F_UserDTO>(item)));

            return(list);
        }
コード例 #2
0
ファイル: F_UserService.cs プロジェクト: xudong114/CRM
        public F_UserDTOList GetUsers(bool?isActive = true, string keywords = "", F_UserTypeEnum?userType = null, string sort = "createddate_desc")
        {
            var userDTOList = new F_UserDTOList();

            ISpecification <F_User> spec = Specification <F_User> .Eval(user => true);

            spec = new AndSpecification <F_User>(spec,
                                                 Specification <F_User> .Eval(user => isActive == null || user.IsActive == isActive.Value));
            spec = new AndSpecification <F_User>(spec,
                                                 Specification <F_User> .Eval(user => (keywords == "") || user.UserName.Contains(keywords)));

            spec = new AndSpecification <F_User>(spec,
                                                 Specification <F_User> .Eval(user => (userType == null) || user.UserType == userType));


            this._IF_UserRepository.GetAll(spec, sort).ToList().ForEach(item =>
                                                                        userDTOList.Add(Mapper.Map <F_User, F_UserDTO>(item)));
            this.F_AppendUserInfo(userDTOList, this._IF_UserRepository.Data);
            return(userDTOList);
        }