private void button1_Click(object sender, EventArgs e) { if (Validacion.validarInputs(this.Controls) && Validacion.soloNumeros( this.kgsTextBox, "Kgs a enviar")) { kgs = Convert.ToInt32(kgsTextBox.Text); encomienda = ( Domain.Encomienda ) new CargarDatos().ShowDialog(codViaje, new DateTime(), -1, kgs); this.Close(); } else MessageBox.Show("Debe cargar los kgs a enviar para confirmar"); }
private void button1_Click(object sender, EventArgs e) { if (Validacion.validarInputs(this.Controls) && Validacion.soloLetras(this.Apellido, Apellido.Name) && Validacion.soloNumeros(this.dni, dni.Name) && Validacion.soloLetras(this.Nombre, Nombre.Name) && Validacion.soloNumeros(this.Telefono, Telefono.Name) && Validacion.emailValido( this.Mail ) // && Validacion.fechaMenorAlDiaDeHoy( fecha, "Fecha de Nacimiento" ) // validar butaca y encomienda ? ) { if ( cl == null ) cl = new Cliente( Convert.ToInt32( dni.Text ), Nombre.Text, Apellido.Text, Direccion.Text, Convert.ToInt32( Telefono.Text ), Mail.Text, Convert.ToDateTime( fecha.Value ), 0 ); if (butaca != -1) { pasaje = new Pasaje( codViaje, fechaSalida, new ViajesRepository().getViaje(codViaje), butaca, cl, 0 // Precio ); } if (kgs != -1) { encomienda = new Domain.Encomienda(kgs, codViaje, cl); } this.Close(); } }