cambio de nombre, añadida otra precarga de datos para

This commit is contained in:
fedpo
2024-08-05 23:21:01 +01:00
parent 513e060309
commit c3fb675532
22 changed files with 351 additions and 130 deletions

View File

@@ -18,6 +18,7 @@ namespace Controladora
public string Eliminar(OrdenDeCompra t) public string Eliminar(OrdenDeCompra t)
{ {
if (t == null) return "El OrdenDeCompra es nulo fallo la carga"; if (t == null) return "El OrdenDeCompra es nulo fallo la carga";
if (t.Id < 0) return "El Id esta mal cargado";
return (RepositorioOrdenDeCompra.Instance.Del(t)) ? return (RepositorioOrdenDeCompra.Instance.Del(t)) ?
$"El OrdenDeCompra {t.Id} se Elimino correctamente": $"El OrdenDeCompra {t.Id} se Elimino correctamente":

View File

@@ -4,5 +4,6 @@ namespace Entidades
public class DetalleOrdenDeCompra: Detalle<Producto> public class DetalleOrdenDeCompra: Detalle<Producto>
{ {
public int IdOrdenDeCompra { get; set; } public int IdOrdenDeCompra { get; set; }
public double MontoCU { get; set; }
} }
} }

View File

@@ -14,29 +14,44 @@
<FileName>Cliente.cs</FileName> <FileName>Cliente.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
</Class> </Class>
<Class Name="Entidades.Detalle&lt;T&gt;" Collapsed="true"> <Class Name="Entidades.Detalle&lt;T&gt;">
<Position X="9.75" Y="0.5" Width="1.5" /> <Position X="10.25" Y="0.5" Width="1.5" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAACAAEAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode> <HashCode>AAACAAEAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Detalle.cs</FileName> <FileName>Detalle.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
</Class> </Class>
<Class Name="Entidades.DetalleFactura"> <Class Name="Entidades.DetalleFactura">
<Position X="12" Y="1.75" Width="1.5" /> <Position X="12.75" Y="2.25" Width="1.5" />
<InheritanceLine Type="Entidades.Detalle&lt;T&gt;" ManuallyRouted="true">
<Path>
<Point X="11" Y="1.988" />
<Point X="11" Y="2.365" />
<Point X="13.5" Y="2.365" />
<Point X="13.5" Y="2.25" />
</Path>
</InheritanceLine>
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAAAAAAAAAAEAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode> <HashCode>AAAAAAAAAAAEAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>DetalleFactura.cs</FileName> <FileName>DetalleFactura.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
</Class> </Class>
<Class Name="Entidades.DetalleOrdenDeCompra"> <Class Name="Entidades.DetalleOrdenDeCompra">
<Position X="9.5" Y="1.75" Width="2" /> <Position X="10" Y="2.75" Width="2" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode> <HashCode>AAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAA=</HashCode>
<FileName>DetalleOrdenDeCompra.cs</FileName> <FileName>DetalleOrdenDeCompra.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
</Class> </Class>
<Class Name="Entidades.DetallePresupuesto"> <Class Name="Entidades.DetallePresupuesto">
<Position X="7.5" Y="0.75" Width="1.75" /> <Position X="6.25" Y="1.25" Width="1.75" />
<InheritanceLine Type="Entidades.Detalle&lt;T&gt;" FixedFromPoint="true">
<Path>
<Point X="11" Y="1.988" />
<Point X="11" Y="2.155" />
<Point X="8" Y="2.155" />
</Path>
</InheritanceLine>
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAAAAAAAAAAEAAAAAAAAEAAAQABAAAAAAAAAAAAAAAA=</HashCode> <HashCode>AAAAAAAAAAAEAAAAAAAAEAAAQABAAAAAAAAAAAAAAAA=</HashCode>
<FileName>DetallePresupuesto.cs</FileName> <FileName>DetallePresupuesto.cs</FileName>
@@ -66,29 +81,40 @@
</ShowAsAssociation> </ShowAsAssociation>
</Class> </Class>
<Class Name="Entidades.OrdenDeCompra"> <Class Name="Entidades.OrdenDeCompra">
<Position X="9.75" Y="3.75" Width="1.5" /> <Position X="10" Y="5.25" Width="1.5" />
<AssociationLine Name="detalles" Type="Entidades.DetalleOrdenDeCompra">
<MemberNameLabel ManuallyPlaced="true">
<Position X="-0.005" Y="1.175" />
</MemberNameLabel>
</AssociationLine>
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAACAACAAAAQAAAAAAAAAAADBAABAAAAAAAAAAAAAAA=</HashCode> <HashCode>AAACAAAAAAAQAAAAAAAAAAADBAABAAAAAAAAAAAAAAA=</HashCode>
<FileName>OrdenDeCompra.cs</FileName> <FileName>OrdenDeCompra.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
<ShowAsAssociation> <ShowAsAssociation>
<Property Name="Proveedor" /> <Property Name="Proveedor" />
<Property Name="presupuesto" />
</ShowAsAssociation> </ShowAsAssociation>
<ShowAsCollectionAssociation> <ShowAsCollectionAssociation>
<Field Name="detalles" /> <Field Name="detalles" />
</ShowAsCollectionAssociation> </ShowAsCollectionAssociation>
</Class> </Class>
<Class Name="Entidades.Presupuesto"> <Class Name="Entidades.Presupuesto">
<Position X="6.25" Y="2.75" Width="1.5" /> <Position X="7.25" Y="3.5" Width="1.5" />
<AssociationLine Name="Proveedor" Type="Entidades.Proveedor" ManuallyRouted="true" FixedFromPoint="true" FixedToPoint="true"> <AssociationLine Name="Proveedor" Type="Entidades.Proveedor" ManuallyRouted="true" FixedFromPoint="true" FixedToPoint="true">
<Path> <Path>
<Point X="7" Y="5.267" /> <Point X="8" Y="6.017" />
<Point X="7" Y="5.689" /> <Point X="8" Y="5.689" />
<Point X="8.25" Y="5.689" /> <Point X="8.25" Y="5.689" />
<Point X="8.25" Y="6.75" /> <Point X="8.25" Y="6.75" />
</Path> </Path>
</AssociationLine> </AssociationLine>
<AssociationLine Name="detalles" Type="Entidades.DetallePresupuesto" FixedFromPoint="true" FixedToPoint="true">
<Path>
<Point X="7.25" Y="4.062" />
<Point X="6.875" Y="4.062" />
<Point X="6.875" Y="3.06" />
</Path>
</AssociationLine>
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAACAAAAAAAQAAEAAAAAAAADBAADABAAAAAAAAAAAAA=</HashCode> <HashCode>AAACAAAAAAAQAAEAAAAAAAADBAADABAAAAAAAAAAAAA=</HashCode>
<FileName>Presupuesto.cs</FileName> <FileName>Presupuesto.cs</FileName>
@@ -101,16 +127,17 @@
</ShowAsCollectionAssociation> </ShowAsCollectionAssociation>
</Class> </Class>
<Class Name="Entidades.Producto"> <Class Name="Entidades.Producto">
<Position X="3.25" Y="3.75" Width="1.75" /> <Position X="3" Y="4.25" Width="1.75" />
<Members> <Members>
<Method Name="AñadirCategoria" Hidden="true" />
<Field Name="categorias" Hidden="true" /> <Field Name="categorias" Hidden="true" />
<Method Name="EliminarCategoria" Hidden="true" />
<Method Name="MostrarCategorias" Hidden="true" />
</Members> </Members>
<AssociationLine Name="proveedores" Type="Entidades.Proveedor" ManuallyRouted="true" FixedFromPoint="true" FixedToPoint="true"> <AssociationLine Name="proveedores" Type="Entidades.Proveedor" ManuallyRouted="true" FixedFromPoint="true" FixedToPoint="true">
<Path> <Path>
<Point X="5" Y="6.04" /> <Point X="4.75" Y="6.138" />
<Point X="7.065" Y="6.04" /> <Point X="7.125" Y="6.138" />
<Point X="7.065" Y="6.516" />
<Point X="7.125" Y="6.516" />
<Point X="7.125" Y="6.75" /> <Point X="7.125" Y="6.75" />
</Path> </Path>
</AssociationLine> </AssociationLine>

