diff --git a/Controladora/ControladoraClientes.cs b/Controladora/ControladoraClientes.cs index 6d59338..2341940 100644 --- a/Controladora/ControladoraClientes.cs +++ b/Controladora/ControladoraClientes.cs @@ -8,10 +8,7 @@ namespace Controladora { public string Añadir(Cliente t) { - if (t == null) - { - return "El Cliente es nulo, fallo la carga"; - } + if (t == null) return "El Cliente es nulo, fallo la carga"; // Verificar si el CUIT ya existe en el repositorio if (RepositorioClientes.Instance.ExistePorCuit(t.Cuit)) diff --git a/Controladora/ControladoraRemito.cs b/Controladora/ControladoraRemito.cs index 9341725..dc1aa06 100644 --- a/Controladora/ControladoraRemito.cs +++ b/Controladora/ControladoraRemito.cs @@ -14,29 +14,31 @@ namespace Controladora public string Añadir(Remito t) { if (t == null) return "El Remito es nulo fallo la carga"; + if (t.Id < 0) return "El id Esta Mal Cargado"; - return (RepositorioRemito.Instance.Add(t)) ? + var retRemito = RepositorioRemito.Instance.Add(t); + var retLotes = RepositorioLote.Instance.Add(t); + + return (!retLotes) ? $"El remito {t.Id} se cargo correctamente": $"Fallo la carga del remito {t.Id}"; } public string Modificar(Remito t) { - if (t == null) return "El Remito es nulo fallo la carga"; - - return (RepositorioRemito.Instance.Add(t)) ? - $"El remito {t.Id} se cargo correctamente": - $"Fallo la carga del remito {t.Id}"; - + return "No se puede modificar un Remito"; } - public string Eliminar(Remito t) + + private string Eliminar(Remito t) { + return "No se puede Eliminar un remito"; + /* if (t == null) return "El Remito es nulo fallo la carga"; - return (RepositorioRemito.Instance.Add(t)) ? - $"El remito {t.Id} se cargo correctamente": - $"Fallo la carga del remito {t.Id}"; - + return (RepositorioRemito.Instance.Del(t)) ? + $"El remito {t.Id} se elimino correctamente": + $"Fallo la Eliminacion del remito {t.Id}"; + */ } } } diff --git a/Controladora/bin/Debug/net6.0/Controladora.dll b/Controladora/bin/Debug/net6.0/Controladora.dll index add0974..cc0236f 100644 Binary files a/Controladora/bin/Debug/net6.0/Controladora.dll and b/Controladora/bin/Debug/net6.0/Controladora.dll differ diff --git a/Controladora/bin/Debug/net6.0/Controladora.pdb b/Controladora/bin/Debug/net6.0/Controladora.pdb index 230be54..a3fa8fc 100644 Binary files a/Controladora/bin/Debug/net6.0/Controladora.pdb and b/Controladora/bin/Debug/net6.0/Controladora.pdb differ diff --git a/Controladora/obj/Debug/net6.0/Controladora.dll b/Controladora/obj/Debug/net6.0/Controladora.dll index add0974..cc0236f 100644 Binary files a/Controladora/obj/Debug/net6.0/Controladora.dll and b/Controladora/obj/Debug/net6.0/Controladora.dll differ diff --git a/Controladora/obj/Debug/net6.0/Controladora.pdb b/Controladora/obj/Debug/net6.0/Controladora.pdb index 230be54..a3fa8fc 100644 Binary files a/Controladora/obj/Debug/net6.0/Controladora.pdb and b/Controladora/obj/Debug/net6.0/Controladora.pdb differ diff --git a/Controladora/obj/Debug/net6.0/ref/Controladora.dll b/Controladora/obj/Debug/net6.0/ref/Controladora.dll index 88b805a..72f821b 100644 Binary files a/Controladora/obj/Debug/net6.0/ref/Controladora.dll and b/Controladora/obj/Debug/net6.0/ref/Controladora.dll differ diff --git a/Controladora/obj/Debug/net6.0/refint/Controladora.dll b/Controladora/obj/Debug/net6.0/refint/Controladora.dll index 88b805a..72f821b 100644 Binary files a/Controladora/obj/Debug/net6.0/refint/Controladora.dll and b/Controladora/obj/Debug/net6.0/refint/Controladora.dll differ diff --git a/Entidades/Entidades.cd b/Entidades/Entidades.cd index fdad442..7d6baad 100644 --- a/Entidades/Entidades.cd +++ b/Entidades/Entidades.cd @@ -49,6 +49,8 @@ + + @@ -73,12 +75,9 @@ - AAACAAAAAAAAAAEAQABAAAAAAAAAABAAAAAAAAAAAAA= + AAAAAAAAAAAAAAEAAAAAAAAAAAAAABAAAAAAAAAAAAA= Lote.cs - - - diff --git a/Entidades/EnvaseTipo.cs b/Entidades/EnvaseTipo.cs new file mode 100644 index 0000000..2625a3a --- /dev/null +++ b/Entidades/EnvaseTipo.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entidades +{ + public enum EnvaseTipo + { + Plastico, + Enlatado, + Carton, + NoTiene + } + +} diff --git a/Entidades/Lote.cs b/Entidades/Lote.cs index 7e24699..abfc822 100644 --- a/Entidades/Lote.cs +++ b/Entidades/Lote.cs @@ -1,12 +1,9 @@  namespace Entidades { - public class Lote + public class Lote: Detalle { - public int Id { get; set; } public DateTime Fecha { get; set; } - public Producto Producto { get; set; } - public long CantidadDeProductos { get; set; } public bool Habilitado { get; set; } } diff --git a/Entidades/ProductoNoPercedero.cs b/Entidades/ProductoNoPercedero.cs new file mode 100644 index 0000000..7101f87 --- /dev/null +++ b/Entidades/ProductoNoPercedero.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entidades +{ + public class ProductoNoPercedero : Producto + { + public EnvaseTipo TipoDeEnvase { get; set; } + } + +} diff --git a/Entidades/ProductoPercedero.cs b/Entidades/ProductoPercedero.cs new file mode 100644 index 0000000..7ae4ad8 --- /dev/null +++ b/Entidades/ProductoPercedero.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entidades +{ + public class ProductoPercedero : Producto + { + public int MesesHastaConsumoPreferente { get; set; } + public int MesesHastaVencimiento { get; set; } + } + +} diff --git a/Informes/bin/Debug/net6.0/Entidades.dll b/Informes/bin/Debug/net6.0/Entidades.dll index 57d6fa0..89d574c 100644 Binary files a/Informes/bin/Debug/net6.0/Entidades.dll and b/Informes/bin/Debug/net6.0/Entidades.dll differ diff --git a/Informes/bin/Debug/net6.0/Entidades.pdb b/Informes/bin/Debug/net6.0/Entidades.pdb index cb501e6..8c5cb89 100644 Binary files a/Informes/bin/Debug/net6.0/Entidades.pdb and b/Informes/bin/Debug/net6.0/Entidades.pdb differ diff --git a/Informes/bin/Debug/net6.0/Informes.dll b/Informes/bin/Debug/net6.0/Informes.dll index 69bbe56..e99f5ab 100644 Binary files a/Informes/bin/Debug/net6.0/Informes.dll and b/Informes/bin/Debug/net6.0/Informes.dll differ diff --git a/Informes/bin/Debug/net6.0/Informes.pdb b/Informes/bin/Debug/net6.0/Informes.pdb index 5998dbc..ccf1f96 100644 Binary files a/Informes/bin/Debug/net6.0/Informes.pdb and b/Informes/bin/Debug/net6.0/Informes.pdb differ diff --git a/Informes/obj/Debug/net6.0/Informes.csproj.AssemblyReference.cache b/Informes/obj/Debug/net6.0/Informes.csproj.AssemblyReference.cache index 1b4b4ba..54ba99a 100644 Binary files a/Informes/obj/Debug/net6.0/Informes.csproj.AssemblyReference.cache and b/Informes/obj/Debug/net6.0/Informes.csproj.AssemblyReference.cache differ diff --git a/Informes/obj/Debug/net6.0/Informes.dll b/Informes/obj/Debug/net6.0/Informes.dll index 69bbe56..e99f5ab 100644 Binary files a/Informes/obj/Debug/net6.0/Informes.dll and b/Informes/obj/Debug/net6.0/Informes.dll differ diff --git a/Informes/obj/Debug/net6.0/Informes.pdb b/Informes/obj/Debug/net6.0/Informes.pdb index 5998dbc..ccf1f96 100644 Binary files a/Informes/obj/Debug/net6.0/Informes.pdb and b/Informes/obj/Debug/net6.0/Informes.pdb differ diff --git a/Modelo/RepositorioClientes.cs b/Modelo/RepositorioClientes.cs index 916ca58..e335560 100644 --- a/Modelo/RepositorioClientes.cs +++ b/Modelo/RepositorioClientes.cs @@ -6,11 +6,6 @@ namespace Modelo { public override bool Add(Cliente t) { - if (ExistePorCuit(t.Cuit)) - { - throw new InvalidOperationException($"El Cliente con el CUIT {t.Cuit} ya existe."); - } - bool ret = false; try { @@ -33,8 +28,6 @@ namespace Modelo override public bool Mod(Cliente t) { bool ret = false; - - try { var clienteAModificar = almacen.FindIndex(x => x.Cuit == t.Cuit); diff --git a/Modelo/RepositorioLote.cs b/Modelo/RepositorioLote.cs index 9d8243d..ddb0d4e 100644 --- a/Modelo/RepositorioLote.cs +++ b/Modelo/RepositorioLote.cs @@ -4,6 +4,7 @@ namespace Modelo { public sealed class RepositorioLote : RepositorioBase { + override public bool Add(Lote t) { bool ret = false; @@ -21,6 +22,23 @@ namespace Modelo return ret; } + public bool Add(Remito rem) + { + if (rem.MostrarLotes().Count <= 0) return true; + var ret = false; + try + { + foreach (var detalle in rem.MostrarLotes()) + { + ret = Add(detalle); + } + }catch (Exception) + { + throw; + } + return ret; + } + override public bool Mod(Lote t) { bool ret = false; diff --git a/Vista/FrmCliente.cs b/Vista/FrmCliente.cs index 973ee36..f58d04c 100644 --- a/Vista/FrmCliente.cs +++ b/Vista/FrmCliente.cs @@ -85,6 +85,7 @@ namespace Vista Direccion = txtDireccion.Text, Apellido = txtApellido.Text, Correo = txtCorreo.Text, + Habilitado = true }; diff --git a/Vista/FrmClientes.Designer.cs b/Vista/FrmClientes.Designer.cs index 742721f..45cc3f2 100644 --- a/Vista/FrmClientes.Designer.cs +++ b/Vista/FrmClientes.Designer.cs @@ -32,9 +32,9 @@ BtnEliminar = new Button(); groupBox1 = new GroupBox(); BtnAceptar = new Button(); - dataGridView1 = new DataGridView(); + dgvCliente = new DataGridView(); groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); + ((System.ComponentModel.ISupportInitialize)dgvCliente).BeginInit(); SuspendLayout(); // // BtnModificar @@ -60,7 +60,7 @@ // groupBox1 // groupBox1.Controls.Add(BtnAceptar); - groupBox1.Controls.Add(dataGridView1); + groupBox1.Controls.Add(dgvCliente); groupBox1.Controls.Add(BtnEliminar); groupBox1.Controls.Add(BtnModificar); groupBox1.Location = new Point(12, 2); @@ -79,20 +79,20 @@ BtnAceptar.UseVisualStyleBackColor = true; BtnAceptar.Click += BtnAceptar_Click; // - // dataGridView1 + // dgvCliente // - dataGridView1.AllowUserToAddRows = false; - dataGridView1.AllowUserToDeleteRows = false; - dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; - dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView1.Location = new Point(6, 22); - dataGridView1.MultiSelect = false; - dataGridView1.Name = "dataGridView1"; - dataGridView1.ReadOnly = true; - dataGridView1.RowTemplate.Height = 25; - dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView1.Size = new Size(737, 235); - dataGridView1.TabIndex = 3; + dgvCliente.AllowUserToAddRows = false; + dgvCliente.AllowUserToDeleteRows = false; + dgvCliente.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dgvCliente.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dgvCliente.Location = new Point(6, 22); + dgvCliente.MultiSelect = false; + dgvCliente.Name = "dgvCliente"; + dgvCliente.ReadOnly = true; + dgvCliente.RowTemplate.Height = 25; + dgvCliente.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dgvCliente.Size = new Size(737, 235); + dgvCliente.TabIndex = 3; // // FrmClientes // @@ -104,7 +104,7 @@ Text = "Clientes"; WindowState = FormWindowState.Maximized; groupBox1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); + ((System.ComponentModel.ISupportInitialize)dgvCliente).EndInit(); ResumeLayout(false); } @@ -112,7 +112,7 @@ private Button BtnModificar; private Button BtnEliminar; private GroupBox groupBox1; - private DataGridView dataGridView1; + private DataGridView dgvCliente; private Button BtnAceptar; } } \ No newline at end of file diff --git a/Vista/FrmClientes.cs b/Vista/FrmClientes.cs index fd5f607..b5756ba 100644 --- a/Vista/FrmClientes.cs +++ b/Vista/FrmClientes.cs @@ -14,8 +14,8 @@ namespace Vista private void ActualizarGrilla() { - dataGridView1.DataSource = null; - dataGridView1.DataSource = ControladoraClientes.Instance.Listar(); + dgvCliente.DataSource = null; + dgvCliente.DataSource = ControladoraClientes.Instance.Listar(); } private void BtnAceptar_Click(object sender, EventArgs e) @@ -27,7 +27,7 @@ namespace Vista private void BtnModificar_Click(object sender, EventArgs e) { - if (dataGridView1.SelectedRows.Count < 1) + if (dgvCliente.SelectedRows.Count < 1) { MessageBox.Show("Seleccione una linea para modificar"); return; @@ -35,11 +35,11 @@ namespace Vista Cliente cliente = new Cliente() { - Nombre = dataGridView1.SelectedRows[0].Cells["Nombre"].Value.ToString(), - Cuit = (Int64)dataGridView1.SelectedRows[0].Cells["Cuit"].Value, - Apellido = dataGridView1.SelectedRows[0].Cells["Apellido"].Value.ToString(), - Direccion = dataGridView1.SelectedRows[0].Cells["Direccion"].Value.ToString(), - Correo = dataGridView1.SelectedRows[0].Cells["Correo"].Value.ToString(), + Nombre = dgvCliente.SelectedRows[0].Cells["Nombre"].Value.ToString(), + Cuit = (Int64)dgvCliente.SelectedRows[0].Cells["Cuit"].Value, + Apellido = dgvCliente.SelectedRows[0].Cells["Apellido"].Value.ToString(), + Direccion = dgvCliente.SelectedRows[0].Cells["Direccion"].Value.ToString(), + Correo = dgvCliente.SelectedRows[0].Cells["Correo"].Value.ToString(), }; var formModificar = new FrmCliente(cliente); @@ -49,13 +49,13 @@ namespace Vista private void BtnEliminar_Click(object sender, EventArgs e) { - if (dataGridView1.SelectedRows.Count < 0) + if (dgvCliente.SelectedRows.Count < 0) { MessageBox.Show("Seleccione una linea para eliminar"); return; } - foreach (DataGridViewRow Fila in dataGridView1.SelectedRows) + foreach (DataGridViewRow Fila in dgvCliente.SelectedRows) { // itera por un loop y elimina las lineas seleccionadas 1 a la vez. string devolucion = ControladoraClientes.Instance.Eliminar(long.Parse(Fila.Cells["Cuit"].Value.ToString())); MessageBox.Show(devolucion); @@ -64,5 +64,5 @@ namespace Vista } -} + } } diff --git a/Vista/FrmClientes.resx b/Vista/FrmClientes.resx index af32865..a395bff 100644 --- a/Vista/FrmClientes.resx +++ b/Vista/FrmClientes.resx @@ -18,7 +18,7 @@ System.Resources.ResXResourceReader, System.Windows.Forms, ... System.Resources.ResXResourceWriter, System.Windows.Forms, ... this is my long stringthis is a comment - Blue + Blue [base64 mime encoded serialized .NET Framework object] diff --git a/Vista/FrmOrdenesDeCompras.Designer.cs b/Vista/FrmOrdenesDeCompras.Designer.cs index bd3f3b7..eb6d19c 100644 --- a/Vista/FrmOrdenesDeCompras.Designer.cs +++ b/Vista/FrmOrdenesDeCompras.Designer.cs @@ -29,15 +29,15 @@ private void InitializeComponent() { groupBox1 = new GroupBox(); + label2 = new Label(); + label1 = new Label(); + dgvDetalles = new DataGridView(); dgvOrdenDeCompra = new DataGridView(); BtnAdd = new Button(); BtnEliminar = new Button(); - dgvDetalles = new DataGridView(); - label1 = new Label(); - label2 = new Label(); groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)dgvOrdenDeCompra).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvDetalles).BeginInit(); + ((System.ComponentModel.ISupportInitialize)dgvOrdenDeCompra).BeginInit(); SuspendLayout(); // // groupBox1 @@ -54,6 +54,37 @@ groupBox1.TabIndex = 4; groupBox1.TabStop = false; // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(6, 4); + label2.Name = "label2"; + label2.Size = new Size(102, 15); + label2.TabIndex = 6; + label2.Text = "Orden de Compra"; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(404, 4); + label1.Name = "label1"; + label1.Size = new Size(48, 15); + label1.TabIndex = 5; + label1.Text = "Detalles"; + // + // dgvDetalles + // + dgvDetalles.AllowUserToAddRows = false; + dgvDetalles.AllowUserToDeleteRows = false; + dgvDetalles.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dgvDetalles.EditMode = DataGridViewEditMode.EditProgrammatically; + dgvDetalles.Location = new Point(404, 22); + dgvDetalles.Name = "dgvDetalles"; + dgvDetalles.RowTemplate.Height = 25; + dgvDetalles.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dgvDetalles.Size = new Size(471, 235); + dgvDetalles.TabIndex = 4; + // // dgvOrdenDeCompra // dgvOrdenDeCompra.AllowUserToAddRows = false; @@ -88,37 +119,6 @@ BtnEliminar.UseVisualStyleBackColor = true; BtnEliminar.Click += BtnEliminar_Click; // - // dgvDetalles - // - dgvDetalles.AllowUserToAddRows = false; - dgvDetalles.AllowUserToDeleteRows = false; - dgvDetalles.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dgvDetalles.EditMode = DataGridViewEditMode.EditProgrammatically; - dgvDetalles.Location = new Point(404, 22); - dgvDetalles.Name = "dgvDetalles"; - dgvDetalles.RowTemplate.Height = 25; - dgvDetalles.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dgvDetalles.Size = new Size(471, 235); - dgvDetalles.TabIndex = 4; - // - // label1 - // - label1.AutoSize = true; - label1.Location = new Point(404, 4); - label1.Name = "label1"; - label1.Size = new Size(48, 15); - label1.TabIndex = 5; - label1.Text = "Detalles"; - // - // label2 - // - label2.AutoSize = true; - label2.Location = new Point(6, 4); - label2.Name = "label2"; - label2.Size = new Size(102, 15); - label2.TabIndex = 6; - label2.Text = "Orden de Compra"; - // // FrmOrdenesDeCompras // AutoScaleDimensions = new SizeF(7F, 15F); @@ -130,8 +130,8 @@ WindowState = FormWindowState.Maximized; groupBox1.ResumeLayout(false); groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)dgvOrdenDeCompra).EndInit(); ((System.ComponentModel.ISupportInitialize)dgvDetalles).EndInit(); + ((System.ComponentModel.ISupportInitialize)dgvOrdenDeCompra).EndInit(); ResumeLayout(false); } diff --git a/Vista/Program.cs b/Vista/Program.cs index 0ee9405..a0a706e 100644 --- a/Vista/Program.cs +++ b/Vista/Program.cs @@ -68,13 +68,14 @@ namespace Vista Id = 2, Descripcion = "Perfumeria" }); - Producto producto = new Producto + ProductoNoPercedero producto = new ProductoNoPercedero { Id = 1, Categoria = ControladoraCategorias.Instance.Listar()[0], Habilitado = true, Nombre = "Pantalones Vaqueros", - Precio = 2000.2 + Precio = 2000.2, + TipoDeEnvase = EnvaseTipo.NoTiene }; producto.AñadirProveedor(proveedor); ControladoraProductos.Instance.Añadir(producto);