This repository has been archived on 2024-08-10. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Final_OOP/Vista/FrmPresupuestos.cs
fedpo 82ef086a3b a
2024-08-05 02:32:20 +01:00

49 lines
1.4 KiB
C#

using Controladora;
using Entidades;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Vista
{
public partial class FrmPresupuestos : Form
{
public FrmPresupuestos()
{
InitializeComponent();
}
private void ActualizarGrilla()
{
dgvPresupuestos.DataSource = null;
dgvPresupuestos.DataSource = ControladoraPresupuestos.Instance.Listar();
}
private void BtnAdd_Click(object sender, EventArgs e)
{
var form = new FrmPresupuesto();
form.ShowDialog();
ActualizarGrilla();
}
private void dgvPresupuestos_CellClick(object sender, DataGridViewCellEventArgs e)
{
dgvdetallesPresupuesto.Rows.Clear();
if (dgvPresupuestos.SelectedRows.Count == 0) return;
if (dgvPresupuestos.SelectedRows.Count > 0)
{
Presupuesto presupuesto = new Presupuesto
{
Id = Convert.ToInt32(dgvPresupuestos.SelectedRows[0].Cells["Id"].Value.ToString()),
};
dgvdetallesPresupuesto.DataSource = ControladoraPresupuestos.Instance.ListarDetalles(presupuesto);
}
}
}
}