private void LoadPlans(MyCourse vmCourse) { Patient patient = _application.OpenPatientById(_viewModel.SelectedPatient.PatientId); Course course = patient.Courses.SingleOrDefault(s => s.Id == vmCourse.CourseId); foreach (PlanSetup planSetup in course.PlanSetups) { vmCourse.PlanItems.Add(new MyPlanItem { pItemId = planSetup.Id, IsInScope = false, IsPlanSum = false }); } foreach (PlanSum planSum in course.PlanSums) { vmCourse.PlanItems.Add(new MyPlanItem { pItemId = planSum.Id, IsInScope = false, IsPlanSum = true }); } _application.ClosePatient(); }
public ActionResult EnrollCourseP(int id) { if (User.Identity.IsAuthenticated) { userId = httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; var date = DateTime.Now; try { var myCourse = new MyCourse(); myCourse.CourseID = id; myCourse.UserId = userId; myCourse.EnrolledDate = date; // TODO: Add Enroll logic here context.MyCourses.Add(myCourse); context.SaveChangesAsync(); return(RedirectToAction("Index", "Section")); } catch { return(View()); } } return(RedirectToAction("Login", "Account")); }
private void OpenSelections() { string filename = "PluginTester.start"; if (!File.Exists(filename)) { return; } using (StreamReader sr = new StreamReader(filename)) { string selPatiId = sr.ReadLine(); string selCourseID = sr.ReadLine(); int numPlans = Convert.ToInt32(sr.ReadLine()); _viewModel.SelectedPatient = _viewModel.Patients.FirstOrDefault(s => s.PatientId == selPatiId); if (_viewModel.SelectedPatient == null) { return; } MyCourse selCourse = _viewModel.SelectedPatient.Courses.FirstOrDefault(s => s.CourseId == selCourseID); if (selCourse == null) { return; } selCourse.IsSelected = true; _viewModel.SelectedCourse = selCourse; for (int i = 0; i < numPlans; i++) { string planId = sr.ReadLine(); MyPlanItem pItem = _viewModel.SelectedCourse.PlanItems.FirstOrDefault(s => s.pItemId == planId); if (pItem != null) { pItem.IsInScope = true; _viewModel.PlansInScope.Add(pItem); } } string openPlanId = sr.ReadLine(); foreach (var plan in _viewModel.PlansInScope) { if (plan.pItemId == openPlanId) { plan.IsOpened = true; break; } } } _firstTime = true; btnStart.IsEnabled = true; }
private void LoadCourses() { Patient patient = _application.OpenPatientById(_viewModel.SelectedPatient.PatientId); foreach (Course course in patient.Courses) { MyCourse vmCourse = new MyCourse(); vmCourse.CourseId = course.Id; _viewModel.SelectedPatient.Courses.Add(vmCourse); } _application.ClosePatient(); }
public MainWindow(VMS.TPS.Common.Model.API.Application Application) { _application = Application; _viewModel = new ViewModel(); InitializeComponent(); this.DataContext = _viewModel; //lstPatients.SelectedIndex = 1; //lstPlans.SelectedIndex=0; foreach (PatientSummary patientSummary in _application.PatientSummaries) { MyPatient myPatient = new MyPatient(); myPatient.PatientId = patientSummary.Id; myPatient.LastName = patientSummary.LastName; myPatient.FirstName = patientSummary.FirstName; Patient patient = _application.OpenPatient(patientSummary); foreach (Course course in patient.Courses) { MyCourse vmCourse = new MyCourse(); vmCourse.CourseId = course.Id; foreach (PlanSetup planSetup in course.PlanSetups) { vmCourse.PlanItems.Add(new MyPlanItem { pItemId = planSetup.Id, IsInScope = false, IsPlanSum = false }); } foreach (PlanSum planSum in course.PlanSums) { vmCourse.PlanItems.Add(new MyPlanItem { pItemId = planSum.Id, IsInScope = false, IsPlanSum = true }); } myPatient.Courses.Add(vmCourse); } _application.ClosePatient(); _viewModel.Patients.Add(myPatient); } OpenSelections(); }
private void chkCourses_Checked(object sender, RoutedEventArgs e) { Cursor = Cursors.Wait; CheckBox check = (CheckBox)sender; string courseId = check.Content.ToString(); MyCourse course = _viewModel.SelectedPatient.Courses.FirstOrDefault(s => s.CourseId == courseId); if (course != null && course.PlanItems.Count == 0) { LoadPlans(course); } _viewModel.NotifyPropertyChanged("CoursePlanItems"); Cursor = Cursors.Arrow; }
public async Task <int> AddCourseToUserAsync(int courseId, string userId, string paymentCode, decimal?price, string username) { var courseToUser = new MyCourse { CourseId = courseId, UserId = userId, PaymentCode = paymentCode, Price = price, Username = username, }; await this.myCoursesRepository.AddAsync(courseToUser); await this.myCoursesRepository.SaveChangesAsync(); return(courseToUser.Id); }
public void ProcessRequest(HttpContext context) { int totalCount = 0; var orderList = bllMall.GetOrderList(10000, 1, "", out totalCount, "", CurrentUserInfo.UserID).Where(p => p.OrderType == 7).Where(p => p.PaymentStatus == 1).Where(p => p.Status != "已取消").OrderByDescending(p => p.InsertDate); List <MyCourse> data = new List <MyCourse>(); foreach (var item in orderList) { try { var orderDetail = bllMall.GetOrderDetailsList(item.OrderID)[0]; MyCourse model = new MyCourse(); var productInfo = bllMall.GetProduct(orderDetail.PID); model.course_img_url = productInfo.RecommendImg; model.course_name = productInfo.PName + " " + orderDetail.SkuShowProp; Questionnaire examInfo = bllMall.Get <Questionnaire>(string.Format("QuestionnaireID={0}", orderDetail.ExQuestionnaireID)); model.exam_id = examInfo.QuestionnaireID; model.exam_minute = examInfo.ExamMinute; model.status = bllMall.GetExamStatus(item, examInfo); switch (model.status) { case 0: //0 尚未到考试时间 model.day = (int)Math.Ceiling((item.InsertDate.AddDays(15) - DateTime.Now).TotalDays); break; case 1: // 1 已经到考试时间,可以正常考试 model.day = (int)Math.Ceiling((item.InsertDate.AddDays(90) - DateTime.Now).TotalDays); break; case 2: // 2 已经考过了 QuestionnaireRecord record = bllMall.Get <QuestionnaireRecord>(string.Format("QuestionnaireID={0}", examInfo.QuestionnaireID)); model.time = record.InsertDate.ToString("yyyy-MM-dd"); break; case 3: // 3 缺考 model.time = item.InsertDate.AddDays(90).ToString("yyyy-MM-dd"); break; default: break; } data.Add(model); } catch (Exception) { continue; } } apiResp.status = true; apiResp.result = new { list = data }; apiResp.msg = "ok"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); }
private void myCourseToolStripMenuItem_Click(object sender, EventArgs e) { MyCourse myCourse = new MyCourse(); myCourse.ShowDialog(); }