//return to first lesson of step by step public ActionResult seeFirst() { sessionOrNot(); if (!_eyeMusicModel.complete_register) { ViewBag.len = _eyeMusicModel.len; System.Web.HttpContext.Current.Session["eyeMusic"] = null; ViewBag.ReturnUrl = "/ExpStep/seeFirst"; return(View("../Home/Login")); } else { string map = Server.MapPath("~"); StepFiles = new ExpStepClass(map, _eyeMusicModel.len); _eyeMusicModel.ExpStep = StepFiles; _eyeMusicModel.totalNumQuestion = FIRST_EXAM; _eyeMusicModel.ExpStep.changeLan(_eyeMusicModel.len); _eyeMusicModel.ExpStep.setindex(0); _eyeMusicModel.blind = false; _eyeMusicModel.SoundAfterPicture = false; _eyeMusicModel.withAnswer = false; _eyeMusicModel.TimeToExam = TIME_EXAM; DateTime baseDate = new DateTime(1970, 1, 1); TimeSpan diff = DateTime.UtcNow - baseDate; _eyeMusicModel.TimeEnd = diff.TotalMilliseconds + _eyeMusicModel.TimeTotalExp; return(View("EnterExp", _eyeMusicModel)); } }
//found the index of user in last session private void goToCurrent() { if (_eyeMusicModel.ExpStep == null) { string map = Server.MapPath("~"); StepFiles = new ExpStepClass(map, _eyeMusicModel.len); _eyeMusicModel.ExpStep = StepFiles; _eyeMusicModel.ExpStep.changeLan(_eyeMusicModel.len); using (amedilab_dataEntities entities = new amedilab_dataEntities()) { try { IQueryable <stepByStep_user> sdd = entities.stepByStep_user.Where(usr => usr.user_ID == _eyeMusicModel.userDAL.user_ID); if (sdd.Any()) { DateTime?TimeStep = sdd.Max(usr => usr.Time); int? indexStep = sdd.Where(usr => usr.Time == (DateTime)TimeStep).FirstOrDefault().id; if (indexStep != null && indexStep != THE_MAX) { _eyeMusicModel.ExpStep.setindex((int)indexStep + 1); } } } catch (Exception e) { } } } }
public ActionResult EndExam() { sessionOrNot(); if (_eyeMusicModel.ExpStep == null) { string map = Server.MapPath("~"); StepFiles = new ExpStepClass(map, _eyeMusicModel.len); _eyeMusicModel.ExpStep = StepFiles; } _eyeMusicModel.ExpStep.changeLan(_eyeMusicModel.len); _eyeMusicModel.withAnswer = true; _eyeMusicModel.ExpStep.SetLessons(); _eyeMusicModel.StepByStepLessons = _eyeMusicModel.ExpStep.getLessonsTitles(); _eyeMusicModel.StepByStepListInts = _eyeMusicModel.ExpStep.getLessonsInt(); _eyeMusicModel.ExpStep.next(); _eyeMusicModel.num_question_step = 1; return(View("enterExp", _eyeMusicModel)); }
public ActionResult OnlyExam() { sessionOrNot(); _eyeMusicModel.onlyExam = true; string map = Server.MapPath("~"); StepFiles = new ExpStepClass(map, "h"); _eyeMusicModel.ExpStep = StepFiles; _eyeMusicModel.totalNumQuestion = FIRST_EXAM; _eyeMusicModel.ExpStep.changeLan("h"); _eyeMusicModel.ExpStep.setindex(1); _eyeMusicModel.blind = false; _eyeMusicModel.SoundAfterPicture = false; _eyeMusicModel.withAnswer = true; _eyeMusicModel.TimeToExam = TIME_EXAM; _eyeMusicModel.totalNumQuestion = FIRST_EXAM; _eyeMusicModel.num_question_step = FIRST_EXAM - 1; _eyeMusicModel.TimeToExam = TIME_EXAM; _eyeMusicModel.withAnswer = true; string path = Server.MapPath("~"); string fileNameSeesion = _eyeMusicModel.ScanSpeed + _eyeMusicModel.filter + _eyeMusicModel.ExpStep.imagesCurrent().Replace("\\", "").Replace(".bmp", "") + ".bmp"; _eyeMusicModel.realpath = path + "\\EM\\Images\\" + fileNameSeesion; _eyeMusicModel.currImagePath = "/EM/Images/" + fileNameSeesion; _eyeMusicModel.currImagePathupload = _eyeMusicModel.currImagePath; vh.createMp3(fileNameSeesion.Replace(".bmp", ""), _eyeMusicModel.path + "\\" + _eyeMusicModel.ExpStep.imagesCurrent()); _eyeMusicModel.theUri = "/EM/Out/" + fileNameSeesion.Replace(".bmp", "") + ".mp3"; _eyeMusicModel.ExpStep.resetNumCorrect(); return(View("ExamExp", _eyeMusicModel)); }
//When the user get grade <70% return on last lesson public ActionResult returnClass() { sessionOrNot(); if (_eyeMusicModel.ExpStep == null) { string map = Server.MapPath("~"); StepFiles = new ExpStepClass(map, _eyeMusicModel.len); _eyeMusicModel.ExpStep = StepFiles; } _eyeMusicModel.ExpStep.changeLan(_eyeMusicModel.len); _eyeMusicModel.ExpStep.SetLessons(); _eyeMusicModel.StepByStepLessons = _eyeMusicModel.ExpStep.getLessonsTitles(); _eyeMusicModel.StepByStepListInts = _eyeMusicModel.ExpStep.getLessonsInt(); if (_eyeMusicModel.StepByStepListInts.Length > 0) { _eyeMusicModel.ExpStep.setindex(_eyeMusicModel.ExpStep.getLessonsInt()[_eyeMusicModel.ExpStep.getLessonsInt().Length - 1]); } _eyeMusicModel.num_question_step = 1; return(View("enterExp", _eyeMusicModel)); }