This commit is contained in:
2024-08-11 18:24:48 -03:00
parent b62fa7b021
commit 502f10131c
12 changed files with 202 additions and 218 deletions

View File

@@ -31,7 +31,7 @@
dgvProducto = new DataGridView();
ID = new Label();
label2 = new Label();
numericUpDown1 = new NumericUpDown();
numId = new NumericUpDown();
btnGuardar = new Button();
btnCerrar = new Button();
btnAddProducto = new Button();
@@ -40,23 +40,29 @@
dgvPedido = new DataGridView();
label1 = new Label();
label3 = new Label();
numericUpDown2 = new NumericUpDown();
numCantidad = new NumericUpDown();
label4 = new Label();
((System.ComponentModel.ISupportInitialize)dgvProducto).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit();
((System.ComponentModel.ISupportInitialize)numId).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvProveedor).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvPedido).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDown2).BeginInit();
((System.ComponentModel.ISupportInitialize)numCantidad).BeginInit();
SuspendLayout();
//
// dgvProducto
//
dgvProducto.AllowUserToAddRows = false;
dgvProducto.AllowUserToDeleteRows = false;
dgvProducto.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvProducto.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvProducto.Location = new Point(227, 26);
dgvProducto.MultiSelect = false;
dgvProducto.Name = "dgvProducto";
dgvProducto.RowTemplate.Height = 25;
dgvProducto.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvProducto.Size = new Size(275, 249);
dgvProducto.TabIndex = 1;
dgvProducto.CellClick += dgvProducto_CellClick;
//
// ID
//
@@ -76,13 +82,13 @@
label2.TabIndex = 3;
label2.Text = "Provedor";
//
// numericUpDown1
// numId
//
numericUpDown1.Location = new Point(78, 26);
numericUpDown1.Maximum = new decimal(new int[] { 1410065407, 2, 0, 0 });
numericUpDown1.Name = "numericUpDown1";
numericUpDown1.Size = new Size(120, 23);
numericUpDown1.TabIndex = 8;
numId.Location = new Point(78, 26);
numId.Maximum = new decimal(new int[] { 1410065407, 2, 0, 0 });
numId.Name = "numId";
numId.Size = new Size(120, 23);
numId.TabIndex = 8;
//
// btnGuardar
//
@@ -92,6 +98,7 @@
btnGuardar.TabIndex = 9;
btnGuardar.Text = "Guardar";
btnGuardar.UseVisualStyleBackColor = true;
btnGuardar.Click += btnGuardar_Click;
//
// btnCerrar
//
@@ -111,6 +118,7 @@
btnAddProducto.TabIndex = 11;
btnAddProducto.Text = "Agregar Producto";
btnAddProducto.UseVisualStyleBackColor = true;
btnAddProducto.Click += btnAddProducto_Click;
//
// btnrmProducto
//
@@ -120,13 +128,19 @@
btnrmProducto.TabIndex = 12;
btnrmProducto.Text = "Eliminar Producto";
btnrmProducto.UseVisualStyleBackColor = true;
btnrmProducto.Click += btnrmProducto_Click;
//
// dgvProveedor
//
dgvProveedor.AllowUserToAddRows = false;
dgvProveedor.AllowUserToDeleteRows = false;
dgvProveedor.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvProveedor.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvProveedor.Location = new Point(508, 26);
dgvProveedor.MultiSelect = false;
dgvProveedor.Name = "dgvProveedor";
dgvProveedor.RowTemplate.Height = 25;
dgvProveedor.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvProveedor.Size = new Size(269, 249);
dgvProveedor.TabIndex = 13;
//
@@ -136,6 +150,7 @@
dgvPedido.Location = new Point(11, 67);
dgvPedido.Name = "dgvPedido";
dgvPedido.RowTemplate.Height = 25;
dgvPedido.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvPedido.Size = new Size(187, 171);
dgvPedido.TabIndex = 14;
//
@@ -157,13 +172,13 @@
label3.TabIndex = 16;
label3.Text = "Pedido";
//
// numericUpDown2
// numCantidad
//
numericUpDown2.Location = new Point(317, 281);
numericUpDown2.Maximum = new decimal(new int[] { 1410065407, 2, 0, 0 });
numericUpDown2.Name = "numericUpDown2";
numericUpDown2.Size = new Size(120, 23);
numericUpDown2.TabIndex = 17;
numCantidad.Location = new Point(317, 281);
numCantidad.Maximum = new decimal(new int[] { 1410065407, 2, 0, 0 });
numCantidad.Name = "numCantidad";
numCantidad.Size = new Size(120, 23);
numCantidad.TabIndex = 17;
//
// label4
//
@@ -174,7 +189,7 @@
label4.TabIndex = 18;
label4.Text = "Cantidad";
//
// FrmPedidoPresupuesto
// FrmPresupuesto
//
AcceptButton = btnGuardar;
AutoScaleDimensions = new SizeF(7F, 15F);
@@ -182,7 +197,7 @@
CancelButton = btnCerrar;
ClientSize = new Size(794, 351);
Controls.Add(label4);
Controls.Add(numericUpDown2);
Controls.Add(numCantidad);
Controls.Add(label3);
Controls.Add(label1);
Controls.Add(dgvPedido);
@@ -191,17 +206,17 @@
Controls.Add(btnAddProducto);
Controls.Add(btnCerrar);
Controls.Add(btnGuardar);
Controls.Add(numericUpDown1);
Controls.Add(numId);
Controls.Add(label2);
Controls.Add(ID);
Controls.Add(dgvProducto);
Name = "FrmPedidoPresupuesto";
Text = "Form1";
Name = "FrmPresupuesto";
Text = "Presupuesto";
((System.ComponentModel.ISupportInitialize)dgvProducto).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDown1).EndInit();
((System.ComponentModel.ISupportInitialize)numId).EndInit();
((System.ComponentModel.ISupportInitialize)dgvProveedor).EndInit();
((System.ComponentModel.ISupportInitialize)dgvPedido).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDown2).EndInit();
((System.ComponentModel.ISupportInitialize)numCantidad).EndInit();
ResumeLayout(false);
PerformLayout();
}
@@ -210,7 +225,7 @@
private DataGridView dgvProducto;
private Label ID;
private Label label2;
private NumericUpDown numericUpDown1;
private NumericUpDown numId;
private Button btnGuardar;
private Button btnCerrar;
private Button btnAddProducto;
@@ -219,7 +234,7 @@
private DataGridView dgvPedido;
private Label label1;
private Label label3;
private NumericUpDown numericUpDown2;
private NumericUpDown numCantidad;
private Label label4;
}
}

