private void btSua_Click(object sender, EventArgs e) { QuanLyLuongEntities csdl = new QuanLyLuongEntities(); if (txttths.Text == "") { MessageBox.Show("Vui lòng chọn nhân viên muốn sửa!"); } else { var u = from b in csdl.LichSuChuyenBacs where b.MaNV == txtttma.Text select b; int idmax = u.Max(b => b.id); string gttim = idmax.ToString(); int VT = dataGridView1.CurrentCell.RowIndex; if (dataGridView1.Rows[VT].Cells[0].Value.ToString() != gttim) { MessageBox.Show("Đây không phải hệ số mới cập nhật của nhân viên!!"); } else { int CT = dataGridView1.CurrentCell.RowIndex; int idtim = int.Parse(dataGridView1.Rows[CT].Cells[0].Value.ToString()); SuaLichSuChuyenBac frmsua = new SuaLichSuChuyenBac(); delPassData del = new delPassData(frmsua.Laydulieu); laymasua lms = new laymasua(frmsua.Layma); del(this.txtttma); lms(this.txtid); frmsua.Show(); } } }