Advertisement
Fhernd

ControlOpciones.cs

Jul 16th, 2014
1,327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.79 KB | None | 0 0
  1. // ===++===
  2. //
  3. //  OrtizOL
  4. //
  5. // ===--===
  6. /*============================================================
  7. //
  8. // Clase: ControlOpciones.cs
  9. //
  10. // Original en: http://goo.gl/pA6Iy5
  11. //
  12. // Propósito: Control para los botones de operaciones
  13. // extendidas sobre los juegos que vende la empresa.
  14. //
  15. ============================================================*/
  16.  
  17. using System;
  18. using System.ComponentModel;
  19. using System.Drawing;
  20. using System.Windows.Forms;
  21.  
  22. namespace JuegosCelulares.GUI
  23. {
  24.     /// <summary>
  25.     /// Control para las operaciones extendidas de la empresa de juegos.
  26.     /// </summary>
  27.     public partial class ControlOpciones : UserControl
  28.     {
  29.         #region Componentes
  30.         /// <summary>
  31.         /// Representa el formulario padre de este control.
  32.         /// </summary>
  33.         private Principal ventanaPrincipal;
  34.         #endregion
  35.  
  36.         #region Campos
  37.         /// <summary>
  38.         /// Presupuesto para la compra de juegos.
  39.         /// </summary>
  40.         private decimal presupuesto;
  41.         /// <summary>
  42.         /// Capacidad del dispositivo.
  43.         /// </summary>
  44.         private int capacidad;
  45.         /// <summary>
  46.         /// Cantidad del juego `Car Racer 2`.
  47.         /// </summary>
  48.         private int cantidadCarRacer2;
  49.         /// <summary>
  50.         /// Cantidad del juego `Air Attack`.
  51.         /// </summary>
  52.         private int cantidadAirAttack;
  53.         /// <summary>
  54.         /// Cantidad del juego `Mini Golf 2`.
  55.         /// </summary>
  56.         private int cantidadMiniGolf2;
  57.         /// <summary>
  58.         /// Cantidad del juego `Aztec Warrior`.
  59.         /// </summary>
  60.         private int cantidadAztecWarrior;
  61.         #endregion
  62.  
  63.         #region Propiedades
  64.         /// <summary>
  65.         /// Obtiene y modifica la cantidad del juego `Car Racer 2`.
  66.         /// </summary>
  67.         public int CantidadCarRacer2
  68.         {
  69.             get
  70.             {
  71.                 return cantidadCarRacer2;
  72.             }
  73.             set
  74.             {
  75.                 cantidadCarRacer2 = value;
  76.             }
  77.         }
  78.         /// <summary>
  79.         /// Obtiene y modifica la cantidad del juego `Air Attack`.
  80.         /// </summary>
  81.         public int CantidadAirAttack
  82.         {
  83.             get
  84.             {
  85.                 return cantidadAirAttack;
  86.             }
  87.             set
  88.             {
  89.                 cantidadAirAttack = value;
  90.             }
  91.         }
  92.         /// <summary>
  93.         /// Obtiene y modifica la cantidad del juego `Mini Golf 2`.
  94.         /// </summary>
  95.         public int CantidadMiniGolf2
  96.         {
  97.             get
  98.             {
  99.                 return cantidadMiniGolf2;
  100.             }
  101.             set
  102.             {
  103.                 cantidadMiniGolf2 = value;
  104.             }
  105.         }
  106.         /// <summary>
  107.         /// Obtiene y modifica la cantidad del juego `Aztec Warrior`.
  108.         /// </summary>
  109.         public int CantidadAztecWarrior
  110.         {
  111.             get
  112.             {
  113.                 return cantidadAztecWarrior;
  114.             }
  115.             set
  116.             {
  117.                 cantidadAztecWarrior = value;
  118.             }
  119.         }
  120.         /// <summary>
  121.         /// Obtiene y modifica el presupuesto para compra de juegos.
  122.         /// </summary>
  123.         public decimal Presupuesto
  124.         {
  125.             get
  126.             {
  127.                 return presupuesto;
  128.             }
  129.             set
  130.             {
  131.                 presupuesto = value;
  132.             }
  133.         }
  134.         /// <summary>
  135.         /// Obtiene y modifica la capacidad del dispositivo.
  136.         /// </summary>
  137.         public int Capacidad
  138.         {
  139.             get
  140.             {
  141.                 return capacidad;
  142.             }
  143.             set
  144.             {
  145.                 capacidad = value;
  146.             }
  147.         }
  148.         #endregion
  149.  
  150.         #region Constructores
  151.         /// <summary>
  152.         /// Crea un nuevo control de opciones.
  153.         /// </summary>
  154.         /// <param name="principal">Control padre.</param>
  155.         public ControlOpciones(Principal principal)
  156.         {
  157.             InitializeComponent();
  158.             ventanaPrincipal = principal;
  159.         }
  160.         #endregion
  161.  
  162.         #region Eventos
  163.         /// <summary>
  164.         /// Busca un juego.
  165.         /// </summary>
  166.         /// <param name="sender">Generador del evento.</param>
  167.         /// <param name="e">Argumentos del evento.</param>
  168.         private void btnBuscarJuego_Click(object sender, EventArgs e)
  169.         {
  170.             using (DialogoBusquedaJuego dbj = new DialogoBusquedaJuego(this))
  171.             {
  172.                 if (dbj.ShowDialog(this) == DialogResult.OK)
  173.                 {
  174.                     ventanaPrincipal.SeleccionarJuego(this.presupuesto, this.capacidad);
  175.                 }
  176.             }
  177.         }
  178.         /// <summary>
  179.         /// Calcula el juego más vendido.
  180.         /// </summary>
  181.         /// <param name="sender">Generador del evento.</param>
  182.         /// <param name="e">Argumentos del evento.</param>
  183.         private void btnJuegoMasVendido_Click(object sender, EventArgs e)
  184.         {
  185.             ventanaPrincipal.MostrarMasVendido();
  186.         }
  187.         /// <summary>
  188.         /// Determina el descuento por volumen.
  189.         /// </summary>
  190.         /// <param name="sender">Generador del evento.</param>
  191.         /// <param name="e">Argumentos del evento.</param>
  192.         private void btnDescuentosPorVolumen_Click(object sender, EventArgs e)
  193.         {
  194.             using (DialogoVentaVolumen dvv = new DialogoVentaVolumen(this))
  195.             {
  196.                 if (dvv.ShowDialog(this) == DialogResult.OK)
  197.                 {
  198.                     ventanaPrincipal.CalcularDescuento(cantidadCarRacer2, cantidadAirAttack, cantidadMiniGolf2, cantidadAztecWarrior);
  199.                 }
  200.             }
  201.         }
  202.         #endregion
  203.     }
  204. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement