/// <summary> /// Sự kiện: khi button Tự động được click /// tự động lập lịch cho năm học /// </summary> private void buttonTuDong_Click(object sender, EventArgs e) { GiaoVien_BUS giaoVienBus = new GiaoVien_BUS(); List <GIAOVIEN> listGiaoVien = giaoVienBus.LayTatCaDanhSachGiaoVien(); List <GIANGDAY> listGiangDay = new List <GIANGDAY>(); for (int i = 0; i < _listLopLapLich.Count; i++) // duyệt từng lớp { foreach (usp_SelectGiangDayBy_MaLopResult temp in _giangDayBus.LayGiangDayTheoMaLop(_listLopLapLich[i].MALOP)) // lấy giảng dạy theo lớp { GIANGDAY giangDay = new GIANGDAY(); giangDay.MaGiaoVien = temp.MaGiaoVien; giangDay.MaLop = temp.MaLop; listGiangDay.Add(giangDay); } } giaithuat = new GiaiThuat.GiaiThuatLapThoiKhoaBieu(listGiaoVien, _danhSachMonHoc, _listLopLapLich, listGiangDay); giaithuat.CreateQuanTheBanDau(); // khởi tạo thời khóa biểu random if (giaithuat.CapNhatMonHocBiTrungTKB()) // cập nhật lai thời khóa biểu sao cho không có tiết học bi trùng { giaithuat.ShowTKBToGridView(dataGridViewThoiKhoaBieu); buttonLuu.Visible = true; } else { MessageBox.Show("Không thể lập lịch. số giảng viên không hợp lệ", "Thông báo"); } }
public bool Delete(GIANGDAY model) { GIANGDAY dbEntry = context.GIANGDAYs.Find(model.magd); if (dbEntry == null) { return(false); } context.GIANGDAYs.Remove(dbEntry); context.SaveChanges(); return(true); }
public bool Insert(GIANGDAY model) { GIANGDAY dbEntry = context.GIANGDAYs.Find(model.magd); if (dbEntry != null) { return(false); } context.GIANGDAYs.Add(model); context.SaveChanges(); return(true); }
public bool Update(GIANGDAY model) { GIANGDAY dbEntry = context.GIANGDAYs.Find(model.magd); if (dbEntry == null) { return(false); } dbEntry.magv = model.magv; dbEntry.magd = model.magd; dbEntry.malop = model.malop; dbEntry.monhoc = model.monhoc; context.SaveChanges(); return(true); }
public GiangDay(GIANGDAY giangDay, GIAOVIEN giaovien, String maKhoi) { this.giangDay = giangDay; this.giaoVien = giaovien; this.maKhoi = maKhoi; }
public GiangDay(GiangDay temp) { giaoVien = temp.giaoVien; this.giangDay = temp.giangDay; maKhoi = temp.maKhoi; }
//trả về 1 đối tượng giảng dạy public GIANGDAY FindEntity(int ID) { GIANGDAY dbEntry = context.GIANGDAYs.Find(ID); return(dbEntry); }