public void Loaded()
        {
            try
            {
                Occupancies = _occupanciesRepository.GetOccupancies();
                Tables      = _tablesRepository.GetTables();

                foreach (Data.Occupancy occupancy in Occupancies)
                {
                    if (occupancy.Table.Id == Table.Id && occupancy.EndTime == null)
                    {
                        CurrentOccupancy = occupancy;

                        if (CurrentOccupancy.Sales != null)
                        {
                            UnpaidAmount = CalculateUnpaidAmount();
                            PaidAmount   = CalculatePaidAmount();
                            TotalAmount  = CalculateTotalAmount();
                        }
                        break;
                    }
                    else
                    {
                        CurrentOccupancy = null;
                    }
                }
                CalculateFutureReservations(Table);
            }
            catch (NullReferenceException)
            {
                UnpaidAmount = 0;
                PaidAmount   = 0;
                TotalAmount  = 0;
            }
        }
Exemple #2
0
        public void Loaded()
        {
            Products     = _productRepo.GetProducts();
            _occupancies = _occupancieRepo.GetOccupancies();
            foreach (Data.Product product in Products)
            {
                /*for (int i = 1; i < 16; i++)
                 * {*/

                InvokeRequestResponseService(1, product.ID);

                //}
                //TODO. Nog onvoldoende test data. vervangen met companyID
            }
            _allpredictions = new ObservableCollection <Prediction>();
            SelectedProduct = Products.First();
        }
Exemple #3
0
        public void Loaded()
        {
            Sales       = new ObservableCollection <WaiterSale>();
            Occupancies = new ObservableCollection <Data.Occupancy>(_occupanciesRepo.GetOccupancies());
            Console.WriteLine("test");
            foreach (Data.Occupancy occupancy in Occupancies)
            {
                foreach (Data.Sale sale in occupancy.Sales)
                {
                    if ((sale.Delivered == 0 && _categoryRepo.GetBySubCategory(sale.Product.SubCategory).Name == "Eten" && sale.Cooked == 1) || (sale.Delivered == 0 && _categoryRepo.GetBySubCategory(sale.Product.SubCategory).Name == "Drank"))
                    {
                        Sales.Add(new WaiterSale(sale, occupancy));
                    }
                }
            }

            //Sales = new ObservableCollection<Sale>(occupancy.Sales.Where(sale => sale.Cooked == 1 && sale.Delivered == 0));
        }