Ejemplo n.º 1
0
        private static string ListServices(PricedItemsCollection <IPricedItem> items)
        {
            string str = "";

            foreach (var item in items)
            {
                str += item.Title;
                str += " (" + item.Price + "), ";
            }
            return(str);
        }
Ejemplo n.º 2
0
        public static void GenerateNewService()
        {
            var items = new PricedItemsCollection <IPricedItem>();

            var client = GetClient();
            var date   = SelectDate();
            var barber = SelectBarber();

            items.Add(barber);

            if (Helper.GetBool("Нужна ли вам стрижка?"))
            {
                items.Add(new HairCut(client.HairLength));
            }

            if (Helper.GetBool("Нужна ли вам прическа?"))
            {
                items.Add(new HairStyle(client.HairLength));
            }

            if (Helper.GetBool("Нужно ли вам окрашивание?"))
            {
                items.Add(new HairDye(client.HairLength));
            }

            if (Helper.GetBool("Нужны ли вам украшения?"))
            {
                items.Add(new HairAccessory());
            }

            if (Helper.GetBool("Нужен ли вам уход за волосами?"))
            {
                items.Add(new HairCare(client.HairLength));
            }


            items.Sort((x, y) => x.CompareTo(y));

            //items.Sort(delegate (IPricedItem x, IPricedItem y) {
            //    return x.CompareTo(y);
            //});

            Console.Clear();
            Console.WriteLine("Вы: " + client);
            Console.WriteLine();
            Console.WriteLine("Вас будет обслуживать " + barber.Title);
            Console.WriteLine("Наши услуги дла вас:");
            Console.WriteLine(ListServices(items));
            Console.WriteLine();
            Console.WriteLine("Цена: " + items.Sum(item => item.Price));
            Console.WriteLine("Время приема: " + date);
            Console.WriteLine("Не опаздывайте!");
        }
Ejemplo n.º 3
0
 public virtual void Dispose()
 {
     Collection   = null;
     CurrentIndex = -1;
     CurrentItem  = default;
 }
Ejemplo n.º 4
0
 public PricedItemsEnumerator(PricedItemsCollection <T> collection)
 {
     Collection   = collection;
     CurrentIndex = -1;
     CurrentItem  = default;
 }