ventana personal completamente terminada
This commit is contained in:
+41
-5
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -15,12 +16,14 @@ namespace compabetov2
|
||||
public partial class EditarEmpleado : Form
|
||||
{
|
||||
private Empleado empleado;
|
||||
personal ventanaPadre;
|
||||
private personal ventanaPadre;
|
||||
private string imagePath;
|
||||
public EditarEmpleado(Empleado empleado, personal ventanaPadre)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.empleado = empleado;
|
||||
this.ventanaPadre = ventanaPadre;
|
||||
imagePath = Path.Combine(Application.StartupPath, "Resources", "usuarios", empleado.img);
|
||||
llenarCampos();
|
||||
}
|
||||
|
||||
@@ -38,6 +41,7 @@ namespace compabetov2
|
||||
dtFechaCon.Text = empleado.fecha_contratacion;
|
||||
dtFechaNac.Text = empleado.fecha_nac;
|
||||
cbEstado.Text = empleado.estado;
|
||||
lbImg.Text = $"Imagen: {Path.GetFileName(imagePath)}";
|
||||
}
|
||||
|
||||
private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
|
||||
@@ -47,6 +51,18 @@ namespace compabetov2
|
||||
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void btnCancelar_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void button1_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
Empleado empleadoNuevo = new Empleado(
|
||||
empleado.idempleado,
|
||||
@@ -61,18 +77,38 @@ namespace compabetov2
|
||||
txtNoInt.Text,
|
||||
txtReferencia.Text,
|
||||
dtFechaNac.Text,
|
||||
txtTelefono.Text);
|
||||
txtTelefono.Text,
|
||||
Path.GetFileName(imagePath));
|
||||
if (service.actualizarEmpleado(empleadoNuevo))
|
||||
{
|
||||
if (!empleado.img.Equals(empleadoNuevo.img))
|
||||
{
|
||||
string destinationFolder = Path.Combine(Application.StartupPath, "Resources", "usuarios");
|
||||
string destinationFile = Path.Combine(destinationFolder, Path.GetFileName(imagePath));
|
||||
File.Copy(imagePath, destinationFile, true);
|
||||
}
|
||||
ventanaPadre.llenarPanel();
|
||||
Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void btnCancelar_Click(object sender, EventArgs e)
|
||||
private void btnCancelar_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnImg_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog1 = new OpenFileDialog();
|
||||
|
||||
openFileDialog1.Filter = "Archivos de imagen (*.jpg, *.jpeg, *.png, *.bmp)|*.jpg;*.jpeg;*.png;*.bmp";
|
||||
openFileDialog1.Title = "Seleccionar imagen";
|
||||
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
imagePath = openFileDialog1.FileName;
|
||||
lbImg.Text = $"Imagen: {Path.GetFileName(imagePath)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user