Dia Mejor

Practica 9.1

Author: Moises

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Practica8_Vendedor_Visual
{
public partial class Form1 : Form
{
Vendedor [] compa = new Vendedor[25];
Arreglo A1 = new Arreglo(25);
int posmay, posmayor;

public Form1()
{
InitializeComponent();

groupBox1.Visible = true;
BtContinuar.Visible = false;
BtTerminar.Visible = false;
BtAceptar.Visible = true;
BtCancelar.Visible = true;
label4.Text = "";
label5.Text = "";

}

private void BtAceptar_Click(object sender, EventArgs e)
{
int no;
string nom;
double monto;

no = int.Parse(textBox1.Text);
nom = textBox2.Text;
monto = double.Parse(textBox3.Text);


Vendedor Vx = new Vendedor(no, nom, monto);
compa[no - 1] = Vx;

A1.AsignarDato(no, monto);
posmay = A1.Mayor(25);
posmayor = posmay;

BtContinuar.Visible = true;
BtTerminar.Visible = true;
BtAceptar.Visible = false;
BtCancelar.Visible = false;

}

private void BtTerminar_Click(object sender, EventArgs e)
{
int I;
listBox1.Visible = true;
groupBox1.Visible = false;
BtContinuar.Visible = false;
BtTerminar.Visible = false;
BtAceptar.Visible = false;
BtCancelar.Visible = false;
listBox1.Items.Add("No. Vendedor \tNombre Vendedor \tMonto Venta");
for (I = 0; I < 25; I++)
{
if (compa[I] != null)
{
listBox1.Items.Add("" + compa[I].ObtenerNo_Vend() + "\t\t" + compa[I].ObtenerNombre() + "\t\t" + compa[I].ObtenerVentaTotal());
}
}



label4.Text = "Primer mayor: "+posmayor.ToString() + " " + A1.ObtenerDato(posmayor).ToString();



A1.AsignarDato(posmayor, 0);

posmay = A1.Mayor(25);
posmayor = posmay;



label5.Text = "Segundo mayor: " + posmayor.ToString() + " " + A1.ObtenerDato(posmayor).ToString();



}
private void BtContinuar_Click(object sender, EventArgs e)
{
groupBox1.Visible = true;
BtContinuar.Visible = false;
BtTerminar.Visible = false;
BtAceptar.Visible = true;
BtCancelar.Visible = true;
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
}

private void BtSalir_Click(object sender, EventArgs e)
{
Close();
}

private void BtCancelar_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
}
}
}

 

0 Response to “Practica 9.1”

Leave a Reply