fix: arreglos en formCliente y eliminado un list obsoleto

This commit is contained in:
2024-04-26 20:46:21 +01:00
parent 675d86f38d
commit ae8dc07364
5 changed files with 71 additions and 69 deletions

View File

@@ -39,8 +39,8 @@ namespace Vista
txtApellido = new TextBox(); txtApellido = new TextBox();
txtDireccion = new TextBox(); txtDireccion = new TextBox();
txtCorreo = new TextBox(); txtCorreo = new TextBox();
button1 = new Button(); BtnAceptar = new Button();
button2 = new Button(); BtnCancelar = new Button();
SuspendLayout(); SuspendLayout();
// //
// label1 // label1
@@ -123,33 +123,36 @@ namespace Vista
txtCorreo.Size = new Size(174, 23); txtCorreo.Size = new Size(174, 23);
txtCorreo.TabIndex = 9; txtCorreo.TabIndex = 9;
// //
// button1 // BtnAceptar
// //
button1.Location = new Point(29, 190); BtnAceptar.Location = new Point(29, 190);
button1.Name = "button1"; BtnAceptar.Name = "BtnAceptar";
button1.Size = new Size(75, 23); BtnAceptar.Size = new Size(75, 23);
button1.TabIndex = 10; BtnAceptar.TabIndex = 10;
button1.Text = "Aceptar"; BtnAceptar.Text = "Aceptar";
button1.UseVisualStyleBackColor = true; BtnAceptar.UseVisualStyleBackColor = true;
button1.Click += button1_Click; BtnAceptar.Click += BtnAceptar_Click;
// //
// button2 // BtnCancelar
// //
button2.Location = new Point(158, 190); BtnCancelar.Location = new Point(158, 190);
button2.Name = "button2"; BtnCancelar.Name = "BtnCancelar";
button2.Size = new Size(75, 23); BtnCancelar.Size = new Size(75, 23);
button2.TabIndex = 11; BtnCancelar.TabIndex = 11;
button2.Text = "Cancelar"; BtnCancelar.Text = "Cancelar";
button2.UseVisualStyleBackColor = true; BtnCancelar.UseVisualStyleBackColor = true;
button2.Click += button2_Click; BtnCancelar.Click += BtnCancelar_Click;
// //
// FrmCliente // FrmCliente
// //
AcceptButton = BtnAceptar;
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
CancelButton = BtnCancelar;
ClientSize = new Size(420, 245); ClientSize = new Size(420, 245);
Controls.Add(button2); ControlBox = false;
Controls.Add(button1); Controls.Add(BtnCancelar);
Controls.Add(BtnAceptar);
Controls.Add(txtCorreo); Controls.Add(txtCorreo);
Controls.Add(txtDireccion); Controls.Add(txtDireccion);
Controls.Add(txtApellido); Controls.Add(txtApellido);
@@ -179,8 +182,8 @@ namespace Vista
private TextBox txtApellido; private TextBox txtApellido;
private TextBox txtDireccion; private TextBox txtDireccion;
private TextBox txtCorreo; private TextBox txtCorreo;
private Button button1; private Button BtnAceptar;
private Button button2; private Button BtnCancelar;
public EventHandler button1_Click_1 { get; private set; } public EventHandler button1_Click_1 { get; private set; }
} }

View File

