Exemplo n.º 1
0
        public PagedResult <CustomerGroupDTO> GetCustomerGroups(Token token, CustomerGroupSearchCriteria criteria, PartialRetrievingInfo pageInfo)
        {
            var securityInfo = SecurityManager.EnsureAuthentication(token);
            var service      = new CustomerGroupService(Session, securityInfo, Configuration);

            return(service.GetCustomerGroups(criteria, pageInfo));
        }
Exemplo n.º 2
0
        public void All()
        {
            var                   param    = new CustomerGroupSearchCriteria();
            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;

            PagedResult <CustomerGroupDTO> result = null;

            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                result = Service.GetCustomerGroups(data.Token, param, pageInfo);
            });
            Assert.AreEqual(groups.Count, result.AllItemsCount);
        }
Exemplo n.º 3
0
        public PagedResult <CustomerGroupDTO> GetCustomerGroups(CustomerGroupSearchCriteria criteria, PartialRetrievingInfo pageInfo)
        {
            Log.WriteWarning("GetCustomerGroups:Username={0}", SecurityInfo.SessionData.Profile.UserName);

            using (var transactionScope = Session.BeginGetTransaction())
            {
                CustomerGroup _temp   = null;
                var           idQuery = Session.QueryOver <CustomerGroup>(() => _temp);
                idQuery = (QueryOver <CustomerGroup, CustomerGroup>)getCustomerGroupsCriterias(idQuery, criteria);


                var fetchQuery = Session.QueryOver <CustomerGroup>(() => _temp)
                                 .Fetch(x => x.Customers).Eager;
                var listPack = fetchQuery.ToExPagedResults <CustomerGroupDTO, CustomerGroup>(pageInfo, idQuery);
                transactionScope.Commit();
                return(listPack);
            }
        }
Exemplo n.º 4
0
        public void WithMembersOnly()
        {
            var param = new CustomerGroupSearchCriteria();

            param.MembersCriteria = CustomerGroupMembersCriteria.WithMembersOnly;
            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;

            PagedResult <CustomerGroupDTO> result = null;

            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                result = Service.GetCustomerGroups(data.Token, param, pageInfo);
            });
            assert(result, 0, 1);
        }
 public PagedResult <CustomerGroupDTO> GetCustomerGroups(Token token, CustomerGroupSearchCriteria criteria, PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(token, () => InternalService.GetCustomerGroups(token, criteria, pageInfo)));
 }
Exemplo n.º 6
0
        private IQueryOver <CustomerGroup, CustomerGroup> getCustomerGroupsCriterias(IQueryOver <CustomerGroup, CustomerGroup> queryCustomer, CustomerGroupSearchCriteria criteria)
        {
            var dbProfile = Session.Load <Profile>(SecurityInfo.SessionData.Profile.GlobalId);

            queryCustomer = queryCustomer.Where(x => x.Profile == dbProfile);
            if (criteria.MembersCriteria == CustomerGroupMembersCriteria.WithMembersOnly)
            {
                queryCustomer = queryCustomer.WhereRestrictionOn(x => x.Customers).IsNotEmpty;
            }
            else if (criteria.MembersCriteria == CustomerGroupMembersCriteria.WithoutMembersOnly)
            {
                queryCustomer = queryCustomer.WhereRestrictionOn(x => x.Customers).IsEmpty;
            }
            return(queryCustomer);
        }