public async Task <IActionResult> FillExamFormAsync(ExamListViewModel vm) { var examsDTO = await _examService.GetExamsAsync(vm.FacultyName, vm.CourseNumber); var listviewmodel = _examViewModelMapper.MapFrom(examsDTO); var model = new ExamListViewModel { CourseNumber = vm.CourseNumber, Exams = listviewmodel, FacultyName = vm.FacultyName, Session = vm.Session, Year = vm.Year, NextYear = vm.Year + 1 }; var html = PdfUtility.GetHTMLString(model); var Renderer = new HtmlToPdf(); var PDF = Renderer.RenderHtmlAsPdf(html); var pdfname = vm.Shortfaculty + "_" + vm.CourseNumber.ToString() + ".pdf"; var OutputPath = "HtmlToPDF.pdf"; PDF.SaveAs(OutputPath); byte[] fileBytes = System.IO.File.ReadAllBytes(@"HtmlToPDF.pdf"); string fileName = pdfname; return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName)); }
public ActionResult AddEditExam(ExamListViewModel model) { FillAllDropdowns(); string strSuccessMsg = string.Empty; string strErrorMsg = string.Empty; if (model != null && model.Exam != null) { if (string.IsNullOrEmpty(model.Exam.ExamID)) { strSuccessMsg = ExamRes.MsgAddSuccess; strErrorMsg = ExamRes.MsgAddError; } else { strSuccessMsg = ExamRes.MsgEditSuccess; strErrorMsg = ExamRes.MsgEditError; } int i = _ExamService.AddEdit(model.Exam); if (i <= 0) { TempData["err"] = strErrorMsg; } else { TempData["msg"] = strSuccessMsg; } } return RedirectToAction("ManageExam", "Exam"); }
public ActionResult Index(Guid disciplineId) { if (!UserIsInRole("Professor")) { return(RedirectToAction("Index", "Home")); } var students = _studentQuery.Handle(new StudentInputListByDiscipline { DisciplineId = disciplineId }).Students; var exams = _activityQuery.Handle(new ExamInputGetByDiscipline { DisciplineId = disciplineId, Semester = new UseCases.Shared.Semester() }).Activities; if (exams.Count() == 0) { CreateExams(disciplineId); exams = _activityQuery.Handle(new ExamInputGetByDiscipline { DisciplineId = disciplineId, Semester = new UseCases.Shared.Semester() }).Activities; } var grades = new ExamListViewModel { DisciplineId = disciplineId, DisciplineName = exams.First().Discipline.Name }; foreach (var student in students) { var studentGrades = new Dictionary <string, decimal>(); foreach (var exam in exams) { var result = _activityEvaluationQuery.Handle(new ActivityInputGetByStudent { ActivityId = exam.Id, StudentId = student.Id }).Activity; decimal grade = 0; if (result == null) { _activityEvaluationCommand.Handle(new ActivityInputGiveGrade { ActivityId = exam.Id, Grade = 0, StudentId = student.Id, Value = exam.Value }); } else { grade = result.Grade; } studentGrades.Add(exam.Description, grade); } var item = new ExamListItem { Student = $"{student.FirstName} {student.LastName}", StudentId = student.Id, Exam1 = studentGrades.Single(x => x.Key == new Exam1(Guid.Empty).Description).Value, Exam2 = studentGrades.Single(x => x.Key == new Exam2(Guid.Empty).Description).Value, Exam3 = studentGrades.Single(x => x.Key == new Exam3(Guid.Empty).Description).Value, FinalExam = studentGrades.Single(x => x.Key == new FinalExam(Guid.Empty).Description).Value }; grades.Students.Add(item); } return(View(grades)); }
public ActionResult AddEditExam(string pExamID) { FillAllDropdowns(); User objUser = null; if (eSchoolSession.IsInSession(SessionKeys.CurrentUser)) objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser); ExamListViewModel model = new ExamListViewModel(); model.Exam = new eSchool.Models.Exam(); if (ModelState.IsValid) { if (!string.IsNullOrEmpty(pExamID)) { model.Exam.ExamID = pExamID; model.Exam = _ExamService.Get(model.Exam); } } return PartialView("_AddEditExam", model); }
// 展示考试列表 Create by HuaFeng-Miki public ActionResult ExamList() { ExamListViewModel examlistViewModel = new ExamListViewModel(); ExamListBusinessLayer examlistBusinessLayer = new ExamListBusinessLayer(); List <ExamList> examList = examlistBusinessLayer.GetExamList(); // 查找该年级的考试科目 加到ExamList中 Create by HuaFeng-Miki int GroupId = Convert.ToInt32(HttpContext.Session["Group"]); if (GroupId != 0) { foreach (ExamList examlist in examList) { if (examlist.Group == GroupId) { ExamList ShowExamlist = new ExamList(); ShowExamlist.ExamName = examlist.ExamName; ShowExamlist.Group = examlist.Group; ShowExamlist.StartTime = examlist.StartTime; ShowExamlist.Duration = examlist.Duration; examlistViewModel.ExamList.Add(ShowExamlist); } } } if (HttpContext.Session["User"] != null && Session["User"].ToString() != "") { examlistViewModel.NavStatusData = new NavStatusViewModel(); examlistViewModel.NavStatusData.LeftLink = "/User/Profile/" + HttpContext.Session["User"].ToString(); examlistViewModel.NavStatusData.LeftText = Session["User"].ToString(); examlistViewModel.NavStatusData.RightLink = "/User/Logout"; examlistViewModel.NavStatusData.RightText = "Log out"; } return(View("ExamList", examlistViewModel)); }
public ActionResult AddEditExamSubjects(string ExamId = "") { ExamListViewModel model = new ExamListViewModel(); model.Exam = new Models.Exam(); model.Exam.ExamID = ExamId; model.Exam = _ExamService.Get(model.Exam); model.Exam.ExamStartDate = Convert.ToDateTime(model.Exam.ExamStartDate.ToString("dd-MMM-yyyy")); model.Exam.ExamEndDate = Convert.ToDateTime(model.Exam.ExamEndDate.ToString("dd-MMM-yyyy")); ViewBag.AwardingTypeList = GetLookupValues("AwardingType"); model.ExamSubjects = new ExamSubjects(); model.ExamSubjectsList = new List<ExamSubjects>(); model.ExamSubjects.ExamID = ExamId; model.ExamSubjectsList = _IExamSubjectsService.GetAll(model.ExamSubjects).ToList(); return View(model); }
public ActionResult WrittenTestMarksDetails(string ExamID) { ExamListViewModel model = new ExamListViewModel(); model.Exam = new Models.Exam(); model.Exam.ExamID = ExamID; model.Exam = _ExamService.Get(model.Exam); ViewBag.AwardingTypeList = GetLookupValues("AwardingType"); return View(model); }
public ActionResult WrittenTestExamMarksDataEntryParent(string ExamID, string AwardingType) { ExamListViewModel model = new ExamListViewModel(); model.ExamMarks = new ExamMarks(); model.ExamMarksList = new List<ExamMarks>(); model.ExamMarksDetailIs = new ExamMarksDetailIs(); model.Exam = new Models.Exam(); model.Exam.ExamID = ExamID; model.Exam = _ExamService.Get(model.Exam); // GET ALL STUDENTS FOR GIVEN CLASS model.ExamMarksDetailIs.ClassID = model.Exam.ClassID; model.ExamStudentsList = _IExamMarksDetailIsService.GetStudentsForClass(model.ExamMarksDetailIs).ToList(); model.ExamSubjects = new ExamSubjects(); model.ExamSubjects.ExamID = ExamID; model.ExamSubjects.AwardingType = AwardingType; model.ExamSubjectsList = _IExamSubjectsService.ExamSubjectsForAwardingType(model.ExamSubjects); // GET DETAILS FOR EXAM MARKS model.ExamMarks.ExamID = ExamID; model.ExamMarksList = _IExamMarksService.GetAll(model.ExamMarks).ToList(); ViewBag.ExamGradesList = GetGradesForExam(ExamID); return PartialView("_WrittenTestExamMarksDataEntryParent", model); }
public ActionResult UnitTestExamMarksDetails(string ExamID) { ExamListViewModel model = new ExamListViewModel(); model.Exam = new Models.Exam(); model.Exam.ExamID = ExamID; model.Exam = _ExamService.Get(model.Exam); ViewBag.ExamSubjectsList = GetAllExamSubjects(ExamID, "Marks"); return View(model); }
public ActionResult UnitTestExamMarksDataEntryParent(string ExamID, string SubjectID) { ExamListViewModel model = new ExamListViewModel(); model.ExamMarksDetailIs = new ExamMarksDetailIs(); model.ExamMarksDetailIsList = new List<ExamMarksDetailIs>(); model.Exam = new Models.Exam(); model.Exam.ExamID = ExamID; model.Exam = _ExamService.Get(model.Exam); model.ExamSubjects = new ExamSubjects(); model.ExamSubjects.ExamID = ExamID; model.ExamSubjects.SubjectID = SubjectID; // GET MAX QUESTIONS model.ExamSubjects = _IExamSubjectsService.Get(model.ExamSubjects); // GET ALL STUDENTS FOR GIVEN CLASS model.ExamMarksDetailIs.ClassID = model.Exam.ClassID; model.ExamStudentsList = _IExamMarksDetailIsService.GetStudentsForClass(model.ExamMarksDetailIs).ToList(); // GET DETAILS FOR EXAM MARKS DETAILS model.ExamMarksDetailIs.ExamID = ExamID; model.ExamMarksDetailIs.SubjectID = SubjectID; model.ExamMarksDetailIsList = _IExamMarksDetailIsService.GetAll(model.ExamMarksDetailIs).ToList(); return PartialView("_UnitTestExamMarksDataEntryParent", model); }
public ActionResult ManageExamGrades(string ExamId, ExamListViewModel model) { if (model == null) { model = new ExamListViewModel(); } if (model.Exam == null) { model.Exam = new Models.Exam(); } if (model.ExamGrades == null) { model.ExamGrades = new ExamGrades(); } if (model.ExamGradesList == null) { model.ExamGradesList = new List<ExamGrades>(); } if (!string.IsNullOrEmpty(model.Exam.sort)) { model.Exam.SortExp = model.Exam.sort + " " + model.Exam.sortdir; } if (model.ExamGrades.PageSize == 0) { int PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]); model.ExamGrades.PageSize = PageSize; } if (model.Exam.PageIndex == 0) { model.Exam.PageIndex = 1; } model.ExamGrades.TotalCount = 0; model.Exam.ExamID = ExamId; model.Exam = _ExamService.Get(model.Exam); model.ExamGrades.ExamID = ExamId; model.ExamGradesList = _IExamGradesService.GetAll(model.ExamGrades).ToList(); if (model.ExamGradesList != null && model.ExamGradesList.Count > 0) { int TotalCount = model.ExamGradesList[0].TotalCount; model.ExamGrades.TotalCount = TotalCount; } return View(model); }
public ActionResult ManageExam(ExamListViewModel model) { User objUser = null; if (eSchoolSession.IsInSession(SessionKeys.CurrentUser)) objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser); if (model.Exam == null) { model.Exam = new eSchool.Models.Exam(); } if (!string.IsNullOrEmpty(model.Exam.sort)) { model.Exam.SortExp = model.Exam.sort + " " + model.Exam.sortdir; } if (model.Exam.PageSize == 0) { int PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]); model.Exam.PageSize = PageSize; } if (model.Exam.PageIndex == 0) { model.Exam.PageIndex = 1; } model.ExamList = new List<eSchool.Models.Exam>(); model.Exam.TotalCount = 0; model.ExamList = _ExamService.GetAll(model.Exam).ToList(); Lookup entity = new Lookup(); if (model.ExamList != null && model.ExamList.Count > 0) { int TotalCount = model.ExamList[0].TotalCount; model.Exam.TotalCount = TotalCount; } return View(model); }
public ActionResult Index() { ExamListViewModel elvm = new ExamListViewModel(); elvm.SideBarData = new SideBarViewModel(); elvm.SideBarData.CurrentIndex = 2; ExamListBusinessLayer examlistBusinessLayer = new ExamListBusinessLayer(); /* Code by Dwayne 2015-12-4 12:57:17 */ const int numPerPage = 5; int pageNum = Int32.Parse(RouteData.Values["id"].ToString()) - 1; List <ExamList> examList = examlistBusinessLayer.GetExamList(); elvm.ExamList = examList.Skip(pageNum * numPerPage).Take(numPerPage).ToList(); elvm.PageNum = pageNum; elvm.ExamNum = elvm.ExamList.Count; elvm.TotalNum = examList.Count; // 查找该年级的考试科目 加到ExamList中 Create by HuaFeng-Miki int GroupId = Convert.ToInt32(HttpContext.Session["Group"]); if (GroupId != 0) { foreach (ExamList examlist in examList) { if (examlist.Group == GroupId) { ExamList ShowExamlist = new ExamList(); ShowExamlist.ExamName = examlist.ExamName; ShowExamlist.Group = examlist.Group; ShowExamlist.StartTime = examlist.StartTime; ShowExamlist.Duration = examlist.Duration; elvm.ExamList.Add(ShowExamlist); } } } // Add default exam // Dwayne 2015-12-5 09:33:13 if (elvm.ExamNum == 0) { ExamList exam = new ExamList(); exam.ExamName = "Test"; exam.StartTime = DateTime.Now; exam.Group = 1; elvm.ExamList.Add(exam); elvm.ExamNum = elvm.TotalNum = 1; } if (HttpContext.Session["User"] != null && Session["User"].ToString() != "") { elvm.NavStatusData = new NavStatusViewModel(); elvm.NavStatusData.LeftLink = "/User/Profile/" + HttpContext.Session["User"].ToString(); elvm.NavStatusData.LeftText = Session["User"].ToString(); elvm.NavStatusData.RightLink = "/User/Logout"; elvm.NavStatusData.RightText = "Log out"; } return(View("", elvm)); }
public static string GetHTMLString(ExamListViewModel model) { var sb = new StringBuilder(); sb.AppendFormat(@" <html> <head> </head> <body id='datatest'> <div> <center> <h1>Технически Университет - София</h1> <h3> Г Р А Ф И К <br /> на {0} сесия за учебната {1}/{2} година <br /> Курс <font color='#CC0333'>{3}</font> <br /> <font color='#CC0333'>{4}</font> </h3> </center> <center> <table border cellspacing='0' cellpadding='2' width='700'> <thead> <tr> <td width='40%'> <center> <b> Дисциплина </b> </center> </td> <td width='10%'> <center> <b> Зала </b> </center> </td> <td width='10%'> <center> <b> Дата </b> </center> </td> <td width='10%'> <center> <b> Час </b> </center> </td> <td width='20%'> <center> <b> Продължителност </b> </center> </td> </tr> </thead> <tbody> ", model.Session.ToLower(), model.Year, model.NextYear, model.CourseNumber, model.FacultyName); foreach (var emp in model.Exams) { sb.AppendFormat(@" <tr> <td> <center> <b> {0} </b> </center> </td> <td> <center> <b> {1} </b> </center> </td> <td> <center> <b> {2}.{3}.{4} </b> </center> </td> <td> <center> <b> {5}:{6} </b> </center> </td> <td> <center> <b> {7} минути </b> </center> </td> </tr>", emp.Name, emp.ExamHall, emp.Date.Day, emp.Date.Month, emp.Date.Year, emp.Date.Hour, emp.Date.Minute.ToString("D2"), emp.Duration); } sb.Append(@" </tbody> </table> </center> </div> </body> </html>"); return(sb.ToString()); }
public ActionResult RptFormatOne(ExamListViewModel model) { if (model == null) { model = new ExamListViewModel(); } if (model.Exam == null) { model.Exam = new Models.Exam(); } if (model.ExamList == null) { model.ExamList = new List<Models.Exam>(); } if (model.ExamMarks == null) { model.ExamMarks = new ExamMarks(); } if (model.ExamSubjects == null) { model.ExamSubjects = new ExamSubjects(); } if (model.ExamMarksDetailIs == null) { model.ExamMarksDetailIs = new ExamMarksDetailIs(); } if (model.ExamStudentsList == null) { model.ExamStudentsList = new List<ExamMarksDetailIs>(); } if (!string.IsNullOrEmpty(model.Exam.ExamID)) { model.Exam = _ExamService.Get(model.Exam); } if (!string.IsNullOrEmpty(model.ExamMarks.SubjectID)) { model.ExamSubjects = new ExamSubjects(); model.ExamSubjects.ExamID = model.Exam.ExamID; model.ExamSubjects.SubjectID = model.ExamMarks.SubjectID; // GET MAX QUESTIONS model.ExamSubjects = _IExamSubjectsService.Get(model.ExamSubjects); // GET ALL STUDENTS FOR GIVEN CLASS model.ExamMarksDetailIs.ClassID = model.Exam.ClassID; model.ExamStudentsList = _IExamMarksDetailIsService.GetStudentsForClass(model.ExamMarksDetailIs).ToList(); // GET DETAILS FOR EXAM MARKS DETAILS model.ExamMarksDetailIs.ExamID = model.Exam.ExamID; model.ExamMarksDetailIs.SubjectID = model.ExamSubjects.SubjectID; model.ExamMarksDetailIsList = _IExamMarksDetailIsService.GetAll(model.ExamMarksDetailIs).ToList(); } User objUser = new User(); if (eSchoolSession.IsInSession(SessionKeys.CurrentUser)) { objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser); } ViewBag.ExamSubjectsList = GetAllExamSubjects(model.Exam.ExamID, "Marks"); ViewBag.AYList = GetAllAY(); ViewBag.ClassList = GetAllClass(); ViewBag.SectionList = GetAllSection(); ViewBag.ExamList = GetAllExams("", objUser.SchoolID); ViewBag.AssessmentTypeList = GetLookupValues("AssessmentType"); return View(model); }
public ActionResult RptFormatTwo(ExamListViewModel model) { if (model == null) { model = new ExamListViewModel(); } if (model.Exam == null) { model.Exam = new Models.Exam(); } if (model.ExamList == null) { model.ExamList = new List<Models.Exam>(); } if (model.ExamMarks == null) { model.ExamMarks = new ExamMarks(); } if (model.ExamMarksDetailIs == null) { model.ExamMarksList = new List<ExamMarks>(); } if (!string.IsNullOrEmpty(model.ExamMarks.SubjectID)) { model.ExamMarksList = _IExamMarksService.FormatTwoDetails(model.ExamMarks).ToList(); } ViewBag.ExamSubjectsList = GetAllExamSubjects(model.Exam.ExamID, "Marks"); ViewBag.AYList = GetAllAY(); ViewBag.ClassList = GetAllClass(); ViewBag.SectionList = GetAllSection(); return View(model); }
public ActionResult RptFormatThree(ExamListViewModel model) { return View(model); }