Example #1
0
        /// <summary>
        /// Lấy ra các lớp được đăng ký để sinh viên đăng ký
        /// </summary>
        /// <param name="lst"></param>
        /// <returns></returns>
        public List <LopTinChi> GetListLTCDangKy(ICollection <LopTinChi> lst)
        {
            NienKhoaHocKyBLL contextNKHK     = new NienKhoaHocKyBLL();
            MonHocBLL        contextMH       = new MonHocBLL();
            List <LopTinChi> lstOpen         = new List <LopTinChi>();
            Date             supportDateTime = new Date();
            DateTime         dt = DateTime.UtcNow;

            foreach (LopTinChi ltc in lst)
            {
                NienKhoaHocKy nkhk = contextNKHK.GetById(ltc.NienKhoa);
                if (nkhk != null && nkhk.HocKy == 1)
                {
                    if (Int32.Parse(ltc.NienKhoa.Split('-')[0]) == dt.Year)
                    {
                        if (ltc.TrangThai == true)
                        {
                            if (nkhk.HocKy == 1)
                            {
                                if (dt.Month >= 9 && dt.Month <= 12)
                                {
                                    DateTime ngayCuoiNam = new DateTime(dt.Year, 12, 31);
                                    dt = dt.AddDays(1);
                                    //  int soTietCoTheMo = supportDateTime.SoTietHocCoTheMo(dt, ngayCuoiNam);
                                }
                            }
                            ltc.MonHoc = contextMH.GetById(ltc.MaMonHoc);
                            lstOpen.Add(ltc);
                        }
                    }
                }
            }
            return(lstOpen);
        }
Example #2
0
        /// <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);
            }
        }