1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Xây dựng chương trình quản lý công tác thi chuẩn đầu ra cho trung tâm ngoại ngữ tin học trường đại học mỏ địa chất

109 8 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Xây Dựng Chương Trình Quản Lý Công Tác Thi Chuẩn Đầu Ra Cho Trung Tâm Ngoại Ngữ - Tin Học
Trường học Trường Đại Học Mỏ Địa Chất
Chuyên ngành Công Nghệ Thông Tin
Thể loại Bài Tập Lớn
Năm xuất bản 2021
Thành phố Hà Nội
Định dạng
Số trang 109
Dung lượng 5,97 MB

Cấu trúc

  • CHƯƠNG 1: THIẾ T KẾ CƠ SỞ DỮ LIỆU (4)
    • 1. Mô hình quan hê (4)
    • 2. Các bảng d ữ liệ u (4)
      • 2.1. Bảng 1: Admin (4)
      • 2.2. Bảng 2: Khoa (ngành) (4)
      • 2.3. Bảng 3: Khóa họ c (5)
      • 2.4. Bảng 4: Chức vụ (5)
      • 2.5. Bảng 5: Đợt thi (5)
      • 2.6. Bảng 6: Buổi thi (0)
      • 2.7. Bang 7: Ca thi (6)
      • 2.8. Bảng 8: Phòng thi (6)
      • 2.9. Bảng 9: L ch thi ị (0)
      • 2.10. Bảng 10: Cán bộ (7)
      • 2.11. Bảng 11: Lớ p (0)
      • 2.12. Bảng 12: Sinh Viên (8)
      • 2.13. Bảng 13: Kết Quả (0)
    • 3. Sơ đồ phân rã ch ức năng (8)
  • CHƯƠNG 2: CÁC CHỨC NĂNG CHÍNH CỦA HỆ THỐNG (9)
  • CHƯƠNG 3: GIAO DIỆ N CÁC CH ỨC NĂNG (10)
    • 1. Giao diện đăng nhậ p (10)
    • 2. Giao diện chương trình chính (10)
    • 3. Giao diện Quản lý thông tin khoa(ngành) (0)
    • 4. Giao diện Form thông tin các khóa họ c (12)
    • 5. Giao diện Form thông tin các lớp (12)
    • 6. Giao diên Form qu ản lý các đợ t thi (13)
    • 7. Giao diện Form thêm mới/ c ập nhât đợ t thi (0)
    • 8. Giao diện form tạo lich thi (0)
    • 9. Giao diện form quản lú thông tin sinh viên (0)
    • 10. Giao diện thêm mới/ s a thông tin sinh viên ử (0)
    • 11. Giao diện Form thông tin cán bộ (17)
    • 12. Giao diện Form thêm/ sửa thông tin cán bộ (0)
    • 13. Giao diên Form thông tin Phòng thi (18)
    • 14. Giao diện Form thêm/ sửa thông tin Phòng thi (0)
    • 15. Giao diện Form Xếp phòng thi cho sinh viên (0)
    • 16. Giao di ện Form đánh số báo danh (21)
    • 17. Giao diện Form qu ản lý điể m thi c a sinh viên ủ (21)
    • 18. Giao diện Form thông báo (23)
  • CHƯƠNG 4: MÃ NGUỒ N CỦA CÁC CH ỨC NĂNG (23)
    • 1. FrmNotification.cs (mã nguồn quản lý thông báo) (0)
    • 2. BaseDAO.cs (kết nối csdl) (0)
    • 3. frmLoginUser.cs (ch ức năng quả n lý giao di ện login) (26)
    • 4. LoginUser.cs (xử lý logic chức năng login) (29)
    • 5. Main.cs (quản lý giao diện mành hình chính) (0)
    • 6. UcKhoa.cs (usercontrol xử lý thao tác các chức năng) (32)
    • 7. KhoaDAO.cs (xử lý logic quản lý khoa) (0)
    • 8. UcKhoaHoc.cs (xử lý thao tác các chức năng) (0)
    • 9. KhoaHocDAO.cs (xử lý logic quản lý khóa học) (43)
    • 10. UcLop.cs (xử lý thao tác ch ức năng trên giao di ện) (45)
    • 11. LopDAO.cs (xử lý logic quản lý lớp) (0)
    • 12. UcDotThi.cs (xử lý thao tác ch ức năng trên giao diệ n qu ản lý đợ t thi) (51)
    • 13. FrmAddEditDotThi.cs (xử lý thao tác các ch ức năng thêm/ sửa đợ t thi) (54)
    • 14. DotThiDAO.cs (xử lý logic qu ản lý đợ t thi) (0)
    • 15. UcLichThi.cs (xử lý thao tác trên các ch ức năng quả n lý l ch thi) ị (0)
    • 16. LichThiDao.cs ( xử lý logic quản lý l ch thi) ị (0)
    • 17. UcThiSinh.cs (xử lý thao tác các ch ức năng quả n lý sinh viên) (0)
    • 18. FrmThiSinhAddEdit.cs (xử lý thao tác các ch ức năng thêm/ sử a sinh vên) (68)
    • 20. UcCanBo.cs (xử lý thao tác các ch ức năng quả n lý cán b ộ ) (0)
    • 21. FrmEditCanBo.cs (xử lý thao tác thêm/ xóa cán bộ ) (75)
    • 22. CanBoDAO.cs (xử lý logic quản lý cán bộ ) (0)
    • 23. UcPhongThi.cs (xử lý thao tác các ch ức năng quả n lý phòng thi) (0)
    • 24. FrmEditPhongThi.cs (xử lý thao tác các ch ức năng thêm mớ i/ s ửa phòng thi) . 84 25. PhongThiDAO.cs (xử lý logic quan lý phòng thi) (83)
    • 26. UcDanhSoBaoDanh.cs (xử lý thao tác các ch ức năng quả n lý s ố báo danh) (87)
    • 27. UcXepPhongThi.cs (xử lý thao tác các ch ức năng xế p phòng thi) (90)
    • 28. XepPhongDAO.cs (xử lý logic ch ức năng xế p phòng thi) (93)
    • 29. UcQuanLyDiem.cs (xử lý thao tác các ch ức năng quản lý điể m sinh viên) (95)
    • 30. KetQuaDAO.cs (xử lý logic quản lý điểm) (0)

Nội dung

THIẾ T KẾ CƠ SỞ DỮ LIỆU

Các bảng d ữ liệ u

2.1 B ảng 1: Admin (idAdmin, tenDangNhap, matKhau, hoTen)

STT Thuộc tính Kiể u d li u ữ ệ Khoa chính

1 idAmin Varchar(10) X Mã qu n tr ả ị

2 tenDangNhap Varchar(10) Tên đăng nhập

3 matKhau Varchar(10) Mạt khẩu đăng nhập

4 hoTen Nvarchar(50) Họ và tê nad min

2.2 B ảng 2: Khoa (ngành) (maKhoa, tenKhoa, namThanhLap)

STT Thuộc tính Kiể u d li u ữ ệ Khóa chinh

1 maKhoa Varchar(10) X Mã qu n tr khoa ả ị

3 namThanhLap Int Năm thành lập

2.3 Bảng 3: Khóa học (maKhoaHoc, tenKhoaHoc, namBatDau, namKetThuc)

STT Thuộc tính Kiể u d li u ữ ệ Khóa chính

1 maKhoaHoc Varchar(10) X Mã qu n tr khóa h c ả ị ọ

3 namBatDau Int Năm bắt đầu của khóa h c ọ

4 namKetThuc Int Năm kết thúc của khóa h c ọ

2.4 Bảng 4: Chức vụ (maChucVu, tenChucVu)

2.5 Bảng 5: Đợt thi (maDotThi, tenDotThi,ngayBatDau, ngayKetThuc)

STT Thuộc tính Kiể u d li u ữ ệ Khóa chính

1 maDotThi Varchar(10) X Mã qu n tr t thi ả ị đợ

2 tenDotThi nVarchar(100) Tiêu đề / tên đợt thi

3 ngayBatDau Datetime Ngày bắt đầu của đợt thi

4 ngayKetThuc Datetime Ngày k t thúc cế ủa đợt thi

2.6 Bảng 6: Bu i thi ổ (maBuoiThi, tenBuoiThi)

STT Thuộc tính Kiể u d li u ữ ệ Khóa chính

1 maBuoiThi Varchar(5) X Mã qu n tr bu i thi ả ị ổ

2 tenBuoiThi nVarchar(10) Tên bu i thi ổ

2.7 Bang 7: Ca thi (maCaThi, tenCaThi)

STT Thuộc tính Kiể u d liệu ữ Khóa chính

1 maCaThi Varchar(5) X Mã qu n tr ca thi ả ị

2 tenCaThi nVarchar(5) Tên ca thi

2.8 Bảng 8: Phòng thi (maPhongThi, tenPhongThi, soCho, trangThai)

STT Thuộc tính Kiể u dữ li u Khóa ệ chính

1 maPhongThi Varchar(10) X Mã qu n tr phòng ả ị thi

2 tenPhongThi nVarchar(20) Tên phòng thi

3 soCho Int Sỗ chỗ ng i c a 1 ồ ủ phòng

4 trangThai Int Trạng thái có lịch thi hay chưa

2.9 Bảng 9: Lịch thi (maLichThi, ngayThi, maDotThi, maBuoiThi, maCaThi, maPhongThi, tietBatDau, soTiet)

STT Thuộc tính Kiể u dữ li u Khóa ệ chính

1 maLichThi Varchar(10) X Mã qu n tr l ch thi ả ị ị

3 maDotThi Varchar(10) X Mã đợt thi

4 maBuoiThi Varchar(5) X Mã bu i thi ổ

5 maCaThi Varchar(5) X Mã ca thi

6 maPhongThi Varchar(10) X Mã phòng thi

7 tietBatDau Int Tiết bắt đầu làm bài

8 soTiet Int Số tiết làm bài

2.10 B ảng 10: Cán bộ (maCanBo, hoTen, ngaySinh, gioiTinh, phone, maKhoa, maChucVu)

STT Thuộc tính Kiể u dữ li u Khóa ệ chính

1 maCanBo Varchar(10) X Mã qu n tr cán b ả ị ộ

5 Phone Varchar(11) Có th r ng ể ỗ

6 maKhoa Varchar(10) X Khóa ngo i( không ạ rỗng)

7 maChucVu Varchar(10) X Khóa ngo i (không ạ rỗng)

STT Thuộc tính Kiể u dữ li u Khóa ệ chính

2 maKhoa Varchar(50) X Mã khoa (ngành)

2.12 B ảng 12: Sinh Viên (maSinhVien, soBaoDanh, hoTen, ngaySinh, gioiTInh, phone, tenLop, maLichThi, maKetQua)

STT Thuộc tính Kiể u dữ li u Khóa ệ chính

1 maSinhVien Varchar(10) X Mã qu n tr sinh viên ả ị

2 soBaoDanh Varchar(10) Số báo danh c a sinh ủ viên

3 hoTen Nvarchar(200) Họ và tên

6 Phone varchar(11) Số điện tho i ạ

8 maLichThi varchar(10) X Mã l ch thi ị

STT Thuộc tính Kiể u dữ li u Khóa ệ chính

1 maKetQua varchar(10) X Mã qu n tr k t qu ả ị ế ả thi

2 maSinhVien Varchar(10) X Mã qu n tr sinh viên ả ị

3 diemThiNghe Float Điểm thi nghe

4 diemThiViet Float Điểm thi vi t ế

5 diemThiNoi Float Điểm thi nói

6 diemDauRa Float Điểm t ng kổ ết đầu ra

7 maDotThi Varchar(10) X Mã qu n tr t thi ả ị đợ

Sơ đồ phân rã ch ức năng

CÁC CHỨC NĂNG CHÍNH CỦA HỆ THỐNG

 Quản lý đợt thi o Thêm/ s a/ xóa kì thi ử

 Quản lý khoa (ngành) o Thêm/ s a/ xóa khoa ử

 Quản lý khóa h c ọ o Thêm/ s a/ xóa khóa h c ử ọ

 Quản lý cán b coi thi ộ o Thêm/ s a/ xóa cán b ử ộ coi thi

 Quản lý thông tin sinh viên o Thêm/ s a/ xóa sinh viên ử

 Quản lý thông tin các phòng thi o Thêm/ s a/ xóa phòng thi ử

 Tổ chức thi tạ i các phòng máy o Xếp l ch thi ị o Đánh số báo danh o Xếp phòng thi

 Quản lý k t qu ế ả thi o Nhập/ xóa điểm thi

 Quản lý các danh muc (l p, khoa, khóa hoc) ớ

11 o Thêm/ s a/ xóa thông tin danh m ử ục.

GIAO DIỆ N CÁC CH ỨC NĂNG

Giao diện đăng nhậ p

Chức năng này hco phém người dùng đăng nhập vào hệ thống với tên và mật khẩu

Hệ thống yêu cầu người dùng nhập "Username" và "Password" để đăng nhập Sau khi nhận thông tin, hệ thống sẽ kiểm tra tính hợp lệ của dữ liệu đầu vào và cho phép người dùng truy cập vào hệ thống nếu thông tin đúng.

Giao diện chương trình chính

3 Giao diện Qu n lý thông tin khoa(ngành) ả

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin

Tại đây, có thể xe, thông tin chi tiết về các khoa

 Các ch ức năng chính: o Thêm m i: thêm m i 1 khoa ớ ớ

Sửa thông tin khoa để cập nhật dữ liệu chính xác Nếu cần xóa thông tin khoa, hãy lưu ý rằng những khoa có ràng buộc liên quan sẽ không thể xóa Nếu muốn hủy thao tác, bạn có thể trở lại trạng thái ban đầu của giao diện.

4 Giao diện Form thông tin các khóa h c ọ

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Khóa học Tại đây, có thể xe, thông tin chi tiết về các Khóa học

Các chức năng chính bao gồm: Thêm mới để thêm một khóa học, Sửa để chỉnh sửa thông tin của một khóa học, và Xóa để loại bỏ thông tin khóa học khỏi danh sách, lưu ý rằng khóa học có ràng buộc liên quan sẽ không được xóa Ngoài ra, chức năng Hủy thao tác cho phép người dùng trở lại trạng thái ban đầu của giao diện.

5 Giao diện Form thông tin các l p ớ

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Lớp Tại đây, có thể xe, thông tin chi tiết về các Lớp

Các chức năng chính của hệ thống bao gồm: Thêm mới lớp học, cho phép người dùng thêm một lớp học mới vào danh sách Chức năng sửa thông tin lớp giúp cập nhật các thông tin cần thiết của lớp học hiện có Người dùng có thể xóa lớp học khỏi danh sách, tuy nhiên, lớp có ràng buộc liên quan sẽ không thể bị xóa Cuối cùng, chức năng hủy thao tác giúp người dùng trở lại trạng thái ban đầu của giao diện.

6 Giao diên Form quản lý các đợt thi

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Đợt thi Tại đây, có thể xe, thông tin chi tiết về các Đợ t thi

Các chức năng chính bao gồm: Thêm mới thông tin bằng cách gọi tới form thêm/sửa, sửa thông tin cũng thông qua form này, và xóa thông tin đợt thi trong danh sách Khi xóa một đợt thi, tất cả các ràng buộc liên quan cũng sẽ bị xóa, ví dụ như nếu đợt thi 1 có lịch thi 1, thì khi xóa đợt thi 1, lịch thi 1 cũng sẽ bị xóa.

7 Giao diện Form thêm m i/ c ớ ập nhât đợ t thi

 Khi gọi form thêm m ớ ợ i đ t thi lên

Cho phép thêm mới 1 đơt thi, vớ i các trư ờng không đượ c trống

 Khi gọi form s ửa thông tin đợ t thi Hiện th ị thông tin đợt thi cầ n s ửa

8 Giao diện form t o lich thi ạ

 Tại đây người dùng tạo lịch thi tự động cho 1 đợt thi

 Chức năng: o Tạo: t o t ạ ự đônh lần lượt các đợ t thi ng v ứ ới 1 đợt thi, 2 buổ i sáng chi u, ề

4 ca thi trong ngày và s ố phòng thi tương ứng

17 o Xóa: xóa hết t t c ấ ả l ịch thi có trong đợt thi đã chọ n, n u có ràng bu c thì ế ộ xóa h t ràng bu ế ộc

9 Giao diện form qu n lú thông tin sinh viên ả

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Sinh viên Tại đây, có thể xe, thông tin chi tiết về các Sinh viên

Các chức năng chính bao gồm: Thêm mới thông tin sinh viên qua form thêm/sửa, sửa đổi thông tin sinh viên bằng cách gọi tới form tương ứng, và xóa thông tin sinh viên khỏi danh sách, đồng thời xóa tất cả các ràng buộc liên quan.

10 Giao di ện thêm mớ i/ s ửa thông tin sinh viên

 Tại đây người dùng tạo lịch thi tự động cho 1 sinh viên

 Chức năng: o Tạo: thêm m i 1 sinh viên v ớ ới đầu đủ thông tin đã điền o Xóa: xóa sinh viện được chon ở Form thông tin sinh viên

11 Giao diện Form thông tin cán b ộ

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Cán bộ Tại đây, có thể xe, thông tin chi tiết về các Cán b ộ

 Các ch ức năng chính:

Để quản lý thông tin hiệu quả, bạn có thể thực hiện các thao tác như thêm mới, sửa đổi hoặc xóa thông tin cán bộ Để thêm thông tin, hãy gọi đến form thêm/sửa thông tin Nếu cần sửa đổi, hãy sử dụng form tương tự Tuy nhiên, việc xóa thông tin chỉ thực hiện được khi không có ràng buộc liên quan đến cán bộ đó.

12 Giao diện Form thêm/ s a thông tin cán b ử ộ

 Tại đây người dùng tạo lịch thi tự động cho 1 cán bộ

 Chức năng: o Tạo: thêm m i 1 cán b v ớ ộ ới đầu đủ thông tin đã điền o Xóa: xóa sinh viện được chon ở Form thông tin cán bộ

13 Giao diên Form thông tin Phòng thi

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Phòng thi Tại đây, có thể xe, thông tin chi tiết về các Phòng thi

Các chức năng chính bao gồm: Thêm mới thông tin bằng cách gọi tới form thêm/sửa; Sửa thông tin cũng thông qua form này; và Xóa thông tin Phòng thi khỏi danh sách, tuy nhiên nếu có ràng buộc liên quan thì không thể thực hiện việc xóa.

14 Giao diện Form thêm/ s a thông tin Phòng thi ử

 Tại đây người dùng tạo lịch thi tự động cho 1 phòng

21 o Tạo: thêm m i 1 phòng v ớ ới đầu đủ thông tin đã điền o Xóa: xóa sinh viện được chon ở Form thông tin phòng

15 Giao diện Form X p phòng thi cho sinh viên ế

Để tạo lịch thi cho mỗi phòng thi có 30 sinh viên, bạn cần chọn đợt hiển thị lịch thi đã tạo hoặc tạo lịch thi mới Sau khi lựa chọn lịch thi và sắp xếp phòng, giao diện sẽ hiển thị thông tin cần thiết.

22 o Tạo: th ực hiệ ự độ n t ng thêm sinh viên vào l ịch thi đã tạ ở o rm t o l fo ạ ịch thi o Xóa: xóa sinh viên ra khỏi lịch thi

16 Giao diện Form đánh số báo danh

 Ở giao diện này, cho phép đánh số báo danh tư động cho sinh viên trong 1 đợ t thi nhất định

 Chức năng: o Thực hiện: đánh số báo danh tự động cho sinh viên o Xóa SBD: xóa số báo danh của sinh viên

17 Giao diện Form qu ản lý điể m thi c a sinh viên ủ

 Tại đây hệ thống yêu c u ch ầ ọn đợt thi để ể hi n th ị điể m c ủa sinh viên

 Sau khi ch ọn đợ t thi có giao di n: ệ

 Giao diện này cho phép người dùng có thể cập nhật thêm, sửa, xóa thông tin Điểm

 Các ch ức năng trên giao diệ n:

• Thêm mớ i: hệ th ống cho phép ngườ i dùng thêm mới kết quả thi của sinh viên

Giao diện Form thông tin các khóa họ c

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Khóa học Tại đây, có thể xe, thông tin chi tiết về các Khóa học

Các chức năng chính bao gồm: Thêm mới để tạo một khóa học, Sửa để chỉnh sửa thông tin của một khóa học hiện có, và Xóa để loại bỏ thông tin khóa học khỏi danh sách (lưu ý rằng khóa học có ràng buộc liên quan sẽ không thể xóa) Ngoài ra, chức năng Hủy thao tác cho phép người dùng trở lại trạng thái ban đầu của giao diện.

Giao diện Form thông tin các lớp

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Lớp Tại đây, có thể xe, thông tin chi tiết về các Lớp

Các chức năng chính bao gồm: Thêm mới lớp, cho phép người dùng thêm một lớp học mới vào danh sách; Sửa thông tin lớp, giúp cập nhật các thông tin cần thiết của lớp; Xóa lớp, với lưu ý rằng lớp có ràng buộc liên quan sẽ không thể xóa; và Hủy thao tác, cho phép quay lại trạng thái ban đầu của giao diện.

Giao diên Form qu ản lý các đợ t thi

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Đợt thi Tại đây, có thể xe, thông tin chi tiết về các Đợ t thi

Các chức năng chính của hệ thống bao gồm: Thêm mới thông tin qua form, sửa đổi thông tin bằng cách gọi tới form sửa, và xóa thông tin đợt thi khỏi danh sách Khi xóa một đợt thi, hệ thống sẽ tự động xóa tất cả các ràng buộc có liên quan, ví dụ như khi xóa đợt thi 1, tất cả các lịch thi liên quan sẽ bị xóa theo.

7 Giao diện Form thêm m i/ c ớ ập nhât đợ t thi

 Khi gọi form thêm m ớ ợ i đ t thi lên

Cho phép thêm mới 1 đơt thi, vớ i các trư ờng không đượ c trống

 Khi gọi form s ửa thông tin đợ t thi Hiện th ị thông tin đợt thi cầ n s ửa

8 Giao diện form t o lich thi ạ

 Tại đây người dùng tạo lịch thi tự động cho 1 đợt thi

 Chức năng: o Tạo: t o t ạ ự đônh lần lượt các đợ t thi ng v ứ ới 1 đợt thi, 2 buổ i sáng chi u, ề

4 ca thi trong ngày và s ố phòng thi tương ứng

17 o Xóa: xóa hết t t c ấ ả l ịch thi có trong đợt thi đã chọ n, n u có ràng bu c thì ế ộ xóa h t ràng bu ế ộc

