コード例 #1
0
        /// <summary>
        /// Gets how often the appointment should be created.
        /// </summary>
        /// <returns>The number of appointments as number.</returns>
        private int GetNumberOfRecurrences()
        {
            int input;

            do
            {
                Console.WriteLine("\nWie oft soll der Termin erstellt werden?");
                Console.Write("Geben Sie die entsprechende Nummer ein um fortzufahren: ");
                input = AppointmentViewGeneral.GetUserInputInt();
            }while (input <= 0);

            return(input);
        }
コード例 #2
0
        /// <summary>
        /// Gets the recurrence type to be created.
        /// </summary>
        /// <returns>Returns the recurrence type as an enum.</returns>
        private RecurrenceType GetRecurrenceType()
        {
            RecurrenceType recurrenceType;

            do
            {
                Console.WriteLine("\n1. Einmaliger Termin");
                Console.WriteLine("2. Wöchtenlicher Termin");
                Console.WriteLine("3. Jährlicher Termin");
                Console.WriteLine("0. Abbruch");
                Console.Write("Geben Sie die entsprechende Nummer ein um fortzufahren: ");
                int input = AppointmentViewGeneral.GetUserInputInt();

                switch (input)
                {
                case 1:
                    recurrenceType = RecurrenceType.Never;
                    break;

                case 2:
                    recurrenceType = RecurrenceType.Weekly;
                    break;

                case 3:
                    recurrenceType = RecurrenceType.Yearly;
                    break;

                case 0:
                    recurrenceType = RecurrenceType.None;
                    AppointmentViewGeneral.PrintCanceledAction();
                    break;

                default:
                    recurrenceType = RecurrenceType.Invalid;
                    AppointmentViewGeneral.PrintInvalidInput();
                    break;
                }
            }while (recurrenceType == RecurrenceType.Invalid);

            return(recurrenceType);
        }
コード例 #3
0
        /// <summary>
        /// Deletes the appointments by index.
        /// </summary>
        internal void DeleteAppointmentByIndex()
        {
            if (appointmentManager.Appointments.Any())
            {
                appointmentViewDisplay.ShowAllAppointments();

                Console.Write($"\nGeben Sie die Terminnummer ein um fortzufahren: ");
                int index = AppointmentViewGeneral.GetUserInputInt();

                int appointmentsCount = appointmentManager.Appointments.Count;
                if (index > 0 && index <= appointmentsCount)
                {
                    RemoveAppointmentByIndex(--index);
                }
                else
                {
                    Console.WriteLine("Die eingegebene Terminnummer existiert nicht.");
                }
            }
            else
            {
                Console.WriteLine("\nEs wurden keine Termine gefunden.");
            }
        }
コード例 #4
0
        /// <summary>
        /// Gets the appointment type to be created.
        /// </summary>
        /// <returns>Returns the appointment type as an enum.</returns>
        private AppointmentType GetAppointmentType()
        {
            AppointmentType appointmentType;

            do
            {
                Console.WriteLine("\n1. Ganztägiger Termin");
                Console.WriteLine("2. Termin mit Dauer");
                Console.WriteLine("0. Abbruch");
                Console.Write("Geben Sie die entsprechende Nummer ein um fortzufahren: ");
                int input = AppointmentViewGeneral.GetUserInputInt();

                switch (input)
                {
                case 1:
                    appointmentType = AppointmentType.AllDay;
                    break;

                case 2:
                    appointmentType = AppointmentType.Duration;
                    break;

                case 0:
                    appointmentType = AppointmentType.None;
                    AppointmentViewGeneral.PrintCanceledAction();
                    break;

                default:
                    appointmentType = AppointmentType.Invalid;
                    AppointmentViewGeneral.PrintInvalidInput();
                    break;
                }
            }while (appointmentType == AppointmentType.Invalid);

            return(appointmentType);
        }
コード例 #5
0
ファイル: Overview.cs プロジェクト: artur-denk/Terminkalender
        /// <summary>
        /// The main menu of the software.
        /// </summary>
        private void MainMenu()
        {
            bool isRunning = true;

            while (isRunning)
            {
                Console.WriteLine("\n##################################################\n");
                Console.WriteLine("1. Termin erstellen");
                Console.WriteLine("2. Übersicht der Termine des aktuellen Tages");
                Console.WriteLine("3. Übersicht der Termine der nächsten sieben Tage");
                Console.WriteLine("4. Übersicht aller Termine");
                Console.WriteLine("5. Termin löschen");
                Console.WriteLine("6. Alle Termine eines Tages löschen");
                Console.WriteLine("7. Alle Termine löschen");
                Console.WriteLine("8. Termine speichern");
                Console.WriteLine("0. Programm beenden");
                Console.Write("Geben Sie die entsprechende Nummer ein um fortzufahren: ");
                int input = AppointmentViewGeneral.GetUserInputInt();

                switch (input)
                {
                case 1:
                    appointmentViewCreate.CreateNewAppointment();
                    break;

                case 2:
                    appointmentViewDisplay.ShowAppointmentsOfToday();
                    break;

                case 3:
                    appointmentViewDisplay.ShowAppointmentsOfNextSevenDays();
                    break;

                case 4:
                    appointmentViewDisplay.ShowAllAppointments();
                    break;

                case 5:
                    appointmentViewDelete.DeleteAppointmentByIndex();
                    break;

                case 6:
                    appointmentViewDelete.DeleteAppointmentByDate();
                    break;

                case 7:
                    appointmentViewDelete.DeleteAllAppointments();
                    break;

                case 8:
                    appointmentViewStorage.SaveAppointments();
                    break;

                case 0:
                    isRunning = false;
                    break;

                default:
                    AppointmentViewGeneral.PrintInvalidInput();
                    break;
                }
            }
        }