ventana personal completamente terminada
This commit is contained in:
@@ -5,7 +5,9 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
@@ -15,6 +17,7 @@ namespace compabetov2
|
||||
public partial class AgregarEmpleado : Form
|
||||
{
|
||||
private personal ventanaPersonal;
|
||||
private string imagenPath = "";
|
||||
public AgregarEmpleado(personal ventanaPersonal)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -60,5 +63,68 @@ namespace compabetov2
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void flowLayoutPanel2_Paint_1(object sender, PaintEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button1_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)
|
||||
{
|
||||
imagenPath = openFileDialog1.FileName;
|
||||
lbImg.Text = $"Imagen: {Path.GetFileName(imagenPath)}";
|
||||
string destinationFolder = Path.Combine(Application.StartupPath, "Resources", "usuarios");
|
||||
//string destinationFile = Path.Combine(destinationFolder, Path.GetFileName(sourceFile));
|
||||
//File.Copy(sourceFile, destinationFile, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void label1_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void btnAgregar_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
string nombre = txtNombre.Text;
|
||||
string apellidos = txtApellido.Text;
|
||||
string calle = txtCalle.Text;
|
||||
string fechaCon = dtFechaCon.Text;
|
||||
string estado = cbEstado.Text;
|
||||
string colonia = txtColonia.Text;
|
||||
string cp = txtCp.Text;
|
||||
string noExt = txtNoExt.Text;
|
||||
string noInt = txtNoInt.Text;
|
||||
string referencia = txtReferencia.Text;
|
||||
string fechaNac = dtFechaNac.Text;
|
||||
string telefono = txtTelefono.Text;
|
||||
|
||||
Empleado empleado = new Empleado(-1, nombre, apellidos, calle, fechaCon, estado, colonia
|
||||
, cp, noExt, noInt, referencia, fechaNac, telefono, Path.GetFileName(imagenPath));
|
||||
|
||||
if (service.insertarEmpleado(empleado))
|
||||
{
|
||||
if (!imagenPath.Equals("")) {
|
||||
string destinationFolder = Path.Combine(Application.StartupPath, "Resources", "usuarios");
|
||||
string destinationFile = Path.Combine(destinationFolder, Path.GetFileName(imagenPath));
|
||||
File.Copy(imagenPath, destinationFile, true);
|
||||
}
|
||||
|
||||
ventanaPersonal.llenarPanel();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user