9 Giao diện form qu n lú thông tin sinh viên ả

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Sinh viên Tại đây, có thể xe, thông tin chi tiết về các Sinh viên

Các chức năng chính bao gồm: Thêm mới thông tin sinh viên qua form thêm/sửa, sửa thông tin bằng cách gọi đến form tương ứng, và xóa thông tin sinh viên khỏi danh sách, đồng thời xóa tất cả các ràng buộc liên quan.

10 Giao di ện thêm mớ i/ s ửa thông tin sinh viên

 Tại đây người dùng tạo lịch thi tự động cho 1 sinh viên

 Chức năng: o Tạo: thêm m i 1 sinh viên v ớ ới đầu đủ thông tin đã điền o Xóa: xóa sinh viện được chon ở Form thông tin sinh viên

11 Giao diện Form thông tin cán b ộ

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Cán bộ Tại đây, có thể xe, thông tin chi tiết về các Cán b ộ

 Các ch ức năng chính:

Để quản lý thông tin Cán bộ hiệu quả, bạn có thể thực hiện các thao tác như thêm mới thông tin bằng cách gọi tới form thêm, sửa đổi thông tin qua form sửa, và xóa thông tin Cán bộ trong danh sách Tuy nhiên, lưu ý rằng nếu có ràng buộc liên quan, việc xóa sẽ không được phép thực hiện.

12 Giao diện Form thêm/ s a thông tin cán b ử ộ

 Tại đây người dùng tạo lịch thi tự động cho 1 cán bộ

 Chức năng: o Tạo: thêm m i 1 cán b v ớ ộ ới đầu đủ thông tin đã điền o Xóa: xóa sinh viện được chon ở Form thông tin cán bộ

13 Giao diên Form thông tin Phòng thi

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Phòng thi Tại đây, có thể xe, thông tin chi tiết về các Phòng thi

Các chức năng chính bao gồm: Thêm mới thông tin bằng cách gọi tới form thêm/sửa, sửa đổi thông tin cũng qua form này, và xóa thông tin Phòng thi trong danh sách Tuy nhiên, nếu có ràng buộc liên quan, việc xóa sẽ không được thực hiện.

14 Giao diện Form thêm/ s a thông tin Phòng thi ử

 Tại đây người dùng tạo lịch thi tự động cho 1 phòng

21 o Tạo: thêm m i 1 phòng v ớ ới đầu đủ thông tin đã điền o Xóa: xóa sinh viện được chon ở Form thông tin phòng

15 Giao diện Form X p phòng thi cho sinh viên ế

Để tổ chức lịch thi cho mỗi phòng có 30 sinh viên, bạn cần chọn đợt hiển thị lịch thi đã tạo hoặc tạo mới Sau khi lựa chọn lịch thi và sắp xếp phòng, giao diện sẽ hiển thị thông tin chi tiết.

22 o Tạo: th ực hiệ ự độ n t ng thêm sinh viên vào l ịch thi đã tạ ở o rm t o l fo ạ ịch thi o Xóa: xóa sinh viên ra khỏi lịch thi

16 Giao diện Form đánh số báo danh

 Ở giao diện này, cho phép đánh số báo danh tư động cho sinh viên trong 1 đợ t thi nhất định

 Chức năng: o Thực hiện: đánh số báo danh tự động cho sinh viên o Xóa SBD: xóa số báo danh của sinh viên

17 Giao diện Form qu ản lý điể m thi c a sinh viên ủ

 Tại đây hệ thống yêu c u ch ầ ọn đợt thi để ể hi n th ị điể m c ủa sinh viên

 Sau khi ch ọn đợ t thi có giao di n: ệ

 Giao diện này cho phép người dùng có thể cập nhật thêm, sửa, xóa thông tin Điểm

 Các ch ức năng trên giao diệ n:

• Thêm mớ i: hệ th ống cho phép ngườ i dùng thêm mới kết quả thi của sinh viên

Giao diện Form thông tin cán bộ

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Cán bộ Tại đây, có thể xe, thông tin chi tiết về các Cán b ộ

 Các ch ức năng chính:

Để quản lý thông tin cán bộ, bạn có thể thực hiện các thao tác sau: Thêm mới thông tin bằng cách gọi tới form thêm/sửa thông tin Nếu cần sửa đổi, hãy gọi tới form sửa thông tin Đối với việc xóa thông tin, bạn có thể xóa thông tin cán bộ trên danh sách, nhưng lưu ý rằng nếu có ràng buộc liên quan, thao tác xóa sẽ không thể thực hiện.

12 Giao diện Form thêm/ s a thông tin cán b ử ộ

 Tại đây người dùng tạo lịch thi tự động cho 1 cán bộ

 Chức năng: o Tạo: thêm m i 1 cán b v ớ ộ ới đầu đủ thông tin đã điền o Xóa: xóa sinh viện được chon ở Form thông tin cán bộ

13 Giao diên Form thông tin Phòng thi

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Phòng thi Tại đây, có thể xe, thông tin chi tiết về các Phòng thi

Các chức năng chính bao gồm: Thêm mới, cho phép người dùng truy cập vào form để thêm hoặc sửa thông tin; Sửa, gọi tới form để cập nhật thông tin hiện có; và Xóa, cho phép người dùng xóa thông tin Phòng thi khỏi danh sách, tuy nhiên nếu có ràng buộc liên quan thì không thể thực hiện thao tác xóa.

14 Giao diện Form thêm/ s a thông tin Phòng thi ử

 Tại đây người dùng tạo lịch thi tự động cho 1 phòng

21 o Tạo: thêm m i 1 phòng v ớ ới đầu đủ thông tin đã điền o Xóa: xóa sinh viện được chon ở Form thông tin phòng

15 Giao diện Form X p phòng thi cho sinh viên ế

Để quản lý lịch thi hiệu quả, bạn cần chọn đợt hiển thị lịch thi đã tạo hoặc tạo mới lịch thi cho mỗi phòng thi, với số lượng tối đa là 30 sinh viên Sau khi lựa chọn lịch thi và sắp xếp phòng, bạn sẽ thấy giao diện tương ứng để tiếp tục các bước tiếp theo.

22 o Tạo: th ực hiệ ự độ n t ng thêm sinh viên vào l ịch thi đã tạ ở o rm t o l fo ạ ịch thi o Xóa: xóa sinh viên ra khỏi lịch thi

16 Giao diện Form đánh số báo danh

 Ở giao diện này, cho phép đánh số báo danh tư động cho sinh viên trong 1 đợ t thi nhất định

 Chức năng: o Thực hiện: đánh số báo danh tự động cho sinh viên o Xóa SBD: xóa số báo danh của sinh viên

17 Giao diện Form qu ản lý điể m thi c a sinh viên ủ

 Tại đây hệ thống yêu c u ch ầ ọn đợt thi để ể hi n th ị điể m c ủa sinh viên

 Sau khi ch ọn đợ t thi có giao di n: ệ

 Giao diện này cho phép người dùng có thể cập nhật thêm, sửa, xóa thông tin Điểm

 Các ch ức năng trên giao diệ n:

• Thêm mớ i: hệ th ống cho phép ngườ i dùng thêm mới kết quả thi của sinh viên

Giao diên Form thông tin Phòng thi

 Ở giao diện này cho phép người dùng có thể thêm/ sửa/ xóa thông tin Phòng thi Tại đây, có thể xe, thông tin chi tiết về các Phòng thi

Các chức năng chính bao gồm: Thêm mới thông tin bằng cách truy cập vào form thêm/sửa; Sửa thông tin cũng thông qua form này; và Xóa thông tin Phòng thi khỏi danh sách, tuy nhiên nếu có ràng buộc liên quan thì không thể thực hiện việc xóa.

14 Giao diện Form thêm/ s a thông tin Phòng thi ử

 Tại đây người dùng tạo lịch thi tự động cho 1 phòng

21 o Tạo: thêm m i 1 phòng v ớ ới đầu đủ thông tin đã điền o Xóa: xóa sinh viện được chon ở Form thông tin phòng

15 Giao diện Form X p phòng thi cho sinh viên ế

Để tạo lịch thi cho mỗi phòng thi có 30 sinh viên, bạn cần chọn đợt hiển thị lịch thi đã tạo hoặc tạo lịch thi mới Sau khi chọn lịch thi và sắp xếp phòng, bạn sẽ thấy giao diện hiển thị thông tin chi tiết.

22 o Tạo: th ực hiệ ự độ n t ng thêm sinh viên vào l ịch thi đã tạ ở o rm t o l fo ạ ịch thi o Xóa: xóa sinh viên ra khỏi lịch thi

16 Giao diện Form đánh số báo danh

 Ở giao diện này, cho phép đánh số báo danh tư động cho sinh viên trong 1 đợ t thi nhất định

 Chức năng: o Thực hiện: đánh số báo danh tự động cho sinh viên o Xóa SBD: xóa số báo danh của sinh viên

17 Giao diện Form qu ản lý điể m thi c a sinh viên ủ

 Tại đây hệ thống yêu c u ch ầ ọn đợt thi để ể hi n th ị điể m c ủa sinh viên

 Sau khi ch ọn đợ t thi có giao di n: ệ

 Giao diện này cho phép người dùng có thể cập nhật thêm, sửa, xóa thông tin Điểm

 Các ch ức năng trên giao diệ n:

• Thêm mớ i: hệ th ống cho phép ngườ i dùng thêm mới kết quả thi của sinh viên

Giao di ện Form đánh số báo danh

 Ở giao diện này, cho phép đánh số báo danh tư động cho sinh viên trong 1 đợ t thi nhất định

 Chức năng: o Thực hiện: đánh số báo danh tự động cho sinh viên o Xóa SBD: xóa số báo danh của sinh viên

Giao diện Form qu ản lý điể m thi c a sinh viên ủ

 Tại đây hệ thống yêu c u ch ầ ọn đợt thi để ể hi n th ị điể m c ủa sinh viên

 Sau khi ch ọn đợ t thi có giao di n: ệ

 Giao diện này cho phép người dùng có thể cập nhật thêm, sửa, xóa thông tin Điểm

 Các ch ức năng trên giao diệ n:

• Thêm mớ i: hệ th ống cho phép ngườ i dùng thêm mới kết quả thi của sinh viên

24 với điểm tb hay điểm đầ u ra của sinh viên sẽ tự động tính với đi ểm thi đầ u vào

• Sửa: sửa tất cả các mục trên form

• Lưu: lưu thay đổi sau khi thao tác nút thêm và sửa

• Xóa: xóa thông tin điểm trong danh sách.

Giao diện Form thông báo

Form này thông báo cho ta bi ết thự c hi n ch ệ ức năng thành công/ lỗi chương trình

MÃ NGUỒ N CỦA CÁC CH ỨC NĂNG

frmLoginUser.cs (ch ức năng quả n lý giao di ện login)

The code snippet provided is a C# program that includes essential namespaces such as System, System.Collections.Generic, and System.Windows.Forms It is part of the BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu project, which likely focuses on managing external language examination standards The use of these namespaces indicates functionality for data manipulation, user interface design, and graphical representation within the application.

} private void btnLoginUser_Click(object sender, EventArgs e)

LoginUser loginUser = new LoginUser(); if (loginUser.LoginUsers(txtUser.Text, txtPass.Text))

//System.Windows.MessageBox.Show("Xin Chào " + txtUser.Text, "Đăng Nhập Thành Công", MessageBoxButton.OK, MessageBoxImage.Warning);

//this.Hide(); this.DialogResult = DialogResult.OK;

//System.Windows.MessageBox.Show("Đăng nhập thành công!", "Thông Báo", MessageBoxButton.OK);

System.Windows.MessageBox.Show("Lỗi", "Sai thông tin đăng nhập", MessageBoxButton.YesNo, MessageBoxImage.Warning); txtPass.Clear(); txtUser.Clear(); txtUser.Focus();