View File

@@ -8,8 +8,6 @@ namespace Entidades
private List<DetalleOrdenDeCompra> detalles = new List<DetalleOrdenDeCompra>(); private List<DetalleOrdenDeCompra> detalles = new List<DetalleOrdenDeCompra>();
public Proveedor Proveedor { get; set; } public Proveedor Proveedor { get; set; }
public Presupuesto presupuesto { get; set; }
public void AñadirDetalle(DetalleOrdenDeCompra detalle) public void AñadirDetalle(DetalleOrdenDeCompra detalle)
{ {
detalles.Add(detalle); detalles.Add(detalle);

147
Vista/FrmOrdenDeCompra.Designer.cs generated Normal file
View File

@@ -0,0 +1,147 @@
namespace Vista
{
partial class FrmOrdenDeCompra
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
label1 = new Label();
dgvPresupuesto = new DataGridView();
dgvProveedor = new DataGridView();
label2 = new Label();
numId = new NumericUpDown();
ID = new Label();
btnAddProducto = new Button();
((System.ComponentModel.ISupportInitialize)dgvPresupuesto).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvProveedor).BeginInit();
((System.ComponentModel.ISupportInitialize)numId).BeginInit();
SuspendLayout();
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(191, 7);
label1.Name = "label1";
label1.Size = new Size(77, 15);
label1.TabIndex = 17;
label1.Text = "Presupuestos";
//
// dgvPresupuesto
//
dgvPresupuesto.AllowUserToAddRows = false;
dgvPresupuesto.AllowUserToDeleteRows = false;
dgvPresupuesto.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvPresupuesto.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvPresupuesto.Location = new Point(191, 25);
dgvPresupuesto.MultiSelect = false;
dgvPresupuesto.Name = "dgvPresupuesto";
dgvPresupuesto.RowTemplate.Height = 25;
dgvPresupuesto.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvPresupuesto.Size = new Size(347, 338);
dgvPresupuesto.TabIndex = 16;
//
// dgvProveedor
//
dgvProveedor.AllowUserToAddRows = false;
dgvProveedor.AllowUserToDeleteRows = false;
dgvProveedor.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvProveedor.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvProveedor.Location = new Point(544, 25);
dgvProveedor.MultiSelect = false;
dgvProveedor.Name = "dgvProveedor";
dgvProveedor.RowTemplate.Height = 25;
dgvProveedor.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvProveedor.Size = new Size(376, 338);
dgvProveedor.TabIndex = 19;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(544, 7);
label2.Name = "label2";
label2.Size = new Size(43, 15);
label2.TabIndex = 18;
label2.Text = "Detalle";
//
// numId
//
numId.Location = new Point(42, 25);
numId.Maximum = new decimal(new int[] { 1410065407, 2, 0, 0 });
numId.Name = "numId";
numId.Size = new Size(120, 23);
numId.TabIndex = 21;
//
// ID
//
ID.AutoSize = true;
ID.Location = new Point(18, 27);
ID.Name = "ID";
ID.Size = new Size(18, 15);
ID.TabIndex = 20;
ID.Text = "ID";
//
// btnAddProducto
//
btnAddProducto.Location = new Point(191, 369);
btnAddProducto.Name = "btnAddProducto";
btnAddProducto.Size = new Size(144, 29);
btnAddProducto.TabIndex = 22;
btnAddProducto.Text = "Seleccionar Presupuesto";
btnAddProducto.UseVisualStyleBackColor = true;
btnAddProducto.Click += btnAddProducto_Click;
//
// OrdenDeCompra
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1194, 450);
Controls.Add(btnAddProducto);
Controls.Add(numId);
Controls.Add(ID);
Controls.Add(dgvProveedor);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(dgvPresupuesto);
Name = "OrdenDeCompra";
Text = "OrdenDeCompra";
((System.ComponentModel.ISupportInitialize)dgvPresupuesto).EndInit();
((System.ComponentModel.ISupportInitialize)dgvProveedor).EndInit();
((System.ComponentModel.ISupportInitialize)numId).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label label1;
private DataGridView dgvPresupuesto;
private DataGridView dgvProveedor;
private Label label2;
private NumericUpDown numId;
private Label ID;
private Button btnAddProducto;
}
}

38
Vista/FrmOrdenDeCompra.cs Normal file
View File

@@ -0,0 +1,38 @@
using Controladora;
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 FrmOrdenDeCompra : Form
{
public FrmOrdenDeCompra()
{
InitializeComponent();
}
private void CargarDatos()
{
dgvPresupuesto.DataSource = null;
var listapresupuesto = ControladoraPresupuestos.Instance.Listar();
dgvPresupuesto.DataSource = listapresupuesto;
numId.Value = (listapresupuesto.Count > 0) ?
listapresupuesto.Max(x => x.Id + 1) :
0;
numId.Enabled = false;
}
private void btnAddProducto_Click(object sender, EventArgs e)
{
}
}
}

View File

@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<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>
@@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->

View File

@@ -1,6 +1,6 @@
namespace Vista namespace Vista
{ {
partial class FrmOrdenDeCompra partial class FrmOrdenesDeCompras
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@@ -29,16 +29,16 @@
private void InitializeComponent() private void InitializeComponent()
{ {
groupBox1 = new GroupBox(); groupBox1 = new GroupBox();
dataGridView1 = new DataGridView(); dgvOrdenDeCompra = new DataGridView();
BtnAdd = new Button(); BtnAdd = new Button();
BtnEliminar = new Button(); BtnEliminar = new Button();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvOrdenDeCompra).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// groupBox1 // groupBox1
// //
groupBox1.Controls.Add(dataGridView1); groupBox1.Controls.Add(dgvOrdenDeCompra);
groupBox1.Controls.Add(BtnAdd); groupBox1.Controls.Add(BtnAdd);
groupBox1.Controls.Add(BtnEliminar); groupBox1.Controls.Add(BtnEliminar);
groupBox1.Location = new Point(12, 3); groupBox1.Location = new Point(12, 3);
@@ -47,15 +47,15 @@
groupBox1.TabIndex = 4; groupBox1.TabIndex = 4;
groupBox1.TabStop = false; groupBox1.TabStop = false;
// //
// dataGridView1 // dgvOrdenDeCompra
// //
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; dgvOrdenDeCompra.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dgvOrdenDeCompra.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Location = new Point(6, 22); dgvOrdenDeCompra.Location = new Point(6, 22);
dataGridView1.Name = "dataGridView1"; dgvOrdenDeCompra.Name = "dgvOrdenDeCompra";
dataGridView1.RowTemplate.Height = 25; dgvOrdenDeCompra.RowTemplate.Height = 25;
dataGridView1.Size = new Size(550, 235); dgvOrdenDeCompra.Size = new Size(550, 235);
dataGridView1.TabIndex = 3; dgvOrdenDeCompra.TabIndex = 3;
// //
// BtnAdd // BtnAdd
// //
@@ -75,25 +75,26 @@
BtnEliminar.TabIndex = 2; BtnEliminar.TabIndex = 2;
BtnEliminar.Text = "Eliminar"; BtnEliminar.Text = "Eliminar";
BtnEliminar.UseVisualStyleBackColor = true; BtnEliminar.UseVisualStyleBackColor = true;
BtnEliminar.Click += BtnEliminar_Click;
// //
// FrmOrdenDeCompra // FrmOrdenesDeCompras
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(800, 450);
Controls.Add(groupBox1); Controls.Add(groupBox1);
Name = "FrmOrdenDeCompra"; Name = "FrmOrdenesDeCompras";
Text = "OrdenDeCompra"; Text = "OrdenDeCompra";
WindowState = FormWindowState.Maximized; WindowState = FormWindowState.Maximized;
groupBox1.ResumeLayout(false); groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); ((System.ComponentModel.ISupportInitialize)dgvOrdenDeCompra).EndInit();
ResumeLayout(false); ResumeLayout(false);
} }
#endregion #endregion
private GroupBox groupBox1; private GroupBox groupBox1;
private DataGridView dataGridView1; private DataGridView dgvOrdenDeCompra;
private Button BtnAdd; private Button BtnAdd;
private Button BtnEliminar; private Button BtnEliminar;
} }