@@ -1,13 +1,5 @@
using Entidades; using Entidades;
using System; using Controladora;
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 namespace Vista
{ {
@@ -17,12 +9,30 @@ namespace Vista
public FrmCliente(Cliente? cliente = null) public FrmCliente(Cliente? cliente = null)
{ {
InitializeComponent(); InitializeComponent();
this.cliente = cliente; if (cliente != null)
{
this.cliente = cliente;
this.Text = "Modificar Proveedor";
CargarDatos();
}
else
{
this.Text = "Agregar Proveedor";
this.Text = (cliente == null) ? }
"Agregar Cliente" :
"Modificar Cliente";
} }
private void CargarDatos()
{
txtNombre.Text = cliente.Nombre;
txtApellido.Text = cliente.Apellido;
txtDireccion.Text = cliente.Direccion;
txtCorreo.Text = cliente.Correo;
txtCuit.ReadOnly = true;
}
private bool ValidarDatos() private bool ValidarDatos()
{ {
string devolucion = ""; string devolucion = "";
@@ -50,12 +60,12 @@ namespace Vista
} }
} }
private void button2_Click(object sender, EventArgs e) private void BtnCancelar_Click(object sender, EventArgs e)
{ {
this.Close(); this.Close();
} }
private void button1_Click(object sender, EventArgs e) private void BtnAceptar_Click(object sender, EventArgs e)
{ {
string msg; string msg;
if (ValidarDatos()) if (ValidarDatos())
@@ -68,22 +78,22 @@ namespace Vista
Cuit = txtCuit.Text, Cuit = txtCuit.Text,
Direccion = txtDireccion.Text, Direccion = txtDireccion.Text,
Apellido = txtApellido.Text, Apellido = txtApellido.Text,
Correo = txtCorreo.Text, Correo = txtCorreo.Text,
}; };
// msg = ControladoraCliente.Instance.AgregarCliente(Cliente); msg = ControladoraClientes.Instance.Añadir(cliente);
} }
else else
{ {
//Cliente.Apellido = txtApellido.Text; cliente.Apellido = txtApellido.Text;
// 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 = txtCuit.Text;
// msg = ControladoraCliente.Instance.ModificarCliente(Cliente); msg = ControladoraClientes.Instance.Modificar(cliente);
} }
// MessageBox.Show(msg, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(msg, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
Close(); Close();
} }

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

@@ -1,13 +1,5 @@
using Entidades; using Entidades;
using System; using Controladora;
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 namespace Vista
{ {
@@ -17,13 +9,13 @@ namespace Vista
public FrmClientes() public FrmClientes()
{ {
InitializeComponent(); InitializeComponent();
ActualizarGrilla();
} }
private void ActualizarGrilla() private void ActualizarGrilla()
{ {
dataGridView1.DataSource = null; dataGridView1.DataSource = null;
// dataGridView1.DataSource = listaProveedores; dataGridView1.DataSource = ControladoraClientes.Instance.Listar();
//revisar dataGridView1.DataSource = ControladoraClientes.Instance.RecuperarProveedores();
} }
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
@@ -45,7 +37,7 @@ namespace Vista
{ {
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 = dataGridView1.SelectedRows[0].Cells["Cuit"].Value.ToString(),
Apellido = dataGridView1.SelectedRows[0].Cells["RazonSocial"].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(),
}; };
@@ -65,9 +57,9 @@ namespace Vista
foreach (DataGridViewRow Fila in dataGridView1.SelectedRows) foreach (DataGridViewRow Fila in dataGridView1.SelectedRows)
{ // itera por un loop y elimina las lineas seleccionadas 1 a la vez. { // itera por un loop y elimina las lineas seleccionadas 1 a la vez.
//string devolucion = ControladoraClientes.Instance.EliminarCliente(Fila.Cells["Codigo"].Value.ToString()); string devolucion = ControladoraClientes.Instance.Eliminar(long.Parse(Fila.Cells["Cuit"].Value.ToString()));
// MessageBox.Show(devolucion); MessageBox.Show(devolucion);
ActualizarGrilla(); ActualizarGrilla();
} }
} }
} }

View File

@@ -6,8 +6,6 @@ namespace Vista
public partial class FrmProveedor : Form public partial class FrmProveedor : Form
{ {
Proveedor proveedor; Proveedor proveedor;
List<Proveedor> listaProveedores = new List<Proveedor>();
public FrmProveedor(Proveedor? proveedor = null) public FrmProveedor(Proveedor? proveedor = null)
{ {
@@ -17,7 +15,7 @@ namespace Vista
{ {
this.proveedor = proveedor; this.proveedor = proveedor;
this.Text = "Modificar Proveedor"; this.Text = "Modificar Proveedor";
CargarDatos(proveedor); CargarDatos();
} }
else else
{ {
@@ -27,7 +25,7 @@ namespace Vista
} }
private void CargarDatos(Proveedor proveedor) private void CargarDatos()
{ {
txtDireccion.Text = proveedor.Direccion; txtDireccion.Text = proveedor.Direccion;
txtNombre.Text = proveedor.Nombre; txtNombre.Text = proveedor.Nombre;
@@ -78,7 +76,6 @@ namespace Vista
RazonSocial = txtSocial.Text, RazonSocial = txtSocial.Text,
Habilitado = checkBoxHabilitado.Checked, Habilitado = checkBoxHabilitado.Checked,
}; };
listaProveedores.Add(proveedor);
msg = ControladoraProveedores.Instance.Añadir(proveedor); msg = ControladoraProveedores.Instance.Añadir(proveedor);
} }
else else