29 private void btnShowPass_Click(object sender, EventArgs e) { this.btnShowPass.Visible = false; if (this.btnHidePass.Visible == false)

} private void btnHidePass_Click(object sender, EventArgs e) { this.btnHidePass.Visible = false; if (this.btnShowPass.Visible == false)

} private void lblForgotPassword_Click(object sender, EventArgs e) {

} private void lblRegisted_Click(object sender, EventArgs e) { this.Visible = false; frmRegisted registed = new frmRegisted(); if(registed.ShowDialog() == DialogResult.OK)

} private void btnCloseLogin_Click(object sender, EventArgs e) {

System.Windows.Forms.Application.Exit();

LoginUser.cs (xử lý logic chức năng login)

using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu { class LoginUser

QuanLyKyThiEntities db = new QuanLyKyThiEntities(); public bool LoginUsers(string username, string password) { var idAdmin = db.Admins.FirstOrDefault(a => a.tenDangNhap.Equals(username)); if (idAdmin != null)

{ if (idAdmin.matKhau.Equals(password)) return true; else return false;

5 Main.cs (qu n lý giao di n mành hình chính) ả ệ using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu

} private void Main_Load(object sender, EventArgs e)

{ this.Visible = false; frmLoginUser login = new frmLoginUser(); if (login.ShowDialog() == DialogResult.OK)

} private void miLogout_Click(object sender, EventArgs e)

{ this.Visible = false; frmLoginUser frmLogin = new frmLoginUser(); if(frmLogin.ShowDialog() == DialogResult.OK)

} private void tạoĐợtThiToolStripMenuItem_Click(object sender, EventArgs e) {

} private void tạoĐợtThiToolStripMenuItem_Click_1(object sender, EventArgs e) {

UC.UsDanhSachSV usDanhSachSV = new UC.UsDanhSachSV(); pnMain.Controls.Clear(); pnMain.Controls.Add(usDanhSachSV);

} private void tạoĐợtThiToolStripMenuItem1_Click(object sender, EventArgs e)

UC.KhoiTao.Dot_Thi.UcDotThi ucDotThi = new

UC.KhoiTao.Dot_Thi.UcDotThi(); pnMain.Controls.Clear(); pnMain.Controls.Add(ucDotThi);

} private void thíSinhToolStripMenuItem_Click(object sender, EventArgs e) {

UC.ChuanBi.ThiSinh.UcThiSinh ucThiSinh = new

UC.ChuanBi.ThiSinh.UcThiSinh(); pnMain.Controls.Clear(); pnMain.Controls.Add(ucThiSinh);

} private void cánBộToolStripMenuItem_Click(object sender, EventArgs e) {

UC.ChuanBi.UcCanBo ucCanBo = new UC.ChuanBi.UcCanBo(); pnMain.Controls.Clear(); pnMain.Controls.Add(ucCanBo);

} private void tạoĐềThiToolStripMenuItem_Click(object sender, EventArgs e) {

} private void phòngThiToolStripMenuItem_Click(object sender, EventArgs e) { pnMain.Controls.Clear();

UcPhongThi ucPhongThi = new UcPhongThi(); pnMain.Controls.Add(ucPhongThi);

} private void lớpToolStripMenuItem_Click(object sender, EventArgs e) { pnMain.Controls.Clear();

UC.DanhMuc.UcLop uc = new UC.DanhMuc.UcLop(); pnMain.Controls.Add(uc);

} private void khoaToolStripMenuItem_Click(object sender, EventArgs e) {

UC.DanhMuc.UcKhoa uc = new UC.DanhMuc.UcKhoa(); pnMain.Controls.Add(uc);

} private void khóaToolStripMenuItem_Click(object sender, EventArgs e) { pnMain.Controls.Clear();

UC.DanhMuc.UcKhoaHoc uc = new UC.DanhMuc.UcKhoaHoc(); pnMain.Controls.Add(uc);

} private void đánhSốBáoDanhToolStripMenuItem_Click(object sender, EventArgs e)

UC.ToChucThi.UcDanhSoBaoDanh uc = new UC.ToChucThi.UcDanhSoBaoDanh(); pnMain.Controls.Add(uc);

} private void xếpToolStripMenuItem_Click(object sender, EventArgs e) { pnMain.Controls.Clear();

UC.ToChucThi.UcXepPhongThi uc = new UC.ToChucThi.UcXepPhongThi(); pnMain.Controls.Add(uc);

} private void lịchThiToolStripMenuItem_Click(object sender, EventArgs e) { pnMain.Controls.Clear();

UC.ChuanBi.UcLichThi uc = new UcLichThi(); pnMain.Controls.Add(uc);

} private void quảnLýĐiểmToolStripMenuItem_Click(object sender, EventArgs e) { pnMain.Controls.Clear();

UC.TongKet.UcQuanLyDiem uc = new UC.TongKet.UcQuanLyDiem(); pnMain.Controls.Add(uc);

6 UcKhoa.cs (usercontrol xử lý thao tác các chức năng)

The code snippet is part of a C# project named "BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu," specifically within the User Control (UC) for managing categories It utilizes various namespaces, including EF for Entity Framework, and includes essential system libraries for functionality The class "UcKhoa" is defined as a partial class that inherits from UserControl, indicating it is designed for use in a graphical user interface.

InitializeComponent(); dgvKhoa.AutoGenerateColumns = false; clMaKhoa.DataPropertyName = "ma"; clTenKhoa.DataPropertyName = "ten"; clNamThanhLap.DataPropertyName = "nam";

DAO.DanhMuc.KhoaDao dao = new DAO.DanhMuc.KhoaDao(); dgvKhoa.DataSource = null; dgvKhoa.Rows.Clear(); dgvKhoa.DataSource = dao.GetAll().Select(x => new { ma = x.maKhoa, ten = x.tenKhoa, nam = x.namThanhLap,

{ txtMaKhoa.Clear(); txtTenKhoa.Clear(); txtNamThanhLap.Clear();

{ btnThem.Enabled = true; btnCapNhat.Enabled = false; btnXoa.Enabled = false; btnHuyThaoTac.Enabled = true;

{ btnThem.Enabled = false; btnCapNhat.Enabled = true; btnXoa.Enabled = true; btnHuyThaoTac.Enabled = true;

} private Khoa GetKhoa(Khoa khoa)

{ khoa.maKhoa = txtMaKhoa.Text.Trim(); khoa.tenKhoa = txtTenKhoa.Text.Trim(); khoa.namThanhLap = int.Parse(txtNamThanhLap.Text.Trim()); return khoa;

} private void UcKhoa_Load(object sender, EventArgs e)

} private void dgvKhoa_CellClick(object sender, DataGridViewCellEventArgs e) {

InactiveButton(); string maKhoa = dgvKhoa.CurrentRow.Cells["clMaKhoa"].Value.ToString(); DAO.DanhMuc.KhoaDao dao = new DAO.DanhMuc.KhoaDao();

Khoa khoa = dao.GetSingleByMaKhoa(maKhoa); txtMaKhoa.Text = khoa.maKhoa.Trim(); txtTenKhoa.Text = khoa.tenKhoa.Trim(); txtNamThanhLap.Text = khoa.namThanhLap.ToString().Trim();

} private void Noti(string msg, Notification.FrmNotification.enmType type)

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.DanhMuc.KhoaDao dao = new DAO.DanhMuc.KhoaDao();

Khoa khoa = new Khoa(); if (dao.Add(GetKhoa(khoa)))

ClearInput(); this.Noti(string.Format("Thêm khoa '{0}' thành công", khoa.tenKhoa), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Thêm khoa '{0} th t bấ ại'", khoa.tenKhoa), Notification.FrmNotification.enmType.Error);

} private void btnCapNhat_Click(object sender, EventArgs e)

To update the department information, the system prompts the user with a confirmation message displaying the department name If the user confirms by selecting "Yes," the process to change the information will proceed.

DAO.DanhMuc.KhoaDao dao = new DAO.DanhMuc.KhoaDao();

Khoa khoa = new Khoa(); if (dao.Edit(GetKhoa(khoa)))

ClearInput(); this.Noti(string.Format("Sửa thông tin Khoa '{0}' thành công", tenKhoa), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Sửa thông tin Khoa '{0}' thất bại", tenKhoa), Notification.FrmNotification.enmType.Error);

} private void btnXoa_Click(object sender, EventArgs e)

{ string tenKhoa = dgvKhoa.CurrentRow.Cells["clMaKhoa"].Value.ToString(); DialogResult result = MessageBox.Show(string.Format("Bạn có mu n xóa ố Khoa: '{0}'?", tenKhoa), "Thông báo", MessageBoxButtons.YesNo,

MessageBoxIcon.Question); if (result == DialogResult.Yes)

DAO.DanhMuc.KhoaDao dao = new DAO.DanhMuc.KhoaDao(); if (dao.Remove(tenKhoa))

ClearInput(); this.Noti(string.Format("Xóa Khoa '{0}' thành công", tenKhoa), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Xóa Khoa '{0} th t bấ ại'", tenKhoa), Notification.FrmNotification.enmType.Error);

} private void btnHuyThaoTac_Click(object sender, EventArgs e)

7 KhoaDAO.cs (x lý logic qu ử ản lý khoa) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF;

38 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.DanhMuc

} public List GetByMaKhoa(string ma)

{ return db_.Khoas.Where(x => x.maKhoa.Contains(ma)).ToList();

} public Khoa GetSingleByMaKhoa(string ma)

{ return db_.Khoas.Where(x => x.maKhoa.Contains(ma)).FirstOrDefault(); } public void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(Khoa Khoa)

{ db_.Khoas.Add(Khoa); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(Khoa Khoa)

Khoa findKhoa = GetSingleByMaKhoa(Khoa.maKhoa); findKhoa.maKhoa = Khoa.maKhoa; findKhoa.maKhoa = Khoa.maKhoa; findKhoa.namThanhLap = Khoa.namThanhLap; db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Remove(string ma)

{ foreach(Lop l in db_.Lops)

{ if (l.maKhoa == ma) db_.Lops.Remove(l);

Khoa findKhoa = GetSingleByMaKhoa(ma); foreach(CanBo i in db_.CanBoes)

{ if (i.maKhoa == findKhoa.maKhoa) db_.CanBoes.Remove(i);

} db_.Khoas.Remove(findKhoa); db_.SaveChanges();

40 this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

8 UcKhoaHoc.cs (x lý thao tác các ch ử ức năng) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.DanhMuc

InitializeComponent(); dgvKhoaHoc.AutoGenerateColumns = false; clMaKhoa.DataPropertyName = "ma"; clTenKhoa.DataPropertyName = "ten"; clKhoaHoc.DataPropertyName = "khoaHoc";

DAO.DanhMuc.KhoaHocDao dao = new DAO.DanhMuc.KhoaHocDao(); dgvKhoaHoc.DataSource = dao.GetAll().Select(x => new

{ ma = x.maKhoaHoc, ten = x.tenKhoaHoc, khoaHoc = string.Format("{0} - {1}", x.namBatDau , x.namKetThuc), }).ToList();

{ txtMaKhoa.Clear(); txtTenKhoa.Clear(); txtNamBatDau.Clear(); txtNamKetThuc.Clear();

{ btnThem.Enabled = true; btnCapNhat.Enabled = false; btnXoa.Enabled = false; btnHuyThaoTac.Enabled = true;

{ btnThem.Enabled = false; btnCapNhat.Enabled = true; btnXoa.Enabled = true; btnHuyThaoTac.Enabled = true;

} private KhoaHoc GetInfo(KhoaHoc kh)

{ kh.maKhoaHoc = txtMaKhoa.Text.Trim(); kh.tenKhoaHoc = txtTenKhoa.Text.Trim(); kh.namBatDau = int.Parse(txtNamBatDau.Text.Trim()); kh.namKetThuc = int.Parse(txtNamKetThuc.Text.Trim()); return kh;

} private void UcKhoaHoc_Load(object sender, EventArgs e)

} private void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification();

} private void btnThem_Click(object sender, EventArgs e)

DAO.DanhMuc.KhoaHocDao dao = new DAO.DanhMuc.KhoaHocDao();

KhoaHoc kh = new KhoaHoc(); if (dao.Add(GetInfo(kh)))

ClearInput(); this.Noti(string.Format("Thêm khoa '{0}' thành công", kh.tenKhoaHoc), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Thêm khoa '{0} th t bấ ại'", kh.tenKhoaHoc), Notification.FrmNotification.enmType.Error);

} private void btnCapNhat_Click(object sender, EventArgs e)

{ string tenKhoa dgvKhoaHoc.CurrentRow.Cells["clMaKhoa"].Value.ToString();

DialogResult result = MessageBox.Show(string.Format("Bạn có mu n thay ố đổi thông tin lớp: '{0}'?", tenKhoa), "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes)

DAO.DanhMuc.KhoaHocDao dao = new DAO.DanhMuc.KhoaHocDao(); KhoaHoc kh = new KhoaHoc(); if (dao.Edit(GetInfo(kh)))

ClearInput(); this.Noti(string.Format("Sửa thông tin l p '{0}' thành công", ớ tenKhoa), Notification.FrmNotification.enmType.Success);

43 this.Noti(string.Format("Sửa thông tin l p '{0}' th t b i", ớ ấ ạ tenKhoa), Notification.FrmNotification.enmType.Error);

} private void btnXoa_Click(object sender, EventArgs e)

{ string tenKhoa dgvKhoaHoc.CurrentRow.Cells["clMaKhoa"].Value.ToString();

DialogResult result = MessageBox.Show(string.Format("Bạn có mu n xóa ố lớp: '{0}'?", tenKhoa), "Thông báo", MessageBoxButtons.YesNo,

MessageBoxIcon.Question); if (result == DialogResult.Yes)

DAO.DanhMuc.KhoaHocDao dao = new DAO.DanhMuc.KhoaHocDao(); if (dao.Remove(tenKhoa))

ClearInput(); this.Noti(string.Format("Xóa l p '{0}' thành công"ớ , tenKhoa), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Xóa l p '{0} thớ ất bại'", tenKhoa), Notification.FrmNotification.enmType.Error);

} private void btnHuyThaoTac_Click(object sender, EventArgs e)

} private void dgvKhoaHoc_CellClick(object sender, DataGridViewCellEventArgs e)

44 string maKhoa dgvKhoaHoc.CurrentRow.Cells["clMaKhoa"].Value.ToString();

DAO.DanhMuc.KhoaHocDao dao = new DAO.DanhMuc.KhoaHocDao();

KhoaHoc khoa = dao.GetSingleById(maKhoa); txtMaKhoa.Text = khoa.maKhoaHoc.Trim(); txtTenKhoa.Text = khoa.tenKhoaHoc.Trim(); txtNamBatDau.Text = khoa.namBatDau.ToString().Trim(); txtNamKetThuc.Text = khoa.namKetThuc.ToString().Trim();

9 KhoaHocDAO.cs (xử lý logic quả n lý khóa h ọc) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.DanhMuc

} public List GetByName(string ten)

{ return db_.KhoaHocs.Where(x => x.tenKhoaHoc.Contains(ten)).ToList(); } public KhoaHoc GetSingleById(string id)

{ return db_.KhoaHocs.Where(x => x.maKhoaHoc.Contains(id)).FirstOrDefault();

} public void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification();

} public bool Add(KhoaHoc KhoaHoc)

{ db_.KhoaHocs.Add(KhoaHoc); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(KhoaHoc KhoaHoc)

KhoaHoc findKhoaHoc = GetSingleById(KhoaHoc.tenKhoaHoc); findKhoaHoc.tenKhoaHoc = KhoaHoc.tenKhoaHoc; findKhoaHoc.maKhoaHoc = KhoaHoc.maKhoaHoc; findKhoaHoc.namBatDau = KhoaHoc.namBatDau; findKhoaHoc.namKetThuc = KhoaHoc.namKetThuc; db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Remove(string ten)

KhoaHoc findKhoaHoc = GetSingleById(ten); db_.KhoaHocs.Remove(findKhoaHoc); db_.SaveChanges();

{ this.Noti(string.Format("Có l i xỗ ảy ra: {0}{1}",

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

10 UcLop.cs (xử lý thao tác chức năng trên giao diện) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.DanhMuc

InitializeComponent(); dgvLop.AutoGenerateColumns = false; clLop.DataPropertyName = "lop"; clKhoa.DataPropertyName = "khoa"; clKhoaHoc.DataPropertyName = "khoahoc";

DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao();

47 dgvLop.DataSource = dao.GetAll().Select(x => new

{ lop = x.tenLop, khoa = x.Khoa.tenKhoa, khoahoc = x.KhoaHoc.tenKhoaHoc,

In the provided code snippet, instances of `KhoaDao` and `KhoaHocDao` are created to manage data access for academic departments and courses The data sources for the combo boxes `cbMaKhoa` and `cbMaKhoaHoc` are cleared and set to null, ensuring a fresh start for populating them A loop iterates through all instances of `Khoa` retrieved from the `khoaDao`, preparing to update the user interface with the latest data.

{ cbMaKhoa.Items.Add(khoa.maKhoa);

} foreach (KhoaHoc khoaHoc in khoaHocDao.GetAll())

{ cbMaKhoaHoc.Items.Add(khoaHoc.maKhoaHoc);

{ txtTenLop.Clear(); cbMaKhoa.SelectedIndex = 0; cbMaKhoaHoc.SelectedIndex = 0;

{ btnThem.Enabled = true; btnCapNhat.Enabled = false; btnXoa.Enabled = false; btnHuyThaoTac.Enabled = true;

{ btnThem.Enabled = false; btnCapNhat.Enabled = true; btnXoa.Enabled = true;

} private Lop GetLop(Lop lop)

{ lop.tenLop = txtTenLop.Text.Trim(); lop.maKhoa = cbMaKhoa.SelectedItem.ToString().Trim(); lop.maKhoaHoc = cbMaKhoaHoc.SelectedItem.ToString().Trim(); return lop;

} private void UcLop_Load(object sender, EventArgs e)

} private void dgvLop_CellClick(object sender, DataGridViewCellEventArgs e) {

InactiveButton(); string tenLop = dgvLop.CurrentRow.Cells["clLop"].Value.ToString(); DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao();

Lop lop = dao.GetSingleByName(tenLop); txtTenLop.Text = lop.tenLop.Trim(); cbMaKhoa.Text = lop.maKhoa.Trim(); cbMaKhoaHoc.Text = lop.maKhoaHoc.Trim();

} private void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao();

Lop lop = new Lop(); if (dao.Add(GetLop(lop)))

49 this.Noti(string.Format("Thêm l p '{0}' thành công"ớ ,lop.tenLop), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Thêm l p '{0} th t bớ ấ ại'", lop.tenLop), Notification.FrmNotification.enmType.Error);

} private void btnCapNhat_Click(object sender, EventArgs e)

In the code snippet, the variable `tenLop` retrieves the current class information from a data grid view A message box prompts the user to confirm if they want to change the details of the class, displaying the name of the class If the user selects "Yes," the program proceeds with the update.

DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao();

Lop lop = new Lop(); if (dao.Edit(GetLop(lop)))

ClearInput(); this.Noti(string.Format("Sửa thông tin l p '{0}' thành công", ớ tenLop), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Sửa thông tin l p '{0}' th t b i", ớ ấ ạ tenLop), Notification.FrmNotification.enmType.Error);

} private void btnXoa_Click(object sender, EventArgs e)

{ string tenLop = dgvLop.CurrentRow.Cells["clLop"].Value.ToString(); DialogResult result = MessageBox.Show(string.Format("Bạn có mu n xóa ố lớp: '{0}'?", tenLop), "Thông báo", MessageBoxButtons.YesNo,

MessageBoxIcon.Question); if(result == DialogResult.Yes)

DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao(); if (dao.Remove(tenLop))

ClearInput(); this.Noti(string.Format("Xóa l p '{0}' thành công"ớ , tenLop), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Xóa l p '{0} thớ ất bại'", tenLop), Notification.FrmNotification.enmType.Error);

} private void btnHuyThaoTac_Click(object sender, EventArgs e)

11 LopDAO.cs (x lý logic qu n lý l ử ả ớp) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.DanhMuc

} public List GetByName(string ten)

{ return db_.Lops.Where(x => x.tenLop.Contains(ten)).ToList();

} public Lop GetSingleByName(string ten)

{ return db_.Lops.Where(x => x.tenLop.Contains(ten)).FirstOrDefault(); } public void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(Lop lop)

{ db_.Lops.Add(lop); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(Lop lop)

Lop findLop = GetSingleByName(lop.tenLop); findLop.tenLop = lop.tenLop; findLop.maKhoa = lop.maKhoa; findLop.maKhoaHoc = lop.maKhoaHoc; db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Remove(string ten)

{ foreach(SinhVien sv in db_.SinhViens)

{ if (sv.tenLop == ten) db_.SinhViens.Remove(sv);

Lop findLop = GetSingleByName(ten); db_.Lops.Remove(findLop); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

12 UcDotThi.cs (xử lý thao tác chức năng trên giao diệ n qu ản lý đợ t thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;

53 namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.KhoiTao.Dot_Thi { public partial classUcDotThi : UserControl

InitializeComponent(); dgvListDotThi.AutoGenerateColumns = false; clTenDotThi.DataPropertyName = "TenDotThi"; clIDDotThi.DataPropertyName = "MaDotThi"; clNgayBatDau.DataPropertyName = "NgayBatDau"; clNgayKetThuc.DataPropertyName = "NgayKetThuc"; clNguoiTao.DataPropertyName = "TenNguoiTao";

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); dgvListDotThi.DataSource = dao.GetAll().Select(x => new {

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void UcDotThi_Load(object sender, EventArgs e)

} private void txtSearch_TextChanged(object sender, EventArgs e)

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); var id = dao.GetByIdDot(text);

{ this.Noti("Không t n tồ ại đợt thi!",

{ dgvListDotThi.DataSource = id.Select(x => new {

} private void tnAdd_Click(object sender, EventArgs e)

UC.KhoiTao.Dot_Thi.FrmAddEditDotThi frm = new FrmAddEditDotThi("Thêm Mới Đợt Thi"); frm.ShowDialog(); if (frm.IsSave)

} private void btnEdit_Click(object sender, EventArgs e)

{ string idDotThi dgvListDotThi.CurrentRow.Cells["clIDDotThi"].Value.ToString();

UC.KhoiTao.Dot_Thi.FrmAddEditDotThi frm = new FrmAddEditDotThi("Sửa Thông Tin Đợt Thi", idDotThi); frm.ShowDialog(); if (frm.IsSave)

} private void btnRemove_Click(object sender, EventArgs e)

55 string idDotThi dgvListDotThi.CurrentRow.Cells["clIDDotThi"].Value.ToString(); string tenDt dgvListDotThi.CurrentRow.Cells["clTenDotThi"].Value.ToString();

DialogResult result = MessageBox.Show(string.Format("Bạn có mu n xóa ố {0}", tenDt), "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if(result == DialogResult.Yes)

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); if (dao.Remove(idDotThi))

Noti(string.Format("Xóa đợt thi {0} thành công!", tenDt), Notification.FrmNotification.enmType.Success);

Noti(string.Format("Xóa đợt thi {0} thất bại!", tenDt), Notification.FrmNotification.enmType.Error);

13 FrmAddEditDotThi.cs (xử lý thao tác các chức năng thêm/ sửa đợ t thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.KhoiTao; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.KhoiTao.Dot_Thi { public partial classFrmAddEditDotThi : Form

56 public bool IsSave { get => isSave_; set => isSave_ = value; } public FrmAddEditDotThi(string title)

InitializeComponent(); lbTitle.Text = title; dtpNgayBatDau.Value = DateTime.Now; dtpNgayKetThuc.Value = DateTime.Now;

} public FrmAddEditDotThi(string title, string maDt)

InitializeComponent(); lbTitle.Text = title; txtMaDotThi.Enabled = false; dtpNgayBatDau.Value = DateTime.Now; dtpNgayKetThuc.Value = DateTime.Now;

EF.DotThi find = dao.GetSingleByIdDot(maDt); txtTieuDe.Text = find.tenDotThi; txtMaDotThi.Text = find.maDotThi; txtNguoiTao.Text = find.Admin.hoTen; dtpNgayBatDau.Value = find.ngayBatDau; dtpNgayKetThuc.Value = find.ngayKetThuc;

} private EF.DotThi GetInfo(EF.DotThi dotThi)

{ dotThi.maDotThi = txtMaDotThi.Text.Trim(); dotThi.tenDotThi = txtTieuDe.Text.Trim(); dotThi.ngayBatDau = (DateTime)dtpNgayBatDau.Value; dotThi.ngayKetThuc = (DateTime)dtpNgayKetThuc.Value; dotThi.idAdmin = txtNguoiTao.Text; return dotThi;

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

57 private void btnThem_Click(object sender, EventArgs e)

DAO.KhoiTao.DotThiDao dao = new DotThiDao();

EF.DotThi info = new EF.DotThi(); if (lbTitle.Text.Contains("Thêm"))

{ if (dao.Add(GetInfo(info)))

} else if (lbTitle.Text.Contains("Sửa"))

{ if (dao.Edit(GetInfo(info)))

Noti(string.Format("{0} đợt thi '{1}' thành công", info.maDotThi = string.Empty ? "Thêm" : "Sửa", info.tenDotThi),

Notification.FrmNotification.enmType.Success); this.Close();

Noti(string.Format("{0} đợt thi '{1}' thất bại", info.maDotThi = string.Empty ? "Thêm" : "Sửa", info.tenDotThi),

} private void btnHuy_Click(object sender, EventArgs e)

14 DotThiDAO.cs (x lý logic qu ử ản lý đợ t thi)

The code snippet initializes a class named `DotThiDao` that inherits from `BaseDao` within the `BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.KhoiTao` namespace This implementation utilizes the Entity Framework and includes necessary system libraries for functionality, such as collections and Windows Forms.

} public List GetByIdDot(string id)

{ return db_.DotThis.Where(x => x.maDotThi.Contains(id)).ToList(); } public DotThi GetSigleByName(string id)

{ return db_.DotThis.Where(x => x.tenDotThi.Contains(id)).FirstOrDefault();

} public DotThi GetSingleByIdDot(string id)

{ return db_.DotThis.Where(x => x.maDotThi==id).FirstOrDefault(); }

59 private void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(DotThi dt)

{ db_.DotThis.Add(dt); db_.SaveChanges();

{ string error = ex.Message; this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả ,

Environment.NewLine, error), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(DotThi dt)

DotThi find = GetSingleByIdDot(dt.maDotThi); find.maDotThi = dt.maDotThi; find.tenDotThi = dt.tenDotThi; find.ngayBatDau = dt.ngayBatDau; find.ngayKetThuc = dt.ngayKetThuc; db_.SaveChanges();

{ string error = ex.Message; this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả ,

Environment.NewLine, error), Notification.FrmNotification.enmType.Error); return false;

60 public bool Remove(string maDotThi)

DotThi find = GetSingleByIdDot(maDotThi); db_.DotThis.Remove(find); db_.SaveChanges();

MessageBox.Show(string.Format("Có l i x y ra {0} {1}"ỗ ả ,

Environment.NewLine, error), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return false;

15 UcLichThi.cs (x lý thao tác trên các ch ử ức năng quản lý lị ch thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi

{ private string maDotThi_; public string MaDotThi_ { get => maDotThi_; set => maDotThi_ = value; } public UcLichThi()

61 dgvLichThi.RowHeadersVisible = true; dgvLichThi.RowHeadersWidth = 21; clStt.DataPropertyName = "stt"; clNgayThi.DataPropertyName = "ngayThi"; clBuoi.DataPropertyName = "buoiThi"; clCa.DataPropertyName = "caThi"; clPhong.DataPropertyName = "phongThi"; clTietBD.DataPropertyName = "tietBd"; clSoTiet.DataPropertyName = "soTiet";

{ cbDotThi.Items.Clear(); cbDotThi.DataSource = null;

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); foreach(DotThi dt in dao.GetAll())

{ cbDotThi.Items.Add(dt.maDotThi);

} private void LoadDataGridView(string id)

DAO.KhoiTao.DotThiDao dotThiDao = new DAO.KhoiTao.DotThiDao(); DAO.ChuanBi.PhongThiDao phongThiDao = new DAO.ChuanBi.PhongThiDao(); DAO.ChuanBi.LichThiDao dao = new

The DAO retrieves all relevant data using methods from dotThiDao and phongThiDao, including exam schedules, sessions, and rooms The data source for dgvLichThi is set by selecting specific attributes from the exam details based on the provided id, which includes the exam date, session name, shift name, room name, start period, and total periods.

} private void UcLichThi_Load(object sender, EventArgs e)

} private void cbDotThi_SelectedIndexChanged(object sender, EventArgs e) { string id = cbDotThi.SelectedItem.ToString();

DAO.ChuanBi.LichThiDao dao = new DAO.ChuanBi.LichThiDao(); if (dao.GetByIdDotThi(id).Count() > 0)

LoadDataGridView(id); btnTao.Enabled = false;

{ btnTao.Enabled = true; dgvLichThi.Visible = false;

} private void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnTao_Click(object sender, EventArgs e)

{ string id = cbDotThi.SelectedItem.ToString();

DAO.KhoiTao.DotThiDao dotThiDao = new DAO.KhoiTao.DotThiDao(); DAO.ChuanBi.PhongThiDao phongThiDao = new DAO.ChuanBi.PhongThiDao(); DAO.ChuanBi.LichThiDao dao = new

DAO.ChuanBi.LichThiDao(dotThiDao.GetAll(), dotThiDao.GetBuoiThis(), dotThiDao.GetCaThis(), phongThiDao.GetAll()); if (dao.Add(id))

{ btnTao.Enabled = false; dgvLichThi.Visible = true;

63 private void btnXoa_Click(object sender, EventArgs e)

{ string id = cbDotThi.SelectedItem.ToString();

DAO.ChuanBi.LichThiDao dao = new DAO.ChuanBi.LichThiDao(); if (dao.Remove(id))

{ btnTao.Enabled = true; dgvLichThi.Visible = false; this.Noti(string.Format("Xóa thành công l ch thi cị ủa đợt '{0}'!", id), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Xóa th t b i l ch thi cấ ạ ị ủa đợt '{0}'!", id), Notification.FrmNotification.enmType.Error);

16 LichThiDao.cs ( x lý logic qu ử ản lý lịch thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ChuanBi

List phongThis_; public LichThiDao(List dotThis, List buoiThis, List caThis, List phongThis)

{ dotThis_ = dotThis; buoiThis_ = buoiThis; caThis_ = caThis;

} public List GetByIdDotThi(string idDotThi)

{ return db_.LichThis.Where(x => x.maDotThi == idDotThi).ToList(); }

// duy t ngày t tháng dén ệ ừ private IEnumerable EachDay(DateTime from, DateTime thru) { for (var day = from.Date; day.Date new { ma = x.maKhoa, ten = x.tenKhoa, nam = x.namThanhLap,

{ txtMaKhoa.Clear(); txtTenKhoa.Clear(); txtNamThanhLap.Clear();

{ btnThem.Enabled = true; btnCapNhat.Enabled = false; btnXoa.Enabled = false; btnHuyThaoTac.Enabled = true;

{ btnThem.Enabled = false; btnCapNhat.Enabled = true; btnXoa.Enabled = true; btnHuyThaoTac.Enabled = true;

} private Khoa GetKhoa(Khoa khoa)

{ khoa.maKhoa = txtMaKhoa.Text.Trim(); khoa.tenKhoa = txtTenKhoa.Text.Trim(); khoa.namThanhLap = int.Parse(txtNamThanhLap.Text.Trim()); return khoa;

} private void UcKhoa_Load(object sender, EventArgs e)

} private void dgvKhoa_CellClick(object sender, DataGridViewCellEventArgs e) {

InactiveButton(); string maKhoa = dgvKhoa.CurrentRow.Cells["clMaKhoa"].Value.ToString(); DAO.DanhMuc.KhoaDao dao = new DAO.DanhMuc.KhoaDao();

Khoa khoa = dao.GetSingleByMaKhoa(maKhoa); txtMaKhoa.Text = khoa.maKhoa.Trim(); txtTenKhoa.Text = khoa.tenKhoa.Trim(); txtNamThanhLap.Text = khoa.namThanhLap.ToString().Trim();

} private void Noti(string msg, Notification.FrmNotification.enmType type)

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.DanhMuc.KhoaDao dao = new DAO.DanhMuc.KhoaDao();

Khoa khoa = new Khoa(); if (dao.Add(GetKhoa(khoa)))

ClearInput(); this.Noti(string.Format("Thêm khoa '{0}' thành công", khoa.tenKhoa), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Thêm khoa '{0} th t bấ ại'", khoa.tenKhoa), Notification.FrmNotification.enmType.Error);

} private void btnCapNhat_Click(object sender, EventArgs e)

To update the department information, the system retrieves the current department code from the selected row in the data grid view A confirmation message prompts the user with the question, "Do you want to change the information for department: '{departmentCode}'?" If the user confirms by selecting "Yes," the process will proceed with the update.

DAO.DanhMuc.KhoaDao dao = new DAO.DanhMuc.KhoaDao();

Khoa khoa = new Khoa(); if (dao.Edit(GetKhoa(khoa)))

ClearInput(); this.Noti(string.Format("Sửa thông tin Khoa '{0}' thành công", tenKhoa), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Sửa thông tin Khoa '{0}' thất bại", tenKhoa), Notification.FrmNotification.enmType.Error);

} private void btnXoa_Click(object sender, EventArgs e)

{ string tenKhoa = dgvKhoa.CurrentRow.Cells["clMaKhoa"].Value.ToString(); DialogResult result = MessageBox.Show(string.Format("Bạn có mu n xóa ố Khoa: '{0}'?", tenKhoa), "Thông báo", MessageBoxButtons.YesNo,

MessageBoxIcon.Question); if (result == DialogResult.Yes)

DAO.DanhMuc.KhoaDao dao = new DAO.DanhMuc.KhoaDao(); if (dao.Remove(tenKhoa))

ClearInput(); this.Noti(string.Format("Xóa Khoa '{0}' thành công", tenKhoa), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Xóa Khoa '{0} th t bấ ại'", tenKhoa), Notification.FrmNotification.enmType.Error);

} private void btnHuyThaoTac_Click(object sender, EventArgs e)

7 KhoaDAO.cs (x lý logic qu ử ản lý khoa) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF;

38 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.DanhMuc

} public List GetByMaKhoa(string ma)

{ return db_.Khoas.Where(x => x.maKhoa.Contains(ma)).ToList();

} public Khoa GetSingleByMaKhoa(string ma)

{ return db_.Khoas.Where(x => x.maKhoa.Contains(ma)).FirstOrDefault(); } public void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(Khoa Khoa)

{ db_.Khoas.Add(Khoa); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(Khoa Khoa)

Khoa findKhoa = GetSingleByMaKhoa(Khoa.maKhoa); findKhoa.maKhoa = Khoa.maKhoa; findKhoa.maKhoa = Khoa.maKhoa; findKhoa.namThanhLap = Khoa.namThanhLap; db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Remove(string ma)

{ foreach(Lop l in db_.Lops)

{ if (l.maKhoa == ma) db_.Lops.Remove(l);

Khoa findKhoa = GetSingleByMaKhoa(ma); foreach(CanBo i in db_.CanBoes)

{ if (i.maKhoa == findKhoa.maKhoa) db_.CanBoes.Remove(i);

} db_.Khoas.Remove(findKhoa); db_.SaveChanges();

40 this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

8 UcKhoaHoc.cs (x lý thao tác các ch ử ức năng) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.DanhMuc

InitializeComponent(); dgvKhoaHoc.AutoGenerateColumns = false; clMaKhoa.DataPropertyName = "ma"; clTenKhoa.DataPropertyName = "ten"; clKhoaHoc.DataPropertyName = "khoaHoc";

DAO.DanhMuc.KhoaHocDao dao = new DAO.DanhMuc.KhoaHocDao(); dgvKhoaHoc.DataSource = dao.GetAll().Select(x => new

{ ma = x.maKhoaHoc, ten = x.tenKhoaHoc, khoaHoc = string.Format("{0} - {1}", x.namBatDau , x.namKetThuc), }).ToList();

{ txtMaKhoa.Clear(); txtTenKhoa.Clear(); txtNamBatDau.Clear(); txtNamKetThuc.Clear();

{ btnThem.Enabled = true; btnCapNhat.Enabled = false; btnXoa.Enabled = false; btnHuyThaoTac.Enabled = true;

{ btnThem.Enabled = false; btnCapNhat.Enabled = true; btnXoa.Enabled = true; btnHuyThaoTac.Enabled = true;

} private KhoaHoc GetInfo(KhoaHoc kh)

{ kh.maKhoaHoc = txtMaKhoa.Text.Trim(); kh.tenKhoaHoc = txtTenKhoa.Text.Trim(); kh.namBatDau = int.Parse(txtNamBatDau.Text.Trim()); kh.namKetThuc = int.Parse(txtNamKetThuc.Text.Trim()); return kh;

} private void UcKhoaHoc_Load(object sender, EventArgs e)

} private void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification();

} private void btnThem_Click(object sender, EventArgs e)

DAO.DanhMuc.KhoaHocDao dao = new DAO.DanhMuc.KhoaHocDao();

KhoaHoc kh = new KhoaHoc(); if (dao.Add(GetInfo(kh)))

ClearInput(); this.Noti(string.Format("Thêm khoa '{0}' thành công", kh.tenKhoaHoc), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Thêm khoa '{0} th t bấ ại'", kh.tenKhoaHoc), Notification.FrmNotification.enmType.Error);

} private void btnCapNhat_Click(object sender, EventArgs e)

{ string tenKhoa dgvKhoaHoc.CurrentRow.Cells["clMaKhoa"].Value.ToString();

DialogResult result = MessageBox.Show(string.Format("Bạn có mu n thay ố đổi thông tin lớp: '{0}'?", tenKhoa), "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes)

DAO.DanhMuc.KhoaHocDao dao = new DAO.DanhMuc.KhoaHocDao(); KhoaHoc kh = new KhoaHoc(); if (dao.Edit(GetInfo(kh)))

ClearInput(); this.Noti(string.Format("Sửa thông tin l p '{0}' thành công", ớ tenKhoa), Notification.FrmNotification.enmType.Success);

43 this.Noti(string.Format("Sửa thông tin l p '{0}' th t b i", ớ ấ ạ tenKhoa), Notification.FrmNotification.enmType.Error);

} private void btnXoa_Click(object sender, EventArgs e)

{ string tenKhoa dgvKhoaHoc.CurrentRow.Cells["clMaKhoa"].Value.ToString();

DialogResult result = MessageBox.Show(string.Format("Bạn có mu n xóa ố lớp: '{0}'?", tenKhoa), "Thông báo", MessageBoxButtons.YesNo,

MessageBoxIcon.Question); if (result == DialogResult.Yes)

DAO.DanhMuc.KhoaHocDao dao = new DAO.DanhMuc.KhoaHocDao(); if (dao.Remove(tenKhoa))

ClearInput(); this.Noti(string.Format("Xóa l p '{0}' thành công"ớ , tenKhoa), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Xóa l p '{0} thớ ất bại'", tenKhoa), Notification.FrmNotification.enmType.Error);

} private void btnHuyThaoTac_Click(object sender, EventArgs e)

} private void dgvKhoaHoc_CellClick(object sender, DataGridViewCellEventArgs e)

44 string maKhoa dgvKhoaHoc.CurrentRow.Cells["clMaKhoa"].Value.ToString();

DAO.DanhMuc.KhoaHocDao dao = new DAO.DanhMuc.KhoaHocDao();

KhoaHoc khoa = dao.GetSingleById(maKhoa); txtMaKhoa.Text = khoa.maKhoaHoc.Trim(); txtTenKhoa.Text = khoa.tenKhoaHoc.Trim(); txtNamBatDau.Text = khoa.namBatDau.ToString().Trim(); txtNamKetThuc.Text = khoa.namKetThuc.ToString().Trim();

9 KhoaHocDAO.cs (xử lý logic quả n lý khóa h ọc) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.DanhMuc

} public List GetByName(string ten)

{ return db_.KhoaHocs.Where(x => x.tenKhoaHoc.Contains(ten)).ToList(); } public KhoaHoc GetSingleById(string id)

{ return db_.KhoaHocs.Where(x => x.maKhoaHoc.Contains(id)).FirstOrDefault();

} public void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification();

} public bool Add(KhoaHoc KhoaHoc)

{ db_.KhoaHocs.Add(KhoaHoc); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(KhoaHoc KhoaHoc)

KhoaHoc findKhoaHoc = GetSingleById(KhoaHoc.tenKhoaHoc); findKhoaHoc.tenKhoaHoc = KhoaHoc.tenKhoaHoc; findKhoaHoc.maKhoaHoc = KhoaHoc.maKhoaHoc; findKhoaHoc.namBatDau = KhoaHoc.namBatDau; findKhoaHoc.namKetThuc = KhoaHoc.namKetThuc; db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Remove(string ten)

KhoaHoc findKhoaHoc = GetSingleById(ten); db_.KhoaHocs.Remove(findKhoaHoc); db_.SaveChanges();

{ this.Noti(string.Format("Có l i xỗ ảy ra: {0}{1}",

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

10 UcLop.cs (xử lý thao tác chức năng trên giao diện) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.DanhMuc

InitializeComponent(); dgvLop.AutoGenerateColumns = false; clLop.DataPropertyName = "lop"; clKhoa.DataPropertyName = "khoa"; clKhoaHoc.DataPropertyName = "khoahoc";

DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao();

47 dgvLop.DataSource = dao.GetAll().Select(x => new

{ lop = x.tenLop, khoa = x.Khoa.tenKhoa, khoahoc = x.KhoaHoc.tenKhoaHoc,

In the given code, instances of `KhoaDao` and `KhoaHocDao` are created to manage educational departments and courses The data sources for the combo boxes `cbMaKhoa` and `cbMaKhoaHoc` are reset by setting them to null and clearing their items Subsequently, a loop iterates through all instances of `Khoa` retrieved from the `khoaDao.GetAll()` method, preparing to populate the combo boxes with the relevant data.

{ cbMaKhoa.Items.Add(khoa.maKhoa);

} foreach (KhoaHoc khoaHoc in khoaHocDao.GetAll())

{ cbMaKhoaHoc.Items.Add(khoaHoc.maKhoaHoc);

{ txtTenLop.Clear(); cbMaKhoa.SelectedIndex = 0; cbMaKhoaHoc.SelectedIndex = 0;

{ btnThem.Enabled = true; btnCapNhat.Enabled = false; btnXoa.Enabled = false; btnHuyThaoTac.Enabled = true;

{ btnThem.Enabled = false; btnCapNhat.Enabled = true; btnXoa.Enabled = true;

} private Lop GetLop(Lop lop)

{ lop.tenLop = txtTenLop.Text.Trim(); lop.maKhoa = cbMaKhoa.SelectedItem.ToString().Trim(); lop.maKhoaHoc = cbMaKhoaHoc.SelectedItem.ToString().Trim(); return lop;

} private void UcLop_Load(object sender, EventArgs e)

} private void dgvLop_CellClick(object sender, DataGridViewCellEventArgs e) {

InactiveButton(); string tenLop = dgvLop.CurrentRow.Cells["clLop"].Value.ToString(); DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao();

Lop lop = dao.GetSingleByName(tenLop); txtTenLop.Text = lop.tenLop.Trim(); cbMaKhoa.Text = lop.maKhoa.Trim(); cbMaKhoaHoc.Text = lop.maKhoaHoc.Trim();

} private void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao();

Lop lop = new Lop(); if (dao.Add(GetLop(lop)))

49 this.Noti(string.Format("Thêm l p '{0}' thành công"ớ ,lop.tenLop), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Thêm l p '{0} th t bớ ấ ại'", lop.tenLop), Notification.FrmNotification.enmType.Error);

} private void btnCapNhat_Click(object sender, EventArgs e)

To update class information, a confirmation message is displayed, asking, "Do you want to change the information for class: '{className}'?" If the user selects "Yes," the process to modify the class details will proceed.

DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao();

Lop lop = new Lop(); if (dao.Edit(GetLop(lop)))

ClearInput(); this.Noti(string.Format("Sửa thông tin l p '{0}' thành công", ớ tenLop), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Sửa thông tin l p '{0}' th t b i", ớ ấ ạ tenLop), Notification.FrmNotification.enmType.Error);

} private void btnXoa_Click(object sender, EventArgs e)

{ string tenLop = dgvLop.CurrentRow.Cells["clLop"].Value.ToString(); DialogResult result = MessageBox.Show(string.Format("Bạn có mu n xóa ố lớp: '{0}'?", tenLop), "Thông báo", MessageBoxButtons.YesNo,

MessageBoxIcon.Question); if(result == DialogResult.Yes)

DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao(); if (dao.Remove(tenLop))

ClearInput(); this.Noti(string.Format("Xóa l p '{0}' thành công"ớ , tenLop), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Xóa l p '{0} thớ ất bại'", tenLop), Notification.FrmNotification.enmType.Error);

} private void btnHuyThaoTac_Click(object sender, EventArgs e)

11 LopDAO.cs (x lý logic qu n lý l ử ả ớp) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.DanhMuc

} public List GetByName(string ten)

{ return db_.Lops.Where(x => x.tenLop.Contains(ten)).ToList();

} public Lop GetSingleByName(string ten)

{ return db_.Lops.Where(x => x.tenLop.Contains(ten)).FirstOrDefault(); } public void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(Lop lop)

{ db_.Lops.Add(lop); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(Lop lop)

Lop findLop = GetSingleByName(lop.tenLop); findLop.tenLop = lop.tenLop; findLop.maKhoa = lop.maKhoa; findLop.maKhoaHoc = lop.maKhoaHoc; db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Remove(string ten)

{ foreach(SinhVien sv in db_.SinhViens)

{ if (sv.tenLop == ten) db_.SinhViens.Remove(sv);

Lop findLop = GetSingleByName(ten); db_.Lops.Remove(findLop); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

12 UcDotThi.cs (xử lý thao tác chức năng trên giao diệ n qu ản lý đợ t thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;

53 namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.KhoiTao.Dot_Thi { public partial classUcDotThi : UserControl

InitializeComponent(); dgvListDotThi.AutoGenerateColumns = false; clTenDotThi.DataPropertyName = "TenDotThi"; clIDDotThi.DataPropertyName = "MaDotThi"; clNgayBatDau.DataPropertyName = "NgayBatDau"; clNgayKetThuc.DataPropertyName = "NgayKetThuc"; clNguoiTao.DataPropertyName = "TenNguoiTao";

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); dgvListDotThi.DataSource = dao.GetAll().Select(x => new {

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void UcDotThi_Load(object sender, EventArgs e)

} private void txtSearch_TextChanged(object sender, EventArgs e)

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); var id = dao.GetByIdDot(text);

{ this.Noti("Không t n tồ ại đợt thi!",

{ dgvListDotThi.DataSource = id.Select(x => new {

} private void tnAdd_Click(object sender, EventArgs e)

UC.KhoiTao.Dot_Thi.FrmAddEditDotThi frm = new FrmAddEditDotThi("Thêm Mới Đợt Thi"); frm.ShowDialog(); if (frm.IsSave)

} private void btnEdit_Click(object sender, EventArgs e)

{ string idDotThi dgvListDotThi.CurrentRow.Cells["clIDDotThi"].Value.ToString();

UC.KhoiTao.Dot_Thi.FrmAddEditDotThi frm = new FrmAddEditDotThi("Sửa Thông Tin Đợt Thi", idDotThi); frm.ShowDialog(); if (frm.IsSave)

} private void btnRemove_Click(object sender, EventArgs e)

55 string idDotThi dgvListDotThi.CurrentRow.Cells["clIDDotThi"].Value.ToString(); string tenDt dgvListDotThi.CurrentRow.Cells["clTenDotThi"].Value.ToString();

DialogResult result = MessageBox.Show(string.Format("Bạn có mu n xóa ố {0}", tenDt), "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if(result == DialogResult.Yes)

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); if (dao.Remove(idDotThi))

Noti(string.Format("Xóa đợt thi {0} thành công!", tenDt), Notification.FrmNotification.enmType.Success);

Noti(string.Format("Xóa đợt thi {0} thất bại!", tenDt), Notification.FrmNotification.enmType.Error);

13 FrmAddEditDotThi.cs (xử lý thao tác các chức năng thêm/ sửa đợ t thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.KhoiTao; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.KhoiTao.Dot_Thi { public partial classFrmAddEditDotThi : Form

56 public bool IsSave { get => isSave_; set => isSave_ = value; } public FrmAddEditDotThi(string title)

InitializeComponent(); lbTitle.Text = title; dtpNgayBatDau.Value = DateTime.Now; dtpNgayKetThuc.Value = DateTime.Now;

} public FrmAddEditDotThi(string title, string maDt)

InitializeComponent(); lbTitle.Text = title; txtMaDotThi.Enabled = false; dtpNgayBatDau.Value = DateTime.Now; dtpNgayKetThuc.Value = DateTime.Now;

EF.DotThi find = dao.GetSingleByIdDot(maDt); txtTieuDe.Text = find.tenDotThi; txtMaDotThi.Text = find.maDotThi; txtNguoiTao.Text = find.Admin.hoTen; dtpNgayBatDau.Value = find.ngayBatDau; dtpNgayKetThuc.Value = find.ngayKetThuc;

} private EF.DotThi GetInfo(EF.DotThi dotThi)

{ dotThi.maDotThi = txtMaDotThi.Text.Trim(); dotThi.tenDotThi = txtTieuDe.Text.Trim(); dotThi.ngayBatDau = (DateTime)dtpNgayBatDau.Value; dotThi.ngayKetThuc = (DateTime)dtpNgayKetThuc.Value; dotThi.idAdmin = txtNguoiTao.Text; return dotThi;

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

57 private void btnThem_Click(object sender, EventArgs e)

DAO.KhoiTao.DotThiDao dao = new DotThiDao();

EF.DotThi info = new EF.DotThi(); if (lbTitle.Text.Contains("Thêm"))

{ if (dao.Add(GetInfo(info)))

} else if (lbTitle.Text.Contains("Sửa"))

{ if (dao.Edit(GetInfo(info)))

Noti(string.Format("{0} đợt thi '{1}' thành công", info.maDotThi = string.Empty ? "Thêm" : "Sửa", info.tenDotThi),

Notification.FrmNotification.enmType.Success); this.Close();

Noti(string.Format("{0} đợt thi '{1}' thất bại", info.maDotThi = string.Empty ? "Thêm" : "Sửa", info.tenDotThi),

} private void btnHuy_Click(object sender, EventArgs e)

14 DotThiDAO.cs (x lý logic qu ử ản lý đợ t thi)

The article discusses the implementation of a class named "DotThiDao" within the BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu project It utilizes Entity Framework for database management and includes essential namespaces such as System and System.Windows.Forms The class extends from "BaseDao," indicating a structured approach to data access and manipulation in the context of managing foreign language examination processes.

} public List GetByIdDot(string id)

{ return db_.DotThis.Where(x => x.maDotThi.Contains(id)).ToList(); } public DotThi GetSigleByName(string id)

{ return db_.DotThis.Where(x => x.tenDotThi.Contains(id)).FirstOrDefault();

} public DotThi GetSingleByIdDot(string id)

{ return db_.DotThis.Where(x => x.maDotThi==id).FirstOrDefault(); }

59 private void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(DotThi dt)

{ db_.DotThis.Add(dt); db_.SaveChanges();

{ string error = ex.Message; this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả ,

Environment.NewLine, error), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(DotThi dt)

DotThi find = GetSingleByIdDot(dt.maDotThi); find.maDotThi = dt.maDotThi; find.tenDotThi = dt.tenDotThi; find.ngayBatDau = dt.ngayBatDau; find.ngayKetThuc = dt.ngayKetThuc; db_.SaveChanges();

{ string error = ex.Message; this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả ,

Environment.NewLine, error), Notification.FrmNotification.enmType.Error); return false;

60 public bool Remove(string maDotThi)

DotThi find = GetSingleByIdDot(maDotThi); db_.DotThis.Remove(find); db_.SaveChanges();

MessageBox.Show(string.Format("Có l i x y ra {0} {1}"ỗ ả ,

Environment.NewLine, error), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return false;

15 UcLichThi.cs (x lý thao tác trên các ch ử ức năng quản lý lị ch thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi

{ private string maDotThi_; public string MaDotThi_ { get => maDotThi_; set => maDotThi_ = value; } public UcLichThi()

61 dgvLichThi.RowHeadersVisible = true; dgvLichThi.RowHeadersWidth = 21; clStt.DataPropertyName = "stt"; clNgayThi.DataPropertyName = "ngayThi"; clBuoi.DataPropertyName = "buoiThi"; clCa.DataPropertyName = "caThi"; clPhong.DataPropertyName = "phongThi"; clTietBD.DataPropertyName = "tietBd"; clSoTiet.DataPropertyName = "soTiet";

{ cbDotThi.Items.Clear(); cbDotThi.DataSource = null;

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); foreach(DotThi dt in dao.GetAll())

{ cbDotThi.Items.Add(dt.maDotThi);

} private void LoadDataGridView(string id)

DAO.KhoiTao.DotThiDao dotThiDao = new DAO.KhoiTao.DotThiDao(); DAO.ChuanBi.PhongThiDao phongThiDao = new DAO.ChuanBi.PhongThiDao(); DAO.ChuanBi.LichThiDao dao = new

The DAO retrieves data from various sources, including exam schedules and room information It populates the data grid view with exam details by selecting the exam date, session name, shift name, room name, start time, and total periods from the specified exam ID.

} private void UcLichThi_Load(object sender, EventArgs e)

} private void cbDotThi_SelectedIndexChanged(object sender, EventArgs e) { string id = cbDotThi.SelectedItem.ToString();

DAO.ChuanBi.LichThiDao dao = new DAO.ChuanBi.LichThiDao(); if (dao.GetByIdDotThi(id).Count() > 0)

LoadDataGridView(id); btnTao.Enabled = false;

{ btnTao.Enabled = true; dgvLichThi.Visible = false;

} private void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnTao_Click(object sender, EventArgs e)

{ string id = cbDotThi.SelectedItem.ToString();

DAO.KhoiTao.DotThiDao dotThiDao = new DAO.KhoiTao.DotThiDao(); DAO.ChuanBi.PhongThiDao phongThiDao = new DAO.ChuanBi.PhongThiDao(); DAO.ChuanBi.LichThiDao dao = new

DAO.ChuanBi.LichThiDao(dotThiDao.GetAll(), dotThiDao.GetBuoiThis(), dotThiDao.GetCaThis(), phongThiDao.GetAll()); if (dao.Add(id))

{ btnTao.Enabled = false; dgvLichThi.Visible = true;

63 private void btnXoa_Click(object sender, EventArgs e)

{ string id = cbDotThi.SelectedItem.ToString();

DAO.ChuanBi.LichThiDao dao = new DAO.ChuanBi.LichThiDao(); if (dao.Remove(id))

{ btnTao.Enabled = true; dgvLichThi.Visible = false; this.Noti(string.Format("Xóa thành công l ch thi cị ủa đợt '{0}'!", id), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Xóa th t b i l ch thi cấ ạ ị ủa đợt '{0}'!", id), Notification.FrmNotification.enmType.Error);

16 LichThiDao.cs ( x lý logic qu ử ản lý lịch thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ChuanBi

List phongThis_; public LichThiDao(List dotThis, List buoiThis, List caThis, List phongThis)

{ dotThis_ = dotThis; buoiThis_ = buoiThis; caThis_ = caThis;

} public List GetByIdDotThi(string idDotThi)

{ return db_.LichThis.Where(x => x.maDotThi == idDotThi).ToList(); }

// duy t ngày t tháng dén ệ ừ private IEnumerable EachDay(DateTime from, DateTime thru) { for (var day = from.Date; day.Date x.tenKhoaHoc.Contains(ten)).ToList(); } public KhoaHoc GetSingleById(string id)

{ return db_.KhoaHocs.Where(x => x.maKhoaHoc.Contains(id)).FirstOrDefault();

} public void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification();

} public bool Add(KhoaHoc KhoaHoc)

{ db_.KhoaHocs.Add(KhoaHoc); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(KhoaHoc KhoaHoc)

KhoaHoc findKhoaHoc = GetSingleById(KhoaHoc.tenKhoaHoc); findKhoaHoc.tenKhoaHoc = KhoaHoc.tenKhoaHoc; findKhoaHoc.maKhoaHoc = KhoaHoc.maKhoaHoc; findKhoaHoc.namBatDau = KhoaHoc.namBatDau; findKhoaHoc.namKetThuc = KhoaHoc.namKetThuc; db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Remove(string ten)

KhoaHoc findKhoaHoc = GetSingleById(ten); db_.KhoaHocs.Remove(findKhoaHoc); db_.SaveChanges();

{ this.Noti(string.Format("Có l i xỗ ảy ra: {0}{1}",

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

UcLop.cs (xử lý thao tác ch ức năng trên giao di ện)

The BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu project utilizes various namespaces including System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, and System.Windows.Forms This project is focused on managing foreign language exam standards and is categorized under the UC.DanhMuc section.

InitializeComponent(); dgvLop.AutoGenerateColumns = false; clLop.DataPropertyName = "lop"; clKhoa.DataPropertyName = "khoa"; clKhoaHoc.DataPropertyName = "khoahoc";

DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao();

47 dgvLop.DataSource = dao.GetAll().Select(x => new

{ lop = x.tenLop, khoa = x.Khoa.tenKhoa, khoahoc = x.KhoaHoc.tenKhoaHoc,

In the given code snippet, instances of `KhoaDao` and `KhoaHocDao` are created to manage data related to educational departments and courses The dropdown lists for departments (`cbMaKhoa`) and courses (`cbMaKhoaHoc`) are cleared and set to null to prepare for new data A loop iterates through all available departments retrieved from `khoaDao.GetAll()`, ensuring that the interface is updated with the most current information.

{ cbMaKhoa.Items.Add(khoa.maKhoa);

} foreach (KhoaHoc khoaHoc in khoaHocDao.GetAll())

{ cbMaKhoaHoc.Items.Add(khoaHoc.maKhoaHoc);

{ txtTenLop.Clear(); cbMaKhoa.SelectedIndex = 0; cbMaKhoaHoc.SelectedIndex = 0;

{ btnThem.Enabled = true; btnCapNhat.Enabled = false; btnXoa.Enabled = false; btnHuyThaoTac.Enabled = true;

{ btnThem.Enabled = false; btnCapNhat.Enabled = true; btnXoa.Enabled = true;

} private Lop GetLop(Lop lop)

{ lop.tenLop = txtTenLop.Text.Trim(); lop.maKhoa = cbMaKhoa.SelectedItem.ToString().Trim(); lop.maKhoaHoc = cbMaKhoaHoc.SelectedItem.ToString().Trim(); return lop;

} private void UcLop_Load(object sender, EventArgs e)

} private void dgvLop_CellClick(object sender, DataGridViewCellEventArgs e) {

InactiveButton(); string tenLop = dgvLop.CurrentRow.Cells["clLop"].Value.ToString(); DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao();

Lop lop = dao.GetSingleByName(tenLop); txtTenLop.Text = lop.tenLop.Trim(); cbMaKhoa.Text = lop.maKhoa.Trim(); cbMaKhoaHoc.Text = lop.maKhoaHoc.Trim();

} private void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao();

Lop lop = new Lop(); if (dao.Add(GetLop(lop)))

49 this.Noti(string.Format("Thêm l p '{0}' thành công"ớ ,lop.tenLop), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Thêm l p '{0} th t bớ ấ ại'", lop.tenLop), Notification.FrmNotification.enmType.Error);

} private void btnCapNhat_Click(object sender, EventArgs e)

The code snippet retrieves the current class name from a data grid view and prompts the user with a confirmation message asking if they want to change the information for that class If the user selects "Yes," the process to update the class information will proceed.

DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao();

Lop lop = new Lop(); if (dao.Edit(GetLop(lop)))

ClearInput(); this.Noti(string.Format("Sửa thông tin l p '{0}' thành công", ớ tenLop), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Sửa thông tin l p '{0}' th t b i", ớ ấ ạ tenLop), Notification.FrmNotification.enmType.Error);

} private void btnXoa_Click(object sender, EventArgs e)

{ string tenLop = dgvLop.CurrentRow.Cells["clLop"].Value.ToString(); DialogResult result = MessageBox.Show(string.Format("Bạn có mu n xóa ố lớp: '{0}'?", tenLop), "Thông báo", MessageBoxButtons.YesNo,

MessageBoxIcon.Question); if(result == DialogResult.Yes)

DAO.DanhMuc.LopDao dao = new DAO.DanhMuc.LopDao(); if (dao.Remove(tenLop))

ClearInput(); this.Noti(string.Format("Xóa l p '{0}' thành công"ớ , tenLop), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Xóa l p '{0} thớ ất bại'", tenLop), Notification.FrmNotification.enmType.Error);

} private void btnHuyThaoTac_Click(object sender, EventArgs e)

11 LopDAO.cs (x lý logic qu n lý l ử ả ớp) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.DanhMuc

} public List GetByName(string ten)

{ return db_.Lops.Where(x => x.tenLop.Contains(ten)).ToList();

} public Lop GetSingleByName(string ten)

{ return db_.Lops.Where(x => x.tenLop.Contains(ten)).FirstOrDefault(); } public void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(Lop lop)

{ db_.Lops.Add(lop); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(Lop lop)

Lop findLop = GetSingleByName(lop.tenLop); findLop.tenLop = lop.tenLop; findLop.maKhoa = lop.maKhoa; findLop.maKhoaHoc = lop.maKhoaHoc; db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Remove(string ten)

{ foreach(SinhVien sv in db_.SinhViens)

{ if (sv.tenLop == ten) db_.SinhViens.Remove(sv);

Lop findLop = GetSingleByName(ten); db_.Lops.Remove(findLop); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra: {0}{1}"ỗ ả ,

Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

12 UcDotThi.cs (xử lý thao tác chức năng trên giao diệ n qu ản lý đợ t thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;

53 namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.KhoiTao.Dot_Thi { public partial classUcDotThi : UserControl

InitializeComponent(); dgvListDotThi.AutoGenerateColumns = false; clTenDotThi.DataPropertyName = "TenDotThi"; clIDDotThi.DataPropertyName = "MaDotThi"; clNgayBatDau.DataPropertyName = "NgayBatDau"; clNgayKetThuc.DataPropertyName = "NgayKetThuc"; clNguoiTao.DataPropertyName = "TenNguoiTao";

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); dgvListDotThi.DataSource = dao.GetAll().Select(x => new {

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void UcDotThi_Load(object sender, EventArgs e)

} private void txtSearch_TextChanged(object sender, EventArgs e)

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); var id = dao.GetByIdDot(text);

{ this.Noti("Không t n tồ ại đợt thi!",

{ dgvListDotThi.DataSource = id.Select(x => new {

} private void tnAdd_Click(object sender, EventArgs e)

UC.KhoiTao.Dot_Thi.FrmAddEditDotThi frm = new FrmAddEditDotThi("Thêm Mới Đợt Thi"); frm.ShowDialog(); if (frm.IsSave)

} private void btnEdit_Click(object sender, EventArgs e)

{ string idDotThi dgvListDotThi.CurrentRow.Cells["clIDDotThi"].Value.ToString();

UC.KhoiTao.Dot_Thi.FrmAddEditDotThi frm = new FrmAddEditDotThi("Sửa Thông Tin Đợt Thi", idDotThi); frm.ShowDialog(); if (frm.IsSave)

} private void btnRemove_Click(object sender, EventArgs e)

55 string idDotThi dgvListDotThi.CurrentRow.Cells["clIDDotThi"].Value.ToString(); string tenDt dgvListDotThi.CurrentRow.Cells["clTenDotThi"].Value.ToString();

DialogResult result = MessageBox.Show(string.Format("Bạn có mu n xóa ố {0}", tenDt), "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if(result == DialogResult.Yes)

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); if (dao.Remove(idDotThi))

Noti(string.Format("Xóa đợt thi {0} thành công!", tenDt), Notification.FrmNotification.enmType.Success);

Noti(string.Format("Xóa đợt thi {0} thất bại!", tenDt), Notification.FrmNotification.enmType.Error);

13 FrmAddEditDotThi.cs (xử lý thao tác các chức năng thêm/ sửa đợ t thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.KhoiTao; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.KhoiTao.Dot_Thi { public partial classFrmAddEditDotThi : Form

56 public bool IsSave { get => isSave_; set => isSave_ = value; } public FrmAddEditDotThi(string title)

InitializeComponent(); lbTitle.Text = title; dtpNgayBatDau.Value = DateTime.Now; dtpNgayKetThuc.Value = DateTime.Now;

} public FrmAddEditDotThi(string title, string maDt)

InitializeComponent(); lbTitle.Text = title; txtMaDotThi.Enabled = false; dtpNgayBatDau.Value = DateTime.Now; dtpNgayKetThuc.Value = DateTime.Now;

EF.DotThi find = dao.GetSingleByIdDot(maDt); txtTieuDe.Text = find.tenDotThi; txtMaDotThi.Text = find.maDotThi; txtNguoiTao.Text = find.Admin.hoTen; dtpNgayBatDau.Value = find.ngayBatDau; dtpNgayKetThuc.Value = find.ngayKetThuc;

} private EF.DotThi GetInfo(EF.DotThi dotThi)

{ dotThi.maDotThi = txtMaDotThi.Text.Trim(); dotThi.tenDotThi = txtTieuDe.Text.Trim(); dotThi.ngayBatDau = (DateTime)dtpNgayBatDau.Value; dotThi.ngayKetThuc = (DateTime)dtpNgayKetThuc.Value; dotThi.idAdmin = txtNguoiTao.Text; return dotThi;

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

57 private void btnThem_Click(object sender, EventArgs e)

DAO.KhoiTao.DotThiDao dao = new DotThiDao();

EF.DotThi info = new EF.DotThi(); if (lbTitle.Text.Contains("Thêm"))

{ if (dao.Add(GetInfo(info)))

} else if (lbTitle.Text.Contains("Sửa"))

{ if (dao.Edit(GetInfo(info)))

Noti(string.Format("{0} đợt thi '{1}' thành công", info.maDotThi = string.Empty ? "Thêm" : "Sửa", info.tenDotThi),

Notification.FrmNotification.enmType.Success); this.Close();

Noti(string.Format("{0} đợt thi '{1}' thất bại", info.maDotThi = string.Empty ? "Thêm" : "Sửa", info.tenDotThi),

} private void btnHuy_Click(object sender, EventArgs e)

14 DotThiDAO.cs (x lý logic qu ử ản lý đợ t thi)

The article discusses the implementation of the `DotThiDao` class within the `BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu` namespace, which utilizes Entity Framework for managing external language examination processes It includes essential using directives for necessary namespaces such as `System`, `System.Collections.Generic`, and `System.Windows.Forms` The `DotThiDao` class inherits from `BaseDao`, establishing a foundation for data access operations related to examination management.

} public List GetByIdDot(string id)

{ return db_.DotThis.Where(x => x.maDotThi.Contains(id)).ToList(); } public DotThi GetSigleByName(string id)

{ return db_.DotThis.Where(x => x.tenDotThi.Contains(id)).FirstOrDefault();

} public DotThi GetSingleByIdDot(string id)

{ return db_.DotThis.Where(x => x.maDotThi==id).FirstOrDefault(); }

59 private void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(DotThi dt)

{ db_.DotThis.Add(dt); db_.SaveChanges();

{ string error = ex.Message; this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả ,

Environment.NewLine, error), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(DotThi dt)

DotThi find = GetSingleByIdDot(dt.maDotThi); find.maDotThi = dt.maDotThi; find.tenDotThi = dt.tenDotThi; find.ngayBatDau = dt.ngayBatDau; find.ngayKetThuc = dt.ngayKetThuc; db_.SaveChanges();

{ string error = ex.Message; this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả ,

Environment.NewLine, error), Notification.FrmNotification.enmType.Error); return false;

60 public bool Remove(string maDotThi)

DotThi find = GetSingleByIdDot(maDotThi); db_.DotThis.Remove(find); db_.SaveChanges();

MessageBox.Show(string.Format("Có l i x y ra {0} {1}"ỗ ả ,

Environment.NewLine, error), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return false;

15 UcLichThi.cs (x lý thao tác trên các ch ử ức năng quản lý lị ch thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi

{ private string maDotThi_; public string MaDotThi_ { get => maDotThi_; set => maDotThi_ = value; } public UcLichThi()

61 dgvLichThi.RowHeadersVisible = true; dgvLichThi.RowHeadersWidth = 21; clStt.DataPropertyName = "stt"; clNgayThi.DataPropertyName = "ngayThi"; clBuoi.DataPropertyName = "buoiThi"; clCa.DataPropertyName = "caThi"; clPhong.DataPropertyName = "phongThi"; clTietBD.DataPropertyName = "tietBd"; clSoTiet.DataPropertyName = "soTiet";

{ cbDotThi.Items.Clear(); cbDotThi.DataSource = null;

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); foreach(DotThi dt in dao.GetAll())

{ cbDotThi.Items.Add(dt.maDotThi);

} private void LoadDataGridView(string id)

DAO.KhoiTao.DotThiDao dotThiDao = new DAO.KhoiTao.DotThiDao(); DAO.ChuanBi.PhongThiDao phongThiDao = new DAO.ChuanBi.PhongThiDao(); DAO.ChuanBi.LichThiDao dao = new

The DAO retrieves all relevant data from the examination schedules, including the current session and room information The data source for the grid view is set to display the examination details based on the specified ID, showcasing the exam date, session name, time slot, room name, start period, and total periods.

} private void UcLichThi_Load(object sender, EventArgs e)

} private void cbDotThi_SelectedIndexChanged(object sender, EventArgs e) { string id = cbDotThi.SelectedItem.ToString();

DAO.ChuanBi.LichThiDao dao = new DAO.ChuanBi.LichThiDao(); if (dao.GetByIdDotThi(id).Count() > 0)

LoadDataGridView(id); btnTao.Enabled = false;

{ btnTao.Enabled = true; dgvLichThi.Visible = false;

} private void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnTao_Click(object sender, EventArgs e)

{ string id = cbDotThi.SelectedItem.ToString();

DAO.KhoiTao.DotThiDao dotThiDao = new DAO.KhoiTao.DotThiDao(); DAO.ChuanBi.PhongThiDao phongThiDao = new DAO.ChuanBi.PhongThiDao(); DAO.ChuanBi.LichThiDao dao = new

DAO.ChuanBi.LichThiDao(dotThiDao.GetAll(), dotThiDao.GetBuoiThis(), dotThiDao.GetCaThis(), phongThiDao.GetAll()); if (dao.Add(id))

{ btnTao.Enabled = false; dgvLichThi.Visible = true;

63 private void btnXoa_Click(object sender, EventArgs e)

{ string id = cbDotThi.SelectedItem.ToString();

DAO.ChuanBi.LichThiDao dao = new DAO.ChuanBi.LichThiDao(); if (dao.Remove(id))

{ btnTao.Enabled = true; dgvLichThi.Visible = false; this.Noti(string.Format("Xóa thành công l ch thi cị ủa đợt '{0}'!", id), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Xóa th t b i l ch thi cấ ạ ị ủa đợt '{0}'!", id), Notification.FrmNotification.enmType.Error);

16 LichThiDao.cs ( x lý logic qu ử ản lý lịch thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ChuanBi

List phongThis_; public LichThiDao(List dotThis, List buoiThis, List caThis, List phongThis)

{ dotThis_ = dotThis; buoiThis_ = buoiThis; caThis_ = caThis;

} public List GetByIdDotThi(string idDotThi)

{ return db_.LichThis.Where(x => x.maDotThi == idDotThi).ToList(); }

// duy t ngày t tháng dén ệ ừ private IEnumerable EachDay(DateTime from, DateTime thru) { for (var day = from.Date; day.Date isSave; set => isSave = value; } public FrmThiSinhAddEdit()

InitializeComponent(); lbTitle.Text = "Thêm M i Sinh Viên"ớ ;

InitializeComponent(); lbTitle.Text = "Cập nh t thông tin"ậ ; txtMsv.Enabled = false;

To retrieve student information, the method `GetSingleByIdSv(msv)` is used to find the student by their ID The student's ID, full name, phone number, gender, date of birth, and class name are then displayed in the respective text fields: `txtMsv`, `txtHoTen`, `txtSDT`, `cbGioiTinh`, `dtpNgaySinh`, and `txtLop`.

} private SinhVien GetInfo(SinhVien sv)

UcDotThi.cs (xử lý thao tác ch ức năng trên giao diệ n qu ản lý đợ t thi)

The article discusses the use of the BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF framework in a NET application It incorporates essential namespaces such as System, System.Collections.Generic, and System.Windows.Forms to facilitate data management and user interface development The implementation focuses on enhancing functionality through efficient data handling and streamlined processes within the application environment.

53 namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.KhoiTao.Dot_Thi { public partial classUcDotThi : UserControl

InitializeComponent(); dgvListDotThi.AutoGenerateColumns = false; clTenDotThi.DataPropertyName = "TenDotThi"; clIDDotThi.DataPropertyName = "MaDotThi"; clNgayBatDau.DataPropertyName = "NgayBatDau"; clNgayKetThuc.DataPropertyName = "NgayKetThuc"; clNguoiTao.DataPropertyName = "TenNguoiTao";

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); dgvListDotThi.DataSource = dao.GetAll().Select(x => new {

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void UcDotThi_Load(object sender, EventArgs e)

} private void txtSearch_TextChanged(object sender, EventArgs e)

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); var id = dao.GetByIdDot(text);

{ this.Noti("Không t n tồ ại đợt thi!",

{ dgvListDotThi.DataSource = id.Select(x => new {

} private void tnAdd_Click(object sender, EventArgs e)

UC.KhoiTao.Dot_Thi.FrmAddEditDotThi frm = new FrmAddEditDotThi("Thêm Mới Đợt Thi"); frm.ShowDialog(); if (frm.IsSave)

} private void btnEdit_Click(object sender, EventArgs e)

{ string idDotThi dgvListDotThi.CurrentRow.Cells["clIDDotThi"].Value.ToString();

UC.KhoiTao.Dot_Thi.FrmAddEditDotThi frm = new FrmAddEditDotThi("Sửa Thông Tin Đợt Thi", idDotThi); frm.ShowDialog(); if (frm.IsSave)

} private void btnRemove_Click(object sender, EventArgs e)

55 string idDotThi dgvListDotThi.CurrentRow.Cells["clIDDotThi"].Value.ToString(); string tenDt dgvListDotThi.CurrentRow.Cells["clTenDotThi"].Value.ToString();

DialogResult result = MessageBox.Show(string.Format("Bạn có mu n xóa ố {0}", tenDt), "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if(result == DialogResult.Yes)

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); if (dao.Remove(idDotThi))

Noti(string.Format("Xóa đợt thi {0} thành công!", tenDt), Notification.FrmNotification.enmType.Success);

Noti(string.Format("Xóa đợt thi {0} thất bại!", tenDt), Notification.FrmNotification.enmType.Error);

FrmAddEditDotThi.cs (xử lý thao tác các ch ức năng thêm/ sửa đợ t thi)

The code snippet begins by importing necessary namespaces for a NET application, specifically for managing external language exam schedules It defines a partial class named `FrmAddEditDotThi`, which inherits from the `Form` class, indicating that it is part of a Windows Forms application This setup suggests that the class is designed to facilitate the addition and editing of exam periods within the context of the application's functionality.

56 public bool IsSave { get => isSave_; set => isSave_ = value; } public FrmAddEditDotThi(string title)

InitializeComponent(); lbTitle.Text = title; dtpNgayBatDau.Value = DateTime.Now; dtpNgayKetThuc.Value = DateTime.Now;

} public FrmAddEditDotThi(string title, string maDt)

InitializeComponent(); lbTitle.Text = title; txtMaDotThi.Enabled = false; dtpNgayBatDau.Value = DateTime.Now; dtpNgayKetThuc.Value = DateTime.Now;

EF.DotThi find = dao.GetSingleByIdDot(maDt); txtTieuDe.Text = find.tenDotThi; txtMaDotThi.Text = find.maDotThi; txtNguoiTao.Text = find.Admin.hoTen; dtpNgayBatDau.Value = find.ngayBatDau; dtpNgayKetThuc.Value = find.ngayKetThuc;

} private EF.DotThi GetInfo(EF.DotThi dotThi)

{ dotThi.maDotThi = txtMaDotThi.Text.Trim(); dotThi.tenDotThi = txtTieuDe.Text.Trim(); dotThi.ngayBatDau = (DateTime)dtpNgayBatDau.Value; dotThi.ngayKetThuc = (DateTime)dtpNgayKetThuc.Value; dotThi.idAdmin = txtNguoiTao.Text; return dotThi;

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

57 private void btnThem_Click(object sender, EventArgs e)

DAO.KhoiTao.DotThiDao dao = new DotThiDao();

EF.DotThi info = new EF.DotThi(); if (lbTitle.Text.Contains("Thêm"))

{ if (dao.Add(GetInfo(info)))

} else if (lbTitle.Text.Contains("Sửa"))

{ if (dao.Edit(GetInfo(info)))

Noti(string.Format("{0} đợt thi '{1}' thành công", info.maDotThi = string.Empty ? "Thêm" : "Sửa", info.tenDotThi),

Notification.FrmNotification.enmType.Success); this.Close();

Noti(string.Format("{0} đợt thi '{1}' thất bại", info.maDotThi = string.Empty ? "Thêm" : "Sửa", info.tenDotThi),

} private void btnHuy_Click(object sender, EventArgs e)

14 DotThiDAO.cs (x lý logic qu ử ản lý đợ t thi)

The code snippet demonstrates the use of the BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF namespace, which is essential for managing external language examination tasks It includes necessary system libraries and establishes a class named DotThiDao that inherits from BaseDao, indicating a structured approach to data access within the application.

} public List GetByIdDot(string id)

{ return db_.DotThis.Where(x => x.maDotThi.Contains(id)).ToList(); } public DotThi GetSigleByName(string id)

{ return db_.DotThis.Where(x => x.tenDotThi.Contains(id)).FirstOrDefault();

} public DotThi GetSingleByIdDot(string id)

{ return db_.DotThis.Where(x => x.maDotThi==id).FirstOrDefault(); }

59 private void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(DotThi dt)

{ db_.DotThis.Add(dt); db_.SaveChanges();

{ string error = ex.Message; this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả ,

Environment.NewLine, error), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(DotThi dt)

DotThi find = GetSingleByIdDot(dt.maDotThi); find.maDotThi = dt.maDotThi; find.tenDotThi = dt.tenDotThi; find.ngayBatDau = dt.ngayBatDau; find.ngayKetThuc = dt.ngayKetThuc; db_.SaveChanges();

{ string error = ex.Message; this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả ,

Environment.NewLine, error), Notification.FrmNotification.enmType.Error); return false;

60 public bool Remove(string maDotThi)

DotThi find = GetSingleByIdDot(maDotThi); db_.DotThis.Remove(find); db_.SaveChanges();

MessageBox.Show(string.Format("Có l i x y ra {0} {1}"ỗ ả ,

Environment.NewLine, error), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return false;

15 UcLichThi.cs (x lý thao tác trên các ch ử ức năng quản lý lị ch thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi

{ private string maDotThi_; public string MaDotThi_ { get => maDotThi_; set => maDotThi_ = value; } public UcLichThi()

61 dgvLichThi.RowHeadersVisible = true; dgvLichThi.RowHeadersWidth = 21; clStt.DataPropertyName = "stt"; clNgayThi.DataPropertyName = "ngayThi"; clBuoi.DataPropertyName = "buoiThi"; clCa.DataPropertyName = "caThi"; clPhong.DataPropertyName = "phongThi"; clTietBD.DataPropertyName = "tietBd"; clSoTiet.DataPropertyName = "soTiet";

{ cbDotThi.Items.Clear(); cbDotThi.DataSource = null;

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); foreach(DotThi dt in dao.GetAll())

{ cbDotThi.Items.Add(dt.maDotThi);

} private void LoadDataGridView(string id)

DAO.KhoiTao.DotThiDao dotThiDao = new DAO.KhoiTao.DotThiDao(); DAO.ChuanBi.PhongThiDao phongThiDao = new DAO.ChuanBi.PhongThiDao(); DAO.ChuanBi.LichThiDao dao = new

The DAO class retrieves data for the exam schedule by calling methods to get all exam sessions, current sessions, and rooms The data source for the grid view is set to display the exam details, including the date, session name, shift name, room name, start time, and total periods, based on the selected exam ID.

} private void UcLichThi_Load(object sender, EventArgs e)

} private void cbDotThi_SelectedIndexChanged(object sender, EventArgs e) { string id = cbDotThi.SelectedItem.ToString();

DAO.ChuanBi.LichThiDao dao = new DAO.ChuanBi.LichThiDao(); if (dao.GetByIdDotThi(id).Count() > 0)

LoadDataGridView(id); btnTao.Enabled = false;

{ btnTao.Enabled = true; dgvLichThi.Visible = false;

} private void Noti(string msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnTao_Click(object sender, EventArgs e)

{ string id = cbDotThi.SelectedItem.ToString();

DAO.KhoiTao.DotThiDao dotThiDao = new DAO.KhoiTao.DotThiDao(); DAO.ChuanBi.PhongThiDao phongThiDao = new DAO.ChuanBi.PhongThiDao(); DAO.ChuanBi.LichThiDao dao = new

DAO.ChuanBi.LichThiDao(dotThiDao.GetAll(), dotThiDao.GetBuoiThis(), dotThiDao.GetCaThis(), phongThiDao.GetAll()); if (dao.Add(id))

{ btnTao.Enabled = false; dgvLichThi.Visible = true;

63 private void btnXoa_Click(object sender, EventArgs e)

{ string id = cbDotThi.SelectedItem.ToString();

DAO.ChuanBi.LichThiDao dao = new DAO.ChuanBi.LichThiDao(); if (dao.Remove(id))

{ btnTao.Enabled = true; dgvLichThi.Visible = false; this.Noti(string.Format("Xóa thành công l ch thi cị ủa đợt '{0}'!", id), Notification.FrmNotification.enmType.Success);

{ this.Noti(string.Format("Xóa th t b i l ch thi cấ ạ ị ủa đợt '{0}'!", id), Notification.FrmNotification.enmType.Error);

16 LichThiDao.cs ( x lý logic qu ử ản lý lịch thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ChuanBi

List phongThis_; public LichThiDao(List dotThis, List buoiThis, List caThis, List phongThis)

{ dotThis_ = dotThis; buoiThis_ = buoiThis; caThis_ = caThis;

} public List GetByIdDotThi(string idDotThi)

{ return db_.LichThis.Where(x => x.maDotThi == idDotThi).ToList(); }

// duy t ngày t tháng dén ệ ừ private IEnumerable EachDay(DateTime from, DateTime thru) { for (var day = from.Date; day.Date isSave; set => isSave = value; } public FrmThiSinhAddEdit()

InitializeComponent(); lbTitle.Text = "Thêm M i Sinh Viên"ớ ;

InitializeComponent(); lbTitle.Text = "Cập nh t thông tin"ậ ; txtMsv.Enabled = false;

The code retrieves a student's information using their ID and populates the relevant fields: the student ID is displayed in the text box, the full name is filled in, the phone number is updated, the gender is set in the combo box, the date of birth is assigned to the date picker, and the class name is entered in the text box.

} private SinhVien GetInfo(SinhVien sv)

The code snippet captures student information by assigning values from input fields: the student ID, full name, and date of birth are extracted from text boxes, while the gender is validated through a selection box If no gender is selected, a message prompts the user to choose one Additionally, the phone number and class name are retrieved from their respective text boxes, and all these details are returned as a student object.

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.ChuanBi.SinhVienDao dao = new SinhVienDao();

SinhVien sv = new SinhVien(); if (lbTitle.Text.Contains("Thêm"))

{ if (dao.Add(GetInfo(sv))){ isSave = true;

} else if(lbTitle.Text.Contains("Cập nhật"))

{ if (dao.Edit(GetInfo(sv)))

Noti(string.Format("{0} đợt thi '{1}' thành công", sv.maSinhVien = string.Empty ? "Thêm" : "Sửa", sv.hoTen),

Notification.FrmNotification.enmType.Success); this.Close();

Noti(string.Format("{0} đợt thi '{1}' thất bại", sv.maSinhVien = string.Empty ? "Thêm" : "Sửa", sv.hoTen), Notification.FrmNotification.enmType.Error); }

} private void btnHuy_Click(object sender, EventArgs e)

19 SinhVienDAO.cs (x ử lý logic quả n lý sinh viên) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ChuanBi; using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi.ThiSinh

72 public bool IsSave { get => isSave; set => isSave = value; } public FrmThiSinhAddEdit()

InitializeComponent(); lbTitle.Text = "Thêm M i Sinh Viên"ớ ;

InitializeComponent(); lbTitle.Text = "Cập nhật thông tin"; txtMsv.Enabled = false;

The code snippet retrieves a student's information using their ID and populates the relevant fields on the form It assigns the student's ID, name, phone number, gender, birth date, and class name to the respective text boxes and combo box This ensures that all necessary details about the student are displayed accurately.

} private SinhVien GetInfo(SinhVien sv)

The student object is populated with data from the input fields: the student ID is set from the trimmed text of the ID field, the full name is taken from the trimmed name field, and the birth date is assigned from the date picker value If no gender is selected, a message box prompts the user to choose a gender; otherwise, the gender is parsed as an integer from the selected item Additionally, the phone number and class name are set from the trimmed text of their respective fields Finally, the populated student object is returned.

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.ChuanBi.SinhVienDao dao = new SinhVienDao();

SinhVien sv = new SinhVien(); if (lbTitle.Text.Contains("Thêm"))

{ if (dao.Add(GetInfo(sv))){ isSave = true;

} else if(lbTitle.Text.Contains("Cập nhật"))

{ if (dao.Edit(GetInfo(sv)))

Noti(string.Format("{0} đợt thi '{1}' thành công", sv.maSinhVien = string.Empty ? "Thêm" : "Sửa", sv.hoTen),

Notification.FrmNotification.enmType.Success); this.Close();

Noti(string.Format("{0} đợt thi '{1}' thất bại", sv.maSinhVien = string.Empty ? "Thêm" : "Sửa", sv.hoTen), Notification.FrmNotification.enmType.Error); }

} private void btnHuy_Click(object sender, EventArgs e)

20 UcCanBo.cs (x lý thao tác các ch ử ức năng quả n lý cán b ) ộ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing;

74 using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi

InitializeComponent(); dgvCanBo.AutoGenerateColumns = false; clMa.DataPropertyName = "maCanBo"; clHoTen.DataPropertyName = "hoTen"; clGioiTinh.DataPropertyName = "gioiTinh"; clNgaySinh.DataPropertyName = "ngaySinh"; clSdt.DataPropertyName = "sdt"; clChucVu.DataPropertyName = "chucVu"; clKhoa.DataPropertyName = "khoa";

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

The code snippet initializes a new instance of the `CanBoDao` class from the `DAO.ChuanBi` namespace, and sets the data source of the `dgvCanBo` DataGridView to a selection of all records retrieved from the database Each record includes essential fields such as employee ID (`maCanBo`), full name (`hoTen`), gender (`gioiTinh`), date of birth (`ngaySinh`), phone number (`sdt`), position (`chucVu`), and department (`khoa`).

75 lbStatus.Text = "Số thí sinh đã đăng ký: " + dao.GetAll().ToList().Count.ToString();

} private void btnTimKiem_Click(object sender, EventArgs e)

DAO.ChuanBi.CanBoDao canBoDao = new DAO.ChuanBi.CanBoDao(); if (canBoDao.GetById(search).Count > 0)

{ dgvCanBo.DataSource = canBoDao.GetById(search).Select(x => new { maCanBo = x.maCanBo, hoTen = x.hoTen, gioiTinh = x.gioiTinh, ngaySinh = x.ngaySinh, sdt = x.phone, chucVu = x.ChucVu.tenChucVu, khoa = x.Khoa.tenKhoa,

} else if(canBoDao.GetById(search).Count == 0)

{ dgvCanBo.DataSource = null; this.Noti(string.Format("Không t n tồ ại cán b có mã: '{0}'"ộ , search), Notification.FrmNotification.enmType.Warning);

} private void txtSearch_TextChanged(object sender, EventArgs e)

} private void btnThemMoi_Click(object sender, EventArgs e)

UC.ChuanBi.FrmEditCanBo frm = new FrmEditCanBo(); frm.ShowDialog(); if (frm.IsSave)

} private void btnCapNhat_Click(object sender, EventArgs e)

{ string idCanBo = dgvCanBo.CurrentRow.Cells["clma"].Value.ToString(); UC.ChuanBi.FrmEditCanBo frm = new FrmEditCanBo(idCanBo); frm.ShowDialog(); if (frm.IsSave)

} private void btnXoa_Click(object sender, EventArgs e)

FrmThiSinhAddEdit.cs (xử lý thao tác các ch ức năng thêm/ sử a sinh vên)

The code snippet utilizes various namespaces such as BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ChuanBi and BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF, along with essential system libraries like System, System.Collections.Generic, and System.Windows.Forms This structure is part of the BTL_DotNet1 project, specifically within the UC.ChuanBi.ThiSinh module, indicating a focus on managing candidate preparation for standardized foreign language exams.

{ private bool isSave = false; public bool IsSave { get => isSave; set => isSave = value; } public FrmThiSinhAddEdit()

InitializeComponent(); lbTitle.Text = "Thêm M i Sinh Viên"ớ ;

InitializeComponent(); lbTitle.Text = "Cập nh t thông tin"ậ ; txtMsv.Enabled = false;

The code retrieves a student's information using their ID (msv) and populates various fields with the retrieved data It assigns the student's ID to txtMsv, their full name to txtHoTen, phone number to txtSDT, gender to cbGioiTinh, date of birth to dtpNgaySinh, and class name to txtLop.

} private SinhVien GetInfo(SinhVien sv)

To create a student object, the code captures the student's ID from the input field, along with their full name and date of birth It checks if the gender has been selected; if not, a message prompts the user to choose a gender The code then retrieves the phone number and class name from the respective input fields before returning the completed student object.

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.ChuanBi.SinhVienDao dao = new SinhVienDao();

SinhVien sv = new SinhVien(); if (lbTitle.Text.Contains("Thêm"))

{ if (dao.Add(GetInfo(sv))){ isSave = true;

} else if(lbTitle.Text.Contains("Cập nhật"))

{ if (dao.Edit(GetInfo(sv)))

Noti(string.Format("{0} đợt thi '{1}' thành công", sv.maSinhVien = string.Empty ? "Thêm" : "Sửa", sv.hoTen),

Notification.FrmNotification.enmType.Success); this.Close();

Noti(string.Format("{0} đợt thi '{1}' thất bại", sv.maSinhVien = string.Empty ? "Thêm" : "Sửa", sv.hoTen), Notification.FrmNotification.enmType.Error); }

} private void btnHuy_Click(object sender, EventArgs e)

19 SinhVienDAO.cs (x ử lý logic quả n lý sinh viên) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ChuanBi; using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi.ThiSinh

72 public bool IsSave { get => isSave; set => isSave = value; } public FrmThiSinhAddEdit()

InitializeComponent(); lbTitle.Text = "Thêm M i Sinh Viên"ớ ;

InitializeComponent(); lbTitle.Text = "Cập nhật thông tin"; txtMsv.Enabled = false;

The code retrieves a student's information using their ID (msv) and populates various fields with the student's details It sets the student ID, full name, phone number, gender, date of birth, and class name into the respective text boxes and dropdowns for display or further processing.

} private SinhVien GetInfo(SinhVien sv)

To create a student object, the code retrieves and trims the student ID, full name, and class name from the input fields It also captures the date of birth from the date picker If the gender selection is not made, a message prompts the user to choose a gender; otherwise, it parses and assigns the selected gender value Finally, it stores the phone number and class name before returning the student object.

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.ChuanBi.SinhVienDao dao = new SinhVienDao();

SinhVien sv = new SinhVien(); if (lbTitle.Text.Contains("Thêm"))

{ if (dao.Add(GetInfo(sv))){ isSave = true;

} else if(lbTitle.Text.Contains("Cập nhật"))

{ if (dao.Edit(GetInfo(sv)))

Noti(string.Format("{0} đợt thi '{1}' thành công", sv.maSinhVien = string.Empty ? "Thêm" : "Sửa", sv.hoTen),

Notification.FrmNotification.enmType.Success); this.Close();

Noti(string.Format("{0} đợt thi '{1}' thất bại", sv.maSinhVien = string.Empty ? "Thêm" : "Sửa", sv.hoTen), Notification.FrmNotification.enmType.Error); }

} private void btnHuy_Click(object sender, EventArgs e)

20 UcCanBo.cs (x lý thao tác các ch ử ức năng quả n lý cán b ) ộ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing;

74 using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi

InitializeComponent(); dgvCanBo.AutoGenerateColumns = false; clMa.DataPropertyName = "maCanBo"; clHoTen.DataPropertyName = "hoTen"; clGioiTinh.DataPropertyName = "gioiTinh"; clNgaySinh.DataPropertyName = "ngaySinh"; clSdt.DataPropertyName = "sdt"; clChucVu.DataPropertyName = "chucVu"; clKhoa.DataPropertyName = "khoa";

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

The code snippet initializes a new instance of the `CanBoDao` class from the `DAO.ChuanBi` namespace and retrieves all records, setting the data source of the `dgvCanBo` DataGridView It selects specific properties for each record, including the staff ID (`maCanBo`), full name (`hoTen`), gender (`gioiTinh`), date of birth (`ngaySinh`), phone number (`sdt`), position name (`chucVu`), and department name (`khoa`).

75 lbStatus.Text = "Số thí sinh đã đăng ký: " + dao.GetAll().ToList().Count.ToString();

} private void btnTimKiem_Click(object sender, EventArgs e)

DAO.ChuanBi.CanBoDao canBoDao = new DAO.ChuanBi.CanBoDao(); if (canBoDao.GetById(search).Count > 0)

{ dgvCanBo.DataSource = canBoDao.GetById(search).Select(x => new { maCanBo = x.maCanBo, hoTen = x.hoTen, gioiTinh = x.gioiTinh, ngaySinh = x.ngaySinh, sdt = x.phone, chucVu = x.ChucVu.tenChucVu, khoa = x.Khoa.tenKhoa,

} else if(canBoDao.GetById(search).Count == 0)

{ dgvCanBo.DataSource = null; this.Noti(string.Format("Không t n tồ ại cán b có mã: '{0}'"ộ , search), Notification.FrmNotification.enmType.Warning);

} private void txtSearch_TextChanged(object sender, EventArgs e)

} private void btnThemMoi_Click(object sender, EventArgs e)

UC.ChuanBi.FrmEditCanBo frm = new FrmEditCanBo(); frm.ShowDialog(); if (frm.IsSave)

} private void btnCapNhat_Click(object sender, EventArgs e)

{ string idCanBo = dgvCanBo.CurrentRow.Cells["clma"].Value.ToString(); UC.ChuanBi.FrmEditCanBo frm = new FrmEditCanBo(idCanBo); frm.ShowDialog(); if (frm.IsSave)

} private void btnXoa_Click(object sender, EventArgs e)

To delete a staff member, retrieve the staff ID and name from the current row of the data grid view A confirmation message box will prompt the user with the question, "Do you want to delete the staff member: [staff name]?" If the user selects "Yes," the deletion process will proceed.

DAO.ChuanBi.CanBoDao dao = new DAO.ChuanBi.CanBoDao(); if (dao.Remove(idCanBo))

Noti(string.Format("Xóa cán b '{0}' thành công!"ộ , tenCanBo), Notification.FrmNotification.enmType.Success);

Noti(string.Format("Xóa sinh viên '{0}' th t bấ ại!", tenCanBo), Notification.FrmNotification.enmType.Success);

21 FrmEditCanBo.cs (x ử lý thao tác thêm/ xóa cán bộ ) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System;

The provided code snippet defines a partial class named `FrmEditCanBo` within the namespace `BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi`, utilizing various namespaces such as `System.Collections.Generic`, `System.ComponentModel`, `System.Data`, `System.Drawing`, `System.Linq`, `System.Text`, `System.Threading.Tasks`, and `System.Windows.Forms` This class is likely intended for a Windows Forms application related to the management of personnel in an educational context.

{ private bool isSave_ = false; public bool IsSave { get => isSave_; set => isSave_ = value; } private bool isAdd = false; public FrmEditCanBo()

InitializeComponent(); lbTitle.Text = "Thêm Cán Bộ"; isAdd = true; btnThem.Text = "Thêm";

InitializeComponent(); lbTitle.Text = "Sửa Cán B "; ộ btnThem.Text = "Cập nhật"; isAdd = false; txtMaCanBo.Enabled = false;

The code snippet initializes a new instance of `CanBoDao` from the `DAO.ChuanBi` namespace and retrieves a `CanBo` object using its ID It then populates various text fields and controls with the properties of the retrieved `CanBo`, including the ID, full name, gender, date of birth, phone number, department code, and position code, ensuring that any leading or trailing spaces are removed from the text values.

} private CanBo GetInfo(CanBo cb)

To create a coherent paragraph from the provided content while adhering to SEO guidelines, the following sentences can be used:"The code snippet initializes a 'cb' object by assigning values from user inputs It sets the 'maCanBo' property with the trimmed text from the 'txtMaCanBo' field The 'hoTen' property is populated with the trimmed value from 'txtHoTen' The 'gioiTinh' is parsed as an integer from the selected item in 'cbGioiTinh' The 'ngaySinh' is assigned the value from the date picker 'dtpNgaySinh' The phone number is captured from 'txtSDT' after trimming, while 'maKhoa' and 'maChucVu' are set with trimmed values from 'txtKhoa' and 'txtMaChucVu', respectively Finally, the method returns the populated 'cb' object."

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.ChuanBi.CanBoDao dao = new DAO.ChuanBi.CanBoDao();

CanBo cb = new CanBo(); if (isAdd)

{ if (dao.Add(GetInfo(cb)))

{ if (dao.Edit(GetInfo(cb)))

Noti(string.Format("{0} cán b '{1}' thành công"ộ , isAdd ? "Thêm" :

"Sửa", cb.hoTen), Notification.FrmNotification.enmType.Success); this.Close();

Noti(string.Format("{0} cán b '{1}' th t bộ ấ ại", isAdd ? "Thêm" :

"Sửa", cb.hoTen), Notification.FrmNotification.enmType.Error);

} private void btnHuy_Click(object sender, EventArgs e)

22 CanBoDAO.cs (x lý logic qu n lý cán b ) ử ả ộ using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ChuanBi

} public List GetById(string msv)

{ return db_.CanBoes.Where(x => x.maCanBo.Contains(msv)).ToList(); } public CanBo GetSingleById(string msv)

{ return db_.CanBoes.Where(x => x.maCanBo.Contains(msv)).FirstOrDefault(); } private void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(CanBo newCanBo)

{ db_.CanBoes.Add(newCanBo); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả , Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(CanBo info)

The code retrieves a record using the identifier `info.maCanBo` with the function `GetSingleById` It then updates the corresponding fields, including `hoTen`, `ngaySinh`, `gioiTinh`, `phone`, `maKhoa`, and `maChucVu`, with the values from the `info` object Finally, it saves the changes to the database using `db_.SaveChanges()`.

{ this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả , Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Remove(string mCanBo)

CanBo find = GetSingleById(mCanBo); db_.CanBoes.Remove(find); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả , Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

23 UcPhongThi.cs (x lý thao tác các ch ử ức năng quả n lý phòng thi) using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi

InitializeComponent(); dgvPhongThi.AutoGenerateColumns = false; clMaPhongThi.DataPropertyName = "maPhong"; clTen.DataPropertyName = "tenPhong"; clSoCho.DataPropertyName = "soCho"; clTrangThai.DataPropertyName = "trangThai";

DAO.ChuanBi.PhongThiDao dao = new DAO.ChuanBi.PhongThiDao(); dgvPhongThi.DataSource = dao.GetAll().Select(x => new

{ maPhong = x.maPhongThi, tenPhong = x.tenPhongThi, soCho = x.soCho, trangThai = x.trangThai,

}).ToList(); lbStatus.Text = "Số phòng thi đã đăng ký: " + dao.GetAll().ToList().Count.ToString();

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnTimKiem_Click(object sender, EventArgs e)

DAO.ChuanBi.PhongThiDao PhongThiDao = new DAO.ChuanBi.PhongThiDao(); if (PhongThiDao.GetByIdPhongThi(search).Count > 0)

{ dgvPhongThi.DataSource = PhongThiDao.GetByIdPhongThi(search).Select(x

=> new { maPhong = x.maPhongThi, tenPhong = x.tenPhongThi, soCho = x.soCho, trangThai = x.trangThai,

} else if (PhongThiDao.GetByIdPhongThi(search).Count == 0)

{ dgvPhongThi.DataSource = null; this.Noti(string.Format("Không t n t i phòng thi có mã: '{0}'"ồ ạ , search), Notification.FrmNotification.enmType.Warning);

} private void txtSearch_TextChanged(object sender, EventArgs e)

} private void btnThemMoi_Click(object sender, EventArgs e)

UC.ChuanBi.FrmEditPhongThi frm = new FrmEditPhongThi(); frm.ShowDialog(); if (frm.IsSave)

} private void btnCapNhat_Click(object sender, EventArgs e)

{ string idPhong dgvPhongThi.CurrentRow.Cells["clMaPhongThi"].Value.ToString();

UC.ChuanBi.FrmEditPhongThi frm = new FrmEditPhongThi(idPhong); frm.ShowDialog(); if (frm.IsSave)

} private void btnXoa_Click(object sender, EventArgs e)

To delete the selected staff member, the system retrieves the room ID and name from the current row in the data grid A confirmation dialog prompts the user with the message, "Do you want to delete the staff member: [room name]?" If the user selects "Yes," the deletion process proceeds.

DAO.ChuanBi.PhongThiDao dao = new DAO.ChuanBi.PhongThiDao(); if (dao.Remove(idPhong))

Noti(string.Format("Xóa cán b '{0}' thành công!"ộ , tenPhong), Notification.FrmNotification.enmType.Success);

Noti(string.Format("Xóa sinh viên '{0}' th t bấ ại!", tenPhong), Notification.FrmNotification.enmType.Success);

FrmEditCanBo.cs (xử lý thao tác thêm/ xóa cán bộ )

using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System;

The code snippet provided is part of a C# Windows Forms application, specifically within the namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi It defines a partial class named FrmEditCanBo, which is likely designed for editing personnel details in a management system The application utilizes various namespaces, including System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, and System.Windows.Forms, indicating a comprehensive use of NET libraries for functionality and user interface elements.

{ private bool isSave_ = false; public bool IsSave { get => isSave_; set => isSave_ = value; } private bool isAdd = false; public FrmEditCanBo()

InitializeComponent(); lbTitle.Text = "Thêm Cán Bộ"; isAdd = true; btnThem.Text = "Thêm";

InitializeComponent(); lbTitle.Text = "Sửa Cán B "; ộ btnThem.Text = "Cập nhật"; isAdd = false; txtMaCanBo.Enabled = false;

The code snippet initializes a new instance of the `CanBoDao` class to retrieve a single record by the specified `idCanBo` It populates various text fields and controls with the retrieved data, including the staff code, full name, gender, date of birth, phone number, department code, and position code, ensuring that all values are trimmed for consistency.

} private CanBo GetInfo(CanBo cb)

The code initializes a new object, `cb`, by assigning values from user input fields It captures the employee ID, full name, gender, date of birth, phone number, department code, and position code Each attribute is trimmed of whitespace and formatted appropriately, ensuring accurate data entry before returning the completed object.

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.ChuanBi.CanBoDao dao = new DAO.ChuanBi.CanBoDao();

CanBo cb = new CanBo(); if (isAdd)

{ if (dao.Add(GetInfo(cb)))

{ if (dao.Edit(GetInfo(cb)))

Noti(string.Format("{0} cán b '{1}' thành công"ộ , isAdd ? "Thêm" :

"Sửa", cb.hoTen), Notification.FrmNotification.enmType.Success); this.Close();

Noti(string.Format("{0} cán b '{1}' th t bộ ấ ại", isAdd ? "Thêm" :

"Sửa", cb.hoTen), Notification.FrmNotification.enmType.Error);

} private void btnHuy_Click(object sender, EventArgs e)

22 CanBoDAO.cs (x lý logic qu n lý cán b ) ử ả ộ using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ChuanBi

} public List GetById(string msv)

{ return db_.CanBoes.Where(x => x.maCanBo.Contains(msv)).ToList(); } public CanBo GetSingleById(string msv)

{ return db_.CanBoes.Where(x => x.maCanBo.Contains(msv)).FirstOrDefault(); } private void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(CanBo newCanBo)

{ db_.CanBoes.Add(newCanBo); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả , Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(CanBo info)

The code snippet retrieves a record using the identifier `maCanBo` with the function `GetSingleById(info.maCanBo)` It then updates the record's properties, including `hoTen`, `ngaySinh`, `gioiTinh`, `phone`, `maKhoa`, and `maChucVu` with corresponding values from the `info` object Finally, the changes are saved to the database using `db_.SaveChanges()`.

{ this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả , Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Remove(string mCanBo)

CanBo find = GetSingleById(mCanBo); db_.CanBoes.Remove(find); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả , Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

23 UcPhongThi.cs (x lý thao tác các ch ử ức năng quả n lý phòng thi) using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi

InitializeComponent(); dgvPhongThi.AutoGenerateColumns = false; clMaPhongThi.DataPropertyName = "maPhong"; clTen.DataPropertyName = "tenPhong"; clSoCho.DataPropertyName = "soCho"; clTrangThai.DataPropertyName = "trangThai";

DAO.ChuanBi.PhongThiDao dao = new DAO.ChuanBi.PhongThiDao(); dgvPhongThi.DataSource = dao.GetAll().Select(x => new

{ maPhong = x.maPhongThi, tenPhong = x.tenPhongThi, soCho = x.soCho, trangThai = x.trangThai,

}).ToList(); lbStatus.Text = "Số phòng thi đã đăng ký: " + dao.GetAll().ToList().Count.ToString();

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnTimKiem_Click(object sender, EventArgs e)

DAO.ChuanBi.PhongThiDao PhongThiDao = new DAO.ChuanBi.PhongThiDao(); if (PhongThiDao.GetByIdPhongThi(search).Count > 0)

{ dgvPhongThi.DataSource = PhongThiDao.GetByIdPhongThi(search).Select(x

=> new { maPhong = x.maPhongThi, tenPhong = x.tenPhongThi, soCho = x.soCho, trangThai = x.trangThai,

} else if (PhongThiDao.GetByIdPhongThi(search).Count == 0)

{ dgvPhongThi.DataSource = null; this.Noti(string.Format("Không t n t i phòng thi có mã: '{0}'"ồ ạ , search), Notification.FrmNotification.enmType.Warning);

} private void txtSearch_TextChanged(object sender, EventArgs e)

} private void btnThemMoi_Click(object sender, EventArgs e)

UC.ChuanBi.FrmEditPhongThi frm = new FrmEditPhongThi(); frm.ShowDialog(); if (frm.IsSave)

} private void btnCapNhat_Click(object sender, EventArgs e)

{ string idPhong dgvPhongThi.CurrentRow.Cells["clMaPhongThi"].Value.ToString();

UC.ChuanBi.FrmEditPhongThi frm = new FrmEditPhongThi(idPhong); frm.ShowDialog(); if (frm.IsSave)

} private void btnXoa_Click(object sender, EventArgs e)

In the provided code snippet, the current room ID and name are retrieved from a data grid view A confirmation dialog prompts the user with the question, "Do you want to delete the staff member: [room name]?" If the user selects "Yes," the deletion process will proceed.

DAO.ChuanBi.PhongThiDao dao = new DAO.ChuanBi.PhongThiDao(); if (dao.Remove(idPhong))

Noti(string.Format("Xóa cán b '{0}' thành công!"ộ , tenPhong), Notification.FrmNotification.enmType.Success);

Noti(string.Format("Xóa sinh viên '{0}' th t bấ ại!", tenPhong), Notification.FrmNotification.enmType.Success);

24 FrmEditPhongThi.cs (x ử lý thao tác các chức năng thêm mớ i/ s a phòng ử thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ChuanBi

{ private bool isSave_ = false; public bool IsSave { get => isSave_; set => isSave_ = value; } private bool isAdd = false; public FrmEditPhongThi()

InitializeComponent(); lbTitle.Text = "Thêm Phòng Thi"; btnThem.Text = "Thêm"; isAdd = true;

InitializeComponent(); lbTitle.Text = "Sửa Phòng Thi"; btnThem.Text = "Lưu"; isAdd = false;

DAO.ChuanBi.PhongThiDao dao = new DAO.ChuanBi.PhongThiDao(); if(dao.GetSingleByIdPhongThi(id)!= null)

PhongThi pt = dao.GetSingleByIdPhongThi(id); txtMaPhong.Text = pt.maPhongThi; txtTenPhong.Text = pt.tenPhongThi; cbTrangThai.Text = pt.trangThai.ToString(); txtSoCho.Text = pt.soCho.ToString();

} private PhongThi GetInfo(PhongThi info)

{ info.maPhongThi = txtMaPhong.Text.Trim(); info.tenPhongThi = txtTenPhong.Text.Trim(); info.soCho = int.Parse(txtSoCho.Text.Trim()); info.trangThai = int.Parse(cbTrangThai.SelectedItem.ToString()); return info;

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.ChuanBi.PhongThiDao dao = new DAO.ChuanBi.PhongThiDao();

PhongThi pt = new PhongThi(); if (isAdd)

{ if (dao.Add(GetInfo(pt)))

{ if (dao.Edit(GetInfo(pt)))

Noti(string.Format("{0} phòng thi '{1}' thành công", isAdd ? "Thêm" :

"Sửa", pt.tenPhongThi), Notification.FrmNotification.enmType.Success); this.Close();

Noti(string.Format("{0} phòng thi '{1}' th t bấ ại", isAdd ? "Thêm" :

"Sửa", pt.tenPhongThi), Notification.FrmNotification.enmType.Error);

} private void btnHuy_Click(object sender, EventArgs e)

25 PhongThiDAO.cs (x ử lý logic quan lý phòng thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ChuanBi

87 public List GetByIdPhongThi(string id)

{ return db_.PhongThis.Where(x => x.maPhongThi.Contains(id)).ToList(); } public PhongThi GetSingleByIdPhongThi(string id)

{ return db_.PhongThis.Where(x => x.maPhongThi.Contains(id)).FirstOrDefault();

} private void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(PhongThi newPhongThi)

{ db_.PhongThis.Add(newPhongThi); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả , Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(PhongThi info)

PhongThi find = GetSingleByIdPhongThi(info.maPhongThi); find.maPhongThi = info.maPhongThi; find.tenPhongThi = info.tenPhongThi; find.soCho = info.soCho; find.trangThai = info.trangThai; db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả , Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Remove(string mPhongThi)

PhongThi find = GetSingleByIdPhongThi(mPhongThi); db_.PhongThis.Remove(find); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả , Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

26 UcDanhSoBaoDanh.cs (x ử lý thao tác các chức năng quả n lý s báo danh) ố using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ToChucThi

InitializeComponent(); dgvSV.AutoGenerateColumns = false; dgvSV.RowHeadersVisible = true; dgvSV.RowHeadersWidth = 22; clHoTen.DataPropertyName = "hoTen"; clMsv.DataPropertyName = "mssv"; clSbd.DataPropertyName = "sbd";

{ cbDotThi.Items.Clear(); cbDotThi.DataSource = null;

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); foreach (DotThi i in dao.GetAll())

DAO.ChuanBi.SinhVienDao dao = new DAO.ChuanBi.SinhVienDao(); dgvSV.DataSource = dao.GetAll().Select(x => new

{ hoTen = x.hoTen, mssv = x.maSinhVien, sbd = x.soBaoDanh,

} private void UcDanhSoBaoDanh_Load(object sender, EventArgs e) {

DAO.ChuanBi.SinhVienDao dao = new DAO.ChuanBi.SinhVienDao(); int soSvChuaDanhSBD = 0, soDvDaDanhSBD = 0; foreach (SinhVien sv in dao.GetAll())

{ if (string.IsNullOrEmpty(sv.soBaoDanh))

} else if (!string.IsNullOrEmpty(sv.soBaoDanh))

} lbSvChuaDanh.Text = string.Format("Số sinh viên chưa đánh sbd: {0}", soSvChuaDanhSBD.ToString()); lbSvDaDanh.Text = string.Format("Số sinh viên đã đánh sbd: {0}", soDvDaDanhSBD.ToString());

} private void btnThucHien_Click(object sender, EventArgs e)

DAO.ChuanBi.SinhVienDao dao = new DAO.ChuanBi.SinhVienDao(); dao.DanhSBD();

FillDataGridView(); int soSvChuaDanhSBD=0, soDvDaDanhSBD=0; foreach(SinhVien sv in dao.GetAll())

{ if (string.IsNullOrEmpty(sv.soBaoDanh))

} else if (!string.IsNullOrEmpty(sv.soBaoDanh))

} lbSvChuaDanh.Text = string.Format("Số sinh viên chưa đánh sbd: {0}", soSvChuaDanhSBD.ToString()); lbSvDaDanh.Text = string.Format("Số sinh viên đã đánh sbd: {0}", soDvDaDanhSBD.ToString());

} private void btnXoa_Click(object sender, EventArgs e)

DAO.ChuanBi.SinhVienDao dao = new DAO.ChuanBi.SinhVienDao(); dao.XoaSBD();

FillDataGridView(); int soSvChuaDanhSBD = 0, soDvDaDanhSBD = 0; foreach (SinhVien sv in dao.GetAll())

{ if (string.IsNullOrEmpty(sv.soBaoDanh))

} else if (!string.IsNullOrEmpty(sv.soBaoDanh))

} lbSvChuaDanh.Text = string.Format("Số sinh viên chưa đánh sbd: {0}", soSvChuaDanhSBD.ToString()); lbSvDaDanh.Text = string.Format("Số sinh viên đã đánh sbd: {0}", soDvDaDanhSBD.ToString());

27 UcXepPhongThi.cs (x ử lý thao tác các chức năng xế p phòng thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.ToChucThi

InitializeComponent(); dgvLichThi.AutoGenerateColumns = false; dgvLichThi.RowHeadersVisible = true;

92 dgvLichThi.RowHeadersWidth = 21; clMaSv.DataPropertyName = "msv"; clHoTen.DataPropertyName = "hoTen"; clNgay.DataPropertyName = "ngayThi"; clTietBD.DataPropertyName = "tietBd"; clSoTiet.DataPropertyName = "soTiet"; clPhong.DataPropertyName = "phongThi";

{ cbDotThi.Items.Clear(); cbDotThi.DataSource = null;

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); foreach (DotThi dt in dao.GetAll())

{ cbDotThi.Items.Add(dt.maDotThi);

} private void LoadDataGridView(string id)

The code snippet initializes a new instance of the `XepPhongDao` class from the `DAO.ToChucThi` namespace and retrieves examination schedule data by student ID It populates a data grid view (`dgvLichThi`) with a selection of relevant information, including student ID, full name, exam date, start time, duration, and examination room name.

} private void UcXepPhongThi_Load(object sender, EventArgs e)

{ dgvLichThi.Visible = false; label1.Visible = true;

} private void cbDotThi_SelectedIndexChanged(object sender, EventArgs e) {

93 string idDotThi = cbDotThi.SelectedItem.ToString();

DAO.ToChucThi.XepPhongDao dao = new DAO.ToChucThi.XepPhongDao(); if (dao.GetByIDDotThi(idDotThi).Count() > 0)

{ label1.Visible = false; dgvLichThi.Visible = true;

LoadDataGridView(idDotThi); btnTao.Enabled = false;

{ btnTao.Enabled = true; label1.Visible = true; dgvLichThi.Visible = false;

} private void btnTao_Click(object sender, EventArgs e)

{ string idDotThi = cbDotThi.SelectedItem.ToString();

DAO.ChuanBi.LichThiDao lichThiDao = new DAO.ChuanBi.LichThiDao(); DAO.ChuanBi.SinhVienDao sinhVienDao = new DAO.ChuanBi.SinhVienDao(); DAO.ToChucThi.XepPhongDao dao = new

DAO.ToChucThi.XepPhongDao(lichThiDao.GetAll(), sinhVienDao.GetAll()); if (dao.Add(idDotThi))

{ btnTao.Enabled = false; label1.Visible = false; dgvLichThi.Visible = true;

} private void btnXoa_Click(object sender, EventArgs e)

{ string idDotThi = cbDotThi.SelectedItem.ToString();

DAO.ChuanBi.LichThiDao lichThiDao = new DAO.ChuanBi.LichThiDao(); DAO.ChuanBi.SinhVienDao sinhVienDao = new DAO.ChuanBi.SinhVienDao(); DAO.ToChucThi.XepPhongDao dao = new

DAO.ToChucThi.XepPhongDao(lichThiDao.GetAll(), sinhVienDao.GetAll()); if (dao.Remove(idDotThi))

94 label1.Visible = true; dgvLichThi.Visible = false;

28 XepPhongDAO.cs (x ử lý logic chức năng xế p phòng thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ToChucThi

{ private List lichThis_; private List sinhViens_; public XepPhongDao() { } public XepPhongDao(List lichThis, List sinhViens) { lichThis_ = lichThis; sinhViens_ = sinhViens;

} public List GetByIDDotThi(string idDotThi)

List list = db_.SinhViens.Where(x => x.LichThi.maDotThi = idDotThi).ToList(); return list;

} public bool Add(string idDotThi)

{ foreach(LichThi lt in lichThis_)

{ int i = 1; if(lt.maDotThi == idDotThi)

{ foreach(SinhVien sv in sinhViens_)

{ var sv1 = db_.SinhViens.Where(x => x.maSinhVien = sv.maSinhVien).FirstOrDefault(); if(sv1.maLichThi == null)

{ sv1.maLichThi = lt.maLichThi; db_.SaveChanges(); sinhViens_.Remove(sv1); if (i == 30)

} public bool Remove(string idDotThi)

{ foreach (SinhVien sv in sinhViens_)

96 if(lichThis_.Where(x => x.maDotThi = idDotThi).FirstOrDefault() != null)

SinhVien sv1 = db_.SinhViens.Where(x => x.maSinhVien = sv.maSinhVien && x.LichThi.maDotThi==idDotThi).FirstOrDefault(); if(sv1 != null)

{ sv1.maLichThi = null; db_.SaveChanges();

29 UcQuanLyDiem.cs (x ử lý thao tác các chức năng quản lý điể m sinh viên) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.TongKet

97 public partial class UcQuanLyDiem : UserControl

InitializeComponent(); dgvDanhSachDiem.AutoGenerateColumns = false; dgvDanhSachDiem.RowHeadersVisible = true; dgvDanhSachDiem.RowHeadersWidth = 22; clMaDiem.DataPropertyName = "maDiem"; clMsv.DataPropertyName = "msv"; clDiemNghe.DataPropertyName = "dNghe"; clDiemNoi.DataPropertyName = "dNoi"; clDiemViet.DataPropertyName = "dViet";

} private void FillDataGridView(string id)

DAO.TongKet.KetQuaDao dao = new DAO.TongKet.KetQuaDao(); dgvDanhSachDiem.DataSource = dao.GetByIdDotThi(id).Select(x => new { maDiem = x.maKetQua, msv = x.maSinhVien, dNghe = x.diemThiNghe, dNoi = x.diemThiNoi, dViet = x.diemThiViet, dTb = x.diemDauRa,

{ cbDotThi.Items.Clear(); cbDotThi.DataSource = null;

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); foreach(DotThi i in dao.GetAll())

//btnSua.Enabled = true; txtId.Enabled = true; btnXoa.Enabled = false; btnHuyThaoTac.Enabled = true;

//btnSua.Enabled = false; btnXoa.Enabled = true; btnHuyThaoTac.Enabled = true; txtId.Enabled = false;

{ txtId.Clear(); txtMSSV.Clear(); txtDiemViet.Clear(); txtDiemNoi.Clear(); txtDiemNghe.Clear(); txtDiemTB.Clear();

} private void UcQuanLyDiem_Load(object sender, EventArgs e)

FillComboBox(); btnSua.Text = "Nhập điểm"; txtDiemTB.Enabled = false; btnSua.Enabled = true; btnXoa.Enabled = true; btnHuyThaoTac.Enabled = true;

} private void cbDotThi_SelectedIndexChanged(object sender, EventArgs e) {

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); string idDt = cbDotThi.SelectedItem.ToString(); var dt = dao.GetSigleByName(idDt);

} private void dgvDanhSachDiem_CellClick(object sender,

The code snippet initializes a new instance of the `KetQuaDao` class from the `DAO.TongKet` namespace and retrieves the ID of the selected row from the `dgvDanhSachDiem` data grid It then fetches the corresponding record using the `GetSingleByID` method The retrieved data is displayed in various text boxes: `txtId` shows the result ID, `txtMSSV` displays the student ID, while `txtDiemNghe`, `txtDiemNoi`, and `txtDiemViet` present the scores for listening, speaking, and writing respectively Finally, `txtDiemTB` reflects the overall score.

InactiveBtn(); btnSua.Text = "Sửa Điểm"; txtMSSV.Enabled = false;

} private void Noti(string msg, Notification.FrmNotification.enmType type) { Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private KetQua GetInfo(KetQua kq)

{ kq.maKetQua = txtId.Text.Trim(); kq.maSinhVien = txtMSSV.Text.Trim();

FrmEditPhongThi.cs (xử lý thao tác các ch ức năng thêm mớ i/ s ửa phòng thi) 84 25 PhongThiDAO.cs (xử lý logic quan lý phòng thi)

The code snippet provided utilizes the BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF namespace, which is part of a project focused on managing foreign language exam preparation It includes essential system libraries such as System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, and System.Windows.Forms This integration highlights the framework's capabilities in developing user interface components and handling data operations effectively within the application.

{ private bool isSave_ = false; public bool IsSave { get => isSave_; set => isSave_ = value; } private bool isAdd = false; public FrmEditPhongThi()

InitializeComponent(); lbTitle.Text = "Thêm Phòng Thi"; btnThem.Text = "Thêm"; isAdd = true;

InitializeComponent(); lbTitle.Text = "Sửa Phòng Thi"; btnThem.Text = "Lưu"; isAdd = false;

DAO.ChuanBi.PhongThiDao dao = new DAO.ChuanBi.PhongThiDao(); if(dao.GetSingleByIdPhongThi(id)!= null)

PhongThi pt = dao.GetSingleByIdPhongThi(id); txtMaPhong.Text = pt.maPhongThi; txtTenPhong.Text = pt.tenPhongThi; cbTrangThai.Text = pt.trangThai.ToString(); txtSoCho.Text = pt.soCho.ToString();

} private PhongThi GetInfo(PhongThi info)

{ info.maPhongThi = txtMaPhong.Text.Trim(); info.tenPhongThi = txtTenPhong.Text.Trim(); info.soCho = int.Parse(txtSoCho.Text.Trim()); info.trangThai = int.Parse(cbTrangThai.SelectedItem.ToString()); return info;

} public void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private void btnThem_Click(object sender, EventArgs e)

DAO.ChuanBi.PhongThiDao dao = new DAO.ChuanBi.PhongThiDao();

PhongThi pt = new PhongThi(); if (isAdd)

{ if (dao.Add(GetInfo(pt)))

{ if (dao.Edit(GetInfo(pt)))

Noti(string.Format("{0} phòng thi '{1}' thành công", isAdd ? "Thêm" :

"Sửa", pt.tenPhongThi), Notification.FrmNotification.enmType.Success); this.Close();

Noti(string.Format("{0} phòng thi '{1}' th t bấ ại", isAdd ? "Thêm" :

"Sửa", pt.tenPhongThi), Notification.FrmNotification.enmType.Error);

} private void btnHuy_Click(object sender, EventArgs e)

25 PhongThiDAO.cs (x ử lý logic quan lý phòng thi) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ChuanBi

87 public List GetByIdPhongThi(string id)

{ return db_.PhongThis.Where(x => x.maPhongThi.Contains(id)).ToList(); } public PhongThi GetSingleByIdPhongThi(string id)

{ return db_.PhongThis.Where(x => x.maPhongThi.Contains(id)).FirstOrDefault();

} private void Noti(String msg, Notification.FrmNotification.enmType type) {

Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} public bool Add(PhongThi newPhongThi)

{ db_.PhongThis.Add(newPhongThi); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả , Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Edit(PhongThi info)

PhongThi find = GetSingleByIdPhongThi(info.maPhongThi); find.maPhongThi = info.maPhongThi; find.tenPhongThi = info.tenPhongThi; find.soCho = info.soCho; find.trangThai = info.trangThai; db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả , Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

} public bool Remove(string mPhongThi)

PhongThi find = GetSingleByIdPhongThi(mPhongThi); db_.PhongThis.Remove(find); db_.SaveChanges();

{ this.Noti(string.Format("Có l i x y ra {0} {1}"ỗ ả , Environment.NewLine, ex.Message), Notification.FrmNotification.enmType.Error); return false;

UcDanhSoBaoDanh.cs (xử lý thao tác các ch ức năng quả n lý s ố báo danh)

The code snippet imports essential namespaces for a NET project focused on managing foreign language exam organization It utilizes the Entity Framework for data access and includes standard libraries for collections, data manipulation, graphics, and Windows Forms The namespace is specifically designated for the exam organization module within the application, indicating a structured approach to developing functionalities related to managing foreign language assessments.

InitializeComponent(); dgvSV.AutoGenerateColumns = false; dgvSV.RowHeadersVisible = true; dgvSV.RowHeadersWidth = 22; clHoTen.DataPropertyName = "hoTen"; clMsv.DataPropertyName = "mssv"; clSbd.DataPropertyName = "sbd";

{ cbDotThi.Items.Clear(); cbDotThi.DataSource = null;

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); foreach (DotThi i in dao.GetAll())

DAO.ChuanBi.SinhVienDao dao = new DAO.ChuanBi.SinhVienDao(); dgvSV.DataSource = dao.GetAll().Select(x => new

{ hoTen = x.hoTen, mssv = x.maSinhVien, sbd = x.soBaoDanh,

} private void UcDanhSoBaoDanh_Load(object sender, EventArgs e) {

DAO.ChuanBi.SinhVienDao dao = new DAO.ChuanBi.SinhVienDao(); int soSvChuaDanhSBD = 0, soDvDaDanhSBD = 0; foreach (SinhVien sv in dao.GetAll())

{ if (string.IsNullOrEmpty(sv.soBaoDanh))

} else if (!string.IsNullOrEmpty(sv.soBaoDanh))

} lbSvChuaDanh.Text = string.Format("Số sinh viên chưa đánh sbd: {0}", soSvChuaDanhSBD.ToString()); lbSvDaDanh.Text = string.Format("Số sinh viên đã đánh sbd: {0}", soDvDaDanhSBD.ToString());

} private void btnThucHien_Click(object sender, EventArgs e)

DAO.ChuanBi.SinhVienDao dao = new DAO.ChuanBi.SinhVienDao(); dao.DanhSBD();

FillDataGridView(); int soSvChuaDanhSBD=0, soDvDaDanhSBD=0; foreach(SinhVien sv in dao.GetAll())

{ if (string.IsNullOrEmpty(sv.soBaoDanh))

} else if (!string.IsNullOrEmpty(sv.soBaoDanh))

} lbSvChuaDanh.Text = string.Format("Số sinh viên chưa đánh sbd: {0}", soSvChuaDanhSBD.ToString()); lbSvDaDanh.Text = string.Format("Số sinh viên đã đánh sbd: {0}", soDvDaDanhSBD.ToString());

} private void btnXoa_Click(object sender, EventArgs e)

DAO.ChuanBi.SinhVienDao dao = new DAO.ChuanBi.SinhVienDao(); dao.XoaSBD();

FillDataGridView(); int soSvChuaDanhSBD = 0, soDvDaDanhSBD = 0; foreach (SinhVien sv in dao.GetAll())

{ if (string.IsNullOrEmpty(sv.soBaoDanh))

} else if (!string.IsNullOrEmpty(sv.soBaoDanh))

} lbSvChuaDanh.Text = string.Format("Số sinh viên chưa đánh sbd: {0}", soSvChuaDanhSBD.ToString()); lbSvDaDanh.Text = string.Format("Số sinh viên đã đánh sbd: {0}", soDvDaDanhSBD.ToString());

UcXepPhongThi.cs (xử lý thao tác các ch ức năng xế p phòng thi)

The article discusses the use of the BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF namespace, which is essential for managing external language examination activities It incorporates various system libraries, including System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, and System.Windows.Forms This framework is designed to facilitate the organization of examination processes within the application.

InitializeComponent(); dgvLichThi.AutoGenerateColumns = false; dgvLichThi.RowHeadersVisible = true;

92 dgvLichThi.RowHeadersWidth = 21; clMaSv.DataPropertyName = "msv"; clHoTen.DataPropertyName = "hoTen"; clNgay.DataPropertyName = "ngayThi"; clTietBD.DataPropertyName = "tietBd"; clSoTiet.DataPropertyName = "soTiet"; clPhong.DataPropertyName = "phongThi";

{ cbDotThi.Items.Clear(); cbDotThi.DataSource = null;

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); foreach (DotThi dt in dao.GetAll())

{ cbDotThi.Items.Add(dt.maDotThi);

} private void LoadDataGridView(string id)

The code snippet initializes a new instance of the `XepPhongDao` class from the `DAO.ToChucThi` namespace It then sets the data source of the `dgvLichThi` DataGridView to the results obtained from the `GetByIDDotThi` method, filtered by the specified `id` The selected data includes student ID (`msv`), full name (`hoTen`), exam date (`ngayThi`), start time (`tietBd`), duration (`soTiet`), and exam room name (`phongThi`).

} private void UcXepPhongThi_Load(object sender, EventArgs e)

{ dgvLichThi.Visible = false; label1.Visible = true;

} private void cbDotThi_SelectedIndexChanged(object sender, EventArgs e) {

93 string idDotThi = cbDotThi.SelectedItem.ToString();

DAO.ToChucThi.XepPhongDao dao = new DAO.ToChucThi.XepPhongDao(); if (dao.GetByIDDotThi(idDotThi).Count() > 0)

{ label1.Visible = false; dgvLichThi.Visible = true;

LoadDataGridView(idDotThi); btnTao.Enabled = false;

{ btnTao.Enabled = true; label1.Visible = true; dgvLichThi.Visible = false;

} private void btnTao_Click(object sender, EventArgs e)

{ string idDotThi = cbDotThi.SelectedItem.ToString();

DAO.ChuanBi.LichThiDao lichThiDao = new DAO.ChuanBi.LichThiDao(); DAO.ChuanBi.SinhVienDao sinhVienDao = new DAO.ChuanBi.SinhVienDao(); DAO.ToChucThi.XepPhongDao dao = new

DAO.ToChucThi.XepPhongDao(lichThiDao.GetAll(), sinhVienDao.GetAll()); if (dao.Add(idDotThi))

{ btnTao.Enabled = false; label1.Visible = false; dgvLichThi.Visible = true;

} private void btnXoa_Click(object sender, EventArgs e)

{ string idDotThi = cbDotThi.SelectedItem.ToString();

DAO.ChuanBi.LichThiDao lichThiDao = new DAO.ChuanBi.LichThiDao(); DAO.ChuanBi.SinhVienDao sinhVienDao = new DAO.ChuanBi.SinhVienDao(); DAO.ToChucThi.XepPhongDao dao = new

DAO.ToChucThi.XepPhongDao(lichThiDao.GetAll(), sinhVienDao.GetAll()); if (dao.Remove(idDotThi))

94 label1.Visible = true; dgvLichThi.Visible = false;

XepPhongDAO.cs (xử lý logic ch ức năng xế p phòng thi)

using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.ToChucThi

{ private List lichThis_; private List sinhViens_; public XepPhongDao() { } public XepPhongDao(List lichThis, List sinhViens) { lichThis_ = lichThis; sinhViens_ = sinhViens;

} public List GetByIDDotThi(string idDotThi)

List list = db_.SinhViens.Where(x => x.LichThi.maDotThi = idDotThi).ToList(); return list;

} public bool Add(string idDotThi)

{ foreach(LichThi lt in lichThis_)

{ int i = 1; if(lt.maDotThi == idDotThi)

{ foreach(SinhVien sv in sinhViens_)

{ var sv1 = db_.SinhViens.Where(x => x.maSinhVien = sv.maSinhVien).FirstOrDefault(); if(sv1.maLichThi == null)

{ sv1.maLichThi = lt.maLichThi; db_.SaveChanges(); sinhViens_.Remove(sv1); if (i == 30)

} public bool Remove(string idDotThi)

{ foreach (SinhVien sv in sinhViens_)

96 if(lichThis_.Where(x => x.maDotThi = idDotThi).FirstOrDefault() != null)

SinhVien sv1 = db_.SinhViens.Where(x => x.maSinhVien = sv.maSinhVien && x.LichThi.maDotThi==idDotThi).FirstOrDefault(); if(sv1 != null)

{ sv1.maLichThi = null; db_.SaveChanges();

UcQuanLyDiem.cs (xử lý thao tác các ch ức năng quản lý điể m sinh viên)

The BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF namespace is utilized to manage external language examination activities This application incorporates essential system libraries, including System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, and System.Threading.Tasks It also leverages the Windows Forms library to create a user-friendly interface for effective management and analysis of examination data The namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.UC.TongKet is designed to facilitate comprehensive evaluation and reporting functionalities within the application.

97 public partial class UcQuanLyDiem : UserControl

InitializeComponent(); dgvDanhSachDiem.AutoGenerateColumns = false; dgvDanhSachDiem.RowHeadersVisible = true; dgvDanhSachDiem.RowHeadersWidth = 22; clMaDiem.DataPropertyName = "maDiem"; clMsv.DataPropertyName = "msv"; clDiemNghe.DataPropertyName = "dNghe"; clDiemNoi.DataPropertyName = "dNoi"; clDiemViet.DataPropertyName = "dViet";

} private void FillDataGridView(string id)

DAO.TongKet.KetQuaDao dao = new DAO.TongKet.KetQuaDao(); dgvDanhSachDiem.DataSource = dao.GetByIdDotThi(id).Select(x => new { maDiem = x.maKetQua, msv = x.maSinhVien, dNghe = x.diemThiNghe, dNoi = x.diemThiNoi, dViet = x.diemThiViet, dTb = x.diemDauRa,

{ cbDotThi.Items.Clear(); cbDotThi.DataSource = null;

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); foreach(DotThi i in dao.GetAll())

//btnSua.Enabled = true; txtId.Enabled = true; btnXoa.Enabled = false; btnHuyThaoTac.Enabled = true;

//btnSua.Enabled = false; btnXoa.Enabled = true; btnHuyThaoTac.Enabled = true; txtId.Enabled = false;

{ txtId.Clear(); txtMSSV.Clear(); txtDiemViet.Clear(); txtDiemNoi.Clear(); txtDiemNghe.Clear(); txtDiemTB.Clear();

} private void UcQuanLyDiem_Load(object sender, EventArgs e)

FillComboBox(); btnSua.Text = "Nhập điểm"; txtDiemTB.Enabled = false; btnSua.Enabled = true; btnXoa.Enabled = true; btnHuyThaoTac.Enabled = true;

} private void cbDotThi_SelectedIndexChanged(object sender, EventArgs e) {

DAO.KhoiTao.DotThiDao dao = new DAO.KhoiTao.DotThiDao(); string idDt = cbDotThi.SelectedItem.ToString(); var dt = dao.GetSigleByName(idDt);

} private void dgvDanhSachDiem_CellClick(object sender,

In the given code snippet, an instance of the `KetQuaDao` class is created to retrieve the results of a student's exam based on their ID The ID is obtained from the currently selected row in the `dgvDanhSachDiem` data grid view The method `GetSingleByID` is called to fetch the exam results, which are then displayed in various text fields: `txtId` shows the result ID, `txtMSSV` displays the student ID, and `txtDiemNghe`, `txtDiemNoi`, and `txtDiemViet` present the scores for listening, speaking, and writing exams, respectively Finally, the average score is shown in `txtDiemTB`.

InactiveBtn(); btnSua.Text = "Sửa Điểm"; txtMSSV.Enabled = false;

} private void Noti(string msg, Notification.FrmNotification.enmType type) { Notification.FrmNotification frm = new Notification.FrmNotification(); frm.ShowNoti(msg, type);

} private KetQua GetInfo(KetQua kq)

{ kq.maKetQua = txtId.Text.Trim(); kq.maSinhVien = txtMSSV.Text.Trim();

The code initializes a new instance of the `DotThiDao` class to retrieve the test ID based on the selected item from a dropdown It then parses and assigns the listening, speaking, writing, and average scores from the respective text fields to the `kq` object.

} private float TinhDiemTb(string noi, string nghe, string viet) { float dTb = 0, dNoi = 0, dNghe = 0, dViet = 0; if(noi!="" && nghe != ""&& viet != "")

{ dNoi = float.Parse(noi); dNghe = float.Parse(nghe); dViet = float.Parse(viet);

{ dNoi = 0; dNghe = float.Parse(nghe); dViet = float.Parse(viet);

{ dNoi = float.Parse(noi); dNghe = 0; dViet = float.Parse(viet);

102 dNghe = float.Parse(nghe); dViet = 0;

} dTb = (float)Math.Round(((dNghe + dNoi + dViet) / 3),2); return dTb;

} private void btnSua_Click(object sender, EventArgs e)

{ if (btnSua.Text.Contains("Nh p")) ậ

DAO.TongKet.KetQuaDao dao = new DAO.TongKet.KetQuaDao();

KetQua newKetQua = new KetQua(); if (GetInfo(newKetQua).maKetQua == "" || GetInfo(newKetQua).maSinhVien

MessageBox.Show("Vui lòng điền đủ thông tin");

} else if (GetInfo(newKetQua).maKetQua != "" &&

GetInfo(newKetQua).maSinhVien != "" && GetInfo(newKetQua).maDotThi != "" &&

{ if (dao.Add(GetInfo(newKetQua))){ this.Noti("Nhập điểm thành công!",

DAO.KhoiTao.DotThiDao dotThiDao = new DAO.KhoiTao.DotThiDao();

FillDataGridView(dotThiDao.GetSigleByName(cbDotThi.SelectedItem.ToString()).maDotThi); ActiveBtn();

ClearInput(); btnSua.Text = "Nhập Điểm";

{ this.Noti("Nhập điểm th t b i!", ấ ạ

} else if (btnSua.Text.Contains("S a")) ử

DAO.TongKet.KetQuaDao dao = new DAO.TongKet.KetQuaDao();

KetQua editKetQua = new KetQua(); if (dao.Edit(GetInfo(editKetQua)))

{ this.Noti("Sửa điểm thành công!",

DAO.KhoiTao.DotThiDao dotThiDao = new DAO.KhoiTao.DotThiDao();

FillDataGridView(dotThiDao.GetSigleByName(cbDotThi.SelectedItem.ToString()).maDotThi); ActiveBtn();

ClearInput(); btnSua.Text = "Nhập Điểm"; txtMSSV.Enabled = true;

{ this.Noti("Sửa điểm th t b i!", ấ ạ

} private void btnXoa_Click(object sender, EventArgs e)

{ string makq dgvDanhSachDiem.CurrentRow.Cells["clMaDiem"].Value.ToString();

DAO.TongKet.KetQuaDao dao = new DAO.TongKet.KetQuaDao(); if (dao.Remove(makq))

{ this.Noti("Xóa điểm thành công!",

DAO.KhoiTao.DotThiDao dotThiDao = new DAO.KhoiTao.DotThiDao();

FillDataGridView(dotThiDao.GetSigleByName(cbDotThi.SelectedItem.ToString()).maDotThi); ActiveBtn();

ClearInput(); btnSua.Text = "Nhập Điểm"; txtMSSV.Enabled = true;

{ this.Noti("Xóa điểm th t b i!", ấ ạ

105 private void btnHuyThaoTac_Click(object sender, EventArgs e)

ClearInput(); txtMSSV.Enabled = true; btnSua.Text = "Nhập Điểm";

} private void txtDiemNghe_TextChanged(object sender, EventArgs e)

{ foreach(char i in txtDiemNghe.Text)

{ if (!char.IsControl(i) && !char.IsDigit(i) && (i != '.') && (i

MessageBox.Show("nh p vào ko ph a là s "); ậ ỉ ố txtDiemNghe.Clear(); txtDiemNghe.Focus();

} diem = float.Parse(txtDiemNghe.Text); if ((0 > diem || diem > 10))

MessageBox.Show("Điểm nhập không đúng Mời nhâp l i!", "Thông ạ báo", MessageBoxButtons.YesNo, MessageBoxIcon.Error); txtDiemNghe.Clear(); txtDiemNghe.Focus();

} txtDiemTB.Text = TinhDiemTb(txtDiemNoi.Text, txtDiemNghe.Text, txtDiemViet.Text).ToString();

} private void txtDiemViet_TextChanged(object sender, EventArgs e)

{ foreach (char i in txtDiemViet.Text)

{ if (!char.IsControl(i) && !char.IsDigit(i) && (i != '.') && (i

MessageBox.Show("nh p vào ko ph a là s "); ậ ỉ ố txtDiemViet.Clear(); txtDiemViet.Focus();

} diem = float.Parse(txtDiemViet.Text); if (0 > diem || diem > 10)

MessageBox.Show("Điểm nhập không đúng Mời nhâp l i!", "Thông ạ báo", MessageBoxButtons.YesNo, MessageBoxIcon.Error); txtDiemViet.Clear(); txtDiemViet.Focus();

} txtDiemTB.Text = TinhDiemTb(txtDiemNoi.Text, txtDiemNghe.Text, txtDiemViet.Text).ToString();

} private void txtDiemNoi_TextChanged(object sender, EventArgs e)

{ foreach (char i in txtDiemNoi.Text)

{ if (!char.IsControl(i) && !char.IsDigit(i) && (i != '.') && (i

MessageBox.Show("nh p vào ko ph a là s "); ậ ỉ ố txtDiemNoi.Clear(); txtDiemNoi.Focus();

} diem = float.Parse(txtDiemNoi.Text); if (0 > diem || diem > 10)

MessageBox.Show("Điểm nh p khôậ ng đúng Mời nhâp l i!", "Thông ạ báo", MessageBoxButtons.YesNo, MessageBoxIcon.Error); txtDiemNoi.Clear(); txtDiemNoi.Focus();

} txtDiemTB.Text = TinhDiemTb(txtDiemNoi.Text, txtDiemNghe.Text, txtDiemViet.Text).ToString();

30 KetQuaDAO.cs (x lý logic qu ử ản lý điểm) using BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.EF; using System; using System.Collections.Generic; using System.Linq; using System.Text;

109 using System.Threading.Tasks; using System.Windows; namespace BTL_DotNet1_QuanLyCongTacThiChuanDauRaNgoaiNgu.DAO.TongKet

} public List GetByIdDotThi(string maDt)

{ return db_.KetQuas.Where(x => x.maDotThi.Contains(maDt)).ToList(); } public KetQua GetSingleByID(string id)

{ return db_.KetQuas.Where(x => x.maKetQua.Contains(id)).FirstOrDefault(); } public bool Add(KetQua kq)

{ db_.KetQuas.Add(kq); db_.SaveChanges();

MessageBox.Show(string.Format("{0}{1}{2}", "Có l i x y ra!"ỗ ả , Environment.NewLine, ex.Message),"Thông Báo",MessageBoxButton.OK,

} public bool Edit(KetQua kq)

Ngày đăng: 15/06/2022, 05:12

HÌNH ẢNH LIÊN QUAN

2.6. Bảng 6: Bu i thi  ổ (maBuoiThi, tenBuoiThi) - Xây dựng chương trình quản lý công tác thi chuẩn đầu ra cho trung tâm ngoại ngữ   tin học trường đại học mỏ địa chất
2.6. Bảng 6: Bu i thi ổ (maBuoiThi, tenBuoiThi) (Trang 5)
2.4. Bảng 4: Chức vụ (maChucVu, tenChucVu) - Xây dựng chương trình quản lý công tác thi chuẩn đầu ra cho trung tâm ngoại ngữ   tin học trường đại học mỏ địa chất
2.4. Bảng 4: Chức vụ (maChucVu, tenChucVu) (Trang 5)
2.3. Bảng 3: Khóa học  (maKhoaHoc, tenKhoaHoc, namBatDau, namKetThuc) - Xây dựng chương trình quản lý công tác thi chuẩn đầu ra cho trung tâm ngoại ngữ   tin học trường đại học mỏ địa chất
2.3. Bảng 3: Khóa học (maKhoaHoc, tenKhoaHoc, namBatDau, namKetThuc) (Trang 5)
2.8. Bảng 8: Phòng thi  (maPhongThi, tenPhongThi, soCho, trangThai) - Xây dựng chương trình quản lý công tác thi chuẩn đầu ra cho trung tâm ngoại ngữ   tin học trường đại học mỏ địa chất
2.8. Bảng 8: Phòng thi (maPhongThi, tenPhongThi, soCho, trangThai) (Trang 6)

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w