Torna indietro
This commit is contained in:
parent
e9a2bb088e
commit
52aa781881
263
Program.cs
263
Program.cs
@ -993,12 +993,13 @@ class Program {
|
||||
}
|
||||
}
|
||||
}
|
||||
while (eccezione || input <= 0 || input > numeroClienti || clienti[input - 1] != null);
|
||||
while (eccezione || input <= 0 || input > numeroClienti);
|
||||
if (clienti[input - 1] == null) {
|
||||
clienti[input - 1] = CreaCliente();
|
||||
Console.WriteLine("Cliente inserito con successo");
|
||||
|
||||
clienti[input - 1] = CreaCliente();
|
||||
Console.WriteLine("Cliente inserito con successo");
|
||||
|
||||
Pausa();
|
||||
Pausa();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
string[] periodi = ["primavera", "estate", "autunno", "inverno"];
|
||||
@ -1033,108 +1034,108 @@ class Program {
|
||||
}
|
||||
}
|
||||
}
|
||||
while (eccezione || input <= 0 || input > numeroClienti || clienti[input - 1] == null);
|
||||
while (eccezione || input <= 0 || input > numeroClienti);
|
||||
if (clienti[input - 1] != null) {
|
||||
scelta = 5;
|
||||
do {
|
||||
Console.WriteLine("Quale periodo dell'anno scegliere?");
|
||||
Console.WriteLine("1. Primavera");
|
||||
Console.WriteLine("2. Estate");
|
||||
Console.WriteLine("3. Autunno");
|
||||
Console.WriteLine("4. Inverno");
|
||||
Console.Write("Scelta: ");
|
||||
|
||||
scelta = 5;
|
||||
do {
|
||||
Console.WriteLine("Quale periodo dell'anno scegliere?");
|
||||
Console.WriteLine("1. Primavera");
|
||||
Console.WriteLine("2. Estate");
|
||||
Console.WriteLine("3. Autunno");
|
||||
Console.WriteLine("4. Inverno");
|
||||
Console.Write("Scelta: ");
|
||||
eccezione = false;
|
||||
|
||||
eccezione = false;
|
||||
|
||||
try {
|
||||
scelta = Convert.ToInt32(Console.ReadLine());
|
||||
}
|
||||
catch (FormatException) {
|
||||
Console.WriteLine("Opzione non valida");
|
||||
eccezione = true;
|
||||
Pausa();
|
||||
}
|
||||
if (!eccezione) {
|
||||
if (scelta < 1 || scelta > 4) {
|
||||
try {
|
||||
scelta = Convert.ToInt32(Console.ReadLine());
|
||||
}
|
||||
catch (FormatException) {
|
||||
Console.WriteLine("Opzione non valida");
|
||||
eccezione = true;
|
||||
Pausa();
|
||||
}
|
||||
if (!eccezione) {
|
||||
if (scelta < 1 || scelta > 4) {
|
||||
Console.WriteLine("Opzione non valida");
|
||||
Pausa();
|
||||
}
|
||||
}
|
||||
} while (eccezione || scelta < 1 || scelta > 4);
|
||||
|
||||
do {
|
||||
Console.Write("Per quanti giorni prenotare? ");
|
||||
|
||||
eccezione = false;
|
||||
|
||||
try {
|
||||
giorniPrenotati = Convert.ToInt32(Console.ReadLine());
|
||||
}
|
||||
catch (FormatException) {
|
||||
Console.WriteLine("Numero non valido");
|
||||
eccezione = true;
|
||||
Pausa();
|
||||
}
|
||||
if (!eccezione) {
|
||||
if (giorniPrenotati <= 0) {
|
||||
Console.WriteLine("Errore: impossibile prenotare per meno di un giorno.");
|
||||
Pausa();
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (eccezione || scelta < 1 || scelta > 4);
|
||||
while (eccezione || giorniPrenotati <= 0);
|
||||
|
||||
do {
|
||||
Console.Write("Per quanti giorni prenotare? ");
|
||||
do {
|
||||
Console.Write("Per quante persone prenotare? ");
|
||||
|
||||
eccezione = false;
|
||||
eccezione = false;
|
||||
|
||||
try {
|
||||
giorniPrenotati = Convert.ToInt32(Console.ReadLine());
|
||||
try {
|
||||
numeroPersone = Convert.ToInt32(Console.ReadLine());
|
||||
}
|
||||
catch (FormatException) {
|
||||
Console.WriteLine("Numero non valido");
|
||||
eccezione = true;
|
||||
Pausa();
|
||||
}
|
||||
if (!eccezione) {
|
||||
if (numeroPersone <= 0) {
|
||||
Console.WriteLine("Errore: impossibile prenotare per meno di una persona.");
|
||||
Pausa();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FormatException) {
|
||||
Console.WriteLine("Numero non valido");
|
||||
eccezione = true;
|
||||
while (numeroPersone <= 0);
|
||||
|
||||
for (int i = 0; i < clienti[input - 1].GetPrenotazioni().Length && !exit; i++) {
|
||||
if (clienti[input - 1].GetPrenotazioni()[i] != null) {
|
||||
exit = clienti[input - 1].GetPrenotazioni()[i].GetPeriodo() == periodi[scelta - 1] ||
|
||||
clienti[input - 1].GetPrenotazioni()[i].GetGiorniPrenotati() == Convert.ToString(giorniPrenotati) ||
|
||||
clienti[input - 1].GetPrenotazioni()[i].GetNumeroPersone() == Convert.ToString(numeroPersone);
|
||||
}
|
||||
}
|
||||
|
||||
if (!exit) {
|
||||
|
||||
eccezione = false;
|
||||
|
||||
try {
|
||||
clienti[input - 1].InserisciPrenotazione(periodi[scelta - 1], Convert.ToString(giorniPrenotati), Convert.ToString(numeroPersone));
|
||||
}
|
||||
catch (Exception e) {
|
||||
Console.WriteLine(e.Message);
|
||||
eccezione = true;
|
||||
}
|
||||
if (!eccezione) {
|
||||
Console.WriteLine("Prenotazione inserita correttamente.");
|
||||
}
|
||||
Pausa();
|
||||
}
|
||||
if (!eccezione) {
|
||||
if (giorniPrenotati <= 0) {
|
||||
Console.WriteLine("Errore: impossibile prenotare per meno di un giorno.");
|
||||
Pausa();
|
||||
}
|
||||
}
|
||||
}
|
||||
while (eccezione || giorniPrenotati <= 0);
|
||||
|
||||
do {
|
||||
Console.Write("Per quante persone prenotare? ");
|
||||
|
||||
eccezione = false;
|
||||
|
||||
try {
|
||||
numeroPersone = Convert.ToInt32(Console.ReadLine());
|
||||
}
|
||||
catch (FormatException) {
|
||||
Console.WriteLine("Numero non valido");
|
||||
eccezione = true;
|
||||
else {
|
||||
Console.WriteLine("Prenotazione già esistente.");
|
||||
Pausa();
|
||||
}
|
||||
if (!eccezione) {
|
||||
if (numeroPersone <= 0) {
|
||||
Console.WriteLine("Errore: impossibile prenotare per meno di una persona.");
|
||||
Pausa();
|
||||
}
|
||||
}
|
||||
}
|
||||
while (numeroPersone <= 0);
|
||||
|
||||
for (int i = 0; i < clienti[input - 1].GetPrenotazioni().Length && !exit; i++) {
|
||||
if (clienti[input - 1].GetPrenotazioni()[i] != null) {
|
||||
exit = clienti[input - 1].GetPrenotazioni()[i].GetPeriodo() == periodi[scelta - 1] ||
|
||||
clienti[input - 1].GetPrenotazioni()[i].GetGiorniPrenotati() == Convert.ToString(giorniPrenotati) ||
|
||||
clienti[input - 1].GetPrenotazioni()[i].GetNumeroPersone() == Convert.ToString(numeroPersone);
|
||||
}
|
||||
}
|
||||
|
||||
if (!exit) {
|
||||
|
||||
eccezione = false;
|
||||
|
||||
try {
|
||||
clienti[input - 1].InserisciPrenotazione(periodi[scelta - 1], Convert.ToString(giorniPrenotati), Convert.ToString(numeroPersone));
|
||||
}
|
||||
catch (Exception e) {
|
||||
Console.WriteLine(e.Message);
|
||||
eccezione = true;
|
||||
}
|
||||
if (!eccezione) {
|
||||
Console.WriteLine("Prenotazione inserita correttamente.");
|
||||
}
|
||||
Pausa();
|
||||
}
|
||||
else {
|
||||
Console.WriteLine("Prenotazione già esistente.");
|
||||
Pausa();
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
for (int i = 0; i < numeroClienti; i++) {
|
||||
@ -1175,44 +1176,45 @@ class Program {
|
||||
}
|
||||
}
|
||||
}
|
||||
while (eccezione || input <= 0 || input > numeroClienti || clienti[input - 1] == null);
|
||||
|
||||
do {
|
||||
Console.WriteLine("Scegliere una prenotazione:");
|
||||
for (int i = 0; i < clienti[input - 1].GetPrenotazioni().Length; i++) {
|
||||
if (clienti[input - 1].GetPrenotazioni()[i] != null) {
|
||||
Console.WriteLine($"{i + 1}. {clienti[input - 1].GetPrenotazioni()[i].GetUUID()}");
|
||||
while (eccezione || input <= 0 || input > numeroClienti);
|
||||
if (clienti[input - 1] != null) {
|
||||
do {
|
||||
Console.WriteLine("Scegliere una prenotazione:");
|
||||
for (int i = 0; i < clienti[input - 1].GetPrenotazioni().Length; i++) {
|
||||
if (clienti[input - 1].GetPrenotazioni()[i] != null) {
|
||||
Console.WriteLine($"{i + 1}. {clienti[input - 1].GetPrenotazioni()[i].GetUUID()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.Write("Scelta: ");
|
||||
Console.Write("Scelta: ");
|
||||
|
||||
eccezione = false;
|
||||
eccezione = false;
|
||||
|
||||
try {
|
||||
scelta = Convert.ToInt32(Console.ReadLine());
|
||||
}
|
||||
catch (FormatException) {
|
||||
Console.WriteLine("Opzione non valida");
|
||||
eccezione = true;
|
||||
Pausa();
|
||||
}
|
||||
if (!eccezione) {
|
||||
if (scelta < 1 || scelta > clienti[input - 1].GetPrenotazioni().Length) {
|
||||
try {
|
||||
scelta = Convert.ToInt32(Console.ReadLine());
|
||||
}
|
||||
catch (FormatException) {
|
||||
Console.WriteLine("Opzione non valida");
|
||||
eccezione = true;
|
||||
Pausa();
|
||||
}
|
||||
else if (clienti[input - 1].GetPrenotazioni()[scelta - 1] == null) {
|
||||
Console.WriteLine("Opzione non valida");
|
||||
Pausa();
|
||||
if (!eccezione) {
|
||||
if (scelta < 1 || scelta > clienti[input - 1].GetPrenotazioni().Length) {
|
||||
Console.WriteLine("Opzione non valida");
|
||||
Pausa();
|
||||
}
|
||||
else if (clienti[input - 1].GetPrenotazioni()[scelta - 1] == null) {
|
||||
Console.WriteLine("Opzione non valida");
|
||||
Pausa();
|
||||
}
|
||||
}
|
||||
}
|
||||
while (eccezione || scelta < 1 || scelta > clienti[input - 1].GetPrenotazioni().Length || clienti[input - 1].GetPrenotazioni()[scelta - 1] == null);
|
||||
|
||||
clienti[input - 1].CancellaPrenotazione(clienti[input - 1].GetPrenotazioni()[scelta - 1].GetUUID());
|
||||
|
||||
Console.WriteLine("Prenotazione cancellata con successo.");
|
||||
Pausa();
|
||||
}
|
||||
while (eccezione || scelta < 1 || scelta > clienti[input - 1].GetPrenotazioni().Length || clienti[input - 1].GetPrenotazioni()[scelta - 1] == null);
|
||||
|
||||
clienti[input - 1].CancellaPrenotazione(clienti[input - 1].GetPrenotazioni()[scelta - 1].GetUUID());
|
||||
|
||||
Console.WriteLine("Prenotazione cancellata con successo.");
|
||||
Pausa();
|
||||
break;
|
||||
case 5:
|
||||
for (int i = 0; i < clienti.Length; i++) {
|
||||
@ -1252,16 +1254,19 @@ class Program {
|
||||
}
|
||||
}
|
||||
}
|
||||
while (eccezione || input <= 0 || input > numeroClienti || clienti[input - 1] == null);
|
||||
while (eccezione || input <= 0 || input > numeroClienti);
|
||||
|
||||
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];
|
||||
if (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();
|
||||
}
|
||||
clienti[input - 1].SetPrenotazioni(nuovo);
|
||||
Console.WriteLine("Prenotazione aggiunta con successo");
|
||||
Pausa();
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Opzione non valida");
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -13,10 +13,10 @@ 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+9eac5a5ec45cf7e6cb0f9452f425a08d185e86e1")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e9a2bb088ee94b78852d49951dc3d021003dc309")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("agenzia_viaggi")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("agenzia_viaggi")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
// Generato dalla classe WriteCodeFragment di MSBuild.
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
3c7d8fec6052be50a3529960f37448ffce5cb2d4ff973de00c355bb1dfcee246
|
||||
153a91f0fce65a5966096ed29a3371d521a9c0aba32f41fa6a5d4d22dfeb12e3
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user