Ejemplo n.º 1
0
        public void UpdateRollinOrder(int id, RollRepository rolls)
        {
            try
            {
                var roll = rollOrder.SingleOrDefault(item => item.Id == id);

                if (roll == null)
                {
                    throw new NullReferenceException();
                }

                Roll mainRoll = rolls.GetRollID(roll.Id);
                Roll tempRoll = new Roll
                                    (mainRoll.Name, mainRoll.Weight, mainRoll.Cost, mainRoll.Others, mainRoll.HalfPosition, mainRoll.Description);
                tempRoll.Id = roll.Id;

                AddRollinOrder(tempRoll);
            }
            catch (Exception exception)
            {
                Console.WriteLine("Нет в заказе.");

                MyLogger.Logger($"Entered invalid roll ID! Repiting going!\n" +
                                $"{exception.Message}\n{exception.StackTrace}");
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            MyLogger.directory.Create();

            MyLogger.Logger("Start");

            try
            {
                RollRepository rollRepository = new RollRepository();
                rollRepository = Menu.MenuList(rollRepository);
                MyLogger.Logger("MenuList done!");

                OrdersRepository orders = new OrdersRepository();

                do
                {
                    MyLogger.Logger("AddNewOrder start");
                    orders.AddNewOrder(MakeNewOrder(rollRepository));
                    MyLogger.Logger("AddNewOrder finish");

                    Console.WriteLine("Нажмите Enter если хотите добавить еще заказ.");
                }while (Console.ReadKey(true).Key == ConsoleKey.Enter);
            }
            catch (Exception ex)
            {
                MyLogger.Logger($"OOOPPS smth wrong\n{ex.Message}\n{ex.StackTrace}");
            }

            MyLogger.Logger("Order finish");

            Console.Read();
        }
Ejemplo n.º 3
0
        public OrderCreatorRepository CreateRollOrder(RollRepository rolls)
        {
            Greeting.Greetins();
            Greeting.AllRolls(rolls);

            do
            {
                do
                {
                    try
                    {
                        AddRollsOrNo(rolls);
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine("Вам надо ввести порядковый номер вида ролл");

                        MyLogger.Logger($"Entered invalid roll ID" +
                            $"{exception.Message}\n{exception.StackTrace}");

                        continue;
                    }


                    OrderCreatorRepository.GetRollsinOrder();
                    Console.WriteLine("Цена заказа {0: 0.00}", SumCounter(OrderCreatorRepository));

                    if (AnythingElse(rolls))
                    {
                        continue;
                    }

                    break;
                }
                while (true);

                Console.WriteLine("Завершить заказ?\n" +
                    "Нажмите Enter если да");

                if (Console.ReadKey(true).Key == ConsoleKey.Y)
                {
                    OrderCreatorRepository.GetRollsinOrder();
                    Console.WriteLine("Цена заказа {0: 0.00}", SumCounter(OrderCreatorRepository));
                    break;
                }
            }
            while (true);

            return OrderCreatorRepository;
        }
Ejemplo n.º 4
0
        static Order MakeNewOrder(RollRepository sushiRepository)
        {
            OrderCreator newOrder = new OrderCreator();

            MyLogger.Logger("newOrder.CreateRollOrder start");

            newOrder.CreateRollOrder(sushiRepository);
            MyLogger.Logger("newOrder.CreateRollOrder finish, newOrder.CreatiningRollOrder start");

            Order order = newOrder.CreatiningRollOrder(newOrder.OrderCreatorRepository);

            MyLogger.Logger("newOrder.CreatiningRollOrder finish");

            newOrder.RollOrderMakingEvent += (string name) =>
            { Console.WriteLine($"{name}, заказ готов"); };

            MyLogger.Logger("newOrder.Done start");
            newOrder.Done(order, 10);

            return(order);
        }
Ejemplo n.º 5
0
 public static void AllRolls(RollRepository rolls)
 {
     Console.WriteLine($"Вот наше меню:");
     rolls.GetRolls();
 }