public JsonResult getDSDangKy_theoHK(int idhk) { IEnumerable <LopHocPhan> lst = new List <LopHocPhan>(); lst = sc.GetLopHocPhanByHK(idhk); List <KetQuaHocTap> list_kqht = new List <KetQuaHocTap>(); KetQuaHocTapService kqhtsev = new KetQuaHocTapService(); List <DKHP> lsl = new List <DKHP>(); list_kqht = kqhtsev.GetAll().ToList(); string idsv = User.Identity.GetUserName(); foreach (var item2 in lst) { foreach (var item in list_kqht) { if (item2.LopHocPhanId == item.LopHocPhanId && item.SinhVienId == idsv) { MonHoc mh = ser_mh.getById(item2.MonHocId); DKHP d = new DKHP(); d.idkqht = item.kqhtID; d.idsv = item.SinhVienId; d.malhp = item.LopHocPhanId; d.sotc = mh.Sotinchi; d.tenmh = mh.TenMonHoc;; if (item2.TrangThai == EnumsHelper.TrangThaiLHP.Cho_SV_dang_ki) { d.trangthai = "Chờ sinh viên đăng kí"; } else if (item2.TrangThai == EnumsHelper.TrangThaiLHP.Chap_Nhan_Mo_Lop) { d.trangthai = "Chấp nhận mở lớp"; } else { d.trangthai = "Chờ hủy lớp"; } lsl.Add(d); } } } return(Json(lsl, JsonRequestBehavior.AllowGet)); }
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)); }