public ActionResult DownloadZipFile(int detaiId) { Account account = (Account)Session[Utils.Constant.MANAGER_SESSION]; if (account == null) { return(RedirectToRoute("login")); } using (var kHHTLinhVucRepository = new KHHTLinhVucService()) { using (var kHKTKhoaHocKiThuatRepository = new KHKTKhoaHocKiThuatService()) { KHKTLinhVucThamGia kHKTLinhVucThamGia = kHHTLinhVucRepository.GetHKTLinhVucThamGiaById(detaiId); List <KhoaHocKiThuat> khoaHocKiThuats = kHKTKhoaHocKiThuatRepository.GetKhoaHocKiThuatByDeTaiId(detaiId); using (var memoryStream = new MemoryStream()) { using (var ziparchive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true)) { for (int i = 0; i < khoaHocKiThuats.Count; i++) { if (khoaHocKiThuats[i].FileTaiLieu != null) { ziparchive.CreateEntryFromFile(System.Web.HttpContext.Current.Server.MapPath("~/UploadedFiles/KhoaHocKiThuat/" + khoaHocKiThuats[i].FileTaiLieu), khoaHocKiThuats[i].FileTaiLieu); } } } return(File(memoryStream.ToArray(), "application/zip", kHKTLinhVucThamGia.Name.Trim() + ".zip")); } } } }
public ActionResult Dangki() { var school = (T_DM_Truong)Session[Constant.SCHOOL_SESSION]; if (school == null) { return(RedirectToRoute("login")); } using (var hCMLopRepository = new T_DM_LopService()) { List <T_DM_Lop> t_DM_Lops = hCMLopRepository.GetT_DM_LopsBySchoolId(school.SchoolID); using (var hCMHocSinhRepository = new T_DM_HocSinhService()) { List <T_DM_HocSinh> t_DM_HocSinhs = hCMHocSinhRepository.GetT_DM_HocSinhsByClassId(t_DM_Lops[0].LopID.Trim()); ViewBag.Lop = t_DM_Lops; ViewBag.HocSinh = t_DM_HocSinhs; using (var kHHTLinhVucRepository = new KHHTLinhVucService()) { List <KHKTLinhVucThamGia> kHKTLinhVucThamGias = kHHTLinhVucRepository.GetKHKTLinhVucThamGias(); ViewBag.LinhVuc = kHKTLinhVucThamGias; } } } return(View()); }
public ActionResult DsKhoaHocKiThuat() { var manager = (Account)Session[Constant.MANAGER_SESSION]; if (manager == null) { return(RedirectToRoute("quanlylogin")); } var managerPersmission = (List <UserPermission>)Session[Constant.MANAGER_PERMISSION_SESSION]; //var permission = 9; if (managerPersmission.Where(s => s.PermissionId == 9).FirstOrDefault() == null) { return(RedirectToRoute("quanlylogin")); } using (var kHKTKhoaHocKiThuatRepository = new KHKTKhoaHocKiThuatService()) { using (var kHHTLinhVucRepository = new KHHTLinhVucService()) { List <KHKTLinhVucThamGia> linhVucThamGias = kHHTLinhVucRepository.GetKHKTLinhVucThamGias(); List <KhoaHocKiThuatDetailDTO> khoaHocKiThuatDetailDTOs = kHKTKhoaHocKiThuatRepository.GetKhoaHocKiThuats(); ViewBag.KHKT = khoaHocKiThuatDetailDTOs; ViewBag.LinhVucs = linhVucThamGias; return(View()); } } }