public ActionResult Index(DailyBookingQueryViewModel viewModel, bool?showTodoTab) { if (viewModel.KeyID != null) { viewModel.CoachID = viewModel.DecryptKeyValue(); } var profile = HttpContext.GetUser(); if (!viewModel.CoachID.HasValue) { if (profile.IsCoach() || profile.IsAssistant()) { viewModel.CoachID = profile.UID; } } ViewBag.ViewModel = viewModel; ViewBag.CurrentCoach = models.GetTable <ServingCoach>().Where(s => s.CoachID == viewModel.CoachID).FirstOrDefault(); ViewBag.ShowTodoTab = showTodoTab; var item = models.GetTable <UserProfile>().Where(s => s.UID == profile.UID).FirstOrDefault(); if (ViewBag.CurrentCoach == null) { if (!item.IsAuthorized(new int[] { (int)Naming.RoleID.Administrator, (int)Naming.RoleID.Assistant, (int)Naming.RoleID.Officer, (int)Naming.RoleID.Manager })) { ViewBag.CurrentCoach = item.ServingCoach; viewModel.CoachID = item.UID; } } return(View("~/Views/CoachFacet/Index.aspx", item)); }
public ActionResult LoadTrainingExecution(DailyBookingQueryViewModel viewModel, int?stageID) { ViewBag.ViewModel = viewModel; if (viewModel.KeyID != null) { viewModel.LessonID = viewModel.DecryptKeyValue(); } var item = ViewBag.DataItem = models.GetTable <LessonTime>().Where(u => u.LessonID == viewModel.LessonID).First(); ViewBag.Learner = models.GetTable <UserProfile>().Where(u => u.UID == viewModel.LearnerID).First(); ViewBag.StageID = stageID; ViewBag.ViewID = viewModel.ViewID; return(View("~/Views/LearnerProfile/Module/LessonTrainingExecution.cshtml", item)); }
public ActionResult LearnerLessonsReviewDetails(DailyBookingQueryViewModel viewModel) { ViewBag.ViewModel = viewModel; if (viewModel.KeyID != null) { viewModel.LearnerID = viewModel.DecryptKeyValue(); } var item = models.GetTable <UserProfile>().Where(u => u.UID == viewModel.LearnerID).FirstOrDefault(); if (item == null) { return(Json(new { result = false, message = "資料錯誤!!" })); } return(View("~/Views/LearnerProfile/Module/LearnerLessonsReviewDetails.cshtml", item)); }
public ActionResult LearnerAttendLesson(DailyBookingQueryViewModel viewModel) { ViewBag.ViewModel = viewModel; if (viewModel.KeyID != null) { viewModel.LessonID = viewModel.DecryptKeyValue(); } LessonTime item = models.GetTable <LessonTime>().Where(t => t.LessonID == viewModel.LessonID).FirstOrDefault(); if (item == null) { return(Json(new { result = false, message = "未登記此上課時間!!" }, JsonRequestBehavior.AllowGet)); } item.LessonPlan.CommitAttendance = DateTime.Now; models.SubmitChanges(); return(Json(new { result = true, message = "資料存檔完成!!" })); }