public JsonResult getDangKyHocPhan(int id)
        {
            LopHocPhanService         lopHocPhan  = new LopHocPhanService();
            KetQuaHocTapService       kqhtsev     = new KetQuaHocTapService();
            List <LopHocPhan>         lopHocPhans = lopHocPhan.GetLopHocPhansByID(id).ToList();
            List <LopHocPhan_soluong> lsl         = new List <LopHocPhan_soluong>();

            foreach (var item in lopHocPhans)
            {
                LopHocPhan_soluong x = new LopHocPhan_soluong();
                x.malophp   = item.LopHocPhanId;
                x.sisotoida = item.soLuongSV;
                x.tenlophp  = item.tenLopHocPhan;
                if (item.TrangThai == EnumsHelper.TrangThaiLHP.Cho_SV_dang_ki)
                {
                    x.trangthai = "Chờ sinh viên đăng kí";
                }
                else if (item.TrangThai == EnumsHelper.TrangThaiLHP.Chap_Nhan_Mo_Lop)
                {
                    x.trangthai = "Chấp nhận mở lớp";
                }
                else
                {
                    x.trangthai = "Chờ hủy lớp";
                }

                x.sisohientai = kqhtsev.getSLSVDK(item.LopHocPhanId);
                lsl.Add(x);
            }
            var res = Json(lsl, JsonRequestBehavior.AllowGet);

            return(res);
        }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //LopHocPhanService.updateSoLuong(maLop);
            if (ThemMoi)
            {
                //int sl = int.Parse(txbSoLuongDangKy.Text.ToString());
                int mmh = MonService.getMaMH(tenMH);

                LopHocPhanService.themLop(
                    txbMaHocphan.Text.Trim(),
                    txbTenLop.Text.Trim(),
                    txbDinhMuc.Text.Trim(),
                    0,
                    txbGiaoVien.Text.Trim(),
                    mmh
                    );
                DialogResult = DialogResult.OK;
            }
            else
            {
                // int sl = int.Parse(txbSoLuongDangKy.Text.ToString());
                LopHocPhanService.SuaLop(
                    maLop,
                    txbTenLop.Text.Trim(),
                    txbDinhMuc.Text.Trim(),
                    0,
                    txbGiaoVien.Text.Trim()
                    );
                DialogResult = DialogResult.OK;
            }
        }
        public ActionResult DangKyHocPhan()
        {
            List <MonHoc>       list              = new List <MonHoc>();
            MonHocService       mh                = new MonHocService();
            KetQuaHocTapService ketQuaHocTap      = new KetQuaHocTapService();
            LopHocPhanService   lopHocPhanService = new LopHocPhanService();
            QLSVDatabaseContext db                = new QLSVDatabaseContext();
            List <KetQuaHocTap> a = db.KetQuaHocTaps.Where(x => x.SinhVienId == 2).ToList();

            if (a.Count == 0)
            {
                return(PartialView(mh.GetAll()));
            }
            foreach (var item in a)
            {
                foreach (var y in mh.GetAll())
                {
                    if (y.MonhocId != lopHocPhanService.getById(item.LopHocPhanId).MonHocId)
                    {
                        var DataMonHoc = new MonHoc();
                        DataMonHoc = y;
                        list.Add(DataMonHoc);
                    }
                }
            }
            return(PartialView(list));
        }
        public JsonResult getDanhSachLopHocPhan_Hocky(int idmh, int idhk)//
        {
            LopHocPhanService        sc  = new LopHocPhanService();
            IEnumerable <LopHocPhan> lst = new List <LopHocPhan>();

            lst = sc.GetLopHocPhan_by_idMh_idHk(idmh, idhk);
            KetQuaHocTapService       kqhtsev = new KetQuaHocTapService();
            List <LopHocPhan_soluong> lsl     = new List <LopHocPhan_soluong>();

            foreach (var item in lst)
            {
                LopHocPhan_soluong x = new LopHocPhan_soluong();
                x.malophp   = item.LopHocPhanId;
                x.sisotoida = item.soLuongSV;
                x.tenlophp  = item.tenLopHocPhan;
                if (item.TrangThai.Equals("1"))
                {
                    x.trangthai = "Chờ sinh viên đăng kí";
                }
                else
                {
                    if (item.TrangThai.Equals("2"))
                    {
                        x.trangthai = "Chấp nhận mở lớp";
                    }
                    else
                    {
                        x.trangthai = "Chờ hủy lớp";
                    }
                }
                x.sisohientai = kqhtsev.getSLSVDK(item.LopHocPhanId);
                lsl.Add(x);
            }
            return(Json(lsl, JsonRequestBehavior.AllowGet));
        }
        }               // kiểm tra xem có trong tgian đk không á

        public bool RangBuocDangky_DkSoTCchoPhep(string idsv, int idhk)
        {
            SinhVienService ser_sv   = new SinhVienService();
            SinhVien        sv       = ser_sv.getById(idsv);
            int             khoaid   = sv.KhoaHocID;
            KhoaHocService  ser_kh   = new KhoaHocService();
            KhoaHoc         kh       = ser_kh.getById(khoaid);
            int             sotc_max = kh.TCTDa;
            //lay ds lhp cua hoc ky do
            LopHocPhanService ser_lhp  = new LopHocPhanService();
            List <LopHocPhan> list_lhp = ser_lhp.GetLopHocPhanByHK(idhk).ToList();
            //lay ds ketquahoctap cua sinh vien do
            KetQuaHocTapService ser_kqht  = new KetQuaHocTapService();
            List <KetQuaHocTap> list_kqht = ser_kqht.getDSKQHT_by_idSV(idsv).ToList();
            int sotchientai = 0;

            foreach (var item in list_lhp)
            {
                foreach (var item2 in list_kqht)
                {
                    if (item2.LopHocPhanId == item.LopHocPhanId)
                    {
                        sotchientai += 1;
                    }
                }
            }
            if (sotchientai > sotc_max)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 6
0
        public ActionResult them()
        {
            LopHocPhanService lopHocPhanService = new LopHocPhanService();
            LopHocPhan        lopHocPhan        = new LopHocPhan();

            return(View());
        }
        public JsonResult getDanhSachLopHocPhan()//
        {
            LopHocPhanService        sc  = new LopHocPhanService();
            IEnumerable <LopHocPhan> lst = new List <LopHocPhan>();

            lst = sc.GetAll();
            return(Json(lst, JsonRequestBehavior.AllowGet));
        }
 public GiangVienController()
 {
     serMH   = new MonHocService();
     serLHP  = new LopHocPhanService();
     serSV   = new SinhVienService();
     serkqht = new KetQuaHocTapService();
     db      = new QLSVDatabaseContext();
 }
Ejemplo n.º 9
0
        // GET: DiemDanh
        public ActionResult DiemDanh_Index(int id)
        {
            LopHocPhanService lhp   = new LopHocPhanService();
            List <LopHocPhan> lslhp = new List <LopHocPhan>();

            lslhp = lhp.GetLopHocPhanByGV(id);
            return(View(lslhp));
        }
        public ActionResult DiemDanh_Index()
        {
            LopHocPhanService lhp   = new LopHocPhanService();
            List <LopHocPhan> lslhp = new List <LopHocPhan>();

            lslhp = lhp.GetLopHocPhansByID(3).ToList();
            return(View(lslhp));
        }
Ejemplo n.º 11
0
        public JsonResult getDanhSachLopHocPhan()
        {
            LopHocPhanService sc  = new LopHocPhanService();
            List <LopHocPhan> lst = new List <LopHocPhan>();

            lst = sc.GetLopHocPhanByGV(2);
            return(Json(lst, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 12
0
        private void updateTableLop()
        {
            string curentMon = cbMon.Text;

            if (curentMon != null && curentMon != "-----")
            {
                dgvLopHocPhan.DataSource = LopHocPhanService.getLopByMon(curentMon);
                lblTongLop.Text          = LopHocPhanService.getLopByMon(curentMon).Count.ToString();
            }
        }
Ejemplo n.º 13
0
        //sửa
        private void toolStripLabel4_Click(object sender, EventArgs e)
        {
            LopHocPhan lhp = new LopHocPhan();

            lhp.Id               = maLop;
            lhp.maMonHoc         = maMonHoc;
            lhp.giaoVienPhuTrach = textGiaoVien.Text;
            lhp.hanMucSinhVien   = textDinhMuc.Text;
            LopHocPhanService.edit(lhp);
            Load();
        }
Ejemplo n.º 14
0
        public frmSinhVien(string MSV)
        {
            InitializeComponent();
            msv = MSV;
            SinhVien sv = SinhVienService.getSinhVienByMa(MSV);

            txbMaSV.Text            = sv.MaSinhVien;
            txbTenSV.Text           = sv.HoDem + " " + sv.Ten;
            cbLopHocPhan.DataSource = LopHocPhanService.getDanhSachLop();
            DK = true;
        }
Ejemplo n.º 15
0
        private void tsbtnXoaL_Click(object sender, EventArgs e)
        {
            var rs = MessageBox.Show("Xóa lớp học phần này", "Bạn thực sư muốn",
                                     MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

            if (rs == DialogResult.OK)
            {
                if (MLHP != "" && MLHP != null)
                {
                    LopHocPhanService.XoaLop(MLHP);
                    updateTableLop();
                }
            }
        }
        public JsonResult RangBuocDangky_DkLopChoHuy(int idlhp)
        {
            LopHocPhanService ser_lhp = new LopHocPhanService();
            LopHocPhan        lhp     = ser_lhp.getById(idlhp);

            if (lhp.TrangThai == EnumsHelper.TrangThaiLHP.Cho_Huy_Lop)
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(lhp, JsonRequestBehavior.AllowGet));
            }
        }
        public bool RangBuocDangky_DkTime(int idlhp)
        {
            LopHocPhanService ser_lhp = new LopHocPhanService();
            LopHocPhan        lhp     = ser_lhp.getById(idlhp);

            if (lhp.NgayBD > DateTime.Today || lhp.NgayKT < DateTime.Today)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }               // kiểm tra xem có trong tgian đk không á
Ejemplo n.º 18
0
        public frmLopHocPhan(string ML, string TM)
        {
            InitializeComponent();
            //FillcomboL();
            this.Text = "Chỉnh sửa lớp học phần";
            maLop     = ML;
            LopHocPhan lopHocPhan = LopHocPhanService.getLopByMaLop(ML);

            txbMaHocphan.Text = lopHocPhan.MaLopHocPhan;
            txbTenLop.Text    = lopHocPhan.TenLopHocPhan;
            txbDinhMuc.Text   = lopHocPhan.DinhMuc;
            //txbSoLuongDangKy.Text = lopHocPhan.SoLuongDangKy.ToString();
            txbGiaoVien.Text = lopHocPhan.GiaoVienPhuTrach;
            ThemMoi          = false;
        }
Ejemplo n.º 19
0
        public frmSinhVien(string MSV, string ML)
        {
            InitializeComponent();
            btnSuccess.Text = "Lưu";
            msv             = MSV;
            mlhp            = ML;
            SinhVien sv = SinhVienService.getSinhVienByMa(MSV);

            txbMaSV.Text  = sv.MaSinhVien;
            txbTenSV.Text = sv.HoDem + " " + sv.Ten;
            LopHocPhan lh = LopHocPhanService.getLopByMaLop(ML);

            cbLopHocPhan.DataSource = LopHocPhanService.getDanhSachLop();
            cbLopHocPhan.Text       = lh.TenLopHocPhan;
            DK = false;
        }
Ejemplo n.º 20
0
        public ActionResult DanhSachDiemDanh(int idsv, int idlhp)
        {
            DiemDanhService   a   = new DiemDanhService();
            SinhVienService   b   = new SinhVienService();
            LopHocPhanService c   = new LopHocPhanService();
            List <DiemDanh>   lst = new List <DiemDanh>();

            foreach (var item in a.GetbyIDSV(idsv, idlhp))
            {
                DiemDanh m = new DiemDanh();
                m = item;
                lst.Add(m);
            }
            ViewBag.ten = b.getById(idsv).tenSinhVien;
            ViewBag.mon = c.getById(idlhp).tenLopHocPhan;
            return(View(lst));
        }
Ejemplo n.º 21
0
        public ActionResult CapNhat()
        {
            LopHocPhanService lopHocPhanService = new LopHocPhanService();
            LopHocPhan        lopHoc            = new LopHocPhan();

            lopHoc.NgayBD = DateTime.Now;
            DateTime ngaykt = lopHoc.NgayBD.AddDays(0);

            if (ngaykt.CompareTo(lopHoc.NgayBD) == 1)
            {
                return(View(TrangThaiLHP.Cho_Huy_Lop));
            }
            else
            {
                return(View(TrangThaiLHP.Cho_SV_dang_ki));
            }
        }
        public ActionResult getDangKy(int idlhp)
        {
            List <DKHP>       list_dkhp = new List <DKHP>();
            LopHocPhanService ser_lhp   = new LopHocPhanService();
            List <LopHocPhan> list_lhp  = new List <LopHocPhan>();
            LopHocPhan        lhp       = ser_lhp.getById(idlhp);

            List <KetQuaHocTap> list_kqht = new List <KetQuaHocTap>();
            KetQuaHocTapService kqhtsv    = new KetQuaHocTapService();
            KetQuaHocTap        kq        = new KetQuaHocTap();

            kq.LopHocPhanId = idlhp;
            kq.SinhVienId   = User.Identity.GetUserName();
            kq = kqhtsv.Add(kq);


            MonHocService ser_mh = new MonHocService();
            int           idmon  = lhp.MonHocId;
            MonHoc        mh     = ser_mh.getById(idmon);

            DKHP dkhp = new DKHP();

            dkhp.idkqht = kq.kqhtID;
            dkhp.malhp  = kq.LopHocPhanId;
            dkhp.idsv   = kq.SinhVienId;
            dkhp.malhp  = idlhp;
            dkhp.tenmh  = mh.TenMonHoc;
            dkhp.sotc   = mh.Sotinchi;
            // dkhp.ngaydk = DateTime.Today;
            if (lhp.TrangThai == EnumsHelper.TrangThaiLHP.Cho_SV_dang_ki)
            {
                dkhp.trangthai = "Chờ sinh viên đăng kí";
            }
            else if (lhp.TrangThai == EnumsHelper.TrangThaiLHP.Chap_Nhan_Mo_Lop)
            {
                dkhp.trangthai = "Chấp nhận mở lớp";
            }
            else
            {
                dkhp.trangthai = "Chờ hủy lớp";
            }
            list_dkhp.Add(dkhp);

            return(Json(dkhp, JsonRequestBehavior.AllowGet));
        }
        public JsonResult ChanSauDangKy(int idlhp)
        {
            LopHocPhanService ser_lhp = new LopHocPhanService();
            MonHocService     ser_mh  = new MonHocService();
            //load lai mon hoc
            LopHocPhan    lhp     = ser_lhp.getById(idlhp);
            MonHoc        mh      = ser_mh.getById(lhp.MonHocId);
            List <MonHoc> list_mh = ser_mh.GetAll().ToList();

            for (int i = 0; i < list_mh.Count; i++)
            {
                if (list_mh[i].MonhocId == mh.MonhocId)
                {
                    list_mh.RemoveAt(i);
                }
            }
            return(Json(list_mh, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 24
0
 private void btnSuccess_Click(object sender, EventArgs e)
 {
     if (DK)
     {
         LopHocPhan ml = LopHocPhanService.getMaLop(cbLopHocPhan.Text);
         SinhVienService.DangKy(msv, ml.MaLopHocPhan);
         DialogResult = DialogResult.OK;
     }
     else
     {
         LopHocPhan ml = LopHocPhanService.getMaLop(cbLopHocPhan.Text);
         if (ml.MaLopHocPhan != mlhp)
         {
             SinhVienService.SuaDangKy(msv, mlhp, ml.MaLopHocPhan);
         }
         DialogResult = DialogResult.OK;
     }
 }
Ejemplo n.º 25
0
        public JsonResult CapNhatLHP(LopHocPhan lopHocPhan)
        {
            LopHocPhanService lopHocPhanService = new LopHocPhanService();
            LopHocPhan        lopHoc            = new LopHocPhan();

            lopHoc.NgayBD = DateTime.Now;
            DateTime ngaykt = lopHoc.NgayBD.AddDays(0);

            if (ngaykt.CompareTo(lopHoc.NgayBD) == 0)
            {
                return(Json(lopHoc.TrangThai == (TrangThaiLHP.Cho_Huy_Lop), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(lopHoc.TrangThai == (TrangThaiLHP.Cho_SV_dang_ki), JsonRequestBehavior.AllowGet));
            }
            //return Json(lopHoc.TrangThai == (TrangThaiLHP.Chap_Nhan_Mo_Lop), JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 26
0
        private void button1_Click(object sender, EventArgs e)
        {
            int j = 0;

            foreach (LopHocPhan i in dsLopHocPhan)
            {
                if (i.Id == ThemMaHP.Text)
                {
                    MessageBox.Show("Học Phần Đã Tồn Tại");
                    j = 1;
                    break;
                }
            }
            if (j == 0)
            {
                LopHocPhanService.addData(ThemMaHP.Text, themGiaoVien.Text, themHanMuc.Text, themMaMH.Text);
                this.Close();
            }
        }
        public JsonResult AddLHP(int idMon)
        {
            LopHocPhanService lopHocPhanService = new LopHocPhanService();
            LopHocPhan        lopHocPhan        = new LopHocPhan();

            lopHocPhan.MonHocId      = 1;
            lopHocPhan.GiangVienid   = 3;
            lopHocPhan.tenLopHocPhan = "WWW";
            lopHocPhan.soLuongSV     = 12;
            lopHocPhan.TrangThai     = TrangThaiLHP.Chap_Nhan_Mo_Lop;
            lopHocPhan.Mota          = "";
            lopHocPhan.NgayBD        = Convert.ToDateTime("10/11/1998");
            lopHocPhan.NgayKT        = Convert.ToDateTime("10/1/2000");
            lopHocPhan.NgayKTDK      = Convert.ToDateTime("6/1/2000");
            lopHocPhan.Hockyid       = 1;
            lopHocPhan = lopHocPhanService.Add(lopHocPhan);
            var res = Json(lopHocPhanService, JsonRequestBehavior.AllowGet);

            return(res);
        }
        public ActionResult KetQuaHocTap()
        {
            LopHocPhanService   hocPhanService = new LopHocPhanService();
            KetQuaHocTapService kqs            = new KetQuaHocTapService();
            List <KQHT>         l = new List <KQHT>();

            foreach (var item in kqs.GetAll())
            {
                KQHT kq = new KQHT();
                kq.kqhtid  = item.kqhtID;
                kq.lophpid = item.LopHocPhanId;
                kq.svid    = item.SinhVienId;
                kq.tk      = item.ThuongKy;
                kq.gk      = item.GiuaKy;
                kq.ck      = item.CuoiKy;

                kq.tenlhp = hocPhanService.getById(item.LopHocPhanId).tenLopHocPhan;
                l.Add(kq);
            }
            return(PartialView(l));
        }
Ejemplo n.º 29
0
        public JsonResult AddLPH(LopHocPhan lp) /*int lophocphanid,int monhocid,int giangvienid,string tenhp,int SL,int trangthai,string mota,DateTime ngayBD,DateTime ngayketthuc,DateTime Ndk,int hockyid*/
        {
            LopHocPhanService lopHocPhanService = new LopHocPhanService();
            //LopHocPhan lopHocPhan = new LopHocPhan();
            //lopHocPhan.MonHocId = 1;
            //lopHocPhan.GiangVienid = 2;
            //lopHocPhan.tenLopHocPhan = "WWW";
            //lopHocPhan.soLuongSV = 12;
            //lopHocPhan.TrangThai = TrangThaiLHP.Chap_Nhan_Mo_Lop;
            //lopHocPhan.Mota = "";
            //lopHocPhan.NgayBD = Convert.ToDateTime("10/11/1999");
            //lopHocPhan.NgayKT = Convert.ToDateTime("10/1/2000");
            //lopHocPhan.NgayKTDK = Convert.ToDateTime("6/1/2000");
            //lopHocPhan.Hockyid = 1;
            //lopHocPhan = lopHocPhanService.Add(lopHocPhan);
            //var res = Json(lopHocPhanService, JsonRequestBehavior.AllowGet);
            //return res;
            List <LopHocPhan> lst = new List <LopHocPhan>();
            var lt = (from mh in sermh.GetAll()
                      join
                      lph in serlhp.GetAll() on mh.MonhocId equals lph.MonHocId
                      where (lph.MonHocId == lp.MonHocId)
                      select new
            {
                lph.MonHocId,
                lph.Mota,
                lph.NgayBD,
                lph.NgayKT,
                lph.NgayKTDK,
                lph.soLuongSV,
                lph.tenLopHocPhan,
                lph.TrangThai
            }).ToList();

            lst.Add(lp);
            return(Json(lst, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 30
0
 private void dgvLopHocPhan_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     updateThongTin();
     LopHocPhanService.updateSoLuong(MLHP);
     updateThongTin();
 }