Created
July 17, 2014 01:10
-
-
Save Fhernd/a7fac7e3c6fc9bafe8cd to your computer and use it in GitHub Desktop.
Diálogo para la captura de la información de la venta.
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 | |
// | |
// ===--=== | |
/*============================================================ | |
// | |
// Clase: DialogoVenta.cs | |
// | |
// Original en: http://goo.gl/0FYV7G | |
// | |
// Propósito: Formulario para capturar la cantidad de la | |
// venta. | |
// | |
============================================================*/ | |
using System; | |
using System.ComponentModel; | |
using System.Drawing; | |
using System.Windows.Forms; | |
namespace JuegosCelulares.GUI | |
{ | |
/// <summary> | |
/// Formulario con controles de captura de las unidades a vender | |
/// de un terminado juego. | |
/// </summary> | |
public partial class DialogoVenta : Form | |
{ | |
#region Controles | |
/// <summary> | |
/// Representa el control padre de este diálogo. | |
/// </summary> | |
private ControlJuegos padre; | |
#endregion | |
#region Constructores | |
/// <summary> | |
/// Crea una instancia de este formulario. | |
/// </summary> | |
/// <param name="padre">Control padre.</param> | |
public DialogoVenta(ControlJuegos padre) | |
{ | |
InitializeComponent(); | |
this.padre = padre; | |
} | |
#endregion | |
#region Eventos | |
/// <summary> | |
/// Valida el valor introducido por el usuario. | |
/// </summary> | |
/// <param name="sender">Generador del evento.</param> | |
/// <param name="e">Argumentos del evento.</param> | |
private void btnAceptar_Click(object sender, EventArgs e) | |
{ | |
int resultado = 0; | |
if (Int32.TryParse(txtCantidad.Text, out resultado)) | |
{ | |
padre.Cantidad = resultado; | |
this.DialogResult = System.Windows.Forms.DialogResult.OK; | |
this.Close(); | |
} | |
else | |
{ | |
MessageBox.Show(this, "Debe introducir un valor válido para la cantidad a vender.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | |
this.DialogResult = System.Windows.Forms.DialogResult.None; | |
} | |
} | |
/// <summary> | |
/// Cancela la venta, y cierra el diálogo. | |
/// </summary> | |
/// <param name="sender">Generador del evento.</param> | |
/// <param name="e">Argumentos del evento.</param> | |
private void Cancelar_Click(object sender, EventArgs e) | |
{ | |
this.Close(); | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment