a
This commit is contained in:
@@ -1,42 +0,0 @@
|
|||||||
using System.Collections.ObjectModel;
|
|
||||||
using Entidades;
|
|
||||||
using Modelo;
|
|
||||||
|
|
||||||
namespace Controladora
|
|
||||||
{
|
|
||||||
public class ControladoraPedidoDePresupuestos : Singleton<ControladoraPedidoDePresupuestos>
|
|
||||||
{
|
|
||||||
public string Añadir(PedidoDePresupuesto t)
|
|
||||||
{
|
|
||||||
if (t == null) return "El PedidoDePresupuesto es nulo fallo la carga";
|
|
||||||
|
|
||||||
return (RepositorioPedidoDePresupuesto.Instance.Add(t)) ?
|
|
||||||
$"El PedidoDePresupuesto {t.Id} se cargo correctamente":
|
|
||||||
$"Fallo la carga del PedidoDePresupuesto {t.Id}";
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Eliminar(PedidoDePresupuesto t)
|
|
||||||
{
|
|
||||||
if (t == null) return "El PedidoDePresupuesto es nulo fallo la carga";
|
|
||||||
|
|
||||||
return (RepositorioPedidoDePresupuesto.Instance.Del(t)) ?
|
|
||||||
$"El PedidoDePresupuesto {t.Id} se Elimino correctamente":
|
|
||||||
$"Fallo la Eliminacion del PedidoDePresupuesto {t.Id}";
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Modificar(PedidoDePresupuesto t)
|
|
||||||
{
|
|
||||||
if (t == null) return "El PedidoDePresupuesto es nulo fallo la carga";
|
|
||||||
|
|
||||||
return (RepositorioPedidoDePresupuesto.Instance.Mod(t)) ?
|
|
||||||
$"El PedidoDePresupuesto {t.Id} se Modifico correctamente":
|
|
||||||
$"Fallo la Modificacion del PedidoDePresupuesto {t.Id}";
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReadOnlyCollection<PedidoDePresupuesto> Listar()
|
|
||||||
{
|
|
||||||
return RepositorioPedidoDePresupuesto.Instance.Listar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -37,5 +37,13 @@ namespace Controladora
|
|||||||
{
|
{
|
||||||
return RepositorioPresupuesto.Instance.Listar();
|
return RepositorioPresupuesto.Instance.Listar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReadOnlyCollection<DetallePresupuesto> ListarDetalles(Presupuesto presupuesto)
|
||||||
|
{
|
||||||
|
Presupuesto pres = RepositorioPresupuesto.Instance.Listar().First(x=> x.Id == presupuesto.Id);
|
||||||
|
if (pres == null) return new ReadOnlyCollection<DetallePresupuesto>(new List<DetallePresupuesto>());
|
||||||
|
return pres.MostrarDetalles();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,5 @@
|
|||||||
|
<<<<<<< HEAD
|
||||||
07cbdde4e47ec2d3a6db548797ff84a15aa08946633217fe5ed64773b3cc8491
|
07cbdde4e47ec2d3a6db548797ff84a15aa08946633217fe5ed64773b3cc8491
|
||||||
|
=======
|
||||||
|
39c8634b9e930bb7c3ea67187f4543b71aaf8be2
|
||||||
|
>>>>>>> 82ef086 (a)
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
|
|
||||||
namespace Entidades
|
|
||||||
{
|
|
||||||
public class DetallePedido : Detalle<Producto>
|
|
||||||
{
|
|
||||||
public int IdPedido { get; set; }
|
|
||||||
public int CantidadPedido { get; set; }
|
|
||||||
public List<Producto> Productos { get; set; } = new List<Producto>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,5 @@ namespace Entidades
|
|||||||
public class DetallePresupuesto: Detalle<Producto>
|
public class DetallePresupuesto: Detalle<Producto>
|
||||||
{
|
{
|
||||||
public int IdPresupuesto { get; set; }
|
public int IdPresupuesto { get; set; }
|
||||||
public double CostoUnitario { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
using System.Collections.ObjectModel;
|
|
||||||
|
|
||||||
namespace Entidades
|
|
||||||
{
|
|
||||||
public class PedidoDePresupuesto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public DateTime Fecha { get; set; }
|
|
||||||
private List<DetallePedido> detallesPedidos = new List<DetallePedido>();
|
|
||||||
public Proveedor Proveedor { get; set; }
|
|
||||||
|
|
||||||
public void AñadirDetalle(DetallePedido detalle)
|
|
||||||
{
|
|
||||||
detallesPedidos.Add(detalle);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool EliminarDetalle(DetallePedido detalle)
|
|
||||||
{
|
|
||||||
var aeliminar = detallesPedidos.Find(x => x.Id == detalle.Id);
|
|
||||||
if (aeliminar == null) return false;
|
|
||||||
return detallesPedidos.Remove(aeliminar);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReadOnlyCollection<DetallePedido> MostrarDetalles()
|
|
||||||
{
|
|
||||||
return detallesPedidos.AsReadOnly();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
using System.Collections.ObjectModel;
|
|
||||||
using Entidades;
|
|
||||||
|
|
||||||
namespace Modelo
|
|
||||||
{
|
|
||||||
public sealed class RepositorioPedidoDePresupuesto : RepositorioBase<PedidoDePresupuesto, RepositorioPedidoDePresupuesto>
|
|
||||||
{
|
|
||||||
override public bool Add(PedidoDePresupuesto t)
|
|
||||||
{
|
|
||||||
bool ret = false;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
almacen.Add(t);
|
|
||||||
ret = true;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
override public bool Mod(PedidoDePresupuesto t)
|
|
||||||
{
|
|
||||||
bool ret = false;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var pedidoAModificar = almacen.FindIndex(x => x.Id == t.Id);
|
|
||||||
if (pedidoAModificar > -1)
|
|
||||||
{
|
|
||||||
almacen[pedidoAModificar] = t;
|
|
||||||
ret = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
override public bool Del(PedidoDePresupuesto t)
|
|
||||||
{
|
|
||||||
bool ret = false;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var pedidoAEliminar = almacen.Find(x => x.Id == t.Id);
|
|
||||||
if (pedidoAEliminar != null)
|
|
||||||
{
|
|
||||||
almacen.Remove(pedidoAEliminar);
|
|
||||||
ret = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReadOnlyCollection<DetallePedido> MostrarDetalles(PedidoDePresupuesto pedido)
|
|
||||||
{
|
|
||||||
return pedido.MostrarDetalles();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
65
Vista/FrmPresupuesto.Designer.cs
generated
65
Vista/FrmPresupuesto.Designer.cs
generated
@@ -31,7 +31,7 @@
|
|||||||
dgvProducto = new DataGridView();
|
dgvProducto = new DataGridView();
|
||||||
ID = new Label();
|
ID = new Label();
|
||||||
label2 = new Label();
|
label2 = new Label();
|
||||||
numericUpDown1 = new NumericUpDown();
|
numId = new NumericUpDown();
|
||||||
btnGuardar = new Button();
|
btnGuardar = new Button();
|
||||||
btnCerrar = new Button();
|
btnCerrar = new Button();
|
||||||
btnAddProducto = new Button();
|
btnAddProducto = new Button();
|
||||||
@@ -40,23 +40,29 @@
|
|||||||
dgvPedido = new DataGridView();
|
dgvPedido = new DataGridView();
|
||||||
label1 = new Label();
|
label1 = new Label();
|
||||||
label3 = new Label();
|
label3 = new Label();
|
||||||
numericUpDown2 = new NumericUpDown();
|
numCantidad = new NumericUpDown();
|
||||||
label4 = new Label();
|
label4 = new Label();
|
||||||
((System.ComponentModel.ISupportInitialize)dgvProducto).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dgvProducto).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numId).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)dgvProveedor).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dgvProveedor).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)dgvPedido).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dgvPedido).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown2).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numCantidad).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// dgvProducto
|
// dgvProducto
|
||||||
//
|
//
|
||||||
|
dgvProducto.AllowUserToAddRows = false;
|
||||||
|
dgvProducto.AllowUserToDeleteRows = false;
|
||||||
dgvProducto.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dgvProducto.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dgvProducto.EditMode = DataGridViewEditMode.EditProgrammatically;
|
||||||
dgvProducto.Location = new Point(227, 26);
|
dgvProducto.Location = new Point(227, 26);
|
||||||
|
dgvProducto.MultiSelect = false;
|
||||||
dgvProducto.Name = "dgvProducto";
|
dgvProducto.Name = "dgvProducto";
|
||||||
dgvProducto.RowTemplate.Height = 25;
|
dgvProducto.RowTemplate.Height = 25;
|
||||||
|
dgvProducto.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
dgvProducto.Size = new Size(275, 249);
|
dgvProducto.Size = new Size(275, 249);
|
||||||
dgvProducto.TabIndex = 1;
|
dgvProducto.TabIndex = 1;
|
||||||
|
dgvProducto.CellClick += dgvProducto_CellClick;
|
||||||
//
|
//
|
||||||
// ID
|
// ID
|
||||||
//
|
//
|
||||||
@@ -76,13 +82,13 @@
|
|||||||
label2.TabIndex = 3;
|
label2.TabIndex = 3;
|
||||||
label2.Text = "Provedor";
|
label2.Text = "Provedor";
|
||||||
//
|
//
|
||||||
// numericUpDown1
|
// numId
|
||||||
//
|
//
|
||||||
numericUpDown1.Location = new Point(78, 26);
|
numId.Location = new Point(78, 26);
|
||||||
numericUpDown1.Maximum = new decimal(new int[] { 1410065407, 2, 0, 0 });
|
numId.Maximum = new decimal(new int[] { 1410065407, 2, 0, 0 });
|
||||||
numericUpDown1.Name = "numericUpDown1";
|
numId.Name = "numId";
|
||||||
numericUpDown1.Size = new Size(120, 23);
|
numId.Size = new Size(120, 23);
|
||||||
numericUpDown1.TabIndex = 8;
|
numId.TabIndex = 8;
|
||||||
//
|
//
|
||||||
// btnGuardar
|
// btnGuardar
|
||||||
//
|
//
|
||||||
@@ -92,6 +98,7 @@
|
|||||||
btnGuardar.TabIndex = 9;
|
btnGuardar.TabIndex = 9;
|
||||||
btnGuardar.Text = "Guardar";
|
btnGuardar.Text = "Guardar";
|
||||||
btnGuardar.UseVisualStyleBackColor = true;
|
btnGuardar.UseVisualStyleBackColor = true;
|
||||||
|
btnGuardar.Click += btnGuardar_Click;
|
||||||
//
|
//
|
||||||
// btnCerrar
|
// btnCerrar
|
||||||
//
|
//
|
||||||
@@ -111,6 +118,7 @@
|
|||||||
btnAddProducto.TabIndex = 11;
|
btnAddProducto.TabIndex = 11;
|
||||||
btnAddProducto.Text = "Agregar Producto";
|
btnAddProducto.Text = "Agregar Producto";
|
||||||
btnAddProducto.UseVisualStyleBackColor = true;
|
btnAddProducto.UseVisualStyleBackColor = true;
|
||||||
|
btnAddProducto.Click += btnAddProducto_Click;
|
||||||
//
|
//
|
||||||
// btnrmProducto
|
// btnrmProducto
|
||||||
//
|
//
|
||||||
@@ -120,13 +128,19 @@
|
|||||||
btnrmProducto.TabIndex = 12;
|
btnrmProducto.TabIndex = 12;
|
||||||
btnrmProducto.Text = "Eliminar Producto";
|
btnrmProducto.Text = "Eliminar Producto";
|
||||||
btnrmProducto.UseVisualStyleBackColor = true;
|
btnrmProducto.UseVisualStyleBackColor = true;
|
||||||
|
btnrmProducto.Click += btnrmProducto_Click;
|
||||||
//
|
//
|
||||||
// dgvProveedor
|
// dgvProveedor
|
||||||
//
|
//
|
||||||
|
dgvProveedor.AllowUserToAddRows = false;
|
||||||
|
dgvProveedor.AllowUserToDeleteRows = false;
|
||||||
dgvProveedor.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dgvProveedor.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dgvProveedor.EditMode = DataGridViewEditMode.EditProgrammatically;
|
||||||
dgvProveedor.Location = new Point(508, 26);
|
dgvProveedor.Location = new Point(508, 26);
|
||||||
|
dgvProveedor.MultiSelect = false;
|
||||||
dgvProveedor.Name = "dgvProveedor";
|
dgvProveedor.Name = "dgvProveedor";
|
||||||
dgvProveedor.RowTemplate.Height = 25;
|
dgvProveedor.RowTemplate.Height = 25;
|
||||||
|
dgvProveedor.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
dgvProveedor.Size = new Size(269, 249);
|
dgvProveedor.Size = new Size(269, 249);
|
||||||
dgvProveedor.TabIndex = 13;
|
dgvProveedor.TabIndex = 13;
|
||||||
//
|
//
|
||||||
@@ -136,6 +150,7 @@
|
|||||||
dgvPedido.Location = new Point(11, 67);
|
dgvPedido.Location = new Point(11, 67);
|
||||||
dgvPedido.Name = "dgvPedido";
|
dgvPedido.Name = "dgvPedido";
|
||||||
dgvPedido.RowTemplate.Height = 25;
|
dgvPedido.RowTemplate.Height = 25;
|
||||||
|
dgvPedido.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
dgvPedido.Size = new Size(187, 171);
|
dgvPedido.Size = new Size(187, 171);
|
||||||
dgvPedido.TabIndex = 14;
|
dgvPedido.TabIndex = 14;
|
||||||
//
|
//
|
||||||
@@ -157,13 +172,13 @@
|
|||||||
label3.TabIndex = 16;
|
label3.TabIndex = 16;
|
||||||
label3.Text = "Pedido";
|
label3.Text = "Pedido";
|
||||||
//
|
//
|
||||||
// numericUpDown2
|
// numCantidad
|
||||||
//
|
//
|
||||||
numericUpDown2.Location = new Point(317, 281);
|
numCantidad.Location = new Point(317, 281);
|
||||||
numericUpDown2.Maximum = new decimal(new int[] { 1410065407, 2, 0, 0 });
|
numCantidad.Maximum = new decimal(new int[] { 1410065407, 2, 0, 0 });
|
||||||
numericUpDown2.Name = "numericUpDown2";
|
numCantidad.Name = "numCantidad";
|
||||||
numericUpDown2.Size = new Size(120, 23);
|
numCantidad.Size = new Size(120, 23);
|
||||||
numericUpDown2.TabIndex = 17;
|
numCantidad.TabIndex = 17;
|
||||||
//
|
//
|
||||||
// label4
|
// label4
|
||||||
//
|
//
|
||||||
@@ -174,7 +189,7 @@
|
|||||||
label4.TabIndex = 18;
|
label4.TabIndex = 18;
|
||||||
label4.Text = "Cantidad";
|
label4.Text = "Cantidad";
|
||||||
//
|
//
|
||||||
// FrmPedidoPresupuesto
|
// FrmPresupuesto
|
||||||
//
|
//
|
||||||
AcceptButton = btnGuardar;
|
AcceptButton = btnGuardar;
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
@@ -182,7 +197,7 @@
|
|||||||
CancelButton = btnCerrar;
|
CancelButton = btnCerrar;
|
||||||
ClientSize = new Size(794, 351);
|
ClientSize = new Size(794, 351);
|
||||||
Controls.Add(label4);
|
Controls.Add(label4);
|
||||||
Controls.Add(numericUpDown2);
|
Controls.Add(numCantidad);
|
||||||
Controls.Add(label3);
|
Controls.Add(label3);
|
||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
Controls.Add(dgvPedido);
|
Controls.Add(dgvPedido);
|
||||||
@@ -191,17 +206,17 @@
|
|||||||
Controls.Add(btnAddProducto);
|
Controls.Add(btnAddProducto);
|
||||||
Controls.Add(btnCerrar);
|
Controls.Add(btnCerrar);
|
||||||
Controls.Add(btnGuardar);
|
Controls.Add(btnGuardar);
|
||||||
Controls.Add(numericUpDown1);
|
Controls.Add(numId);
|
||||||
Controls.Add(label2);
|
Controls.Add(label2);
|
||||||
Controls.Add(ID);
|
Controls.Add(ID);
|
||||||
Controls.Add(dgvProducto);
|
Controls.Add(dgvProducto);
|
||||||
Name = "FrmPedidoPresupuesto";
|
Name = "FrmPresupuesto";
|
||||||
Text = "Form1";
|
Text = "Presupuesto";
|
||||||
((System.ComponentModel.ISupportInitialize)dgvProducto).EndInit();
|
((System.ComponentModel.ISupportInitialize)dgvProducto).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown1).EndInit();
|
((System.ComponentModel.ISupportInitialize)numId).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)dgvProveedor).EndInit();
|
((System.ComponentModel.ISupportInitialize)dgvProveedor).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)dgvPedido).EndInit();
|
((System.ComponentModel.ISupportInitialize)dgvPedido).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown2).EndInit();
|
((System.ComponentModel.ISupportInitialize)numCantidad).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@@ -210,7 +225,7 @@
|
|||||||
private DataGridView dgvProducto;
|
private DataGridView dgvProducto;
|
||||||
private Label ID;
|
private Label ID;
|
||||||
private Label label2;
|
private Label label2;
|
||||||
private NumericUpDown numericUpDown1;
|
private NumericUpDown numId;
|
||||||
private Button btnGuardar;
|
private Button btnGuardar;
|
||||||
private Button btnCerrar;
|
private Button btnCerrar;
|
||||||
private Button btnAddProducto;
|
private Button btnAddProducto;
|
||||||
@@ -219,7 +234,7 @@
|
|||||||
private DataGridView dgvPedido;
|
private DataGridView dgvPedido;
|
||||||
private Label label1;
|
private Label label1;
|
||||||
private Label label3;
|
private Label label3;
|
||||||
private NumericUpDown numericUpDown2;
|
private NumericUpDown numCantidad;
|
||||||
private Label label4;
|
private Label label4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
using System;
|
using Controladora;
|
||||||
|
using Entidades;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@@ -12,20 +14,85 @@ namespace Vista
|
|||||||
{
|
{
|
||||||
public partial class FrmPresupuesto : Form
|
public partial class FrmPresupuesto : Form
|
||||||
{
|
{
|
||||||
|
private Presupuesto presupuesto = new Presupuesto();
|
||||||
|
private int id = 0;
|
||||||
public FrmPresupuesto()
|
public FrmPresupuesto()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
CargarDatos();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button3_Click(object sender, EventArgs e)
|
private void CargarDatos()
|
||||||
{
|
{
|
||||||
var form = new AddProducto();
|
dgvProducto.DataSource = null;
|
||||||
form.ShowDialog();
|
dgvProducto.DataSource = ControladoraProductos.Instance.Listar();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnCerrar_Click(object sender, EventArgs e)
|
private void btnCerrar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.Close();
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
92
Vista/FrmPresupuestos.Designer.cs
generated
92
Vista/FrmPresupuestos.Designer.cs
generated
@@ -29,19 +29,23 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
groupBox1 = new GroupBox();
|
groupBox1 = new GroupBox();
|
||||||
dataGridView1 = new DataGridView();
|
label2 = new Label();
|
||||||
|
label1 = new Label();
|
||||||
|
dgvdetallesPresupuesto = new DataGridView();
|
||||||
|
dgvPresupuestos = new DataGridView();
|
||||||
BtnAdd = new Button();
|
BtnAdd = new Button();
|
||||||
BtnEliminar = new Button();
|
BtnEliminar = new Button();
|
||||||
dataGridView2 = new DataGridView();
|
|
||||||
groupBox1.SuspendLayout();
|
groupBox1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dgvdetallesPresupuesto).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView2).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dgvPresupuestos).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
groupBox1.Controls.Add(dataGridView2);
|
groupBox1.Controls.Add(label2);
|
||||||
groupBox1.Controls.Add(dataGridView1);
|
groupBox1.Controls.Add(label1);
|
||||||
|
groupBox1.Controls.Add(dgvdetallesPresupuesto);
|
||||||
|
groupBox1.Controls.Add(dgvPresupuestos);
|
||||||
groupBox1.Controls.Add(BtnAdd);
|
groupBox1.Controls.Add(BtnAdd);
|
||||||
groupBox1.Controls.Add(BtnEliminar);
|
groupBox1.Controls.Add(BtnEliminar);
|
||||||
groupBox1.Location = new Point(12, 2);
|
groupBox1.Location = new Point(12, 2);
|
||||||
@@ -50,19 +54,50 @@
|
|||||||
groupBox1.TabIndex = 4;
|
groupBox1.TabIndex = 4;
|
||||||
groupBox1.TabStop = false;
|
groupBox1.TabStop = false;
|
||||||
//
|
//
|
||||||
// dataGridView1
|
// label2
|
||||||
//
|
//
|
||||||
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
label2.AutoSize = true;
|
||||||
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
label2.Location = new Point(323, 4);
|
||||||
dataGridView1.Location = new Point(6, 22);
|
label2.Name = "label2";
|
||||||
dataGridView1.Name = "dataGridView1";
|
label2.Size = new Size(48, 15);
|
||||||
dataGridView1.RowTemplate.Height = 25;
|
label2.TabIndex = 6;
|
||||||
dataGridView1.Size = new Size(284, 235);
|
label2.Text = "Detalles";
|
||||||
dataGridView1.TabIndex = 3;
|
//
|
||||||
|
// 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
|
||||||
//
|
//
|
||||||
BtnAdd.Location = new Point(6, 302);
|
BtnAdd.Location = new Point(6, 263);
|
||||||
BtnAdd.Name = "BtnAdd";
|
BtnAdd.Name = "BtnAdd";
|
||||||
BtnAdd.Size = new Size(75, 23);
|
BtnAdd.Size = new Size(75, 23);
|
||||||
BtnAdd.TabIndex = 0;
|
BtnAdd.TabIndex = 0;
|
||||||
@@ -72,44 +107,37 @@
|
|||||||
//
|
//
|
||||||
// BtnEliminar
|
// BtnEliminar
|
||||||
//
|
//
|
||||||
BtnEliminar.Location = new Point(215, 302);
|
BtnEliminar.Location = new Point(87, 263);
|
||||||
BtnEliminar.Name = "BtnEliminar";
|
BtnEliminar.Name = "BtnEliminar";
|
||||||
BtnEliminar.Size = new Size(75, 23);
|
BtnEliminar.Size = new Size(75, 23);
|
||||||
BtnEliminar.TabIndex = 2;
|
BtnEliminar.TabIndex = 2;
|
||||||
BtnEliminar.Text = "Eliminar";
|
BtnEliminar.Text = "Eliminar";
|
||||||
BtnEliminar.UseVisualStyleBackColor = true;
|
BtnEliminar.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// dataGridView2
|
// FrmPresupuestos
|
||||||
//
|
|
||||||
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
|
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(970, 450);
|
ClientSize = new Size(970, 450);
|
||||||
Controls.Add(groupBox1);
|
Controls.Add(groupBox1);
|
||||||
Name = "FrmPedidosDePresupuestos";
|
Name = "FrmPresupuestos";
|
||||||
Text = "PedidosDePresupuestos";
|
Text = "PedidosDePresupuestos";
|
||||||
WindowState = FormWindowState.Maximized;
|
WindowState = FormWindowState.Maximized;
|
||||||
groupBox1.ResumeLayout(false);
|
groupBox1.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
groupBox1.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView2).EndInit();
|
((System.ComponentModel.ISupportInitialize)dgvdetallesPresupuesto).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dgvPresupuestos).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private GroupBox groupBox1;
|
private GroupBox groupBox1;
|
||||||
private DataGridView dataGridView1;
|
private DataGridView dgvPresupuestos;
|
||||||
private Button BtnAdd;
|
private Button BtnAdd;
|
||||||
private Button BtnEliminar;
|
private Button BtnEliminar;
|
||||||
private DataGridView dataGridView2;
|
private DataGridView dgvdetallesPresupuesto;
|
||||||
|
private Label label2;
|
||||||
|
private Label label1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Controladora;
|
using Controladora;
|
||||||
|
using Entidades;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -19,8 +20,8 @@ namespace Vista
|
|||||||
}
|
}
|
||||||
private void ActualizarGrilla()
|
private void ActualizarGrilla()
|
||||||
{
|
{
|
||||||
dataGridView1.DataSource = null;
|
dgvPresupuestos.DataSource = null;
|
||||||
dataGridView1.DataSource = ControladoraPedidoDePresupuestos.Instance.Listar();
|
dgvPresupuestos.DataSource = ControladoraPresupuestos.Instance.Listar();
|
||||||
}
|
}
|
||||||
private void BtnAdd_Click(object sender, EventArgs e)
|
private void BtnAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -28,5 +29,20 @@ namespace Vista
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
ActualizarGrilla();
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, 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="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">
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
Reference in New Issue
Block a user