Advertisement
Fhernd

FormCantidad.cs

Jul 6th, 2014
1,955
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.22 KB | None | 0 0
  1. // ===++===
  2. //
  3. //  OrtizOL
  4. //
  5. // ===--===
  6. /*============================================================
  7. //
  8. // Clase: FormCantidad.cs
  9. //
  10. // Propósito: Crear formulario para solicitiar la cantidad
  11. // de producto a vender o a pedir.
  12. //
  13. ============================================================*/
  14.  
  15. using System;
  16. using System.ComponentModel;
  17. using System.Data;
  18. using System.Drawing;
  19. using System.Windows.Forms;
  20.  
  21. namespace LaTienda.GUI
  22. {
  23.     /// <summary>
  24.     /// Diálogo para solicitar la cantidad de producto a vender o pedir.
  25.     /// </summary>
  26.     public partial class FormCantidad : Form
  27.     {
  28.         #region Campos (componentes de interfaz)
  29.         /// <summary>
  30.         /// Control padre.
  31.         /// </summary>
  32.         private ControlOperaciones padre;
  33.         #endregion
  34.  
  35.         #region Constructores
  36.         /// <summary>
  37.         /// Crea el diálog para solicitar la cantidad a vender o a pedir.
  38.         /// </summary>
  39.         /// <param name="padre">Control padre.</param>
  40.         public FormCantidad(ControlOperaciones padre)
  41.         {
  42.             InitializeComponent();
  43.  
  44.             this.padre = padre;
  45.         }
  46.         #endregion
  47.  
  48.         #region eventos
  49.         /// <summary>
  50.         /// Acepta la cantidad introducida.
  51.         /// </summary>
  52.         /// <param name="sender">Generador del evento.</param>
  53.         /// <param name="e">Argumentos del evento.</param>
  54.         private void btnOK_Click(object sender, EventArgs e)
  55.         {
  56.             int resultado;
  57.  
  58.             if (Int32.TryParse(txtCantidad.Text, out resultado))
  59.             {
  60.                 padre.CantidadIntroducida = resultado;
  61.             }
  62.             else
  63.             {
  64.                 MessageBox.Show(this, "No introdujo un valor entero válido.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  65.             }
  66.         }
  67.         /// <summary>
  68.         /// Cancela la cantidad del producto a vender o a pedir.
  69.         /// </summary>
  70.         /// <param name="sender">Generador del evento.</param>
  71.         /// <param name="e">Argumentos del evento.</param>
  72.         private void btnCancelar_Click(object sender, EventArgs e)
  73.         {
  74.             this.Close();
  75.         }
  76.         #endregion
  77.     }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement