Files
compabetoOG/AgregarEmpleado.cs
T

65 lines
1.8 KiB
C#

using compabetov2.database;
using compabetov2.database.modelos;
using System;
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 compabetov2
{
public partial class AgregarEmpleado : Form
{
private personal ventanaPersonal;
public AgregarEmpleado(personal ventanaPersonal)
{
InitializeComponent();
this.ventanaPersonal = ventanaPersonal;
}
private void label1_Click(object sender, EventArgs e)
{
}
private void flowLayoutPanel2_Paint(object sender, PaintEventArgs e)
{
}
private void btnAgregar_Click(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);
if (service.insertarEmpleado(empleado))
{
ventanaPersonal.llenarPanel();
MessageBox.Show($"Empleado {nombre} agreado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void AgregarEmpleado_Load(object sender, EventArgs e)
{
}
}
}