Beispiel #1
0
        private void TransferFromMenuToSales(IProduct orderedProduct)
        {
            string type = orderedProduct.GetType().Name;

            Sales.Add(orderedProduct);

            switch (type)
            {
            case "Salad":
                SaladSales.Add((Salad)orderedProduct);
                break;

            case "Drink":
                DrinkSales.Add((Drink)orderedProduct);
                break;

            case "Soup":
                SoupSales.Add((Soup)orderedProduct);
                break;

            case "MainDish":
                MainDishSales.Add((MainDish)orderedProduct);
                break;

            case "Dessert":
                DessertSales.Add((Dessert)orderedProduct);
                break;
            }
        }
Beispiel #2
0
        public string Statistics()
        {
            StringBuilder report = new StringBuilder();
            int           reservedTablesCount = Tables.Where(x => x == true).Count();
            decimal       totalIncome         = Sales.Select(x => x.Price).Sum();
            decimal       saladIncome         = SaladSales.Select(x => x.Price).Sum();
            decimal       soupIncome          = SoupSales.Select(x => x.Price).Sum();
            decimal       mainDishIncome      = MainDishSales.Select(x => x.Price).Sum();
            decimal       dessertIncome       = DessertSales.Select(x => x.Price).Sum();
            decimal       drinkIncome         = DrinkSales.Select(x => x.Price).Sum();

            report.AppendLine($"Общо маси заети през деня: {reservedTablesCount}");
            report.AppendLine($"Общо продажби: {Sales.Count} - {totalIncome}");
            report.AppendLine("По категории:");
            report.AppendLine($"Салата: {SaladSales.Count} - {saladIncome}");
            report.AppendLine($"Супа: {SoupSales.Count} - {soupIncome}");
            report.AppendLine($"Основно ястие: {MainDishSales.Count} - {mainDishIncome}");
            report.AppendLine($"Десерт: {DessertSales.Count} - {dessertIncome}");
            report.AppendLine($"Напитка: {DrinkSales.Count} - {drinkIncome}");
            return(report.ToString());
        }