Files
Final_Das/Vista/FrmPresupuestos.cs
2024-08-11 18:24:48 -03: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);
}
}
}
}