Created
July 2, 2015 21:31
-
-
Save Fhernd/174396764bedc5d782b3 to your computer and use it in GitHub Desktop.
Diálogo `DialogoBuscarPasajero`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ===++=== | |
// | |
// OrtizOL - xCSw | |
// | |
// Proyecto: Cupi2.NET | |
// | |
// ===--=== | |
/*============================================================ | |
// | |
// Clase(s): DialogoBuscarPasajero. | |
// | |
// Propósito: Representar diálogo de búsqueda de un pasajero. | |
// | |
// Original: http://cupi2.uniandes.edu.co/sitio/index.php/cursos/apo1/nivel-3/avion/visualizacion-codigo/dialogoasignacion | |
// | |
============================================================*/ | |
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
using ElAvión.Modelo; | |
namespace ElAvión.GUI | |
{ | |
/// <summary> | |
/// Clase que representa el diálogo de búsqueda de los datos (detalles) de un pasajero. | |
/// </summary> | |
public partial class DialogoBuscarPasajero : Form | |
{ | |
#region Campos | |
/// <summary> | |
/// Instancia de referencia del objeto `Avion` principal. | |
/// </summary> | |
private Avion m_avion; | |
#endregion | |
#region Constructores | |
/// <summary> | |
/// Crea un nuevo diálogo de búsqueda de los detalles de un pasajero. | |
/// </summary> | |
/// <param name="avion">Referencia al objeto `Avion` principal.</param> | |
public DialogoBuscarPasajero(Avion avion) | |
{ | |
InitializeComponent(); | |
m_avion = avion; | |
} | |
#endregion | |
#region Eventos | |
/// <summary> | |
/// Activa y valida los datos ingresados del pasajero para su eventual visualización. | |
/// </summary> | |
/// <param name="sender">Generador del evento.</param> | |
/// <param name="e">Argumentos del evento.</param> | |
private void btnAceptar_Click(object sender, EventArgs e) | |
{ | |
Int64 cedula; | |
if (Int64.TryParse(txtCedula.Text, out cedula)) | |
{ | |
Pasajero pasajero = new Pasajero(cedula); | |
Silla silla = m_avion.BuscarPasajero(pasajero); | |
if (silla != null) | |
{ | |
using(DialogoDetallesPasajero ddp = new DialogoDetallesPasajero(silla)) | |
{ | |
DialogResult dr = ddp.ShowDialog(this); | |
if (dr == System.Windows.Forms.DialogResult.OK) | |
{ | |
this.Close(); | |
} | |
} | |
} | |
} | |
else | |
{ | |
MessageBox.Show(this, "El valor de cédula no es válido. Intente de nuevo.", "Error Número Cédula", MessageBoxButtons.OK, MessageBoxIcon.Error); | |
} | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment