using compabetov2.database.modelos; using compabetov2.database; 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.Empleados { public partial class AgregarLogin1 : Form { personal ventanaPadre; int idEmpleado; public AgregarLogin1() { InitializeComponent(); InitializeComponent(); this.ventanaPadre = ventanaPadre; this.idEmpleado = idEmpleado; } private void AgregarLogin1_Load(object sender, EventArgs e) { } private void pictureBox2_Click(object sender, EventArgs e) { string contra = txtContra.Text; string contraConf = txtContraConf.Text; if (contra.Equals(contraConf)) { string tipo = cbTipo.Text; string nombre = txtNombre.Text; LoginModel loginModel = new LoginModel(nombre, contra, tipo, idEmpleado); if (service.verificarExistenciaLogin(loginModel)) { if (service.crearLogin(loginModel, idEmpleado)) { ventanaPadre.llenarPanel(); Close(); } } else { MessageBox.Show("El nombre de usuario ya existe", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Las cotraseña no coinciden", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void pictureBox1_Click(object sender, EventArgs e) { this.Close(); } } }