Example #1
0
        public Bouqet ExecuteCommand(Comand command, string param)
        {
            Bouqet b = new Bouqet();

            switch (command)
            {
            case Comand.FindByColor:
                b = FindByColor(param);
                return(b);

            case Comand.SortByParam:
                SortByName();
                break;
            }

            return(b);
        }
Example #2
0
        public Bouqet FindByColor(string color)
        {
            Bouqet b = new Bouqet();

            if (!_bouqet.Any())
            {
                throw new EmptyBouqetException("Букет пуст");
            }

            foreach (var flower in _bouqet)
            {
                if (flower.Color == color)
                {
                    b.Add(flower);
                }
            }
            return(b);
        }
Example #3
0
        static void Main(string[] args)
        {
            Bouqet           bouqet  = new Bouqet();
            BouqetController bc      = new BouqetController(bouqet);
            Printer          printer = new Printer();
            Cactus           cact    = null;

            Printer.IsObjectOfClass(cact, typeof(Rose));

            try
            {
                Rose rose = new Rose("", "", -1000);
            }

            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                bc.FindByColor("Red");
            }

            catch (EmptyBouqetException e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                Printer.Print(printer);
            }

            catch
            {
                Console.WriteLine("Что-то пошло не так");
            }

            finally
            {
                Console.WriteLine("finally : Выполняюсь так скозать");
            }
        }
Example #4
0
 public BouqetController(Bouqet bouqet)
 {
     _bouqet = bouqet;
 }