diff --git a/.gitignore b/.gitignore index dc10d47..5e33ad2 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ Modelo/obj Entidades/bin Entidades/obj Controladora/bin -Controladora/obj \ No newline at end of file +Controladora/obj +.vs diff --git a/.vs/Final_OOP/DesignTimeBuild/.dtbcache.v2 b/.vs/Final_OOP/DesignTimeBuild/.dtbcache.v2 index a879841..18aba02 100644 Binary files a/.vs/Final_OOP/DesignTimeBuild/.dtbcache.v2 and b/.vs/Final_OOP/DesignTimeBuild/.dtbcache.v2 differ diff --git a/Controladora/ControladoraClientes.cs b/Controladora/ControladoraClientes.cs index 1976a54..1df7e2a 100644 --- a/Controladora/ControladoraClientes.cs +++ b/Controladora/ControladoraClientes.cs @@ -17,7 +17,7 @@ namespace Controladora public string Eliminar(long t) { - var cl = RepositorioClientes.Instance.Listar().First(x => long.Parse(x.Cuit) == t); + var cl = RepositorioClientes.Instance.Listar().First(x => x.Cuit == t); if (cl == null) return "El Cliente es nulo fallo la carga"; @@ -26,13 +26,13 @@ namespace Controladora $"Fallo la Eliminacion del Cliente {t}"; } - public string Modificar(Cliente cl) + public string Modificar(Cliente t) { - if (cl == null) return "El Cliente es nulo fallo la carga"; + if (t == null) return "El Cliente es nulo fallo la carga"; - return (RepositorioClientes.Instance.Mod(cl)) ? - $"El Cliente {cl.Nombre} se Modifico correctamente": - $"Fallo la Modificacion del Cliente {cl.Nombre}"; + return (RepositorioClientes.Instance.Mod(t)) ? + $"El Cliente {t.Nombre} se Modifico correctamente": + $"Fallo la Modificacion del Cliente {t.Nombre}"; } public ReadOnlyCollection Listar() diff --git a/Controladora/bin/Debug/net6.0/Controladora.dll b/Controladora/bin/Debug/net6.0/Controladora.dll index 387625a..eedcf14 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 dd74473..5871efc 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 387625a..eedcf14 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 dd74473..5871efc 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 b6bb564..3c94f84 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 b6bb564..3c94f84 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/Cliente.cs b/Entidades/Cliente.cs index 13f269f..0f2072e 100644 --- a/Entidades/Cliente.cs +++ b/Entidades/Cliente.cs @@ -1,12 +1,17 @@  +using System.ComponentModel; + namespace Entidades { public class Cliente { - public string Cuit { get; set; } + public Int64 Cuit { get; set; } public string Nombre { get; set; } public string Apellido { get; set; } public string Direccion { get; set; } public string Correo { get; set; } + + [Browsable(false)] + public bool Habilitado { get; set; } } } \ No newline at end of file diff --git a/Modelo/RepositorioCategoria.cs b/Modelo/RepositorioCategoria.cs index 652c08e..74ee70d 100644 --- a/Modelo/RepositorioCategoria.cs +++ b/Modelo/RepositorioCategoria.cs @@ -27,10 +27,10 @@ namespace Modelo try { - var categoriaAModificar = almacen.Find(x => x.Id == t.Id); - if (categoriaAModificar != null) + var categoriaAModificar = almacen.FindIndex(x => x.Id == t.Id); + if (categoriaAModificar > -1) { - categoriaAModificar = t; + almacen[categoriaAModificar] = t; ret = true; } } diff --git a/Modelo/RepositorioClientes.cs b/Modelo/RepositorioClientes.cs index f054012..b64bc04 100644 --- a/Modelo/RepositorioClientes.cs +++ b/Modelo/RepositorioClientes.cs @@ -28,10 +28,10 @@ namespace Modelo try { - var clienteAModificar = almacen.Find(x => x.Cuit == t.Cuit); - if (clienteAModificar != null) + var clienteAModificar = almacen.FindIndex(x => x.Cuit == t.Cuit); + if (clienteAModificar > -1) { - clienteAModificar = t; + almacen[clienteAModificar] = t; ret = true; } } diff --git a/Modelo/RepositorioFactura.cs b/Modelo/RepositorioFactura.cs index 72372fc..ac1841a 100644 --- a/Modelo/RepositorioFactura.cs +++ b/Modelo/RepositorioFactura.cs @@ -28,10 +28,10 @@ namespace Modelo try { - var facturaAModificar = almacen.Find(x => x.Id == t.Id); - if (facturaAModificar != null) + var facturaAModificar = almacen.FindIndex(x => x.Id == t.Id); + if (facturaAModificar > -1) { - facturaAModificar = t; + almacen[facturaAModificar] = t; ret = true; } } diff --git a/Modelo/RepositorioLote.cs b/Modelo/RepositorioLote.cs index a982521..9b69f26 100644 --- a/Modelo/RepositorioLote.cs +++ b/Modelo/RepositorioLote.cs @@ -27,10 +27,10 @@ namespace Modelo try { - var loteAModificar = almacen.Find(x => x.Id == t.Id); - if (loteAModificar != null) + var loteAModificar = almacen.FindIndex(x => x.Id == t.Id); + if (loteAModificar > -1) { - loteAModificar = t; + almacen[loteAModificar] = t; ret = true; } } diff --git a/Modelo/RepositorioOrdenDeCompra.cs b/Modelo/RepositorioOrdenDeCompra.cs index de21f3a..3ebe845 100644 --- a/Modelo/RepositorioOrdenDeCompra.cs +++ b/Modelo/RepositorioOrdenDeCompra.cs @@ -28,10 +28,10 @@ namespace Modelo try { - var ordenAModificar = almacen.Find(x => x.Id == t.Id); - if (ordenAModificar != null) + var ordenAModificar = almacen.FindIndex(x => x.Id == t.Id); + if (ordenAModificar > -1) { - ordenAModificar = t; + almacen[ordenAModificar] = t; ret = true; } } diff --git a/Modelo/RepositorioPedidoDePresupuesto.cs b/Modelo/RepositorioPedidoDePresupuesto.cs index 8a2e08b..c08c399 100644 --- a/Modelo/RepositorioPedidoDePresupuesto.cs +++ b/Modelo/RepositorioPedidoDePresupuesto.cs @@ -28,10 +28,10 @@ namespace Modelo try { - var pedidoAModificar = almacen.Find(x => x.Id == t.Id); - if (pedidoAModificar != null) + var pedidoAModificar = almacen.FindIndex(x => x.Id == t.Id); + if (pedidoAModificar > -1) { - pedidoAModificar = t; + almacen[pedidoAModificar] = t; ret = true; } } diff --git a/Modelo/RepositorioPresupuesto.cs b/Modelo/RepositorioPresupuesto.cs index 1764102..fbe60f8 100644 --- a/Modelo/RepositorioPresupuesto.cs +++ b/Modelo/RepositorioPresupuesto.cs @@ -28,11 +28,11 @@ namespace Modelo try { - var presupuestoAModificar = almacen.Find(x => x.Id == t.Id); - if (presupuestoAModificar != null) + var presupuestoAModificar = almacen.FindIndex(x => x.Id == t.Id); + if (presupuestoAModificar > -1) { - presupuestoAModificar = t; + almacen[presupuestoAModificar] = t; ret = true; } } diff --git a/Modelo/RepositorioProductos.cs b/Modelo/RepositorioProductos.cs index 0e258d5..7ebe2c2 100644 --- a/Modelo/RepositorioProductos.cs +++ b/Modelo/RepositorioProductos.cs @@ -27,8 +27,8 @@ namespace Modelo try { - var AModificar = almacen.Find(x => x.Id == t.Id); - AModificar = t; + var AModificar = almacen.FindIndex(x => x.Id == t.Id); + almacen[AModificar] = t; ret = true; } catch (Exception) diff --git a/Modelo/RepositorioProveedor.cs b/Modelo/RepositorioProveedor.cs index 15c2d19..5bd3553 100644 --- a/Modelo/RepositorioProveedor.cs +++ b/Modelo/RepositorioProveedor.cs @@ -27,10 +27,10 @@ namespace Modelo try { - var proveedorAModificar = almacen.Find(x => x.Cuit == t.Cuit); - if (proveedorAModificar != null) + var proveedorAModificar = almacen.FindIndex(x => x.Cuit == t.Cuit); + if (proveedorAModificar > -1) { - proveedorAModificar = t; + almacen[proveedorAModificar] = t; ret = true; } } diff --git a/Modelo/RepositorioRemito.cs b/Modelo/RepositorioRemito.cs index 7207fcf..5d4599d 100644 --- a/Modelo/RepositorioRemito.cs +++ b/Modelo/RepositorioRemito.cs @@ -29,11 +29,11 @@ namespace Modelo try { - var remitoAModificar = almacen.Find(x => x.Id == t.Id); - if (remitoAModificar != null) + var remitoAModificar = almacen.FindIndex(x => x.Id == t.Id); + if (remitoAModificar > -1) { - remitoAModificar = t; + almacen[remitoAModificar] = t; ret = true; ret = true; diff --git a/Vista/FrmCliente.Designer.cs b/Vista/FrmCliente.Designer.cs index d2a401d..290cbe2 100644 --- a/Vista/FrmCliente.Designer.cs +++ b/Vista/FrmCliente.Designer.cs @@ -34,13 +34,14 @@ namespace Vista label3 = new Label(); label4 = new Label(); label5 = new Label(); - txtCuit = new TextBox(); txtNombre = new TextBox(); txtApellido = new TextBox(); txtDireccion = new TextBox(); txtCorreo = new TextBox(); BtnAceptar = new Button(); BtnCancelar = new Button(); + numCuit = new NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)numCuit).BeginInit(); SuspendLayout(); // // label1 @@ -88,13 +89,6 @@ namespace Vista label5.TabIndex = 4; label5.Text = "Correo"; // - // txtCuit - // - txtCuit.Location = new Point(92, 21); - txtCuit.Name = "txtCuit"; - txtCuit.Size = new Size(173, 23); - txtCuit.TabIndex = 5; - // // txtNombre // txtNombre.Location = new Point(92, 51); @@ -143,6 +137,14 @@ namespace Vista BtnCancelar.UseVisualStyleBackColor = true; BtnCancelar.Click += BtnCancelar_Click; // + // numCuit + // + numCuit.Location = new Point(92, 22); + numCuit.Maximum = new decimal(new int[] { 1215752191, 23, 0, 0 }); + numCuit.Name = "numCuit"; + numCuit.Size = new Size(173, 23); + numCuit.TabIndex = 12; + // // FrmCliente // AcceptButton = BtnAceptar; @@ -151,13 +153,13 @@ namespace Vista CancelButton = BtnCancelar; ClientSize = new Size(420, 245); ControlBox = false; + Controls.Add(numCuit); Controls.Add(BtnCancelar); Controls.Add(BtnAceptar); Controls.Add(txtCorreo); Controls.Add(txtDireccion); Controls.Add(txtApellido); Controls.Add(txtNombre); - Controls.Add(txtCuit); Controls.Add(label5); Controls.Add(label4); Controls.Add(label3); @@ -165,6 +167,7 @@ namespace Vista Controls.Add(label1); Name = "FrmCliente"; Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)numCuit).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -177,13 +180,13 @@ namespace Vista private Label label3; private Label label4; private Label label5; - private TextBox txtCuit; private TextBox txtNombre; private TextBox txtApellido; private TextBox txtDireccion; private TextBox txtCorreo; private Button BtnAceptar; private Button BtnCancelar; + private NumericUpDown numCuit; public EventHandler button1_Click_1 { get; private set; } } diff --git a/Vista/FrmCliente.cs b/Vista/FrmCliente.cs index 8a940e1..7506c11 100644 --- a/Vista/FrmCliente.cs +++ b/Vista/FrmCliente.cs @@ -28,7 +28,8 @@ namespace Vista txtApellido.Text = cliente.Apellido; txtDireccion.Text = cliente.Direccion; txtCorreo.Text = cliente.Correo; - txtCuit.ReadOnly = true; + numCuit.Value = cliente.Cuit; + numCuit.ReadOnly = true; } @@ -75,7 +76,7 @@ namespace Vista cliente = new Cliente { Nombre = txtNombre.Text, - Cuit = txtCuit.Text, + Cuit = long.Parse(numCuit.Value.ToString()), Direccion = txtDireccion.Text, Apellido = txtApellido.Text, Correo = txtCorreo.Text, @@ -90,7 +91,7 @@ namespace Vista cliente.Nombre = txtNombre.Text; cliente.Direccion = txtDireccion.Text; cliente.Correo = txtCorreo.Text; - cliente.Cuit = txtCuit.Text; + cliente.Cuit = long.Parse(numCuit.Text.ToString()); msg = ControladoraClientes.Instance.Modificar(cliente); } MessageBox.Show(msg, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); diff --git a/Vista/FrmClientes.Designer.cs b/Vista/FrmClientes.Designer.cs index 09b5921..4c62b3b 100644 --- a/Vista/FrmClientes.Designer.cs +++ b/Vista/FrmClientes.Designer.cs @@ -31,7 +31,7 @@ BtnModificar = new Button(); BtnEliminar = new Button(); groupBox1 = new GroupBox(); - button1 = new Button(); + BtnAceptar = new Button(); dataGridView1 = new DataGridView(); groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); @@ -59,7 +59,7 @@ // // groupBox1 // - groupBox1.Controls.Add(button1); + groupBox1.Controls.Add(BtnAceptar); groupBox1.Controls.Add(dataGridView1); groupBox1.Controls.Add(BtnEliminar); groupBox1.Controls.Add(BtnModificar); @@ -69,15 +69,15 @@ groupBox1.TabIndex = 3; groupBox1.TabStop = false; // - // button1 + // BtnAceptar // - button1.Location = new Point(6, 302); - button1.Name = "button1"; - button1.Size = new Size(75, 23); - button1.TabIndex = 4; - button1.Text = "Añadir"; - button1.UseVisualStyleBackColor = true; - button1.Click += button1_Click; + BtnAceptar.Location = new Point(6, 302); + BtnAceptar.Name = "BtnAceptar"; + BtnAceptar.Size = new Size(75, 23); + BtnAceptar.TabIndex = 4; + BtnAceptar.Text = "Añadir"; + BtnAceptar.UseVisualStyleBackColor = true; + BtnAceptar.Click += BtnAceptar_Click; // // dataGridView1 // @@ -112,6 +112,6 @@ private Button BtnEliminar; private GroupBox groupBox1; private DataGridView dataGridView1; - private Button button1; + private Button BtnAceptar; } } \ No newline at end of file diff --git a/Vista/FrmClientes.cs b/Vista/FrmClientes.cs index 0abf28c..0633a3a 100644 --- a/Vista/FrmClientes.cs +++ b/Vista/FrmClientes.cs @@ -18,7 +18,7 @@ namespace Vista dataGridView1.DataSource = ControladoraClientes.Instance.Listar(); } - private void button1_Click(object sender, EventArgs e) + private void BtnAceptar_Click(object sender, EventArgs e) { var form = new FrmCliente(); form.ShowDialog(); @@ -36,7 +36,7 @@ namespace Vista Cliente cliente = new Cliente() { Nombre = dataGridView1.SelectedRows[0].Cells["Nombre"].Value.ToString(), - Cuit = dataGridView1.SelectedRows[0].Cells["Cuit"].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(), @@ -57,9 +57,9 @@ namespace Vista foreach (DataGridViewRow Fila in dataGridView1.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); - ActualizarGrilla(); + string devolucion = ControladoraClientes.Instance.Eliminar(long.Parse(Fila.Cells["Cuit"].Value.ToString())); + MessageBox.Show(devolucion); + ActualizarGrilla(); } } } 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]