View File

@@ -1,4 +1,6 @@
using System;
using Controladora;
using Entidades;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -12,20 +14,85 @@ namespace Vista
{
public partial class FrmPresupuesto : Form
{
private Presupuesto presupuesto = new Presupuesto();
private int id = 0;
public FrmPresupuesto()
{
InitializeComponent();
CargarDatos();
}
private void button3_Click(object sender, EventArgs e)
private void CargarDatos()
{
var form = new AddProducto();
form.ShowDialog();
dgvProducto.DataSource = null;
dgvProducto.DataSource = ControladoraProductos.Instance.Listar();
}
private void btnCerrar_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnGuardar_Click(object sender, EventArgs e)
{
}
private void btnAddProducto_Click(object sender, EventArgs e)
{
if (VerificacionesDetalles()) return;
if (dgvProducto.SelectedRows.Count > 0 && dgvProveedor.SelectedRows.Count > 0)
{
var selectedRow = dgvProducto.SelectedRows[0] as DataGridViewRow;
Producto producto = (Producto)selectedRow.DataBoundItem;
DetallePresupuesto detalle = new DetallePresupuesto
{
Id = id++,
Producto = producto,
Cantidad = Convert.ToInt32(numCantidad.Value),
};
presupuesto.AñadirDetalle(detalle);
dgvPedido.DataSource = null;
dgvPedido.DataSource = presupuesto.MostrarDetalles();
}
else
{
MessageBox.Show("Por favor, selecciona una fila para eliminar Proveedor del producto.");
}
}
private bool VerificacionesDetalles()
{
bool ret = false;
return ret;
}
private bool VerificacionesPresupuesto()
{
bool ret = false;
return ret;
}
private void btnrmProducto_Click(object sender, EventArgs e)
{
}
private void dgvProducto_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dgvProducto.SelectedRows.Count == 0) return;
if (dgvProducto.SelectedRows.Count > 0)
{
Producto producto = new Producto
{
Id = Convert.ToInt32(dgvProducto.SelectedRows[0].Cells["Id"].Value.ToString()),
};
dgvProveedor.DataSource = ControladoraProductos.Instance.ListarProveedores(producto);
}
}
}
}

View File

