ahi va todo fixeado por ahora faltan forms

This commit is contained in:
2024-08-11 18:22:54 -03:00
parent 1877f7705c
commit 08cb7d769f
25 changed files with 77 additions and 67 deletions

1
.gitignore vendored
View File

@@ -13,3 +13,4 @@ Entidades/bin
Entidades/obj
Controladora/bin
Controladora/obj
.vs

View File

@@ -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<Cliente> Listar()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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();
}
}
}

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>