Пример #1
0
        public G_UserDTOList GetBankUser(string bankcode = "", bool?isactive = null)
        {
            ISpecification <G_User> spec = Specification <G_User> .Eval(user => true);

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

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

            var list = new G_UserDTOList();

            this._IG_UserRepository.GetAll(spec).ToList().ForEach(item => list.Add(Mapper.Map <G_User, G_UserDTO>(item)));

            return(list);
        }
Пример #2
0
        public G_UserDTOList GetUsers(bool?isActive = true, string keywords = "", G_UserTypeEnum?userType = null, string sort = "createddate_desc")
        {
            var userDTOList = new G_UserDTOList();

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

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

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


            this._IG_UserRepository.GetAll(spec, sort).ToList().ForEach(item =>
                                                                        userDTOList.Add(Mapper.Map <G_User, G_UserDTO>(item)));
            // this.F_AppendUserInfo(userDTOList, this._IG_UserRepository.Data);
            foreach (var item in userDTOList)
            {
                item.G_UserDetail = this._IG_UserDetailService.GetUserDetailByUserId(item.Id);
            }
            return(userDTOList);
        }