private void simpleButton1_Click(object sender, EventArgs e) { dgvContent.Enabled = false; ResetAllTextboxes(); curClass = null; db.SaveChanges(); BoundDataSource(); dgvContent.Enabled = true; }
private void dgvContent_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.RowIndex >= dgvContent.RowCount) { return; } var classId = int.Parse(dgvContent.Rows[e.RowIndex].Cells[0].Value.ToString()); curClass = db.MucHocPhis.Where(mhp => mhp.Ma == classId).FirstOrDefault(); tbMhp.Text = curClass.SoHocPhi.ToString(); }
private void btnXoa_Click(object sender, EventArgs e) { if (curClass != null) { //db.LopHocs.Where(lh => lh.Ma == curClass.Ma).FirstOrDefault(); db.MucHocPhis.Remove(curClass); db.SaveChanges(); curClass = null; BoundDataSource(); } }
private void simpleButton2_Click(object sender, EventArgs e) { if (curClass == null) { MucHocPhi mhp = new MucHocPhi() { SoHocPhi = int.Parse(tbMhp.Text), }; db.MucHocPhis.Add(mhp); } else { curClass.SoHocPhi = int.Parse(tbMhp.Text); } db.SaveChanges(); BoundDataSource(); dgvContent.Enabled = true; }