private void button1_Click(object sender, EventArgs e) { string tentk = textBox1.Text; string mk = textBox2.Text; string qh = textBox3.Text; string tennv = textBox4.Text; string dc = textBox5.Text; string dt = textBox6.Text; string email = textBox7.Text; string cv = textBox8.Text; string age = textBox9.Text; UpdateEMP update = new UpdateEMP(); if (textBox7.Text != emailtext) { emailchange = 1; } a = update.UpdateEmp2(tentk, mk, qh, tennv, dc, dt, email, cv, age, emailchange, tentkchange); switch (a == true) { case true: { cls.LoadData2DataGridView(dataGridView1, "select * from tblNhanVien"); emailchange = 0; tentkchange = 0; break; } } emailchange = 0; tentkchange = 0; }
private void button5_Click(object sender, EventArgs e) { UpdateEMP update = new UpdateEMP(); string ten = txtNHANVIEN.Text; string dc = txtDiaChi.Text; string dt = txtSoDienThoai.Text; string em = txtEmail.Text; string per = textPer.Text; string age = textAge.Text; if (txtNHANVIEN.Text == "") { update.UpdateEmp(ten, dc, dt, em, per, age); } else if (update.UpdateEmp(ten, dc, dt, em, per, age) == true) { cls.LoadData2DataGridView(dataGridView1, "select * from tblNhanVien where TAIKHOAN='" + Main.TenDN + "'"); MessageBox.Show("Sửa thành công"); } }