Esempio n. 1
0
        /// <summary>
        /// Fetches an event.
        /// </summary>
        protected static void FetchEvent()
        {
            //Clears the console window
            Clear();

            WriteLine(new string('-', 40));
            WriteLine(new string(' ', 14) + "FETCH EVENT" + new string(' ', 15));
            WriteLine(new string('-', 40));

            //Gets the event id
            WriteLine("Enter event id: ");
            int id = int.Parse(ReadLine());

            Event @event = EBusiness.FetchEventById(id, CurrentUser);

            if (@event == null)
            {
                WriteLine($"There is no event with id {id}");
            }
            else
            {
                WriteLine($"Listing the event with the id {id}...");
                WriteLine($"{@event.EventId} {@event.Name} {@event.DueTime.ToString("g")}");
            }

            MenuOrExit();
        }
Esempio n. 2
0
        /// <summary>
        /// Modifies an event by its ID.
        /// </summary>
        protected static void ModifyEvent()
        {
            //Clears the console window
            Clear();

            WriteLine(new string('-', 40));
            WriteLine(new string(' ', 17) + "MODIFY" + new string(' ', 17));
            WriteLine(new string('-', 40));

            //Gets the changed event data
            WriteLine("Enter event id: ");
            int id = int.Parse(ReadLine());

            Event @event = EBusiness.FetchEventById(id, CurrentUser);

            WriteLine("Enter new title: ");
            @event.Name = ReadLine();

            WriteLine("Enter new due time (e.g : 2009/02/26 18:37:58): ");
            @event.DueTime = DateTime.Parse(ReadLine());

            EBusiness.ModifyEvent(@event, CurrentUser);
            WriteLine("Event successfully Modified");

            MenuOrExit();
        }