//初始化员工信息 //功能-员工信息 public void Init(MySqlConnection Connection, Grid grid1) { var list = new List <员工_data>(); string str1 = "select * from staff_data;"; MySqlCommand cmd = new MySqlCommand(str1, Connection); MySqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { 员工_data data = new 员工_data(); data.Staffid = Convert.ToInt32(rdr[0].ToString()); data.Staffname = rdr[1].ToString(); data.Staffsex = rdr[2].ToString(); data.Staffhukou = rdr[3].ToString(); data.Staffzhengzhi = rdr[4].ToString(); data.Staffhealth = rdr[5].ToString(); data.Staffconstrace = rdr[6].ToString(); data.Staffpay = Convert.ToInt32(rdr[7]); list.Add(data); } grid1.DataContext = list; rdr.Close(); }
public void 员工信息_button1(Object sender, RoutedEventArgs e) { var list = new List <员工_data>(); 员工信息_grid1.DataContext = list; 员工_data data1 = new 员工_data(); data1.Init(Connection, 员工信息_grid1); }
public 功能(MySqlConnection connection, string user, string password) { Hightpowver = false; Password = password; Connection = connection; User = user; InitializeComponent(); 员工_data data1 = new 员工_data(); data1.Init(Connection, 员工信息_grid1); }
//删除员工 public void 人事变动_删除click(Object sender, RoutedEventArgs e) { if (Hightpowver == true) { 员工_data data = new 员工_data(); data.Delete_anemployee(Connection, 人事变动_删除textbox删除.Text); } else { MessageBox.Show("权限不足", "你的权限不足,请获得更高的权限", MessageBoxButton.OK); } }
//修改员工 public void 人事变动_修改click(Object sender, RoutedEventArgs e) { if (Hightpowver == true) { 员工_data data = new 员工_data(); data.Change_anemployee(Connection, Convert.ToInt32(人事变动_修改textboxid.Text), 人事变动_修改textbox姓名.Text, 人事变动_修改textbox性别.Text, 人事变动_修改textbox户口.Text, 人事变动_修改textbox政治面貌.Text, 人事变动_修改textbox健康.Text, 人事变动_修改textbox合同状况.Text, Convert.ToInt32(人事变动_修改textbox工资.Text)); } else { MessageBox.Show("权限不足", "你的权限不足,请获得更高的权限", MessageBoxButton.OK); } }