// GET: SelectCourse/Create public async Task <ActionResult> Create(string personId, string courseId) { SelectCourseInput selectCourse = new SelectCourseInput() { PersonUserId = personId, CourseId = courseId }; SelectCourse scNew = await _selectCourseAppService.CreateSelectCourse(selectCourse); return(RedirectToAction("SelectCourseList", "SelectCourse")); }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { switch (this.treeView1.SelectedNode.Text) { case "查看学生信息": SelectStuInfo selectStuInfo = new SelectStuInfo("学生"); selectStuInfo.TopLevel = false; selectStuInfo.FormBorderStyle = FormBorderStyle.None; selectStuInfo.WindowState = FormWindowState.Maximized; panel.Controls.Add(selectStuInfo); selectStuInfo.Show(); break; case "选择课程": ChoiceCourse choiceCourse = new ChoiceCourse(); choiceCourse.TopLevel = false; choiceCourse.FormBorderStyle = FormBorderStyle.None; choiceCourse.WindowState = FormWindowState.Maximized; panel.Controls.Add(choiceCourse); choiceCourse.Show(); break; case "查询课程": SelectCourse selectClass = new SelectCourse("学生"); selectClass.TopLevel = false; selectClass.FormBorderStyle = FormBorderStyle.None; selectClass.WindowState = FormWindowState.Maximized; panel.Controls.Add(selectClass); selectClass.Show(); break; case "查询成绩": SelectStuScore selectStuScore = new SelectStuScore("学生"); selectStuScore.TopLevel = false; selectStuScore.FormBorderStyle = FormBorderStyle.None; selectStuScore.WindowState = FormWindowState.Maximized; panel.Controls.Add(selectStuScore); selectStuScore.Show(); break; case "修改密码": UpdataPasswd updatePasswd = new UpdataPasswd(); updatePasswd.TopLevel = false; updatePasswd.FormBorderStyle = FormBorderStyle.None; updatePasswd.WindowState = FormWindowState.Maximized; panel.Controls.Add(updatePasswd); updatePasswd.Show(); break; case "退出系统": Application.Exit(); break; } }
public async Task <IActionResult> CourseSelected(SelectCourse course) { await _mediator.Send(new CourseSelected.Command() { LarsCode = course.LearnAimRef, CourseName = course.CourseName }); return(RedirectToAction(nameof(CourseDescription)) .WithMptxInstanceId(Flow.InstanceId) .WithProviderContext(_providerContext)); }
public string UpdateGrade(List <InsertStusentGrade> models) { //不知道怎么将json传递过来,先放着吧,不干了,等以后再弄到再搞,现在宣布此项目暂时停住 Grade grade = null; GradeDBContext gradeDbContext = new GradeDBContext(); SelectCourseDBContext course = new SelectCourseDBContext(); SelectCourse select = new SelectCourse(); string result = null; if (models != null) { foreach (var n in models) { var cNo = course.SelectCourses.SingleOrDefault(u => u.CNAME == n.CNAME).CNO; string CNO = cNo.ToString(); var newGrade = gradeDbContext.Grades.Where(u => u.SNO == n.SNO && u.CNO == CNO && u.SEMESTER == "15-16春").FirstOrDefault(); if (newGrade == null) { //插入 grade = new Grade() { SNO = n.SNO, CNO = CNO, GRADE = n.GRADE, SEMESTER = "15-16春" }; gradeDbContext.Grades.Add(grade); gradeDbContext.SaveChanges(); } else { //更新 newGrade.GRADE = n.GRADE; gradeDbContext.SaveChanges(); } } } else { result = "返回值为空"; } result = "成功"; return(result); }
public string AddCourse(string tno, string tname, string cno, string cname, string credit, string cdept, string time, string selectednum, string capacity) { string lastResult = null; BasicInfoDBContext basicDbInfo = new BasicInfoDBContext(); SelectCourse selectcourse; SelectCourseDBContext selectDbContext = new SelectCourseDBContext(); var result = basicDbInfo.Basics.Where(u => u.ID == tno && u.NAME == tname).FirstOrDefault(); //判断教师是否存在 //教师是否存在 if (result == null) { lastResult = "该教师不存在,请核实!"; } //教师存在 else { var teacherTeachCourse = selectDbContext.SelectCourses.Where(u => u.TNAME == tname).ToList(); //该教师自己课程间是否冲突 foreach (var t in teacherTeachCourse) { if (t.TIME.ToString().Trim() == time || t.CNO.ToString().Trim() == cno) { lastResult = "该教师课时或课号冲突,请重新确认!"; break; } } if (lastResult == null) { selectcourse = new SelectCourse() { CNO = cno, TNO = tno, CNAME = cname, CREDIT = Convert.ToInt32(credit), CDEPT = cdept, TNAME = tname, TIME = time, SELECTEDNUM = Convert.ToInt32(selectednum), CAPACITY = Convert.ToInt32(capacity) }; selectDbContext.SelectCourses.Add(selectcourse); selectDbContext.SaveChanges(); lastResult = "添加成功!"; } } return(lastResult); }
public ActionResult Spela(string searchString) { WeatherInfo.RootObject wi = new WeatherInfo.RootObject(); wi = GetWeather(); ViewBag.temp = wi.timeSeries[2].parameters[1].values[0]; ViewBag.vind = wi.timeSeries[2].parameters[4].values[0]; ViewBag.tid = wi.timeSeries[2].validTime; if (Session["användarID"] == null) { return(Redirect("/Login.aspx")); } int userID = Int32.Parse(Session["användarID"].ToString()); if ((from s in db.GameRound where s.Game1.Active == 1 && s.Game1.Player == userID select s).FirstOrDefault() != null) { int unfinishedID = ((from s in db.GameRound where s.Game1.Active == 1 && s.Game1.Player == userID select s).OrderBy(o => o.Hole1.Number)).FirstOrDefault().ID; return(RedirectToAction("PlayRound", new { id = unfinishedID })); } SelectCourse selectCourse = new SelectCourse(); selectCourse.Courses = db.GolfCourse.ToList(); selectCourse.Location = new SelectList(db.GolfCourse.GroupBy(x => x.Location).Select(x => x.FirstOrDefault()), "Location", "Location"); selectCourse.Courses = db.GolfCourse.ToList(); selectCourse.Name = new SelectList(db.GolfCourse, "ID", "Name"); var golfCourses = from s in db.GolfCourse select s; if (!String.IsNullOrEmpty(searchString)) { golfCourses = golfCourses.Where(s => s.Location.Contains(searchString)); } ViewBag.Locations = new SelectList(db.GolfCourse, "Name", "Location"); return(View(selectCourse)); }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { switch (this.treeView1.SelectedNode.Text) { case "查看学生信息": SelectStuInfo selectStuInfo = new SelectStuInfo(); selectStuInfo.TopLevel = false; selectStuInfo.FormBorderStyle = FormBorderStyle.None; selectStuInfo.WindowState = FormWindowState.Maximized; panel.Controls.Add(selectStuInfo); selectStuInfo.Show(); break; case "添加学生信息": AddStuInfo addStuInfo = new AddStuInfo(); addStuInfo.TopLevel = false; addStuInfo.FormBorderStyle = FormBorderStyle.None; addStuInfo.WindowState = FormWindowState.Maximized; panel.Controls.Add(addStuInfo); addStuInfo.Show(); break; case "查看教师信息": if (admin) { SelectTeaInfo selectTeaInfo = new SelectTeaInfo(); selectTeaInfo.TopLevel = false; selectTeaInfo.FormBorderStyle = FormBorderStyle.None; selectTeaInfo.WindowState = FormWindowState.Maximized; panel.Controls.Add(selectTeaInfo); selectTeaInfo.Show(); } else { MessageBox.Show("你不是管理员,无法使用本模块"); } break; case "添加教师信息": if (admin) { AddTeaInfo addTeaInfo = new AddTeaInfo(); addTeaInfo.TopLevel = false; addTeaInfo.FormBorderStyle = FormBorderStyle.None; addTeaInfo.WindowState = FormWindowState.Maximized; panel.Controls.Add(addTeaInfo); addTeaInfo.Show(); } else { MessageBox.Show("你不是管理员,无法使用本模块"); } break; case "开设课程": AddCourse addClass = new AddCourse(); addClass.TopLevel = false; addClass.FormBorderStyle = FormBorderStyle.None; addClass.WindowState = FormWindowState.Maximized; panel.Controls.Add(addClass); addClass.Show(); break; case "查询课程": SelectCourse selectClass = new SelectCourse(); selectClass.TopLevel = false; selectClass.FormBorderStyle = FormBorderStyle.None; selectClass.WindowState = FormWindowState.Maximized; panel.Controls.Add(selectClass); selectClass.Show(); break; case "查询成绩": SelectStuScore selectStuScore = new SelectStuScore(); selectStuScore.TopLevel = false; selectStuScore.FormBorderStyle = FormBorderStyle.None; selectStuScore.WindowState = FormWindowState.Maximized; panel.Controls.Add(selectStuScore); selectStuScore.Show(); break; case "添加修改成绩": AddStuScore addStuScore = new AddStuScore(); addStuScore.TopLevel = false; addStuScore.FormBorderStyle = FormBorderStyle.None; addStuScore.WindowState = FormWindowState.Maximized; panel.Controls.Add(addStuScore); addStuScore.Show(); break; case "修改密码": UpdataPasswd updatePasswd = new UpdataPasswd(); updatePasswd.TopLevel = false; updatePasswd.FormBorderStyle = FormBorderStyle.None; updatePasswd.WindowState = FormWindowState.Maximized; panel.Controls.Add(updatePasswd); updatePasswd.Show(); break; case "退出系统": Application.Exit(); break; } }