public JsonResult ScheduleExam(ExamSchedule examSchedule) { examSchedule.BatchId = _bId; Exam examData = new Exam(); var dataList = new ExamEntryForView(); dataList = Mapper.Map <ExamEntryForView>(examData); if (_examScheduleBll.QuarableScheduleExam() .Any(e => e.BatchId == examSchedule.BatchId && e.ExamId == examSchedule.ExamId)) { dataList = null; } else { var isSaved = _examScheduleBll.Add(examSchedule); examData = _examBll.GetById(examSchedule.ExamId); dataList = Mapper.Map <ExamEntryForView>(examData); if (examData.Examtype == 1003) { dataList.TypeExam = "ClassTest"; } else { dataList.TypeExam = "LabTest"; } } return(Json(dataList, JsonRequestBehavior.AllowGet)); }
/*----------------------------------------------------------------------------EXAM SCHEDULE-----------------------------------------------------*/ public string addExamSchedule(ExamSchedule examSchedule) { int id; try { id = objUserInfoDAL.getExamReportMappingid(examSchedule.erm_institution_id, examSchedule.erm_class_id, examSchedule.erm_section_id, examSchedule.exam_term); if (id == 0) { objUserInfoDAL.addExamReportMapping(examSchedule); id = objUserInfoDAL.getExamReportMappingid(examSchedule.erm_institution_id, examSchedule.erm_class_id, examSchedule.erm_section_id, examSchedule.exam_term); examSchedule.erm_id = id; objUserInfoDAL.addExamSchedule(examSchedule); return("Success"); } else { return("User Exists"); } } catch (Exception ex) { CubitExceptionUtility.CubitExceptionLog(ex.Message + "BAL: Error while storing Post details" + ex.StackTrace + " " + ex.InnerException, this.GetType().BaseType.Name.ToString(), DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString()); return("Error"); } }
public IEnumerator ExamSchedule() { ExamSchedule SQL_ES = new ExamSchedule(); JSONNode JSON_ES = JSONReader.Read("GetExamSchedule"); for (int i = 0; i < JSON_ES.Count; i++) { SQL_ES.CoursesOffered_ID = JSON_ES[i]["courses_offered_id"] != "null" ? int.Parse(JSON_ES[i]["courses_offered_id"]) : 0; SQL_ES.LastName = JSON_ES[i]["LastName"]; SQL_ES.FirstName = JSON_ES[i]["FirstName"]; SQL_ES.PreferredFirstName = JSON_ES[i]["PreferredFirstName"]; SQL_ES.ExamDate = JSON_ES[i]["ExamDate"]; SQL_ES.StartTime = JSON_ES[i]["StartTime"]; SQL_ES.EndTime = JSON_ES[i]["EndTime"]; SQL_ES.Room = JSON_ES[i]["Room"]; SQL_ES.Day = JSON_ES[i]["Day"]; SQL_ES.Section = JSON_ES[i]["Section"]; SQL_ES.Location = JSON_ES[i]["Location"]; SQL_ES.Subject = JSON_ES[i]["Subject"]; SQL_ES.CourseNumber = JSON_ES[i]["CourseNumber"]; dbLink.Insert(SQL_ES); } yield break; }
public ExamScheduleViewModel(ExamSchedule exams, WellknownData schedule) { Exams = exams.Exams.Select(x => new ExamViewModel(x, schedule)).ToList(); int recentExamsThreshold = Application.Current.GetConfigurationValue("RecentExamsThreshold", 15); RecentExams = Exams.Where(x => x.EndTime > DateTimeOffset.Now && x.StartTime < DateTimeOffset.Now.AddDays(recentExamsThreshold)).OrderBy(x => x.Countdown).ToList(); }
public ActionResult DeleteConfirmed(int id) { ExamSchedule examSchedule = db.ExamSchedules.Find(id); db.ExamSchedules.Remove(examSchedule); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: ExamSchedule/Edit/5 public ActionResult Edit(int id) { ExamSchedule examSchedule = examScheduleService.Get(id); ExamScheduleViewModel examScheduleViewModel = new ExamScheduleViewModel { ExamSchedule = examSchedule, Courses = courseService.GetAll() }; return(View(examScheduleViewModel)); }
public void UpdateExamTest() { IExamService target = CreateIExamService(); // TODO: Initialize to an appropriate value ExamSchedule ent = null; // TODO: Initialize to an appropriate value ResponseMessage <bool> expected = null; // TODO: Initialize to an appropriate value ResponseMessage <bool> actual; actual = target.UpdateExam(ent); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public ActionResult Edit([Bind(Include = "ExamScheduleId,ExamId,Date,StartTime,EndTime,LastModifiedDate,LastModifiedBy,CreatedDate,CreatedBy")] ExamSchedule examSchedule) { if (ModelState.IsValid) { db.Entry(examSchedule).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ExamId = new SelectList(db.ExamDetails, "ExamId", "LastModifiedBy", examSchedule.ExamId); return(View(examSchedule)); }
public ActionResult Edit([Bind(Include = "Id,ExamDateTime,ExamId,BatchId")] ExamSchedule examSchedule) { if (ModelState.IsValid) { db.Entry(examSchedule).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BatchId = new SelectList(db.Batches, "Id", "Description", examSchedule.BatchId); ViewBag.ExamId = new SelectList(db.Exams, "Id", "ExamType", examSchedule.ExamId); return(View(examSchedule)); }
public ActionResult Edit(int id, ExamScheduleViewModel examScheduleViewModel) { ExamSchedule examSchedule = examScheduleViewModel.ExamSchedule; try { examScheduleService.Edit(examSchedule); return(RedirectToAction("Index")); } catch (Exception ex) { return(View(examScheduleViewModel)); } }
public ActionResult Create(ExamScheduleViewModel examScheduleViewModel) { ExamSchedule examSchedule = examScheduleViewModel.ExamSchedule; try { examScheduleService.Add(examSchedule); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult DeleteConfirmed(int id) { ExamSchedule examSchedule = examScheduleService.Get(id); try { examScheduleService.Delete(examSchedule); return(RedirectToAction("Index")); } catch (Exception ex) { return(View(examSchedule)); } }
// GET: ExamSchedules/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ExamSchedule examSchedule = db.ExamSchedules.Find(id); if (examSchedule == null) { return(HttpNotFound()); } return(View(examSchedule)); }
// GET: ExamSchedules/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ExamSchedule examSchedule = db.ExamSchedules.Find(id); if (examSchedule == null) { return(HttpNotFound()); } ViewBag.ExamId = new SelectList(db.ExamDetails, "ExamId", "LastModifiedBy", examSchedule.ExamId); return(View(examSchedule)); }
// Формирует расписание экзаменов protected string FormExamSchedule(ExamSchedule exam, User user, int number) { string responseText = ""; foreach (var item in exam.schedule) { responseText = FormDisplayingParameters(responseText, number, item, user.DisplayAuditory, user.DisplayEmployeeName, user.DisplaySubjectTime, user.DisplaySubjectType); responseText = responseText.TrimEnd(); responseText += "\n" + exam.weekDay + "\n\n"; number++; } return(responseText); }
// GET: ExamSchedules/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ExamSchedule examSchedule = db.ExamSchedules.Find(id); if (examSchedule == null) { return(HttpNotFound()); } ViewBag.BatchId = new SelectList(db.Batches, "Id", "Description", examSchedule.BatchId); ViewBag.ExamId = new SelectList(db.Exams, "Id", "ExamType", examSchedule.ExamId); return(View(examSchedule)); }
private ExamSchedule ParseExams(string page, string signedInUser) { if (string.IsNullOrEmpty(page)) { throw new FormatException("Page is empty."); } ExamSchedule examSchedule = new ExamSchedule(signedInUser); Regex trRegex = new Regex("<tr class=.>.*?</tr>", RegexOptions.CultureInvariant); Regex tdRegex = new Regex("<td .*?>(.*?)<br></td>", RegexOptions.CultureInvariant); Regex timeRegex = new Regex("(.*?)\\((.*?)周 星期(.)\\)(.*)-(.*)", RegexOptions.CultureInvariant); MatchCollection rows = trRegex.Matches(page); foreach (Match?row in rows) { if (row == null) { continue; } MatchCollection cols = tdRegex.Matches(row.Value); Exam exam = new Exam( name: cols[1].FirstGroupValue(), location: cols[6].FirstGroupValue(), seating: int.Parse(cols[7].FirstGroupValue()) ) { Credit = double.Parse(cols[2].FirstGroupValue()), Category = cols[3].FirstGroupValue(), Type = cols[4].FirstGroupValue(), }; string timeStr = cols[5].FirstGroupValue(); Match timeMatch = timeRegex.Match(timeStr); if (!timeMatch.Success) { throw new FormatException($"Unable to parse exam time. Got {timeStr}"); } exam.Week = int.Parse(timeMatch.Groups[2].Value); exam.DayOfWeek = GetDayOfWeek(timeMatch.Groups[3].Value); DateTimeOffset date = DateTimeOffset.Parse($"{timeMatch.FirstGroupValue()} +8"); TimeSpan startTimeSpan = TimeSpan.Parse(timeMatch.Groups[4].Value); TimeSpan endTimeSpan = TimeSpan.Parse(timeMatch.Groups[5].Value); exam.StartTime = date.Add(startTimeSpan); exam.EndTime = date.Add(endTimeSpan); examSchedule.Exams.Add(exam); } return(examSchedule); }
private bool IsMultipleExamPresent(IEnumerable <Course> courses, int numberOfExams = 2) { int[] days = new int[6]; foreach (var course in courses) { ExamSchedule examSchedule = examScheduleService.FindBy(x => x.CourseId == course.Id).SingleOrDefault(); if (examSchedule != null) { days[examSchedule.Day - 1]++; } } for (int i = 0; i < 6; i++) { if (days[i] >= numberOfExams) { return(true); } } return(false); }
private bool IsClashExamPresent(IEnumerable <Course> courses) { int[,] slot = new int[6, 3]; foreach (var course in courses) { ExamSchedule examSchedule = examScheduleService.FindBy(x => x.CourseId == course.Id).SingleOrDefault(); if (examSchedule != null) { slot[examSchedule.Day - 1, examSchedule.Slot - 1]++; } } for (int i = 0; i < 6; i++) { for (int j = 0; j < 3; j++) { if (slot[i, j] > 1) { return(true); } } } return(false); }
public Task <DataAccessResult> SetExamsAsync(ExamSchedule exams) => SetResourceAsync(exams);
public bool Remove(ExamSchedule examScedule) { db.ExamSchedules.Remove(examScedule); return(db.SaveChanges() > 0); }
public bool Update(ExamSchedule examScedule) { db.Entry(examScedule).State = EntityState.Modified; return(db.SaveChanges() > 0); }
public bool Add(ExamSchedule examScedule) { db.ExamSchedules.Add(examScedule); return(db.SaveChanges() > 0); }
// GET: ExamSchedule/Delete/5 public ActionResult Delete(int id) { ExamSchedule examSchedule = examScheduleService.Get(id); return(View(examSchedule)); }
public bool Remove(ExamSchedule examScedule) { return(_examScheduleRepository.Remove(examScedule)); }
public bool Update(ExamSchedule examScedule) { return(_examScheduleRepository.Update(examScedule)); }
public bool Add(ExamSchedule examScedule) { return(_examScheduleRepository.Add(examScedule)); }
public Task SetExamsAsync(ExamSchedule exams) => SetRecordDataAsync(RecordType.Exams, exams);
private void SaveMode() { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); if (string.IsNullOrEmpty(txtDetailExamCode.Text)) { ExamSchedule ent = new ExamSchedule(); ent.USER_ID = "AGDOI"; ent.EXAM_PLACE_GROUP_CODE = ddlDetailYardGroupCode.SelectedValue; ent.EXAM_PLACE_CODE = ddlDetailExamYardCode.SelectedValue; ent.TESTING_DATE = Convert.ToDateTime(txtDetailDateExam.Text); ent.TEST_TIME_CODE = ddlDetailTimeExamCode.SelectedValue; ent.LICENSE_TYPE_CODE = ddlDetailOfficerCode.SelectedValue; ent.USER_DATE = DateTime.Now; ent.EXAM_ADMISSION = txtDetailNumberOfSeat.Text.ToShort(); ent.EXAM_FEE = txtDetailFee.Text.ToDecimal(); ent.EXAM_STATUS = "E"; ent.EXAM_APPLY = 0; //if (base.UserProfile.MemberType == DTO.RegistrationType.OIC.GetEnumValue()) //{ // ent.EXAM_OWNER = "B"; //} //else if (base.UserProfile.MemberType == DTO.RegistrationType.TestCenter.GetEnumValue()) //{ // ent.EXAM_OWNER = "C"; //} //else //{ // ent.EXAM_OWNER = "A"; //} if (Convert.ToDateTime(txtDetailDateExam.Text) > DateTime.Now.Date) { var res = biz.InsertExam(ent); if (res.IsError) { UCModalError.ShowMessageError = res.ErrorMsg; UCModalError.ShowModalError(); } else { UCModalSuccess.ShowMessageSuccess = SysMessage.SaveSucess; UCModalSuccess.ShowModalSuccess(); } } else { UCModalError.ShowMessageError = Resources.errorExamSchedule_001; UCModalError.ShowModalError(); } } else { string testingNo = txtDetailExamCode.Text; string examPlaceCode = ddlDetailExamYardCode.SelectedValue; if (biz.CanChangeExam(testingNo, examPlaceCode).ResultMessage) { ExamSchedule ent = new ExamSchedule(); var exam = biz.GetExamByTestingNoAndPlaceCode(testingNo, examPlaceCode); ent.TESTING_NO = txtDetailExamCode.Text; ent.TESTING_DATE = Convert.ToDateTime(txtDetailDateExam.Text); ent.EXAM_FEE = txtDetailFee.Text.ToShort(); ent.EXAM_STATUS = "E"; ent.EXAM_FEE = txtDetailFee.Text.ToShort(); ent.TEST_TIME_CODE = ddlDetailTimeExamCode.SelectedValue; ent.EXAM_PLACE_GROUP_CODE = ddlDetailYardGroupCode.SelectedValue; if (ddlDetailYardGroupCode.SelectedValue != "") { ent.EXAM_PLACE_CODE = ddlDetailExamYardCode.SelectedValue; } ent.LICENSE_TYPE_CODE = ddlDetailOfficerCode.SelectedValue; ent.EXAM_APPLY = 0; ent.EXAM_ADMISSION = txtDetailNumberOfSeat.Text.ToShort(); //ent.EXAM_OWNER = "A"; biz.UpdateExam(ent); DateTime dtExam = Convert.ToDateTime(txtDetailDateExam.Text); string strMonth = string.Empty; if (dtExam.Date.Month < 10) { strMonth = "0" + dtExam.Date.Month; } //var re = biz.GetExamByCriteria("", "", "", dtExam.Year.ToString() + strMonth, "", Convert.ToDateTime(txtDetailDateExam.Text)); //if (re.IsError) //{ // UCModalError.ShowMessageError = re.ErrorMsg; // UCModalError.ShowModalError(); //} //UCModalSuccess.ShowMessageSuccess = SysMessage.SaveSucess; //UCModalSuccess.ShowModalSuccess(); //gvExamSchedule.DataSource = re.DataResponse; //gvExamSchedule.DataBind(); //gvTable.DataSource = re.DataResponse; //gvTable.DataBind(); } else { UCModalError.ShowMessageError = SysMessage.CannotEditExamTestingNo; UCModalError.ShowModalError(); } } }