using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HRManagerSystem
{
    public partial class AddDepartForm : Form
    {
        public AddDepartForm()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            txt_name.Clear();//清空文本内容
        }
        DataDataContext ddt = new DataDataContext();
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            T_Department depart = new T_Department();
            depart.Depart_Name = txt_name.Text;
            ddt.T_Department.InsertOnSubmit(depart);
            ddt.SubmitChanges();
            var result = ddt.T_Department.Select(dd => dd);
            dataGridView1.DataSource = result;
        }
        /// <summary>
        /// 退出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
