Ejemplo n.º 1
0
 public void ConvertPackItemPassTest()
 {
     foreach (var entity in packItems)
     {
         var packItemBO = _conv.Convert(entity);
         Assert.NotNull(packItemBO);
         Assert.Equal(entity.PackingListId, packItemBO.PackingListId);
         Assert.Equal(entity.ItemId, packItemBO.ItemId);
         Assert.Equal(entity.Count, packItemBO.Count);
         Assert.Equal(entity.Id, packItemBO.Id);
     }
 }
        public PackingListBO Get(int Id)
        {
            if (Id < 1)
            {
                return(null);
            }

            using (var uow = _facade.UnitOfWork)
            {
                var packingList = _convPL.Convert(uow.PackingListRepository.Get(Id));
                if (packingList != null)
                {
                    packingList.Projects = uow.ProjectRepository.GetAllById(packingList.ProjectIds)
                                           .Select(p => _conv.Convert(p))
                                           .ToList();

                    packingList.ColliLists = uow.ColliListRepository.GetAllById(packingList.ColliListIds)
                                             .Select(cl => _convCL.Convert(cl))
                                             .ToList();

                    packingList.PackItems = uow.PackItemRepository.GetAllById(packingList.PackItemsIds)
                                            .Select(pi => _convPI.Convert(pi))
                                            .ToList();
                }
                uow.Complete();
                return(packingList);
            }
        }
Ejemplo n.º 3
0
        public PackItemBO Create(PackItemBO packItem)
        {
            if (packItem == null)
            {
                return(null);
            }

            using (var uow = _facade.UnitOfWork)
            {
                var createdPackItem = uow.PackItemRepository.Create(_conv.ConvertBO(packItem));
                uow.Complete();
                return(_conv.Convert(createdPackItem));
            }
        }
Ejemplo n.º 4
0
        public ItemBO Get(int Id)
        {
            if (Id < 1)
            {
                return(null);
            }

            using (var uow = _facade.UnitOfWork)
            {
                var item = _conv.Convert(uow.ItemRepository.Get(Id));
                if (item != null)
                {
                    if (item.PackItemsIds != null)
                    {
                        item.PackItems = uow.PackItemRepository.GetAllById(item.PackItemsIds)
                                         .Select(pi => _convPI.Convert(pi))
                                         .ToList();
                    }

                    if (item.ColliItemsIds != null)
                    {
                        item.ColliItems = uow.ColliItemRepository.GetAllById(item.ColliItemsIds)
                                          .Select(ci => _convCI.Convert(ci))
                                          .ToList();
                    }

                    if (item.FreightConditionIds != null)
                    {
                        item.FreightConditions = uow.FreightConditionRepository.GetAllById(item.FreightConditionIds)
                                                 .Select(fc => _convFC.Convert(fc))
                                                 .ToList();
                    }
                }

                uow.Complete();
                return(item);
            }
        }