Một cách giản lược, đây là khái niệm và là một nỗ lực nhằm giảm nhẹ các thao tác viết mã cho người lập trình, cho phép họ tạo ra các ứng dụng mà các yếu tố bên ngoài có thể tương tác với
T ng quan h thôấng ổ ệ
H thôấng t ng quát ệ ổ
Đ xầy d ng m t h thôấng thông tin hoàn ch nh chúng ta cầần tr i qua 6 giai ể ự ộ ệ ỉ ả đo n: ạ
Giai đoạn khảo sát là một trong sáu giai đoạn rất quan trọng trong quá trình học tập Trong quá trình học, sinh viên thường gặp nhiều khó khăn trong việc quản lý và theo dõi tiến độ công việc của mình Thay vì sử dụng các công cụ như Excel để tính toán và theo dõi, sinh viên chưa thực sự nắm vững cách sử dụng để đảm bảo quá trình học diễn ra hiệu quả Điều này khiến cho việc ghi lại và đánh giá tiến trình học tập gặp nhiều khó khăn, ảnh hưởng đến thành tích cuối kỳ và kết quả học tập của sinh viên Do đó, việc khảo sát và quản lý tiến trình học tập một cách hiệu quả là vô cùng cần thiết để nâng cao thành tích và đảm bảo quá trình học tập diễn ra suôn sẻ hơn.
Nhóm chúng tôi cần đảm bảo yêu cầu cao về cơ cấu và nội dung của bài viết Chúng tôi phải khắc phục các khó khăn và hạn chế trong quá trình quản lý đi mở sinh viên, nhằm hỗ trợ tối đa cho quá trình quản lý, giúp hạn chế sai sót và đảm bảo thu đúng tiến độ Việc này nhằm nâng cao hiệu quả quản lý và tránh các rủi ro trong quá trình xử lý dữ liệu của sinh viên.
Nhi m v h thôấng ệ ụ ệ
Theo dõi toàn bộ quá trình học tập và quá trình nhập học của sinh viên trong suốt thời gian học tại trường là rất quan trọng để đảm bảo không xảy ra sai sót trong quá trình nhập điểm và in điểm Hệ thống này giúp phòng đào tạo dễ dàng theo dõi, đánh giá kết quả học tập của sinh viên một cách nhanh chóng và chính xác Như vậy, nó sẽ giảm đáng kể công sức, thời gian và giấy tờ lưu trữ, nâng cao hiệu quả trong công tác quản lý dữ liệu sinh viên.
Ngoài vi c c p nh t đi m c a t ng sinh viên, h thôấng cũng có th tra c u ệ ậ ậ ể ủ ừ ệ ể ứ m t sôấ thông tin cầần thiêất vêầ sinh viên nh ngày sinh, quê quán, chôỗ hi n t i… ộ ư ở ệ ạ
Hệ thống lưu trữ và xử lý kết quả học tập của sinh viên theo quy chế của nhà trường giúp kiểm soát thống kê việc xếp loại, xét học bổng, xét lưu ban, thi lại một cách nhanh chóng và chính xác Công tác quản lý hồ sơ kết quả học tập góp phần nâng cao hiệu quả rèn luyện của sinh viên khi đại học.
Ch c năng h thôấng ứ ệ
H thôấng qu n lý đi m sinh viên bao gôầm 3 b ph n, ho t đ ng có môấi liên ệ ả ể ộ ậ ạ ộ h ch t cheỗ nhau ệ ặ
Phần quản lý sinh viên chịu trách nhiệm xử lý tất cả các công việc liên quan đến hồ sơ sinh viên trong suốt quá trình học tập, đảm bảo cập nhật thông tin khi có khóa mới nhập học Phần này tiến hành cập nhật danh sách sinh viên theo khóa, ngành học, và thực hiện các chức năng như chuyển lớp, tách lớp, đăng học, và thôi học Ngoài ra, phần quản lý sinh viên còn hỗ trợ tra cứu hồ sơ của sinh viên đã tốt nghiệp hoặc rút vào hệ thống máy tính Phần này được sử dụng trên máy tính cài đặt phần mềm Hệ thống Quản lý Sinh viên (HSSV), giúp dễ dàng cập nhật, thêm, xóa và chỉnh sửa thông tin của sinh viên một cách nhanh chóng và chính xác.
Chức năng cập nhật điểm môn học là quá trình điều chỉnh điểm của sinh viên sau các kỳ thi và học kỳ nhằm phản ánh chính xác kết quả học tập Hệ thống tự động cập nhật điểm trung bình học kỳ, học năm và tổng điểm của từng sinh viên dựa trên các dữ liệu nhập từ phòng đào tạo, đảm bảo theo đúng quy định Tổng hợp dữ liệu này giúp tạo các báo cáo danh sách sinh viên thi, thi lại, thôi học, hoặc tốt nghiệp, phù hợp với quy chuẩn quản lý của nhà trường Thư viện này còn cho phép truyền dữ liệu kết quả đến cán bộ quản lý và sinh viên, nhằm hỗ trợ công tác theo dõi kết quả học tập dễ dàng Ngoài ra, phần mềm có khả năng cài đặt và in các phiếu điểm, in dữ liệu tổng hợp để phục vụ việc tổng lập và báo cáo toàn diện cho các kỳ học và toàn khóa học.
Các bi u mầẫu s d ng trong h thôấng ể ử ụ ệ
Danh sách sinh viên t ng l p: ừ ớ
Tr ườ ng đ i h c đi n l c ạ ọ ệ ự Khoa:…
STT Mã SV H và Tên ọ Ngày sinh
Tr ườ ng đ i h c đi n l c ạ ọ ệ ự Khoa:
Bộ môn Đvhp Ngành đào t o ạ
B quôấc phòng ộ C NG HÒA XÃ H I CH NGHĨA VI T NAM Ộ Ộ Ủ Ệ
Tr ườ ng đ i h c đi n l c ạ ọ ệ ự Đ c l p-T do- H nh phúc ộ ậ ự ạ
Gi i tính: ớ Chuyên ngành: Quê quán: H đào t o: ệ ạ
STT Mã môn h c ọ Tên môn h c ọ Sôấ ĐVHP Đi m t ng ể ổ kêất
Mô hình tiếấn trình nghi p v ệ ụ
Các kí hi u s d ng trong mô hình ệ ử ụ
Dùng kí hi u hình ch nh t đ mô t ch c năng c a h thôấng, tên c a ch c ệ ữ ậ ể ả ứ ủ ệ ủ ứ năng ghi bên trong Ví d nh : b ph n qu n lý đi m, b ph n qu n lý sinh ụ ư ộ ậ ả ể ộ ậ ả viên
Dùng mũi tên ch h ỉ ướ ng c a luôầng d li u ghi trên mũi tên ủ ữ ệ
Dùng kí hi u hình elip đ miêu t tác nhần bên ngoài c a h thôấng, tên tác ệ ể ả ủ ệ nhần ghi bên trong
STT MSSV H và tên ọ L p ớ ĐTBC Ghi chú
CH ƯƠ NG 3: CÁC CH C NĂNG CHÍNH C A PHẦỀN MỀỀM QU N LÝ ĐI M SINH Ứ Ủ Ả Ể VIỀN
1 Qu n lý ng ả ườ i dùng
Trong mọi hệ thống quản lý, việc phân chia vai trò sử dụng và quản lý là yếu tố thiết yếu để đảm bảo hoạt động hiệu quả Hệ thống quản lý thường được phân chia thành các quyền chính như Admin và Member, nhằm xác định rõ ràng trách nhiệm và quyền hạn của từng người dùng Điều này giúp hệ thống hoạt động ổn định, an toàn và dễ dàng kiểm soát hơn, đồng thời nâng cao trải nghiệm của người dùng.
Quyền truy cập dữ liệu của admin cho phép quản trị hệ thống xem và chỉnh sửa thông tin khi cần thiết, đảm bảo quản lý dữ liệu hiệu quả Thành viên có quyền truy cập và xem thông tin hiển thị trên hệ thống mà không thể chỉnh sửa dữ liệu, bảo vệ tính toàn vẹn của dữ liệu Mẫu đăng nhập được thiết kế để bảo vệ dữ liệu người dùng, giúp tăng cường bảo mật và giảm thiểu các trường hợp lỗi do người dùng nhập sai dữ liệu ban đầu Việc kiểm soát quyền truy cập đúng cách giúp hạn chế các rủi ro về an ninh hệ thống và duy trì tính chính xác của dữ liệu.
Vẽẫ s đôầ ERD h thôấng ơ ệ
Form nh p thông tin sinh viên ch s d ng b ng d li u sinh viên ậ ỉ ử ụ ả ữ ệ
Ch c năng c a giao diên: c p nh t thông tin cầần thiêất c a m t sinh viên khi ứ ủ ậ ậ ủ ộ m i vào tr ớ ườ ng, trong giao di n có các nút l nh ệ ệ
Thêm: thêm m t b ng ghi m i, trong đó có đầầy đ thông tin sinh viên ộ ả ớ ủ
S a: khi có s sai sót trong quá trình điêần thông tin nút l nh này cho ử ự ệ phép ng ườ i nh p có th s a bầất kỳ m t thông tin nào ậ ể ử ộ
Xóa: xóa toàn b b ng ghi đã ch n ộ ả ọ
Thoát: thoát kh i form nh p thông tin ỏ ậ
Qu n lý thông tin sinh viến ả
Form nh p thông tin sinh viên ch s d ng b ng d li u sinh viên ậ ỉ ử ụ ả ữ ệ
Ch c năng c a giao diên: c p nh t thông tin cầần thiêất c a m t sinh viên khi ứ ủ ậ ậ ủ ộ m i vào tr ớ ườ ng, trong giao di n có các nút l nh ệ ệ
Thêm: thêm m t b ng ghi m i, trong đó có đầầy đ thông tin sinh viên ộ ả ớ ủ
S a: khi có s sai sót trong quá trình điêần thông tin nút l nh này cho ử ự ệ phép ng ườ i nh p có th s a bầất kỳ m t thông tin nào ậ ể ử ộ
Xóa: xóa toàn b b ng ghi đã ch n ộ ả ọ
Thoát: thoát kh i form nh p thông tin ỏ ậ
Qu n lý đi m sinh viến ả ể
Trong các bảng dữ liệu liên quan đến sinh viên, bao gồm bảng DM khoa, bảng DM lớp, bảng DM môn học và bảng sinh viên, các trường dữ liệu được xác định rõ ràng để đảm bảo tính chuẩn xác Bảng DM khoa chứa mã khoa, bảng DM lớp lưu mã lớp, còn bảng DM môn học ghi tên môn học Trong bảng sinh viên, các trường bao gồm mã sinh viên và tên sinh viên, giúp quản lý thông tin sinh viên một cách đầy đủ và chính xác.
Ch c năng c a giao diên: C p nh t đi m c a t ng môn h c trong suôất quá ứ ủ ậ ậ ể ủ ừ ọ trình h c c a m t sinh viên Trong form có cac nút l nh: ọ ủ ộ ệ
Thêm: thêm đi m c a m t môn h c cho sinh viên c a 1 l p nào đó ể ủ ộ ọ ủ ớ
Xóa: xóa b ng ghi đi m c a môn h c có mã môn đ ả ể ủ ọ ượ c ch n ọ
Thoát: thoát kh i form c p nh t b ng đi m cá nhần ỏ ậ ậ ả ể Đi m trung bình đ ể ượ c tính theo công th c : (đi m lầần 1+ (đi m lầần 2 *2))/3 ứ ể ể
H nh ki m seỗ do b ph n qu n lí đánh giá và xêấp lo i d a vào các tiêu chí đánh ạ ể ộ ậ ả ạ ự giá riêng c a BCH đoàn m t h thôấng khác ủ ở ộ ệ
Báo cáo danh sách sinh viến
Báo cáo danh sách sinh viên c a t ng l p Trong báo cáo các b ng sinh viên, ủ ừ ớ ả
DM l p C th là nh ng thu c tính Hoten_SV, Ngaysinh, Diachi… ớ ụ ể ữ ộ
B ng đi m sinh viến ả ể
Báo cáo c th đi m c a sinh viên qua t ng môn h c Trong báo cáo các b ng ụ ể ể ủ ừ ọ ả
Kêất Q a, Môn H c, Sinh Viên C th gôầm có các thu c tính MaLop, MaMon, ủ ọ ụ ể ộ
CH ƯƠ NG 4: S ĐỐỀ QUAN H VÀ CÁC L P GI I QUYỀỐT CH C NĂNG Ơ Ệ Ớ Ả Ứ
Các l p gi i quyếất ch c năng ớ ả ứ
L p qu n lý gi ng viến ớ ả ả
namespace Qu n_lý_đi m_sinh_vien_CNTTả ể
{ public partial class frmGiangVien : Form
{ private CommonConnect cc = new CommonConnect();
SqlConnection conn = null; public frmGiangVien()
} private void frmGiangVien_Load(object sender, EventArgs e)
{ conn = cc.Connected(); if (conn.State == ConnectionState.Open) ; string sql = "select * from [Quanlydiem].[dbo].[tblGIANG_VIEN]";
SqlCommand commandsql = new SqlCommand(sql, conn);
SqlDataAdapter com = new SqlDataAdapter(commandsql);
DataTable table = new DataTable(); com.Fill(table); dgrDSGV.DataSource = table;
// Ch c năng nh p ứ ậ private void button1_Click(object sender, EventArgs e)
//Kiem tra trung ten MaSV string select2 = "Select * From tblGIANG_VIEN where MaGV='" + txtMaGV.Text + "'";
SqlCommand cmd2 = new SqlCommand(select2, conn);
SqlDataReader reader2; errorProvider1.Clear(); if (txtMaGV.Text == "")
{ errorProvider1.SetError(txtMaGV, "Mã gi ng viên không đ tr ng!"ả ể ố ); } else if (reader2.Read())
MessageBox.Show("B n đã nh p trùng mã gi ng viên"ạ ậ ả , "Thông báo !",
MessageBoxButtons.OK, MessageBoxIcon.Warning); txtMaGV.Focus(); cmd2.Dispose(); reader2.Dispose();
// Tr tài nguyênả cmd2.Dispose(); reader2.Dispose();
// Th c hi n truy v nự ệ ấ string insert = "Insert Into tblGIANG_VIEN(MaGV,TenGV,Gioitinh,Phone,Email,PhanloaiGV)" +"Values('" + txtMaGV.Text + "',N'" + txtHoTen.Text + "',N'" + cboGioiTinh.Text + "','" + mskPhone.Text + "','" + txtEmail.Text + "',N'" + cboPhanloai.Text + "')";
SqlCommand cmd = new SqlCommand(insert, conn); cmd.ExecuteNonQuery();
MessageBox.Show("Thêm m i thành công"ớ , "Thông báo!");
// Tr tài nguyênả cmd.Dispose();
// Tr tài nguyênả cmd2.Dispose(); reader2.Dispose();
} private void txtHoTen_TextChanged(object sender, EventArgs e)
} private void pictureBox1_Click(object sender, EventArgs e)
SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = cmd;
// Fill d li u t adapter vào DataSetữ ệ ừ adapter.Fill(ds, "SINHVIEN");
// Đ a ra DataGridViewư dgrDSGV.DataSource = ds; dgrDSGV.DataMember = "SINHVIEN"; cmd.Dispose();
} private void dgrDSGV_CellContentClick(object sender,
// Ch c năng Xóaứ private void button3_Click(object sender, EventArgs e)
{ if (MessageBox.Show("B n có ch c ch n mu n xóa ?"ạ ắ ắ ố , "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
// Thuc hien xoa du lieu
SqlCommand cmd = new SqlCommand("delete from tblGIANG_VIEN where MaGV='" + txtMaGV.Text + "'", conn); cmd.ExecuteNonQuery();
MessageBox.Show("Xóa d li u thành công"ữ ệ , "Thông báo!");
// Tr tài nguyênả cmd.Dispose();
// Ch c năng c p nh tứ ậ ậ private void button2_Click(object sender, EventArgs e)
{ errorProvider1.Clear(); if (txtMaGV.Text == "") errorProvider1.SetError(txtMaGV, "Mã gi ng viên không đ tr ng!"ả ể ố ); else
// Th c hi n truy v nự ệ ấ string update = "Update tblGIANG_VIEN Set TenGV=N'" + txtHoTen.Text + "',GioiTinh=N'" + cboGioiTinh.Text + "',Phone='" + mskPhone.Text +
"',Email='" + txtEmail.Text + "',PhanLoaiGV=N'" + cboPhanloai.Text + "' where MaGV='" + txtMaGV.Text + "'";
SqlCommand cmd = new SqlCommand(update, conn);
// Tr tài nguyênả cmd.Dispose();
} private void dgrDSGV_CellContentClick_1(object sender,
The application retrieves and displays teacher information by extracting data from the selected row in the data grid It assigns the teacher's ID, full name, gender, phone number, email, and classification to their respective input fields This process ensures that users can view and edit teacher details efficiently within the user interface Proper data binding enhances user experience and supports effective management of teacher records.
} private void button4_Click(object sender, EventArgs e)
} namespace Qu n_lý_đi m_sinh_vien_CNTTả ể
{ public partial class frmQLSV : Form
{ private CommonConnect cc = new CommonConnect();
SqlConnection conn = null; public frmQLSV()
} private void frmQLSV_Load(object sender, EventArgs e)
{ connConnected(); if (conn.State == ConnectionState.Open) ;
//Add du lieu vao cboKhoa string select = "Select MaKhoa from tblKHOA ";
SqlCommand cmd = new SqlCommand(select, conn);
SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read())
{ cboKhoahoc.Items.Add(reader.GetString(0));
//Add du lieu vao MaLop string selects = "Select MaLop from tblLOP";
SqlCommand cmd1 = new SqlCommand(selects, conn);
SqlDataReader reader1 = cmd1.ExecuteReader(); while (reader1.Read())
} private void dataGridView1_CellContentClick(object sender,
The code assigns student data from a DataGridView to corresponding input fields, such as setting the Student ID, full name, date of birth, gender, address, and class code This process ensures that when a student record is selected, their details are accurately populated into the form for viewing or editing Properly handling this data transfer enhances user experience by enabling quick and efficient management of student information within the application Implementing these data-binding techniques is essential for maintaining data consistency and streamlining student record updates.
// Ch c năng thêmứ private void btnThemmoi_Click(object sender, EventArgs e)
//Kiem tra trung ten MaSV string select2 = "Select * From tblSINH_VIEN where Masv='" + txtMaSV.Text +
SqlCommand cmd2 = new SqlCommand(select2, conn);
SqlDataReader reader2; reader2 = cmd2.ExecuteReader(); errorProvider1.Clear(); if (txtMaSV.Text == "")
{ errorProvider1.SetError(txtMaSV, "Mã sinh viên không đ tr ng!"ể ố ); } else if (cboMalop.Text == "")
{ errorProvider1.SetError(cboMalop, "Mã l p không đ tr ng!"ớ ể ố );
MessageBox.Show("B n đã nh p trùng mã sinh viên "ạ ậ , "Thông báo !",MessageBoxButtons.OK,MessageBoxIcon.Warning); txtMaSV.Focus(); cmd2.Dispose(); reader2.Dispose();
// Tr tài nguyênả cmd2.Dispose(); reader2.Dispose();
// Tr tài nguyênả cmd.Dispose();
// Tr tài nguyênả cmd2.Dispose(); reader2.Dispose();
// Th c hi n truy v nự ệ ấ string select = "Select * From tblSINH_VIEN ";
SqlCommand cmd = new SqlCommand(select, conn);
SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = cmd;
// Fill d li u t adapter vào DataSetữ ệ ừ adapter.Fill(ds, "SINHVIEN");
// Đ a ra DataGridViewư dgrDSSV.DataSource = ds; dgrDSSV.DataMember = "SINHVIEN"; cmd.Dispose();
// Ch c năng xóaứ private void btnXoa_Click(object sender, EventArgs e)
//Kiem tra string select1 = "Select MaSv from tblKET_QUA where MaSv='" + txtMaSV.Text + "' ";
SqlCommand cmd1 = new SqlCommand(select1, conn);
SqlDataReader reader1 = cmd1.ExecuteReader(); if (reader1.Read())
MessageBox.Show("B n ph i xóa Mã Sinh viên "ạ ả + txtMaSV.Text +
"t b ng K t qu h c t p"ừ ả ế ả ọ ậ , "Thông báo", MessageBoxButtons.OK,
} else if (MessageBox.Show("B n có ch c ch n mu n xóa ?"ạ ắ ắ ố , "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
SqlCommand cmd = new SqlCommand("delete from tblSINH_VIEN where MaSv='" + txtMaSV.Text + "'", conn); cmd.ExecuteNonQuery();
MessageBox.Show("Xóa d li u thành công"ữ ệ , "Thông báo!");
// Tr tài nguyênả cmd.Dispose();
} private void btnThoat_Click(object sender, EventArgs e)
// Ch c năng s aứ ử private void btnSua_Click(object sender, EventArgs e)
{ errorProvider1.Clear(); if (txtMaSV.Text == "") errorProvider1.SetError(txtMaSV, "Mã sinh viên không đ tr ng!"ể ố ); else if (cboMalop.Text == "") errorProvider1.SetError(cboMalop, "Mã l p không đ tr ng!"ớ ể ố ); else
// Th c hi n truy v nự ệ ấ string update = "Update tblSINH_VIEN Set HoTen=N'" + txtHoTen.Text +
"',NgaySinh='" + mskNgaySinh.Text + "',GioiTinh=N'" + cboGioiTinh.Text + "',DiaChi=N'" + txtDiaChi.Text + "',MaLop='" + cboMalop.Text + "'where MaSV='" + txtMaSV.Text +
SqlCommand cmd = new SqlCommand(update, conn); cmd.ExecuteNonQuery();
MessageBox.Show("C p nh t d li u thành công"ậ ậ ữ ệ , "Thông báo!");
// Tr tài nguyênả cmd.Dispose();
} private void cboKhoahoc_SelectedIndexChanged(object sender, EventArgs e)
{ cboLop.Items.Add(reader.GetString(0));
//Tra tai nguyen reader.Dispose(); cmd.Dispose();
} private void cboLop_SelectedIndexChanged(object sender, EventArgs e)
// Th c hi n truy v nự ệ ấ string select = "Select * From tblSINH_VIEN where MaLop='"+ cboLop.Text +"'";
SqlCommand cmd = new SqlCommand(select, conn);
SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = cmd;
// Fill d li u t adapter vào DataSetữ ệ ừ adapter.Fill(ds, "SINHVIEN");
// Đ a ra DataGridViewư dgrDSSV.DataSource = ds; dgrDSSV.DataMember = "SINHVIEN"; cmd.Dispose();
} private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) {
} private void groupBox3_Enter(object sender, EventArgs e)
} } } namespace Qu n_lý_đi m_sinh_vien_CNTTả ể
{ public partial class frmLop : Form
{ private CommonConnect cc = new CommonConnect();
SqlConnection conn = null; public frmLop()
} private void txtMaKhoa_TextChanged(object sender, EventArgs e)
} private void frmLop_Load(object sender, EventArgs e)
{ conn = cc.Connected(); if (conn.State == ConnectionState.Open) ; string sql = " select * from [Quanlydiem].[dbo].[tblLOP]";
SqlCommand commandsql = new SqlCommand(sql, conn);
SqlDataAdapter com = new SqlDataAdapter(commandsql);
DataTable table = new DataTable(); com.Fill(table); dgrLop.DataSource = table;
} private void button1_Click(object sender, EventArgs e)
{ string select1 = "Select MaKhoa from tblKHOA where MaKhoa='" + cboKhoa.Text + "' ";
SqlCommand cmd1 = new SqlCommand(select1, conn);
SqlDataReader reader1 = cmd1.ExecuteReader(); errorProvider1.Clear(); if (txtMaLop.Text == "")
{ errorProvider1.SetError(txtMaLop, "!"); txtMaLop.Focus();
} else if (txtMaLop.Text == dgrLop.CurrentRow.Cells[1].Value.ToString()) { errorProvider1.SetError(txtMaLop, "!");
MessageBox.Show("Mã l p đã t n t i !"ớ ồ ạ , "Thông báo",
MessageBoxButtons.OK, MessageBoxIcon.Warning); txtMaLop.Focus();
// Th c hi n truy v nự ệ ấ string insert = "Insert Into tblLOP(MaLop,TenLop,Makhoa)" + "Values('" + txtMaLop.Text + "',N'" + txtTenlop.Text + "','" + cboKhoa.Text + "')";
SqlCommand cmd = new SqlCommand(insert, conn); cmd.ExecuteNonQuery();
MessageBox.Show("Nh p thông tin thành công"ậ , "Thông báo!");
// Tr tài nguyênả cmd.Dispose();
//Fill du lieu vao Database
MessageBox.Show("Nh p mã khoa không chính xác !"ậ , "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); cboKhoa.Focus(); reader1.Dispose(); reader1.Dispose(); cmd1.Dispose();
// Th c hi n truy v nự ệ ấ string select = "Select * From tblLop ";
SqlCommand cmd = new SqlCommand(select, conn);
SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = cmd;
// Fill d li u t adapter vào DataSetữ ệ ừ adapter.Fill(ds, "SINHVIEN");
// Đ a ra DataGridViewư dgrLop.DataSource = ds; dgrLop.DataMember = "SINHVIEN"; cmd.Dispose();
} private void dgrLop_CellContentClick(object sender,
DataGridViewCellEventArgs { cboKhoa.Text = dgrLop.CurrentRow.Cells[0].Value.ToString(); txtMaLop.Text = dgrLop.CurrentRow.Cells[1].Value.ToString(); txtTenlop.Text = dgrLop.CurrentRow.Cells[2].Value.ToString();
} private void button3_Click(object sender, EventArgs e)
//Kiem tra string select1 = "Select MaLop from tblSINH_VIEN where MaLop='" + txtMaLop.Text + "' ";
SqlCommand cmd1 = new SqlCommand(select1, conn);
SqlDataReader reader1 = cmd1.ExecuteReader(); if (reader1.Read())
MessageBox.Show("B n ph i xóa Mã L p "ạ ả ớ + txtMaLop.Text+"t ừ b ng Sinh Viên"ả , "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ txtMaLop.Text + "'", conn); cmd.ExecuteNonQuery();
MessageBox.Show("Xóa d li u thành công"ữ ệ , "Thông báo!");
// Tr tài nguyênả cmd.Dispose();
} private void label1_Click(object sender, EventArgs e)
} private void button4_Click(object sender, EventArgs e)
} private void button2_Click(object sender, EventArgs e)
// Th c hi n truy v nự ệ ấ string update = "Update tblLOP Set MaKhoa='" + cboKhoa.Text +
"',MaLop='" + txtMaLop.Text + "',TenLop='" + txtTenlop.Text + "' where MaLop='" + txtMaLop.Text + "' ";
SqlCommand cmd = new SqlCommand(update, conn); cmd.ExecuteNonQuery();
MessageBox.Show("C p nh t d li u thành công"ậ ậ ữ ệ , "Thông báo!",
// Tr tài nguyênả cmd.Dispose();
} namespace Qu n_lý_đi m_sinh_vien_CNTTả ể
{ public partial class frmKhoa : Form
{ private CommonConnect cc = new CommonConnect();
SqlConnection conn = null; public frmKhoa()
} private void button1_Click(object sender, EventArgs e)
{ string select1 = "Select MaKhoa from tblKHOA where MaKhoa='" + txtKhoa.Text + "' ";
SqlCommand cmd1 = new SqlCommand(select1, conn);
SqlDataReader reader1 = cmd1.ExecuteReader(); errorProvider1.Clear(); if (txtKhoa.Text == "")
{ errorProvider1.SetError(txtKhoa, "Khóa h c không đ tr ng!"ọ ể ố ); txtTenKhoa.Focus();
MessageBox.Show("Thông tin đã t n t i !"ồ ạ , "Thông báo", cmd1.Dispose();
// Th c hi n truy v nự ệ ấ string insert = "Insert Into tblKHOA(MaKhoa,TenKhoa)" +
"Values('" + txtKhoa.Text + "',N'" + txtTenKhoa.Text + "')";
SqlCommand cmd = new SqlCommand(insert, conn); cmd.ExecuteNonQuery();
MessageBox.Show("Nh p thông tin thành công"ậ , "Thông báo!");
// Tr tài nguyênả cmd.Dispose();
//Fill du lieu vao Database
// Th c hi n truy v nự ệ ấ string select = "Select * From tblKHOA ";
SqlCommand cmd = new SqlCommand(select, conn);
SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = cmd;
// Fill d li u t adapter vào DataSetữ ệ ừ adapter.Fill(ds, "SINHVIEN");
// Đ a ra DataGridViewư dgrKhoa.DataSource = ds; dgrKhoa.DataMember = "SINHVIEN"; cmd.Dispose();
} private void frmLop_Khoa_Load(object sender, EventArgs e)
{ conn = cc.Connected(); if (conn.State == ConnectionState.Open) ; string sqlkhoa = "select * from [Quanlydiem].[dbo].[tblKHOA]";
SqlCommand comand = new SqlCommand(sqlkhoa, conn);
SqlDataAdapter sqlcom = new SqlDataAdapter(comand);
DataTable table = new DataTable(); sqlcom.Fill(table); dgrKhoa.DataSource = table;
//Kiem tra string select1 = "Select MaKhoa from tblLOP where MaKhoa='" + txtKhoa.Text + "' ";
SqlCommand cmd1 = new SqlCommand(select1, conn);
SqlDataReader reader1 = cmd1.ExecuteReader(); if (reader1.Read())
MessageBox.Show("B n ph i xóa Mã Khoa "ạ ả + txtKhoa.Text +"t ừ b ng L p"ả ớ ,"Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
} else if (MessageBox.Show("B n có ch c ch n mu n xóa ?"ạ ắ ắ ố , "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
// Thuc hien xoa du lieu reader1.Dispose(); cmd1.Dispose();
SqlCommand cmd = new SqlCommand("delete from tblKHOA where
MaKhoa='" + txtKhoa.Text + "'", conn); cmd.ExecuteNonQuery();
MessageBox.Show("Xóa d li u thành công"ữ ệ , "Thông báo!");
// Tr tài nguyênả cmd.Dispose();
} private void button2_Click(object sender, EventArgs e)
// Th c hi n truy v nự ệ ấ string update = "Update tblKHOA Set TenKhoa=N'" + txtTenKhoa.Text + "' where MaKhoa='" + txtKhoa.Text + "' ";
SqlCommand cmd = new SqlCommand(update, conn); cmd.ExecuteNonQuery();
MessageBox.Show("C p nh t d li u thành công"ậ ậ ữ ệ , "Thông báo!",
// Tr tài nguyênả cmd.Dispose();
} private void button4_Click(object sender, EventArgs e)
2.5 L p qu n lý thông tin sinh viến ớ ả namespace Qu n_lý_đi m_sinh_vien_CNTTả ể
{ public partial class frmQLDiem : Form
{ private CommonConnect cc = new CommonConnect();
SqlConnection conn = null; public frmQLDiem()
} private void groupBox2_Enter(object sender, EventArgs e)
} private void groupBox4_Enter(object sender, EventArgs e)
} private void cboKhoaHoc_SelectedIndexChanged(object sender, EventArgs e) { cboLop.Items.Clear(); cboLop.Text = ""; string select = "Select MaLop from tblLOP where MaKhoa='" + cboKhoaHoc.Text + "'";
//Add vao cboLop while (reader.Read())
{ cboLop.Items.Add(reader.GetString(0));
//Tra tai nguyen reader.Dispose(); cmd.Dispose();
} private void frmQLDiem_Load(object sender, EventArgs e)
{ conn = cc.Connected(); if (conn.State == ConnectionState.Open) ; string sql = " select * from [Quanlydiem].[dbo].[tblKET_QUA2]";
SqlCommand commandsql = new SqlCommand(sql, conn);
SqlDataAdapter com = new SqlDataAdapter(commandsql);
DataTable table = new DataTable(); com.Fill(table); dgrDiem.DataSource = table;
//Add du lieu vao cboKhoaHoc string select = "Select MaKhoa from tblKHOA ";
SqlCommand cmd = new SqlCommand(select, conn);
SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read())
{ cboKhoaHoc.Items.Add(reader.GetString(0));
} private void cboNamHoc_SelectedIndexChanged(object sender, EventArgs e) {
} private void cboHocKi_SelectedIndexChanged(object sender, EventArgs e) { cboMonHoc.Items.Clear(); string select = "Select MaMon from tblMON where HocKi='" +
//Tra tai nguyen reader.Dispose(); cmd.Dispose();
} private void button1_Click(object sender, EventArgs e)
//Kiem tra trung ten MonHoc va MASV string select1 = "Select MaSV from tblSINH_VIEN where MaSV=N'" + txtMaSV.Text + "' and Hoten=N'"+ txtHoTen.Text +"' ";
SqlCommand cmd1 = new SqlCommand(select1, conn);
SqlDataReader reader1 = cmd1.ExecuteReader(); errorProvider1.Clear(); if (txtMaSV.Text == "")
{ errorProvider1.SetError(txtMaSV,"Mã sinh viên không đ tr ng!"ể ố ); txtMaSV.Focus();
} else if (txtMaSV.Text == dgrDiem.CurrentRow.Cells[0].Value.ToString()
&& cboMonHoc.Text == dgrDiem.CurrentRow.Cells[3].Value.ToString())
MessageBox.Show("Sinh viên này đã được nh p đi m môn: "ậ ể + cboMonHoc.Text,"Thông báo", MessageBoxButtons.OK,MessageBoxIcon.Warning); txtMaSV.Focus();
{ errorProvider1.SetError(cboLop, "Mã l p không đ tr ng!"ớ ể ố ); cboLop.Focus();
{ errorProvider1.SetError(cboHocKi, "H c kỳ không đ tr ng!"ọ ể ố ); cboHocKi.Focus();
{ errorProvider1.SetError(cboMonHoc, "Mã môn không đ tr ng!"ể ố ); cboMonHoc.Focus();
//Tra tai nguyen reader1.Dispose(); cmd1.Dispose();
// Th c hi n truy v nự ệ ấ tblKET_QUA(MaSV,HoTen,MaLop,MaMon,DiemThiLan1,DiemTB,DiemTongket,HanhKiem,HocKi,Gh iChu)" +
"Values('" + txtMaSV.Text + "',N'" + txtHoTen.Text + "','" + cboLop.Text + "',N'" + cboMonHoc.Text + "','" + txtDiemThi1.Text + "','" + txtDiemTB.Text + "','" + txtDiemTK.Text + "',N'" + cboHanhKiem.Text + "',N'" + cboHocKi.Text + "',N'" + txtGhiChu.Text + "')";
SqlCommand cmd = new SqlCommand(insert, conn); cmd.ExecuteNonQuery();
MessageBox.Show("Nh p thông tin thành công"ậ , "Thông báo!");
// Tr tài nguyênả cmd.Dispose();
MessageBox.Show("Nh p mã sinh viên không chính xác !"ậ , "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtMaSV.Focus();
//Tra tai nguyen reader1.Dispose(); cmd1.Dispose();
//Tra tai nguyen reader1.Dispose(); cmd1.Dispose();
// Th c hi n truy v nự ệ ấ string select = "Select * From tblKET_QUA ";
SqlCommand cmd = new SqlCommand(select, conn);
SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = cmd;
// Fill d li u t adapter vào DataSetữ ệ ừ adapter.Fill(ds, "SINHVIEN");
//string select = "Select * From tblKET_QUA Where MaLop='"+cboLop Text +"'";
//SqlCommand cmd = new SqlCommand(select, conn);
//// Fill d li u t adapter vào DataSetữ ệ ừ
} private void textBox1_TextChanged(object sender, EventArgs e)
} private void button3_Click(object sender, EventArgs e)
{ if (MessageBox.Show("B n có ch c ch n mu n xóa ?"ạ ắ ắ ố , "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
// Thuc hien xoa du lieu string delete = "delete from tblKET_QUA where MaSV='" + txtMaSV.Text + "' and MaMon='" + cboMonHoc.Text + "' ";
SqlCommand cmd = new SqlCommand(delete, conn); cmd.ExecuteNonQuery();
MessageBox.Show("Xóa d li u thành công"ữ ệ , "Thông báo!");
// Tr tài nguyênả cmd.Dispose();
} private void dgrDiem_CellContentClick(object sender,
This code snippet assigns values from the current row of a data grid to various input controls, effectively displaying student information and their grades It retrieves the student's ID, name, class, subject, average score, first test score, total score, and conduct evaluation, ensuring accurate data presentation for further processing or updating Implementing this data binding technique enhances the efficiency of managing student records within an educational management system.
} private void button2_Click(object sender, EventArgs e)
//Kiem tra trung ten MonHoc va MASV
//string select1 = "Select MaSV,TenMon from tblKET_QUA where
//SqlCommand cmd1 = new SqlCommand(select1, conn);
//errorProvider1.Clear(); if (txtMaSV.Text == "")
{ errorProvider1.SetError(txtMaSV, "Mã sinh viên không đ tr ng!"ể ố ); }
// MessageBox.Show("Sinh viên này đã được nh p đi m môn: " + ậ ể cboMonHoc.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); // txtMaSV.Focus();
// Th c hi n truy v nự ệ ấ string update = "Update tblKET_QUA Set HoTen=N'" + txtHoTen.Text +
"',MaMon=N'" +cboMonHoc.Text + "',MaLop='" + cboLop.Text + "',DiemThiLan1='" + txtDiemThi1.Text + "',DiemTB='" +txtDiemTB.Text + "' ,DiemTongket='" + txtDiemTK.Text + "',HanhKiem=N'" + cboHanhKiem.Text + "',HocKi=N'" + cboHocKi.Text + "',GhiChu=N'" + txtGhiChu.Text + "' where MaSV='" + txtMaSV.Text +
SqlCommand cmd = new SqlCommand(update, conn); cmd.ExecuteNonQuery();
MessageBox.Show("C p nh t d li u thành công"ậ ậ ữ ệ , "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information);
} private void txtDiemTK_KeyPress(object sender, KeyPressEventArgs e)
} private void txtDiemThi2_TextChanged(object sender, EventArgs e)
} private void txtDiemThi1_TextChanged(object sender, EventArgs e )
{ double DIEMTHI, DIEMTB, DIEMTK; if (txtDiemThi1.Text == "")
DIEMTB = double.Parse(this.txtDiemTB.Text);
DIEMTK = (0.3 * DIEMTB + 0.7 * 0); this.txtDiemTK.Text = Convert.ToString(DIEMTK);
DIEMTHI = double.Parse(this.txtDiemThi1.Text);
DIEMTK = (0.3 * 0 + 0.7 * DIEMTHI); this.txtDiemTK.Text = Convert.ToString(DIEMTK);
DIEMTHI = double.Parse(this.txtDiemThi1.Text);
DIEMTB = double.Parse(this.txtDiemTB.Text);
DIEMTK = (0.3 * DIEMTB + 0.7 * DIEMTHI); this.txtDiemTK.Text = Convert.ToString(DIEMTK);
DIEMTK = double.Parse(this.txtDiemTK.Text); if (DIEMTK