private void btSua_Click(object sender, EventArgs e) { QuanLyLuongEntities db = new QuanLyLuongEntities(); string macv = dataGridView1.CurrentRow.Cells[1].Value.ToString(); if (suaten.Text != "" && suahs.Text != "") { _chucvu.MaChucVu = macv; _chucvu.TenChucVu = suaten.Text; _chucvu.HeSoCV = Convert.ToDouble(suahs.Text); if (_bizchucvu.BizTimKiem(_chucvu) == true) { MessageBox.Show("Sửa thành công"); } else { MessageBox.Show("Sửa thất bại"); } db.SaveChanges(); load(); } else { MessageBox.Show("Vui lòng chọn thông tin cần sửa!!"); } }
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(); } } }