public int ThemSVDK(eSVDangKi h) { if (h != null) { SinhVienDangKy v = new SinhVienDangKy(); db = new DKHPDataContext(); v.maSV = h.MaSV; v.maChiTietLopHP = h.MaCTLHP; db.SinhVienDangKies.InsertOnSubmit(v); db.SubmitChanges(); return(1); } return(0); }
private void button1_Click(object sender, EventArgs e) { if (txtTK.Text != "" && txtGK.Text != "" && txtCK.Text != "") { db = new DKHPDataContext(); SinhVienDangKy h = db.SinhVienDangKies.Where(p => p.maSV == Int32.Parse(txtMaSV.Text) && p.maLopHP == Int32.Parse(txtMLHP.Text)).FirstOrDefault(); h.ThuongKi = Int32.Parse(txtTK.Text); h.GiuaKi = Int32.Parse(txtGK.Text); h.CuoiKi = Int32.Parse(txtCK.Text); db.SubmitChanges(); cboLopHP_SelectedIndexChanged(cboLopHP, null); clearTextBox(); } else { MessageBox.Show("Chưa Nhập Dữ Liệu"); } }
private void btnDK_Click(object sender, EventArgs e) { DataGridViewRow dtr = dgrLopHocPhan.CurrentRow; if (dtr != null && !dtr.IsNewRow) { int hk = 0; int.TryParse(cboHocKy.Text.ToString(), out hk); db = new DKHPDataContext(); SinhVienDangKy g = new SinhVienDangKy(); g.maSV = Int32.Parse(textBox1.Text); g.maLopHP = Int32.Parse(dtr.Cells[0].Value.ToString()); db.SinhVienDangKies.InsertOnSubmit(g); db.SubmitChanges(); loadgridLHPDK(Int32.Parse(textBox1.Text)); cboHocKy_SelectedIndexChanged(cboHocKy, null); dgrMon_SelectionChanged(dgrMon, null); //loadGridMon(hk); } else { MessageBox.Show("Chưa Chọn Lớp"); } }