/// <summary> /// Lay 1 record dua vao ma lop /// </summary> /// <param name="maLop"></param> /// <returns>Lop</returns> public LopTinChi GetById(int maLop) { GiangVienBLL ctGV = new GiangVienBLL(); LopTinChiBLL contextLTC = new LopTinChiBLL(); MonHocBLL contextMH = new MonHocBLL(); NienKhoaHocKyBLL contextNKHK = new NienKhoaHocKyBLL(); try { LopTinChi lopTinChi = context.GetById(maLop); lopTinChi.NienKhoaHocKy = contextNKHK.GetById(lopTinChi.NienKhoa); lopTinChi.MonHoc = contextMH.GetById(lopTinChi.MaMonHoc); lopTinChi.GiangVien = ctGV.GetById(lopTinChi.MaGV); return(lopTinChi); } catch (Exception ex) { Console.WriteLine(ex); return(null); } }
/// <summary> /// Lấy tất cả record trong hiện tại, trước và sau 1 năm /// </summary> /// <returns>List</returns> public List <ThoiKhoaBieu> GetTKBCurent() { LopTinChiBLL contextLopTC = new LopTinChiBLL(); GiangVienBLL contextGV = new GiangVienBLL(); int yearNow = DateTime.UtcNow.Year; int yearLast = yearNow - 1; int yearFt = yearNow + 1; List <ThoiKhoaBieu> listThoiKhoaBieu = context.GetAll(); foreach (ThoiKhoaBieu tkb in listThoiKhoaBieu) { if (tkb.Ngay.Year < yearNow && tkb.Ngay.Year > yearLast) { listThoiKhoaBieu.Remove(tkb); } else { tkb.LopTinChi = contextLopTC.GetById(tkb.MaLopTC); tkb.LopTinChi.GiangVien = contextGV.GetById(tkb.LopTinChi.MaGV); } } return(listThoiKhoaBieu); }