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 Entidades/obj
Controladora/bin Controladora/bin
Controladora/obj Controladora/obj
.vs

View File

@@ -17,7 +17,7 @@ namespace Controladora
public string Eliminar(long t) 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"; if (cl == null) return "El Cliente es nulo fallo la carga";
@@ -26,13 +26,13 @@ namespace Controladora
$"Fallo la Eliminacion del Cliente {t}"; $"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)) ? return (RepositorioClientes.Instance.Mod(t)) ?
$"El Cliente {cl.Nombre} se Modifico correctamente": $"El Cliente {t.Nombre} se Modifico correctamente":
$"Fallo la Modificacion del Cliente {cl.Nombre}"; $"Fallo la Modificacion del Cliente {t.Nombre}";
} }
public ReadOnlyCollection<Cliente> Listar() public ReadOnlyCollection<Cliente> Listar()

View File

@@ -1,12 +1,17 @@
 
using System.ComponentModel;
namespace Entidades namespace Entidades
{ {
public class Cliente public class Cliente
{ {
public string Cuit { get; set; } public Int64 Cuit { get; set; }
public string Nombre { get; set; } public string Nombre { get; set; }
public string Apellido { get; set; } public string Apellido { get; set; }
public string Direccion { get; set; } public string Direccion { get; set; }
public string Correo { get; set; } public string Correo { get; set; }
[Browsable(false)]
public bool Habilitado { get; set; }
} }
} }

View File

@@ -27,10 +27,10 @@ namespace Modelo
try try
{ {
var categoriaAModificar = almacen.Find(x => x.Id == t.Id); var categoriaAModificar = almacen.FindIndex(x => x.Id == t.Id);
if (categoriaAModificar != null) if (categoriaAModificar > -1)
{ {
categoriaAModificar = t; almacen[categoriaAModificar] = t;
ret = true; ret = true;
} }
} }

View File

@@ -28,10 +28,10 @@ namespace Modelo
try try
{ {
var clienteAModificar = almacen.Find(x => x.Cuit == t.Cuit); var clienteAModificar = almacen.FindIndex(x => x.Cuit == t.Cuit);
if (clienteAModificar != null) if (clienteAModificar > -1)
{ {
clienteAModificar = t; almacen[clienteAModificar] = t;
ret = true; ret = true;
} }
} }

View File

@@ -28,10 +28,10 @@ namespace Modelo
try try
{ {
var facturaAModificar = almacen.Find(x => x.Id == t.Id); var facturaAModificar = almacen.FindIndex(x => x.Id == t.Id);
if (facturaAModificar != null) if (facturaAModificar > -1)
{ {
facturaAModificar = t; almacen[facturaAModificar] = t;
ret = true; ret = true;
} }
} }

View File

@@ -27,10 +27,10 @@ namespace Modelo
try try
{ {
var loteAModificar = almacen.Find(x => x.Id == t.Id); var loteAModificar = almacen.FindIndex(x => x.Id == t.Id);
if (loteAModificar != null) if (loteAModificar > -1)
{ {
loteAModificar = t; almacen[loteAModificar] = t;
ret = true; ret = true;
} }
} }

View File

@@ -28,10 +28,10 @@ namespace Modelo
try try
{ {
var ordenAModificar = almacen.Find(x => x.Id == t.Id); var ordenAModificar = almacen.FindIndex(x => x.Id == t.Id);
if (ordenAModificar != null) if (ordenAModificar > -1)
{ {
ordenAModificar = t; almacen[ordenAModificar] = t;
ret = true; ret = true;
} }
} }

View File

@@ -28,10 +28,10 @@ namespace Modelo
try try
{ {
var pedidoAModificar = almacen.Find(x => x.Id == t.Id); var pedidoAModificar = almacen.FindIndex(x => x.Id == t.Id);
if (pedidoAModificar != null) if (pedidoAModificar > -1)
{ {
pedidoAModificar = t; almacen[pedidoAModificar] = t;
ret = true; ret = true;
} }
} }

View File

@@ -28,11 +28,11 @@ namespace Modelo
try try
{ {
var presupuestoAModificar = almacen.Find(x => x.Id == t.Id); var presupuestoAModificar = almacen.FindIndex(x => x.Id == t.Id);
if (presupuestoAModificar != null) if (presupuestoAModificar > -1)
{ {
presupuestoAModificar = t; almacen[presupuestoAModificar] = t;
ret = true; ret = true;
} }
} }

View File

@@ -27,8 +27,8 @@ namespace Modelo
try try
{ {
var AModificar = almacen.Find(x => x.Id == t.Id); var AModificar = almacen.FindIndex(x => x.Id == t.Id);
AModificar = t; almacen[AModificar] = t;
ret = true; ret = true;
} }
catch (Exception) catch (Exception)

