using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using HRLibrary;

namespace HRApplication
{
    /// <summary>
    /// MainWindow.xaml 的互動邏輯
    /// </summary>
    public partial class MainWindow : Window
    {
        //宣告myCompany資料欄位
        private Company myCompany = new Company();

        public MainWindow()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Employee emp = new Employee(txtID.Text, txtName.Text);
            myCompany.Employees.Add(emp);

            //列出所有員工資料
            listBox1.Items.Clear();
            foreach (var employee in myCompany.Employees)
            {
                listBox1.Items.Add("編號：" + employee.Id + ",姓名：" + employee.Name);
            }
        }
    }
}
