public List <CatalogueItemDTO> GetCatalogueItems(int employeeId)
        {
            List <CartDetail>       cartDetails    = GetAnyExistingCartDetails(employeeId);
            List <Stationery>       stationeries   = (List <Stationery>)stationeryRepo.FindAll();
            List <CatalogueItemDTO> catalogueItems = new List <CatalogueItemDTO>();

            //for each stationery in stationeries create a catalogueItemDTO
            foreach (Stationery s in stationeries)
            {
                CatalogueItemDTO catalogueItemDTO = new CatalogueItemDTO()
                {
                    Item          = s.Description,
                    UnitOfMeasure = s.UnitOfMeasure,
                    StationeryId  = s.Id
                };
                getCatalogueItemAvailability(catalogueItemDTO, s);
                catalogueItems.Add(catalogueItemDTO);
            }

            if (cartDetails != null)
            {
                foreach (CartDetail cd in cartDetails)
                {
                    CatalogueItemDTO catItemDTO = catalogueItems.Find(x => x.StationeryId == cd.StationeryId);
                    catItemDTO.OrderQtyInput = cd.Quantity;
                    catItemDTO.ReservedCount = getReservedBalanceForExistingCartItem(cd);
                    catItemDTO.WaitlistCount = cd.Quantity - catItemDTO.ReservedCount;
                    catItemDTO.Confirmation  = true;
                }
            }
            return(catalogueItems);
        }
Exemplo n.º 2
0
        public ChartFilteringDTO FilteringByAttributes()
        {
            List <Supplier>   suppliers        = (List <Supplier>)supplierRepo.FindAll();
            List <Stationery> stationeries     = (List <Stationery>)stationeryRepo.FindAll();
            List <Category>   categories       = (List <Category>)categoryRepo.FindAll();
            List <Department> departments      = (List <Department>)departmentRepo.FindAll();
            ChartFilteringDTO FilteringDetails = new ChartFilteringDTO()
            {
                SupplierForChartList   = suppliers,
                StationeryForChartList = stationeries,
                CategoryForChartList   = categories,
                DepartmentForChartList = departments,
            };

            return(FilteringDetails);
        }