Opzione 6

This commit is contained in:
La Programmatrice Verde 2025-05-07 22:18:27 +02:00
parent 4dd44238f1
commit d78b3c74cc
9 changed files with 43 additions and 2 deletions

View File

@ -749,6 +749,7 @@ class Program {
Console.WriteLine("3. Mostra informazioni cliente");
Console.WriteLine("4. Cancella prenotazione");
Console.WriteLine("5. Mostra tutte le prenotazioni");
Console.WriteLine("6. Aggiungi prenotazione");
Console.WriteLine("0. Esci");
Console.Write("Scelta: ");
@ -1010,6 +1011,46 @@ class Program {
}
Pausa();
break;
case 6:
do {
Console.WriteLine("Aggiungere una prenotazione a quale cliente? ");
for (int i = 0; i < clienti.Length; i++) {
Console.WriteLine(i + 1);
}
Console.Write("Scelta: ");
eccezione = false;
try {
input = Convert.ToInt32(Console.ReadLine());
}
catch (FormatException) {
Console.WriteLine("Opzione non valida");
eccezione = true;
Pausa();
}
if (!eccezione) {
if (input <= 0 || input > numeroClienti) {
Console.WriteLine("Opzione non valida");
Pausa();
}
else if (clienti[input - 1] == null) {
Console.WriteLine("I dati di questo cliente non sono ancora stati inseriti.");
Pausa();
}
}
}
while (eccezione || input <= 0 || input > numeroClienti || clienti[input - 1] == null);
Prenotazione[] precedente = clienti[input - 1].GetPrenotazioni();
Prenotazione[] nuovo = new Prenotazione[precedente.Length + 1];
for (int i = 0; i < precedente.Length; i++) {
nuovo[i] = precedente[i];
}
clienti[input - 1].SetPrenotazioni(nuovo);
Console.WriteLine("Prenotazione aggiunta con successo");
Pausa();
break;
default:
Console.WriteLine("Opzione non valida");
Pausa();

Binary file not shown.

Binary file not shown.

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("agenzia_viaggi")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+7d0e2d2a20832c08fee6ed8e5c82929ee4b7ef6e")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4dd44238f18c5c584ff4ebd96a7111c406880bdb")]
[assembly: System.Reflection.AssemblyProductAttribute("agenzia_viaggi")]
[assembly: System.Reflection.AssemblyTitleAttribute("agenzia_viaggi")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
26fd656d6612597d0a6de6b43658ea976dd067e7afd7d8ca4033dcfa8783659c
2a7dc145931764cff965068fab78fe77e949894ad5284855228257b3af6943c7

Binary file not shown.

Binary file not shown.