View File

@@ -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;
@@ -10,16 +12,63 @@ using System.Windows.Forms;
namespace Vista namespace Vista
{ {
public partial class FrmOrdenDeCompra : Form public partial class FrmOrdenesDeCompras : Form
{ {
public FrmOrdenDeCompra() public FrmOrdenesDeCompras()
{ {
InitializeComponent(); InitializeComponent();
} }
private void BtnAdd_Click(object sender, EventArgs e) private void BtnAdd_Click(object sender, EventArgs e)
{ {
using (var form = new FrmOrdenDeCompra())
{
form.ShowDialog();
ActualizarGrilla();
}
}
private void ActualizarGrilla()
{
dgvOrdenDeCompra.DataSource = null;
dgvOrdenDeCompra.DataSource = ControladoraOrdenDeCompras.Instance.Listar();
}
private void BtnEliminar_Click(object sender, EventArgs e)
{
// Verifica si hay filas seleccionadas en dgvPresupuestos
if (dgvOrdenDeCompra.SelectedRows.Count == 0)
{
MessageBox.Show("Por favor, selecciona una orden de Compra para eliminar.");
return;
}
// Recupera el ID del presupuesto seleccionado
int ordenId = Convert.ToInt32(dgvOrdenDeCompra.SelectedRows[0].Cells["Id"].Value.ToString());
// Crea un objeto de Presupuesto con el ID recuperado
var orden = new OrdenDeCompra { Id = ordenId };
// Confirma la eliminación con el usuario
var result = MessageBox.Show("¿Estás seguro de que deseas eliminar esta orden?", "Confirmar Eliminación", MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
try
{
// Llama al método Eliminar de la controladora con el objeto Presupuesto
ControladoraOrdenDeCompras.Instance.Eliminar(orden);
// Actualiza la grilla de presupuestos después de eliminar el presupuesto
ActualizarGrilla();
MessageBox.Show("Orden eliminado exitosamente.");
}
catch (Exception ex)
{
MessageBox.Show($"Error al eliminar la Orden de Compra: {ex.Message}");
}
}
} }
} }
} }

