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 ModificarContra : Form
    {
        private Empleado empleado;
        public ModificarContra(Empleado empleado)
        {
            InitializeComponent();
            this.empleado = empleado;
        }

        private void btnConfirmar_Click(object sender, EventArgs e)
        {
            string contra = txtContra.Text;
            string contraConfi = txtConfi.Text;
            if (contra.Equals(contraConfi))
            {
                if (service.modificarContra(empleado, contra))
                {
                    
                    Close();
                }
            }
            else
            {
                MessageBox.Show("Las contraseña no son iguales", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void btnCancelar_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            string contra = txtContra.Text;
            string contraConfi = txtConfi.Text;
            if (contra.Equals(contraConfi))
            {
                if (service.modificarContra(empleado, contra))
                {

                    Close();
                }
            }
            else
            {
                MessageBox.Show("Las contraseña no son iguales", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            this.Close();

        }
    }
}
