public ActionResult ResumeLearnerCharacter(LearnerCharacterViewModel viewModel) { ViewBag.ViewModel = viewModel; if (viewModel.KeyID != null) { viewModel.UID = viewModel.DecryptKeyValue(); } var profile = models.GetTable <UserProfile>().Where(u => u.UID == viewModel.UID).FirstOrDefault(); if (profile == null) { return(Json(new { result = false, message = "資料錯誤!" })); } var questionnaire = models.GetEffectiveQuestionnaireRequest(profile, Naming.QuestionnaireGroup.身體心靈密碼).FirstOrDefault(); if (questionnaire == null || !questionnaire.PDQTask.Any()) { return(Json(new { result = true })); } if (!questionnaire.PartID.HasValue && viewModel.PartID == QuestionnaireRequest.PartIDEnum.PartA) { return(View("~/Views/ConsoleHome/EditLearnerCharacter/ResumeLearnerCharacterPartA.cshtml", questionnaire)); } return(View("~/Views/LearnerProfile/Module/ResumeLearnerCharacter.cshtml", questionnaire)); }
public async Task <ActionResult> CommitLearnerCharacterAsync(LearnerCharacterViewModel viewModel) { ViewBag.ViewModel = viewModel; var profile = await HttpContext.GetUserAsync(); if (viewModel.KeyID != null) { viewModel.UID = viewModel.DecryptKeyValue(); } if (viewModel.QuestionnaireID.HasValue) { var count = models.ExecuteCommand(@" UPDATE QuestionnaireRequest SET Status = {0} WHERE (UID = {1}) AND (QuestionnaireID = {2})", (int)Naming.IncommingMessageStatus.已讀, viewModel.UID, viewModel.QuestionnaireID); models.ExecuteCommand("delete QuestionnaireCoachFinish where QuestionnaireID = {0}", viewModel.QuestionnaireID); models.ExecuteCommand(@" INSERT INTO QuestionnaireCoachFinish (QuestionnaireID, UID) values ({0},{1})", viewModel.QuestionnaireID, profile.UID); } return(Json(new { result = true })); }
public ActionResult ShowLearnerDailyAnswers(LearnerCharacterViewModel viewModel) { var result = ShowLearnerBonusDetails(viewModel); UserProfile item = ViewBag.DataItem as UserProfile; if (item == null) { return(result); } return(View("~/Views/LearnerProfile/Module/ShowLearnerDailyAnswers.cshtml", item)); }
public ActionResult ShowLearnerBonusDetails(LearnerCharacterViewModel viewModel) { ViewBag.ViewModel = viewModel; if (viewModel.KeyID != null) { viewModel.UID = viewModel.DecryptKeyValue(); } var profile = models.GetTable <UserProfile>().Where(q => q.UID == viewModel.UID).FirstOrDefault(); ViewBag.DataItem = profile; if (profile == null) { return(Json(new { result = false, message = "資料錯誤!" })); } return(View("~/Views/LearnerProfile/ProfileModal/ShowLearnerBonusDetails.cshtml", profile)); }
public ActionResult RejectLearnerCharacter(LearnerCharacterViewModel viewModel) { ViewBag.ViewModel = viewModel; if (viewModel.KeyID != null) { viewModel.UID = viewModel.DecryptKeyValue(); } var questionnaire = models.GetTable <QuestionnaireRequest>().Where(q => q.QuestionnaireID == viewModel.QuestionnaireID) .Where(q => q.UID == viewModel.UID).FirstOrDefault(); if (questionnaire == null) { return(Json(new { result = false, message = "資料錯誤!" })); } questionnaire.Status = (int)Naming.IncommingMessageStatus.拒答; models.SubmitChanges(); return(Json(new { result = true })); }