using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class EmployeeViewForm : Form
    {

        protected readonly ZkContext context;
        protected Employees employee;



        public EmployeeViewForm(ZkContext context)
        {

            this.context = context;
            InitializeComponent();
        }



        public void SetEmployee(Employees emp)
        {
            this.employee = emp;

            lbid.Text = employee.id;
            lbname.Text = employee.name;
            lbsername.Text = employee.sername;
  
        }



        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            var form = Program.ServiceProvider.GetRequiredService<EmployeeForm>();
            form.Employee = employee;

            if (form.ShowDialog() == DialogResult.OK)
            {
                SetEmployee(form.Employee);
            }
        }
    }
}
