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 ActionResult getDanhsachMonHoc() { MonHocService mh = new MonHocService(); var list = mh.GetAll(); return(View(list)); }
public ActionResult LopHocPhan() { MonHocService mh = new MonHocService(); var list = mh.GetAll(); return(View(list)); }
public ActionResult DanhSachMonHoc() { List <MonHoc> list = new List <MonHoc>(); MonHocService mh = new MonHocService(); foreach (var item in mh.GetAll()) { var DataMonHoc = new MonHoc(); DataMonHoc = item; list.Add(DataMonHoc); } return(PartialView(list)); }
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)); }
public JsonResult getDanhSachLopHocPhan(int id) { var query = (from mh in serMH.GetAll() join lhp in serLHP.GetAll() on mh.MonhocId equals lhp.MonHocId where (mh.MonhocId == id) select new { lhp.LopHocPhanId, lhp.tenLopHocPhan, lhp.NgayKT, lhp.NgayKTDK, lhp.NgayBD, lhp.TrangThai, lhp.Mota, lhp.soLuongSV }).ToList(); return(Json(query, JsonRequestBehavior.AllowGet)); }
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)); }
public ActionResult DangKyHocPhan() { string idsv = User.Identity.GetUserName(); Model_DangKyHocPhan a = new Model_DangKyHocPhan(); List <MonHoc> monHocs = new List <MonHoc>(); SinhVienService sinhVienService = new SinhVienService(); MonHocService mh = new MonHocService(); List <MonHoc> monhocs = db.MonHocs.Select(x => x).ToList(); List <KetQuaHocTap> kqht = db.KetQuaHocTaps.Where(x => x.SinhVienId.Equals(idsv)).ToList(); List <LopHocPhan> lhp = db.LopHocPhans.Select(x => x).ToList(); List <LopHocPhan> listtemp = new List <LopHocPhan>(); MonHocService ser_mh = new MonHocService(); List <MonHoc> list_mh = ser_mh.GetAll().ToList(); foreach (var item in kqht) { LopHocPhan lhpnew = new LopHocPhan(); lhpnew = db.LopHocPhans.Where(x => x.LopHocPhanId == item.LopHocPhanId).FirstOrDefault() ; int malop = lhpnew.MonHocId; for (int i = 0; i < list_mh.Count; i++) { if (list_mh[i].MonhocId == malop) { list_mh.RemoveAt(i); } } } //for (int i = 0; i < kqht.Count; i++) //{ // for (int j = 0; j < lhp.Count; j++) // { // if (kqht[i].LopHocPhanId == lhp[j].LopHocPhanId) // { // LopHocPhan temp = new LopHocPhan(); // temp = lhp[j]; // listtemp.Add(temp); // } // } //} //for (int i = 0; i < mon; i++) //{ // for (int j = 0; j < listtemp.Count; j++) // { // if (item.MonhocId != listtemp[i].MonHocId) // { // monHocs.Add(item); // } // } //} //foreach (var item in mh.GetAll()) //{ // var monhoc = new MonHoc(); // monhoc = item; // monHocs.Add(monhoc); //} //hoc ki List <HocKy> hockis = new List <HocKy>(); HocKyService hk = new HocKyService(); foreach (var item in hk.GetAll()) { var hocky = new HocKy(); hocky = item; hockis.Add(hocky); } //sinh vien SinhVien sv = new SinhVien(); sv = db.SinhViens.Where(x => x.SinhVienId.Equals(idsv)).FirstOrDefault(); a.mHocKy = hockis; //a.mMonHoc = monHocs; a.mMonHoc = list_mh; a.mSinhVien = sv; return(PartialView(a)); }