View File

@@ -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>

View File

@@ -70,7 +70,7 @@
// ID // ID
// //
ID.AutoSize = true; ID.AutoSize = true;
ID.Location = new Point(11, 26); ID.Location = new Point(26, 20);
ID.Name = "ID"; ID.Name = "ID";
ID.Size = new Size(18, 15); ID.Size = new Size(18, 15);
ID.TabIndex = 2; ID.TabIndex = 2;

View File

@@ -1,6 +1,6 @@
namespace Vista namespace Vista
{ {
partial class Remito partial class FrmRemito
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.

View File

@@ -10,9 +10,9 @@ using System.Windows.Forms;
namespace Vista namespace Vista
{ {
public partial class Remito : Form public partial class FrmRemito : Form
{ {
public Remito() public FrmRemito()
{ {
InitializeComponent(); InitializeComponent();
} }

View File

@@ -1,39 +0,0 @@
namespace Vista
{
partial class OrdenDeCompra
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "OrdenDeCompra";
}
#endregion
}
}

View File

@@ -1,20 +0,0 @@
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 OrdenDeCompra : Form
{
public OrdenDeCompra()
{
InitializeComponent();
}
}
}

View File

@@ -79,6 +79,24 @@ namespace Vista
producto.A<EFBFBD>adirProveedor(proveedor); producto.A<EFBFBD>adirProveedor(proveedor);
ControladoraProductos.Instance.A<EFBFBD>adir(producto); ControladoraProductos.Instance.A<EFBFBD>adir(producto);
Presupuesto presupuesto = new Presupuesto
{
Id = 1,
Aceptado = false,
Habilitado = true,
Fecha = DateTime.Now,
Proveedor = proveedor,
};
presupuesto.A<EFBFBD>adirDetalle(new DetallePresupuesto
{
Id = 1,
Cantidad = 2,
IdPresupuesto = 1,
MontoCUPropuesto = 1000,
Producto = producto,
});
ControladoraPresupuestos.Instance.A<EFBFBD>adir(presupuesto);
} }
} }
} }

View File

@@ -47,13 +47,13 @@
<Compile Update="FrmRemitos.cs"> <Compile Update="FrmRemitos.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Update="OrdenDeCompra.cs"> <Compile Update="FrmOrdenDeCompra.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Update="PantallaPrincipal.cs"> <Compile Update="PantallaPrincipal.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Update="Remito.cs"> <Compile Update="FrmRemito.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
</ItemGroup> </ItemGroup>