@@ -29,19 +29,23 @@
private void InitializeComponent()
{
groupBox1 = new GroupBox();
dataGridView1 = new DataGridView();
label2 = new Label();
label1 = new Label();
dgvdetallesPresupuesto = new DataGridView();
dgvPresupuestos = new DataGridView();
BtnAdd = new Button();
BtnEliminar = new Button();
dataGridView2 = new DataGridView();
groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
((System.ComponentModel.ISupportInitialize)dataGridView2).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvdetallesPresupuesto).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvPresupuestos).BeginInit();
SuspendLayout();
//
// groupBox1
//
groupBox1.Controls.Add(dataGridView2);
groupBox1.Controls.Add(dataGridView1);
groupBox1.Controls.Add(label2);
groupBox1.Controls.Add(label1);
groupBox1.Controls.Add(dgvdetallesPresupuesto);
groupBox1.Controls.Add(dgvPresupuestos);
groupBox1.Controls.Add(BtnAdd);
groupBox1.Controls.Add(BtnEliminar);
groupBox1.Location = new Point(12, 2);
@@ -50,19 +54,50 @@
groupBox1.TabIndex = 4;
groupBox1.TabStop = false;
//
// dataGridView1
// label2
//
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Location = new Point(6, 22);
dataGridView1.Name = "dataGridView1";
dataGridView1.RowTemplate.Height = 25;
dataGridView1.Size = new Size(284, 235);
dataGridView1.TabIndex = 3;
label2.AutoSize = true;
label2.Location = new Point(323, 4);
label2.Name = "label2";
label2.Size = new Size(48, 15);
label2.TabIndex = 6;
label2.Text = "Detalles";
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(6, 0);
label1.Name = "label1";
label1.Size = new Size(72, 15);
label1.TabIndex = 5;
label1.Text = "Presupuesto";
//
// dgvdetallesPresupuesto
//
dgvdetallesPresupuesto.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgvdetallesPresupuesto.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvdetallesPresupuesto.Location = new Point(323, 22);
dgvdetallesPresupuesto.Name = "dgvdetallesPresupuesto";
dgvdetallesPresupuesto.RowTemplate.Height = 25;
dgvdetallesPresupuesto.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvdetallesPresupuesto.Size = new Size(321, 235);
dgvdetallesPresupuesto.TabIndex = 4;
//
// dgvPresupuestos
//
dgvPresupuestos.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgvPresupuestos.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvPresupuestos.Location = new Point(6, 22);
dgvPresupuestos.Name = "dgvPresupuestos";
dgvPresupuestos.RowTemplate.Height = 25;
dgvPresupuestos.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvPresupuestos.Size = new Size(284, 235);
dgvPresupuestos.TabIndex = 3;
dgvPresupuestos.CellClick += dgvPresupuestos_CellClick;
//
// BtnAdd
//
BtnAdd.Location = new Point(6, 302);
BtnAdd.Location = new Point(6, 263);
BtnAdd.Name = "BtnAdd";
BtnAdd.Size = new Size(75, 23);
BtnAdd.TabIndex = 0;
@@ -72,44 +107,37 @@
//
// BtnEliminar
//
BtnEliminar.Location = new Point(215, 302);
BtnEliminar.Location = new Point(87, 263);
BtnEliminar.Name = "BtnEliminar";
BtnEliminar.Size = new Size(75, 23);
BtnEliminar.TabIndex = 2;
BtnEliminar.Text = "Eliminar";
BtnEliminar.UseVisualStyleBackColor = true;
//
// dataGridView2
//
dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView2.Location = new Point(355, 22);
dataGridView2.Name = "dataGridView2";
dataGridView2.RowTemplate.Height = 25;
dataGridView2.Size = new Size(585, 281);
dataGridView2.TabIndex = 4;
//
// FrmPedidosDePresupuestos
// FrmPresupuestos
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(970, 450);
Controls.Add(groupBox1);
Name = "FrmPedidosDePresupuestos";
Name = "FrmPresupuestos";
Text = "PedidosDePresupuestos";
WindowState = FormWindowState.Maximized;
groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
((System.ComponentModel.ISupportInitialize)dataGridView2).EndInit();
groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)dgvdetallesPresupuesto).EndInit();
((System.ComponentModel.ISupportInitialize)dgvPresupuestos).EndInit();
ResumeLayout(false);
}
#endregion
private GroupBox groupBox1;
private DataGridView dataGridView1;
private DataGridView dgvPresupuestos;
private Button BtnAdd;
private Button BtnEliminar;
private DataGridView dataGridView2;
private DataGridView dgvdetallesPresupuesto;
private Label label2;
private Label label1;
}
}

View File

@@ -1,4 +1,5 @@
using Controladora;
using Entidades;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -19,8 +20,8 @@ namespace Vista
}
private void ActualizarGrilla()
{
dataGridView1.DataSource = null;
dataGridView1.DataSource = ControladoraPedidoDePresupuestos.Instance.Listar();
dgvPresupuestos.DataSource = null;
dgvPresupuestos.DataSource = ControladoraPresupuestos.Instance.Listar();
}
private void BtnAdd_Click(object sender, EventArgs e)
{
@@ -28,5 +29,20 @@ namespace Vista
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);
}
}
}
}

View File

@@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>