Beispiel #1
0
        public void UpdateComplete(Order order)
        {
            ServiceHelper.ValidateParams(new object[] { order });

            //Verificando se existe
            if (GetById(order.Id) == null)
            {
                throw new ArgumentException("order not exists");
            }

            _unitOfWork.Begin();

            //Atualizando Ordem Pai
            _entityRepository.Update(order);

            var orderItensRepository = ServiceLocator.Current.GetInstance <IOrderItemRepository>();

            //Excluindo itens Filhos
            orderItensRepository.DeleteItensOfOrder(order.Id);

            //Criando novos itens filhos
            var orderItensService = ServiceLocator.Current.GetInstance <IBaseService <OrderItem> >();

            foreach (var orderItem in order.OrderItems)
            {
                orderItensService.Post(orderItem);
            }

            _unitOfWork.Commit();
        }
Beispiel #2
0
        public void Update(TEntity obj)
        {
            ServiceHelper.ValidateParams(new object[] { obj });

            //Verificando se existe
            if (GetById(obj.Id) == null)
            {
                throw new ArgumentException("object not exists");
            }

            _unitOfWork.Begin();
            _entityRepository.Update(obj);
            _unitOfWork.Commit();
        }
        public IQueryable <Product> GetByType(ProductType productType)
        {
            ServiceHelper.ValidateParams(new object[] { productType });

            return(_productRepository.GetByType(productType));
        }
Beispiel #4
0
        public TEntity GetById(int id)
        {
            ServiceHelper.ValidateParams(new object[] { id });

            return(_entityRepository.GetById(id));
        }
Beispiel #5
0
        public Double GetTotalByPeriod(DateTime dtBegin, DateTime dtEnd)
        {
            ServiceHelper.ValidateParams(new object[] { dtBegin, dtEnd });

            return(_orderRepository.GetTotalByPeriod(dtBegin, dtEnd));
        }
Beispiel #6
0
        public IQueryable <MostRequestedProducts> GetMostRequestedProducts(DateTime dtBegin, DateTime dtEnd, ProductType productType)
        {
            ServiceHelper.ValidateParams(new object[] { dtBegin, dtEnd });

            return(_orderRepository.GetMostRequestedProducts(dtBegin, dtEnd, productType));
        }
Beispiel #7
0
        public Order GetCompleteById(int id)
        {
            ServiceHelper.ValidateParams(new object[] { id });

            return(_orderRepository.GetCompleteById(id));
        }
Beispiel #8
0
        public IQueryable <Order> GetByPhone(string phone)
        {
            ServiceHelper.ValidateParams(new object[] { phone });

            return(_orderRepository.GetByPhone(phone));
        }
Beispiel #9
0
        public IQueryable <Order> GetByDtDelivery(DateTime dtBegin, DateTime dtEnd)
        {
            ServiceHelper.ValidateParams(new object[] { dtBegin, dtEnd });

            return(_orderRepository.GetByDtDelivery(dtBegin, dtEnd));
        }
Beispiel #10
0
        public IQueryable <Order> GetByCustomer(int customerId)
        {
            ServiceHelper.ValidateParams(new object[] { customerId });

            return(_orderRepository.GetByCustomer(customerId));
        }