View File

@@ -27,10 +27,10 @@ namespace Modelo
try try
{ {
var proveedorAModificar = almacen.Find(x => x.Cuit == t.Cuit); var proveedorAModificar = almacen.FindIndex(x => x.Cuit == t.Cuit);
if (proveedorAModificar != null) if (proveedorAModificar > -1)
{ {
proveedorAModificar = t; almacen[proveedorAModificar] = t;
ret = true; ret = true;
} }
} }

View File

@@ -29,11 +29,11 @@ namespace Modelo
try try
{ {
var remitoAModificar = almacen.Find(x => x.Id == t.Id); var remitoAModificar = almacen.FindIndex(x => x.Id == t.Id);
if (remitoAModificar != null) if (remitoAModificar > -1)
{ {
remitoAModificar = t; almacen[remitoAModificar] = t;
ret = true; ret = true;
ret = true; ret = true;

View File

@@ -34,13 +34,14 @@ namespace Vista
label3 = new Label(); label3 = new Label();
label4 = new Label(); label4 = new Label();
label5 = new Label(); label5 = new Label();
txtCuit = new TextBox();
txtNombre = new TextBox(); txtNombre = new TextBox();
txtApellido = new TextBox(); txtApellido = new TextBox();
txtDireccion = new TextBox(); txtDireccion = new TextBox();
txtCorreo = new TextBox(); txtCorreo = new TextBox();
BtnAceptar = new Button(); BtnAceptar = new Button();
BtnCancelar = new Button(); BtnCancelar = new Button();
numCuit = new NumericUpDown();
((System.ComponentModel.ISupportInitialize)numCuit).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// label1 // label1
@@ -88,13 +89,6 @@ namespace Vista
label5.TabIndex = 4; label5.TabIndex = 4;
label5.Text = "Correo"; label5.Text = "Correo";
// //
// txtCuit
//
txtCuit.Location = new Point(92, 21);
txtCuit.Name = "txtCuit";
txtCuit.Size = new Size(173, 23);
txtCuit.TabIndex = 5;
//
// txtNombre // txtNombre
// //
txtNombre.Location = new Point(92, 51); txtNombre.Location = new Point(92, 51);
@@ -143,6 +137,14 @@ namespace Vista
BtnCancelar.UseVisualStyleBackColor = true; BtnCancelar.UseVisualStyleBackColor = true;
BtnCancelar.Click += BtnCancelar_Click; 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 // FrmCliente
// //
AcceptButton = BtnAceptar; AcceptButton = BtnAceptar;
@@ -151,13 +153,13 @@ namespace Vista
CancelButton = BtnCancelar; CancelButton = BtnCancelar;
ClientSize = new Size(420, 245); ClientSize = new Size(420, 245);
ControlBox = false; ControlBox = false;
Controls.Add(numCuit);
Controls.Add(BtnCancelar); Controls.Add(BtnCancelar);
Controls.Add(BtnAceptar); Controls.Add(BtnAceptar);
Controls.Add(txtCorreo); Controls.Add(txtCorreo);
Controls.Add(txtDireccion); Controls.Add(txtDireccion);
Controls.Add(txtApellido); Controls.Add(txtApellido);
Controls.Add(txtNombre); Controls.Add(txtNombre);
Controls.Add(txtCuit);
Controls.Add(label5); Controls.Add(label5);
Controls.Add(label4); Controls.Add(label4);
Controls.Add(label3); Controls.Add(label3);
@@ -165,6 +167,7 @@ namespace Vista
Controls.Add(label1); Controls.Add(label1);
Name = "FrmCliente"; Name = "FrmCliente";
Text = "Form1"; Text = "Form1";
((System.ComponentModel.ISupportInitialize)numCuit).EndInit();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
@@ -177,13 +180,13 @@ namespace Vista
private Label label3; private Label label3;
private Label label4; private Label label4;
private Label label5; private Label label5;
private TextBox txtCuit;
private TextBox txtNombre; private TextBox txtNombre;
private TextBox txtApellido; private TextBox txtApellido;
private TextBox txtDireccion; private TextBox txtDireccion;
private TextBox txtCorreo; private TextBox txtCorreo;
private Button BtnAceptar; private Button BtnAceptar;
private Button BtnCancelar; private Button BtnCancelar;
private NumericUpDown numCuit;
public EventHandler button1_Click_1 { get; private set; } public EventHandler button1_Click_1 { get; private set; }
} }

View File

@@ -28,7 +28,8 @@ namespace Vista
txtApellido.Text = cliente.Apellido; txtApellido.Text = cliente.Apellido;
txtDireccion.Text = cliente.Direccion; txtDireccion.Text = cliente.Direccion;
txtCorreo.Text = cliente.Correo; txtCorreo.Text = cliente.Correo;
txtCuit.ReadOnly = true; numCuit.Value = cliente.Cuit;
numCuit.ReadOnly = true;
} }
@@ -75,7 +76,7 @@ namespace Vista
cliente = new Cliente cliente = new Cliente
{ {
Nombre = txtNombre.Text, Nombre = txtNombre.Text,
Cuit = txtCuit.Text, Cuit = long.Parse(numCuit.Value.ToString()),
Direccion = txtDireccion.Text, Direccion = txtDireccion.Text,
Apellido = txtApellido.Text, Apellido = txtApellido.Text,
Correo = txtCorreo.Text, Correo = txtCorreo.Text,
@@ -90,7 +91,7 @@ namespace Vista
cliente.Nombre = txtNombre.Text; cliente.Nombre = txtNombre.Text;
cliente.Direccion = txtDireccion.Text; cliente.Direccion = txtDireccion.Text;
cliente.Correo = txtCorreo.Text; cliente.Correo = txtCorreo.Text;
cliente.Cuit = txtCuit.Text; cliente.Cuit = long.Parse(numCuit.Text.ToString());
msg = ControladoraClientes.Instance.Modificar(cliente); msg = ControladoraClientes.Instance.Modificar(cliente);
} }
MessageBox.Show(msg, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(msg, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);

View File

@@ -31,7 +31,7 @@
BtnModificar = new Button(); BtnModificar = new Button();
BtnEliminar = new Button(); BtnEliminar = new Button();
groupBox1 = new GroupBox(); groupBox1 = new GroupBox();
button1 = new Button(); BtnAceptar = new Button();
dataGridView1 = new DataGridView(); dataGridView1 = new DataGridView();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
@@ -59,7 +59,7 @@
// //
// groupBox1 // groupBox1
// //
groupBox1.Controls.Add(button1); groupBox1.Controls.Add(BtnAceptar);
groupBox1.Controls.Add(dataGridView1); groupBox1.Controls.Add(dataGridView1);
groupBox1.Controls.Add(BtnEliminar); groupBox1.Controls.Add(BtnEliminar);
groupBox1.Controls.Add(BtnModificar); groupBox1.Controls.Add(BtnModificar);
@@ -69,15 +69,15 @@
groupBox1.TabIndex = 3; groupBox1.TabIndex = 3;
groupBox1.TabStop = false; groupBox1.TabStop = false;
// //
// button1 // BtnAceptar
// //
button1.Location = new Point(6, 302); BtnAceptar.Location = new Point(6, 302);
button1.Name = "button1"; BtnAceptar.Name = "BtnAceptar";
button1.Size = new Size(75, 23); BtnAceptar.Size = new Size(75, 23);
button1.TabIndex = 4; BtnAceptar.TabIndex = 4;
button1.Text = "Añadir"; BtnAceptar.Text = "Añadir";
button1.UseVisualStyleBackColor = true; BtnAceptar.UseVisualStyleBackColor = true;
button1.Click += button1_Click; BtnAceptar.Click += BtnAceptar_Click;
// //
// dataGridView1 // dataGridView1
// //
@@ -112,6 +112,6 @@
private Button BtnEliminar; private Button BtnEliminar;
private GroupBox groupBox1; private GroupBox groupBox1;
private DataGridView dataGridView1; private DataGridView dataGridView1;
private Button button1; private Button BtnAceptar;
} }
} }

View File

@@ -18,7 +18,7 @@ namespace Vista
dataGridView1.DataSource = ControladoraClientes.Instance.Listar(); 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(); var form = new FrmCliente();
form.ShowDialog(); form.ShowDialog();
@@ -36,7 +36,7 @@ namespace Vista
Cliente cliente = new Cliente() Cliente cliente = new Cliente()
{ {
Nombre = dataGridView1.SelectedRows[0].Cells["Nombre"].Value.ToString(), 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(), Apellido = dataGridView1.SelectedRows[0].Cells["Apellido"].Value.ToString(),
Direccion = dataGridView1.SelectedRows[0].Cells["Direccion"].Value.ToString(), Direccion = dataGridView1.SelectedRows[0].Cells["Direccion"].Value.ToString(),
Correo = dataGridView1.SelectedRows[0].Cells["Correo"].Value.ToString(), Correo = dataGridView1.SelectedRows[0].Cells["Correo"].Value.ToString(),

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>