Exemple #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);
        }
        public void Create(ThoiKhoaBieu tkb)
        {
            LopTinChiBLL contextLTC = new LopTinChiBLL();
            MonHocBLL    contextMH  = new MonHocBLL();
            // lấy thông tin lớp tín chỉ của thời khóa biểu.
            LopTinChi ltc = contextLTC.GetById(tkb.MaLopTC);
            //Lasays thông tin môn học
            MonHoc mh = contextMH.GetById(ltc.MaMonHoc);

            int soBuoi = 0;
            int sotc   = mh.SoTinChiLyThuyet + mh.SoTinChiThucHanh;

            if (sotc * 15 % 4 != 0)
            {
                soBuoi = (int)(sotc * 15 / 4) + 1;
            }
            else
            {
                soBuoi = sotc * 15 / 4;
            }
            try
            {
                for (int i = 0; i < soBuoi; i++)
                {
                    context.Create(tkb);
                    tkb.Ngay = tkb.Ngay.AddDays(7);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Exemple #3
0
        public List <LopTinChi> GetListLTCOpen(ICollection <LopTinChi> lst)
        {
            MonHocBLL        contextMH = new MonHocBLL();
            List <LopTinChi> lstOpen   = new List <LopTinChi>();

            foreach (LopTinChi ltc in lst)
            {
                if (ltc.TrangThai == true)
                {
                    ltc.MonHoc = contextMH.GetById(ltc.MaMonHoc);
                    lstOpen.Add(ltc);
                }
            }
            return(lstOpen);
        }
Exemple #4
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);
            }
        }