Esempio n. 1
0
        /// <summary>
        /// добавляет уведомление встрече.
        /// </summary>
        private void AddNotification()
        {
            try
            {
                if (_schedule.Count() == 0)
                {
                    Console.WriteLine("Расписание пусто!");
                }
                else
                {
                    Console.WriteLine("Введите данные о встрече");
                    Console.Write("Номер встречи: ");
                    int id = int.Parse(Console.ReadLine());
                    if (_schedule.Find(id) == null)
                    {
                        Console.WriteLine($"Встреча № { id } не найдена!");
                    }
                    else
                    {
                        Console.Write("Время уведомления: ");
                        DateTime noteDateTime = DateTime.Parse(Console.ReadLine());

                        _schedule.AddNotification(id, noteDateTime);
                        Console.WriteLine($"Встрече № {id} добавлено уведомление!");
                    }
                }
            }
            catch (FormatException)
            {
                Console.WriteLine("Введены некорректные данные!");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }