private void ObtenerJugadoresNroDoc() { var source = new AutoCompleteStringCollection(); SistemaARA.Negocio.Jugadores oJugadoresNegocio = new SistemaARA.Negocio.Jugadores(); SistemaARA.Entidades.Jugadores oJugadores = new SistemaARA.Entidades.Jugadores(); oJugadores = oJugadoresNegocio.GetAll(); foreach (SistemaARA.Entidades.Jugador oJugador in oJugadores) { source.Add(oJugador.nroDoc); } txbNroDocJugador.AutoCompleteCustomSource = source; }
private void txbNroDocJugador_TextChanged(object sender, EventArgs e) { SistemaARA.Negocio.Jugadores oJugadoresNegocio = new SistemaARA.Negocio.Jugadores(); SistemaARA.Entidades.Jugadores oJugadores = new SistemaARA.Entidades.Jugadores(); oJugadores = oJugadoresNegocio.GetOneNroDoc(txbNroDocJugador.Text); if (oJugadores.Count > 0) { txbNomApJugador.Text = oJugadores[0].apellido + ", " + oJugadores[0].nombre; } else { txbNomApJugador.Text = ""; } }
private void ObtenerJugadoresNombre() { var source = new AutoCompleteStringCollection(); SistemaARA.Negocio.Jugadores oJugadoresNegocio = new SistemaARA.Negocio.Jugadores(); SistemaARA.Entidades.Jugadores oJugadores = new SistemaARA.Entidades.Jugadores(); oJugadores = oJugadoresNegocio.GetAll(); foreach (SistemaARA.Entidades.Jugador oJugador in oJugadores) { source.Add(oJugador.apellido + ", " + oJugador.nombre); } txbNomApJugador.AutoCompleteCustomSource = source; }
private void txbNomApJugador_TextChanged(object sender, EventArgs e) { SistemaARA.Negocio.Jugadores oJugadoresNegocio = new SistemaARA.Negocio.Jugadores(); SistemaARA.Entidades.Jugadores oJugadores = new SistemaARA.Entidades.Jugadores(); oJugadores = oJugadoresNegocio.GetOne(txbNomApJugador.Text); if (oJugadores.Count > 0) { if (oJugadores[0].nroDoc.ToString() == ". .") { txbNroDocJugador.Text = "S/D"; } else { txbNroDocJugador.Text = oJugadores[0].nroDoc.ToString(); } } else { txbNroDocJugador.Text = ""; } }
// Inicializa el formulario private void IniciarFormulario() { SistemaARA.Negocio.Torneos oTorneosNegocio = new SistemaARA.Negocio.Torneos(); SistemaARA.Entidades.Torneos oTorneos = new SistemaARA.Entidades.Torneos(); oTorneos = oTorneosNegocio.GetOne(IdTorneo); txbTorneo.Text = oTorneos[0].nombre; txbCostoInscripcion.Text = oTorneos[0].costoEstandar.ToString(); // Verifica la operacion en curso if (Operacion == General.TipoOperacion.Edicion) { if (oTorneos[0].fechaHora < DateTime.Today) { MessageBox.Show("El torneo ya fue realizado. No se pueden modificar los datos de la inscripción.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CancelarOperacion(); this.Close(); } else { lblNomApRequerido.Visible = false; lblNroDocRequerido.Visible = false; this.Text = "Inscripcion - Edición"; // Debo obtener la inscripcion para editar SistemaARA.Entidades.Inscripciones oInscripciones; SistemaARA.Negocio.Inscripciones oInscripcionesNegocio = new SistemaARA.Negocio.Inscripciones(); txbNomApJugador.Enabled = false; txbNroDocJugador.Enabled = false; try { // Solicito a negocio toda la informacion de la inscripcion a editar oInscripciones = oInscripcionesNegocio.GetOne(IdJugador, IdTorneo); // Verifico que haya obtenido datos if (oInscripciones.Count > 0) { // Siempre es el primer valor de la coleccion // Visualizo los datos en los controles SistemaARA.Entidades.Inscripcion oInscripcion = oInscripciones[0]; SistemaARA.Entidades.Jugadores oJugadores; SistemaARA.Negocio.Jugadores oJugadoresNegocio = new SistemaARA.Negocio.Jugadores(); oJugadores = oJugadoresNegocio.GetOne(IdJugador); txbNomApJugador.Text = oJugadores[0].apellido + ", " + oJugadores[0].nombre; if (oJugadores[0].nroDoc.ToString() == ". .") { txbNroDocJugador.Text = "S/D"; } else { txbNroDocJugador.Text = oJugadores[0].nroDoc.ToString(); } } else { // Sino puedo encontrar el jugador, puede haberse eliminado por otro usuario // Informo de la situación e invalido el formulario para cualquier operación MessageBox.Show("La inscripción solicitada no existe. Verifique que no haya sido eliminada.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); gpbDatosInscripcion.Enabled = false; btnAceptar.Visible = false; } } catch (Exception ex) { // Muestra el error ocurrido MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { // Liberamos memoria oInscripciones = null; oInscripcionesNegocio = null; } } } else { if (oTorneos[0].fechaHora < DateTime.Today) { MessageBox.Show("El torneo ya fue realizado. No se puede registrar una inscripción.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CancelarOperacion(); this.Close(); } else { this.Text = "Inscripcion - Alta"; txbNomApJugador.Text = ""; txbNroDocJugador.Text = ""; } } }