public ActionResult Practice( int studyTaskId, int studentTaskId, StudyTaskTypeEnum taskType, string path) { ViewBag.TaskType = taskType; ViewBag.StudentTaskId = studentTaskId; ViewBag.Path = path; var bll = new StudentPracticeBll(); string pageTitle = string.Empty; DtoStudyTaskListItem item = bll.GetCourseLessonNameByStudyTask(studentTaskId); if (taskType == StudyTaskTypeEnum.课后练习) { pageTitle = $"{item.CourseName}课后练习"; } else { pageTitle = $"{item.CourseName}-第{item.LessonIndex}课时课后任务"; } ViewBag.PageTitle = pageTitle; return(View(studyTaskId)); }
public ActionResult GetTotalRecordByStatus(DtoStudyTaskSearch search) { search.StudentId = GetCurrentUser().StudentId; search.TaskType = StudyTaskTypeEnum.系统课后任务; StudentPracticeBll bll = new StudentPracticeBll(); var entities = bll.GetTotalRecordByStatus(search); return(Json(new SuccessJsonResponse(entities), JsonRequestBehavior.AllowGet)); }
public ActionResult GetStudyTasks(DtoStudyTaskSearch search) { search.StudentId = GetCurrentUser().StudentId; search.TaskType = StudyTaskTypeEnum.系统课后任务; StudentPracticeBll bll = new StudentPracticeBll(); var entities = bll.GetStudyTasks(search); var list = entities.ConvertTo <IList <StudyTaskListViewModel> >(); var table = AbhsTableFactory.Create(list, search.Pagination.TotalCount); return(Json(table, JsonRequestBehavior.AllowGet)); }
public ActionResult GetTotalSubjectsPracticed(IList <int> courseIds) { StudentPracticeBll bll = new StudentPracticeBll(); IList <StudentPractice.DtoSubjectCountToPractice> subjects = bll.GetTotalSubjectsPracticed(courseIds, GetCurrentUser().StudentId); //将每个课时的练习过得题按课程分组,得到某个课程的所有练习过的练习题 var result = subjects.GroupBy(s => s.CourseId) .Select(g => new { CourseId = g.Key, TotalSubjectCount = g.Sum(ss => ss.SubjectCount) }); return(Json(new SuccessJsonResponse(result), JsonRequestBehavior.AllowGet)); }
public ActionResult PracticeSubjects( int courseId, int returnCount, string path) { StudentPracticeBll bll = new StudentPracticeBll(); Yw_StudentTask task = bll.GeneratePractice(GetCurrentUser().StudentId, courseId, returnCount); return(RedirectToAction( nameof(Practice), new { StudyTaskId = task.Yuk_TaskId, StudentTaskId = task.Yuk_Id, TaskType = (int)StudyTaskTypeEnum.课后练习, Path = path })); }
public JsonResult SavePracticeResult(string dataStr, StudyTaskTypeEnum taskType) { try { JObject data = JsonConvert.DeserializeObject(dataStr) as JObject; int studyTaskId = data["id"].Value <int>(); int useTime = data["useTime"].Value <int>(); List <StudentAnswerBase> answers = new List <StudentAnswerBase>(); JArray jAnswers = data["answers"] as JArray; foreach (var jAnswer in jAnswers) { var answer = SubjectAnswerObjectBuilder.TranslateAnswer(jAnswer.ToString()); answers.Add(answer); } StudentPracticeBll bll = new StudentPracticeBll(); bll.SaveResult( GetCurrentUser().StudentId, studyTaskId, useTime, answers, taskType); return(Json(new SuccessJsonResponse())); } catch (AbhsException ex) { if (ex.ErrorCode == (int)ErrorCodeEnum.StudentTaskStatusInvalid) { JsonSimpleResponse res = new JsonSimpleResponse(); res.State = false; res.ErrorMsg = "你已经完成该练习"; return(Json(res)); } else { throw; } } }
public ActionResult GetSubjectsToPractice(int studyTaskId, int pageIndex) { StudentPracticeBll bll = new StudentPracticeBll(); int totalCount = 0; var result = bll.GetTaskSubject(studyTaskId, pageIndex, out totalCount); SubjectBll subjectBll = new SubjectBll(); var subjectIds = result.Select(s => s.SubjectId); var subjects = subjectBll.GetSubjectsByIds(subjectIds); foreach (var item in result) { //为vm的MainKnowledgeId属性赋值 var subject = subjects.FirstOrDefault(s => s.Ysj_Id == item.SubjectId); item.KnowledgeId = subject.Ysj_MainKnowledgeId; } return(Json( new AbhsTableJsonResponse(result, totalCount), JsonRequestBehavior.AllowGet)); }
public override void Run(DateTime now) { MessageBll messageBll = new MessageBll(); StudentPracticeBll practiceBll = new StudentPracticeBll(); int count = 1; while (count <= 5) { try { MessageBody body = messageBll.ReceiveMessageBody(MessageChannel.LESSONTASK_CHANNEL); if (body != null && !string.IsNullOrEmpty(body.Data)) { string message = body.Data; string[] items = message.Split(','); int studentId = Convert.ToInt32(items[0]); int progressId = Convert.ToInt32(items[1]); Yw_StudentTask task = practiceBll.CreateTaskAutoAfterStudy(studentId, progressId); if (task != null) { practiceBll.GenerateTaskSubjectsAutoAfterStudy(task.Yuk_TaskId, studentId); } Thread.Sleep(20); } else { Thread.Sleep(3000); break; } } catch (Exception ex) { LogHelper.ErrorLog(this.JobName(), ex); } count++; } }
public void GeneratePracticeTest() { StudentPracticeBll bll = new StudentPracticeBll(); bll.GeneratePractice(10003, 10001, 20); }
public void PayOrder() { StudentPracticeBll bll = new StudentPracticeBll(); bll.GenerateTaskSubjectsAutoAfterStudy(10196, 10011); }
public override void Run(DateTime now) { nextRunTime = new DateTime(1900, 1, 1); MessageBll messageBll = new MessageBll(); StudentPracticeBll practiceBll = new StudentPracticeBll(); Dictionary <int, AdvertisingNumber> dic = new Dictionary <int, AdvertisingNumber>(); int count = 1; while (count <= 100) { try { MessageBody body = messageBll.ReceiveMessageBody(MessageChannel.ADVERTISING_CHANNEL); if (body != null && !string.IsNullOrEmpty(body.Data)) { string message = body.Data; string[] array = message.Split(','); if (array.Length == 3) { int advertisingId = Convert.ToInt32(array[0]); if (!dic.ContainsKey(advertisingId)) { AdvertisingNumber action = new AdvertisingNumber(advertisingId, 0, 0); dic.Add(advertisingId, action); } dic[advertisingId].HitNumber += Convert.ToInt32(array[1]); dic[advertisingId].OrderNumber += Convert.ToInt32(array[2]); } } else { nextRunTime = DateTime.Now.AddSeconds(5); break; } } catch (Exception ex) { LogHelper.ErrorLog(this.JobName(), ex); } count++; } if (dic.Count > 0) { AdvertisingBll bll = new AdvertisingBll(); foreach (KeyValuePair <int, AdvertisingNumber> item in dic) { if (item.Value.HitNumber > 0) { bll.IncrementHitCount(item.Value.AdvertisingId, item.Value.HitNumber); } if (item.Value.OrderNumber > 0) { bll.IncrementValidCount(item.Value.AdvertisingId, item.Value.OrderNumber); } } } }