Created
August 16, 2014 11:56
-
-
Save Fhernd/249d3c6542a453956ca8 to your computer and use it in GitHub Desktop.
Captura de la nota para el estudiante.
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: DialogoNota.cs | |
// | |
// Propósito: Diálogo para la captura de la nota de un | |
// estudiante. | |
// | |
============================================================*/ | |
using System; | |
using System.ComponentModel; | |
using System.Drawing; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace NotasCurso.GUI | |
{ | |
public partial class DialogoNota : Form | |
{ | |
#region Componentes | |
/// <summary> | |
/// Ventana padre de este diálogo de captura de nota. | |
/// </summary> | |
private Principal ventanaPrincipal; | |
#endregion | |
#region Constructores | |
/// <summary> | |
/// Crea formulario de captura de nota de estudiante. | |
/// </summary> | |
/// <param name="principal">Componente padre de este diálogo.</param> | |
public DialogoNota(Principal principal) | |
{ | |
InitializeComponent(); | |
ventanaPrincipal = principal; | |
} | |
#endregion | |
#region Eventos | |
/// <summary> | |
/// Evento que valida, acepta o rechaza, la entrada de la nota | |
/// por parte del usuario de la aplicación. | |
/// </summary> | |
/// <param name="sender">Objeto generador del evento</param> | |
/// <param name="e">Datos del evento.</param> | |
private void btnAceptar_Click(object sender, EventArgs e) | |
{ | |
double nota; | |
if (double.TryParse(txtNota.Text, out nota)) | |
{ | |
if (nota >= 0 && nota <= 5) | |
{ | |
ventanaPrincipal.Nota = nota; | |
this.DialogResult = System.Windows.Forms.DialogResult.OK; | |
this.Close(); | |
} | |
else | |
{ | |
MessageBox.Show(this, "La nota debe tener un valor entre 0.0 y 5.0", "Nota", MessageBoxButtons.OK, MessageBoxIcon.Error); | |
} | |
} | |
else | |
{ | |
MessageBox.Show(this, "Introduzca un valor válido para la nota.", "Nota", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); | |
} | |
} | |
/// <summary> | |
/// Evento que cancela la entrada de la nota. | |
/// </summary> | |
/// <param name="sender">Objeto generador del evento</param> | |
/// <param name="e">Datos del evento.</param> | |
private void btnCancelar_Click(object sender, EventArgs e) | |
{ | |
this.DialogResult = System.Windows.Forms.DialogResult.Cancel; | |
this.Close(); | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment