Ejemplo n.º 1
0
        public PagedResult <PaymentBasketDTO> GetPaymentBaskets(GetPaymentBasketParam getPaymentBasketParam, PartialRetrievingInfo retrievingInfo)
        {
            using (var trans = Session.BeginGetTransaction())
            {
                Profile dbProfile = Session.Load <Profile>(SecurityInfo.SessionData.Profile.GlobalId);

                var query = Session.QueryOver <PaymentBasket>().Where(x => x.Profile == dbProfile);


                if (getPaymentBasketParam.StartTime.HasValue)
                {
                    query = query.Where(x => x.DateTime >= getPaymentBasketParam.StartTime.Value);
                }
                if (getPaymentBasketParam.EndTime.HasValue)
                {
                    query = query.Where(x => x.DateTime <= getPaymentBasketParam.EndTime.Value);
                }
                if (getPaymentBasketParam.CustomerId.HasValue)
                {
                    Customer dbCustomer = Session.Load <Customer>(getPaymentBasketParam.CustomerId.Value);
                    query = query.Where(x => x.Customer == dbCustomer);
                }
                query.TransformUsing(new DistinctRootEntityResultTransformer());
                trans.Commit();
                return(query.ToPagedResults <PaymentBasketDTO, PaymentBasket>(retrievingInfo));
            }
        }
Ejemplo n.º 2
0
        public PagedResult <PaymentBasketDTO> GetPaymentBaskets(Token token, GetPaymentBasketParam getPaymentBasketParam, PartialRetrievingInfo retrievingInfo)
        {
            var securityInfo = SecurityManager.EnsureAuthentication(token);
            var service      = new PaymentService(Session, securityInfo, Configuration);

            return(service.GetPaymentBaskets(getPaymentBasketParam, retrievingInfo));
        }
        public void GetForCustomer()
        {
            var         profile = (ProfileDTO)profiles[0].Tag;
            SessionData data    = CreateNewSession(profile, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                var param          = new GetPaymentBasketParam();
                var retrievingInfo = new PartialRetrievingInfo();
                param.CustomerId   = customers[0].GlobalId;
                var list           = service.GetPaymentBaskets(data.Token, param, retrievingInfo);
                assert(list, 0, 1);
            });
        }
        public void GetAllPaymentBaskets()
        {
            var         profile = (ProfileDTO)profiles[0].Tag;
            SessionData data    = CreateNewSession(profile, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                var param          = new GetPaymentBasketParam();
                var retrievingInfo = new PartialRetrievingInfo();
                var list           = service.GetPaymentBaskets(data.Token, param, retrievingInfo);
                Assert.AreEqual(koszyki.Count, list.AllItemsCount);
                Assert.AreEqual(koszyki.Count, list.Items.Count);
            });
        }
 public PagedResult <PaymentBasketDTO> GetPaymentBaskets(Token token, GetPaymentBasketParam getPaymentBasketParam, PartialRetrievingInfo retrievingInfo)
 {
     return(exceptionHandling(token, () => InternalService.GetPaymentBaskets(token, getPaymentBasketParam, retrievingInfo)));
 }