예제 #1
0
        public static void addEvent()
        {
            string eventName, venue;
            Date   eventDate;
            int    maxAttendees;
            int    day, month, year, hour, minute;

            Console.Clear();
            Console.WriteLine("-----------Add Event----------");
            Console.Write("Please enter the name of the Event:");
            eventName = Console.ReadLine();
            Console.Write("Please enter venue for the event:");
            venue = Console.ReadLine();
            Console.Write("Please enter the Day of the event:");
            day = getDayChoice();
            Console.Write("Please enter the Month of the event (as an integer):");
            month = getMonthChoice();
            Console.Write("Please enter the Year of the event:");
            year = getYearChoice();
            Console.Write("Please enter the Hour the event starts in 24 hour format:");
            hour = getHourChoice();
            Console.Write("Please enter the Minute the event starts:");
            minute    = getMinuteChoice();
            eventDate = new Date(day, month, year, hour, minute);
            DateTime compareDate = new DateTime(year, month, day, hour, minute, 0);

            Console.Write("Please enter the maximum number of attendees:");
            maxAttendees = getIntChoice();

            if (eCoord.checkEventSameVenueSameDay(venue, day, month, year))
            {
                Console.WriteLine("The event was not added..");
                Console.WriteLine("There is already an event at that venue on that day.");
            }

            if (dateIsInPast(compareDate))
            {
                Console.WriteLine("The event was not added..");
                Console.WriteLine("You can not create an event for a past date.");
            }

            else if (eCoord.addEvent(eventName, venue, eventDate, maxAttendees))
            {
                Console.WriteLine("Event successfully added..");
            }
            else
            {
                Console.WriteLine("The event was not added..");
            }
            Console.WriteLine("\nPress any key to continue return to the main menu.");
            Console.ReadKey();
        }