private void checkHoste() { try { // string nom, string dNIPasaport, string telefon, string nacionalitat, string adreca, int codipostal, string poblacio hoste = new Hoste(Nom, DNIPasaport, Telefon, Nacionalitat, Adreca, Codipostal, Poblacio); Console.WriteLine(hoste.ToString()); bool hostevalid = false; if (Nom != null && DNIPasaport != null && Telefon != null && Nacionalitat != null && Adreca != null && Codipostal != 0 && Poblacio != null) { hostevalid = true; } ah.afegirClientB.Enabled = hostevalid; Console.WriteLine(hostevalid); } catch (Exception ex) { // } }
private void getHosteSelected() { try { hosteSelected = (Hoste)ar.SeleccionaHosteInput.SelectedItem; } catch (Exception ex) { hosteSelected = new Hoste(); } }
private void checkHoste() { try { // string nom, string dNIPasaport, string telefon, string nacionalitat, string adreca, int codipostal, string poblacio hoste = new Hoste(Nom, DNIPasaport, Telefon, Nacionalitat, Adreca, Codipostal, Poblacio); bool hostevalid = hoste.GetType().GetProperties().All(p => p.GetValue(hoste) != null); Console.WriteLine(hostevalid); } catch (Exception ex) { // } }