Exemplo n.º 1
0
 public AddettoAllaSicurezza(string nome, string cognome, string cf, DateTime dataNascita,
                             LuogoNascita luogoNascita, DateTime dataAssunzione, Qualifica qualifica, params Indirizzo[] indirizzi)
 {
     if (String.IsNullOrEmpty(nome))
     {
         throw new ArgumentException("String.IsNullOrEmpty(nome)");
     }
     _nome = nome;
     if (String.IsNullOrEmpty(cognome))
     {
         throw new ArgumentException("String.IsNullOrEmpty(cognome)");
     }
     _cognome = cognome;
     if (String.IsNullOrEmpty(cf))
     {
         throw new ArgumentException("String.IsNullOrEmpty(cf)");
     }
     _cf = cf;
     if (dataNascita.AddYears(16) > DateTime.Now)/*controllo età minima anni 16*/
     {
         throw new ArgumentException("la data di nascita non è ammisibile!");
     }
     _dataNascita = dataNascita;
     if (luogoNascita == null)
     {
         throw new ArgumentException("luogoNascita == null");
     }
     _luogoNascita = luogoNascita;
     if (indirizzi == null || indirizzi[0] == null || indirizzi.Length > 2)
     {
         throw new ArgumentException("indirizzi == null || Indirizzo residenza non fornito|| indirizzi.Length>2");
     }
     else
     {
         _indirizzi[0] = indirizzi[0];
         if (indirizzi.Length == 2 && indirizzi[1] != null)
         {
             _indirizzi[1] = indirizzi[1];
         }
         else if (indirizzi.Length == 2 && indirizzi[1] == null)
         {
             throw new ArgumentException("indirizzi[1] != null ");
         }
     }
     if (dataAssunzione > DateTime.Now)
     {
         throw new ArgumentException("non e' ancora stato assunto");
     }
     _dataAssunzione = dataAssunzione;
     _qualifica      = qualifica;
 }
Exemplo n.º 2
0
 public AddettoAllaSicurezza(string nome, string cognome, string cf, DateTime dataNascita,
                             LuogoNascita luogoNascita, DateTime dataAssunzione, params Indirizzo[] indirizzi)
     : this(nome, cognome, cf, dataNascita, luogoNascita,
            dataAssunzione, Qualifica.Steward, indirizzi)
 {
 }
Exemplo n.º 3
0
 public override int GetHashCode()
 {
     return(Nome.GetHashCode() ^ Cognome.GetHashCode() ^ Cf.GetHashCode() ^ DataNascita.GetHashCode() ^
            LuogoNascita.GetHashCode() ^ Residenza.GetHashCode() ^ DataAssunzione.GetHashCode() ^ Qualifica.GetHashCode());
 }