Ejemplo n.º 1
0
        public CompanyEntity GetComposed(int companyId)
        {
            var company = _companyService.GetById(companyId);

            if (company == null)
            {
                return(null);
            }

            var companyEntity = _companyService.GetById(companyId);

            //companyEntity.Address = _addressService.GetCompanyAddress(companyId);
            companyEntity.Items = _itemService.GetByCompanyId(companyId)
                                  .Where(x => x.IsActive == true)
                                  .ToList();

            foreach (var item in companyEntity.Items)
            {
                item.SubItems = _subItemService.GetByCompanyAndItemId(item.Id, companyId)
                                .Where(x => x.IsActive == true)
                                .ToList();

                item.YearPlanning  = _planningService.GetYearPlanning(companyId, item.Id, null);
                item.MonthPlanning = _planningService.GetItemPlanning(companyId, item.Id).ToList();


                foreach (var subitem in item.SubItems)
                {
                    subitem.MonthPlanning = _planningService.GetSubItemPlanning(companyId, item.Id, subitem.Id).ToList();
                }
            }
            return(companyEntity);
        }
 public IEnumerable <SubItemEntity> GetByCompanyAndItemId(int itemId, int companyId)
 {
     return(_subItemService.GetByCompanyAndItemId(itemId, companyId));
 }