84 lines
2.5 KiB
C#
84 lines
2.5 KiB
C#
namespace agenzia_viaggi;
|
|
|
|
class Prenotazione {
|
|
string UUID; //codice univoco prenotazione
|
|
string periodo;
|
|
string giorniPrenotati;
|
|
string costo;
|
|
string numeroPersone;
|
|
string codiceFiscalePrenotante;
|
|
|
|
public Prenotazione(string p_periodo, string p_giorniPrenotati, string p_numeroPersone, string p_codiceFiscalePrenotante) {
|
|
this.SetUUID();
|
|
this.periodo = p_periodo;
|
|
this.giorniPrenotati = p_giorniPrenotati;
|
|
this.SetCosto();
|
|
this.numeroPersone = p_numeroPersone;
|
|
this.codiceFiscalePrenotante = p_codiceFiscalePrenotante;
|
|
}
|
|
|
|
public string GetUUID() {
|
|
return this.UUID;
|
|
}
|
|
|
|
public string GetPeriodo() {
|
|
return this.periodo;
|
|
}
|
|
|
|
public string GetGiorniPrenotati() {
|
|
return this.giorniPrenotati;
|
|
}
|
|
|
|
public string GetCosto() {
|
|
return this.costo;
|
|
}
|
|
|
|
public string GetNumeroPersone() {
|
|
return this.numeroPersone;
|
|
}
|
|
|
|
public string GetCodiceFiscalePrenotante() {
|
|
return this.codiceFiscalePrenotante;
|
|
}
|
|
|
|
public void SetUUID() {
|
|
const int LUNGHEZZA = 16;
|
|
Random random = new Random();
|
|
const string caratteri = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
char[] risultato = new char[LUNGHEZZA];
|
|
for (int i = 0; i < LUNGHEZZA; i++) {
|
|
risultato[i] = caratteri[random.Next(caratteri.Length)];
|
|
}
|
|
this.UUID = string.Join("", risultato);
|
|
}
|
|
|
|
public void SetPeriodo(string p_periodo) {
|
|
this.periodo = p_periodo;
|
|
}
|
|
|
|
public void SetGiorniPrenotati(string p_giorniPrenotati) {
|
|
this.giorniPrenotati = p_giorniPrenotati;
|
|
}
|
|
|
|
public void SetCosto() {
|
|
Random random = new Random();
|
|
this.costo = Convert.ToString(random.Next());
|
|
}
|
|
|
|
public void SetNumeroPersone(string p_numeroPersone) {
|
|
this.numeroPersone = p_numeroPersone;
|
|
}
|
|
|
|
public void SetCodiceFiscalePrenotante(string p_codiceFiscalePrenotante) {
|
|
this.codiceFiscalePrenotante = p_codiceFiscalePrenotante;
|
|
}
|
|
|
|
public void StampaDatiPrenotazione() {
|
|
Console.WriteLine($"Codice univoco: {this.GetUUID()}");
|
|
Console.WriteLine($"Periodo dell'anno: {this.GetPeriodo()}");
|
|
Console.WriteLine($"Giorni prenotati: {this.GetGiorniPrenotati()}");
|
|
Console.WriteLine($"Costo: {this.GetCosto()}");
|
|
Console.WriteLine($"Numero persone: {this.GetNumeroPersone()}");
|
|
Console.WriteLine($"COdice fiscale a cui è intestata la prenotazione: {this.GetCodiceFiscalePrenotante()}");
|
|
}
|
|
} |