Ecchijpbp

Programacion 6-2

Apr 27th, 2016
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Proyecto_Producto
  12. {
  13. public partial class Form1 : Form
  14. {
  15. int cantidad = 0;
  16. double ValoracionTotal = 0;
  17. double PrecioPromedio = 0;
  18. double CantAlimentos = 0;
  19. double CantPerfumeria = 0;
  20. Producto AP;
  21.  
  22. public Form1()
  23. {
  24. InitializeComponent();
  25. rbtAlimentos.Checked = true;
  26. cmbMarca.SelectedIndex = 0;
  27. AP = new Producto();
  28. }
  29.  
  30. private void cmdCargar_Click(object sender, EventArgs e)
  31. {
  32. Producto p;
  33. p = new Producto();
  34. p.pCodigo = Convert.ToInt32(txtCodigo.Text);
  35. p.pNombre = txtNombre.Text;
  36. if (rbtAlimentos.Checked)
  37. {
  38. p.pRubro = 0;
  39. CantAlimentos++;
  40. }
  41. else
  42. {
  43. p.pRubro = 1;
  44. CantPerfumeria++;
  45. }
  46. MessageBox.Show("Lameme Las Bolas");
  47. p.pPrecio = Convert.ToDouble(txtPrecio.Text);
  48. p.pCantidad = Convert.ToDouble(txtCantidad.Text);
  49. p.pMarca = Convert.ToInt32(cmbMarca.SelectedIndex+1);
  50. lblValor.Text = Convert.ToString(Math.Round(p.calcularValuacion(),2));
  51. if (p.pPrecio >= AP.pPrecio)
  52. {
  53. AP.pPrecio = p.pPrecio;
  54. AP.pNombre = p.pNombre;
  55. }
  56. lblAlimentos.Text = Convert.ToString(CantAlimentos);
  57. lblPerfumeria.Text = Convert.ToString(CantPerfumeria);
  58. cantidad++;
  59. ValoracionTotal = ValoracionTotal + p.calcularValuacion();
  60. lblPrecioMayor.Text = Convert.ToString(AP.pPrecio);
  61. MessageBox.Show(p.MostrarProducto());
  62.  
  63. //Producto con mayor precio.
  64.  
  65. }
  66.  
  67. private void label8_Click(object sender, EventArgs e)
  68. {
  69.  
  70. }
  71.  
  72. private void lblCantidadTotal_Click(object sender, EventArgs e)
  73. {
  74.  
  75. }
  76. }
  77. }
Add Comment
Please, Sign In to add comment