public ActionResult Edit(FormCollection formCollection, int?id) { if (Session["Email"] != null) { if (id != null) { RotationListContext context = new RotationListContext(); RotationList rotationLists = context.RotationList.Single(pro => pro.Id == id); rotationLists.StudentName = formCollection["StudentName"]; rotationLists.Type = formCollection["Type"]; rotationLists.Start = formCollection["Start"]; rotationLists.End = formCollection["End"]; rotationLists.Supervisor = formCollection["Supervisor"]; context.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index", "RotationList")); } } return(RedirectToAction("Index", "Home")); }
public ActionResult AddNewRotationStudent(FormCollection formCollection) { if (Session["Email"] != null) { string email = (string)Session["Email"]; StudentContext studentContext = new StudentContext(); Student student = studentContext.Students.Single(e => e.Email.Equals(email)); RotationListContext rotationListContext = new RotationListContext(); RotationList rotationList = new RotationList(); rotationList.StudentName = formCollection["StudentName"]; rotationList.StudentId = student.ID; rotationList.Start = formCollection["Start"]; rotationList.End = formCollection["End"]; rotationList.Supervisor = formCollection["Supervisors"]; rotationList.Type = formCollection["Rotations"]; rotationListContext.RotationList.Add(rotationList); rotationListContext.SaveChanges(); return(RedirectToAction("StudentPage", "Student")); } return(RedirectToAction("Index", "Home")); }
public ActionResult RegistrationForm(Models.RegisterFormModel formData) { if (ModelState.IsValid) { using (SqlConnection con = new SqlConnection(CS)) { con.Open(); string secCode = generateSecurityCode(); StudentContext studentContext = new StudentContext(); Student student = new Student(); try { student.FirstName = formData.FirstName; student.LastName = formData.LastName; student.Address = formData.Address; student.PostalCode = formData.PostalCode; student.DOB = formData.DOB; student.Email = formData.Email; student.Password = formData.Password; student.Phone = formData.Phone; student.ProgramName = formData.ProgramName; student.InstitutionName = formData.InstitutionName; student.ProgramType = formData.ProgramType; student.SecurityCode = secCode; } catch (Exception e) { Console.WriteLine(e); } studentContext.Students.Add(student); studentContext.SaveChanges(); Session["FirstName"] = student.FirstName; Session["id"] = student.ID; RotationListContext rotationListContext = new RotationListContext(); RotationList rotationList = new RotationList(); rotationList.StudentName = student.LastName + ", " + student.FirstName; rotationList.StudentId = student.ID; rotationList.Start = formData.StartDate; rotationList.End = formData.EndDate; rotationList.Supervisor = formData.RotationSupervisors; rotationList.Type = formData.Rotations; rotationListContext.RotationList.Add(rotationList); rotationListContext.SaveChanges(); } return(RedirectToAction("StudentPage", "Student")); } else { //return View("Index"); return(RedirectToAction("Index", "Registration")); } }
public ActionResult EditRotationStudent(RotationList rotationList) { if (Session["Email"] != null) { RotationListContext rotationListContext = new RotationListContext(); rotationListContext.Entry(rotationList).State = System.Data.Entity.EntityState.Modified; rotationListContext.SaveChanges(); return(RedirectToAction("StudentPage", "Student")); } return(RedirectToAction("Index", "Home")); }
public ActionResult Edit(int?id) { if (Session["Email"] != null) { if (id != null) { RotationListContext context = new RotationListContext(); RotationList rotationList = context.RotationList.Single(pro => pro.Id == id); return(View(rotationList)); } else { return(RedirectToAction("Index", "RotationList")); } } return(RedirectToAction("Index", "Home")); }
void UpdateRotation() { //更新每一根关节的旋转信息. if (!RotationList.ContainsKey(currentJointName)) { return; } List <YamlSQTData> pList = RotationList[currentJointName]; if (FindKeyFrames(pList)) { CurentSQT.Rotation_Weight = 1; CurentSQT.Rotation = HermiteTool.GetHermitePoint_Q(frameLerp, (YamlRotationData)preFrameData, (YamlRotationData)nexFrameData, aAnimator.LerpType); } else { CurentSQT.Rotation_Weight = 0; } }
public ActionResult DeleteRotationStudent(int?id) { if (Session["Email"] != null) { if (id != null) { RotationListContext rotationListContext = new RotationListContext(); RotationList rotationList = rotationListContext.RotationList.Single(e => e.Id == id); return(View(rotationList)); } else { return(RedirectToAction("StudentPage", "Student")); } } return(RedirectToAction("Index", "Home")); }
public ActionResult Create(FormCollection formCollection) { if (Session["Email"] != null) { RotationList rotationLists = new RotationList(); RotationListContext context = new RotationListContext(); rotationLists.StudentName = formCollection["StudentName"]; rotationLists.Type = formCollection["Type"]; rotationLists.Start = formCollection["Start"]; rotationLists.End = formCollection["End"]; rotationLists.Supervisor = formCollection["Supervisor"]; context.RotationList.Add(rotationLists); context.SaveChanges(); return(RedirectToAction("Index")); } return(RedirectToAction("Index", "Home")); }
public ActionResult Delete(int?id, FormCollection formCollection) { if (Session["Email"] != null) { if (id != null) { RotationListContext context = new RotationListContext(); RotationList rotationLists = context.RotationList.Single(pro => pro.Id == id); context.RotationList.Remove(rotationLists); context.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index", "RotationList")); } } return(RedirectToAction("Index", "Home")); }
public ActionResult EditRotationStudent(int?id) { if (Session["Email"] != null) { if (id != null) { string email = (string)Session["Email"]; Student student = getStudentInfo(email); RotationListContext rotationListContext = new RotationListContext(); RotationList rotationList = rotationListContext.RotationList.Single(e => e.Id == id); List <String> rotationsList = new List <String>(); List <String> rotationSupervisorsList = new List <String>(); using (var connection = new SqlConnection(CS)) { string commandText = "SELECT DISTINCT Rotations FROM [Rotations]"; using (var command = new SqlCommand(commandText, connection)) { connection.Open(); using (SqlDataReader sdr = command.ExecuteReader()) { while (sdr.Read()) { rotationsList.Add(Convert.ToString(sdr[0])); } } connection.Close(); } commandText = "SELECT DISTINCT Supervisor FROM [Rotations]"; using (var command = new SqlCommand(commandText, connection)) { connection.Open(); using (SqlDataReader sdr = command.ExecuteReader()) { while (sdr.Read()) { rotationSupervisorsList.Add(Convert.ToString(sdr[0])); } } connection.Close(); } } SelectList selectRotations = new SelectList(rotationsList, "id"); SelectList selectRotationSupervisors = new SelectList(rotationSupervisorsList, "id"); ViewBag.Student = student.LastName + ", " + student.FirstName; ViewBag.Rotations = selectRotations; ViewBag.Supervisors = selectRotationSupervisors; return(View(rotationList)); } else { return(RedirectToAction("StudentPage", "Student")); } } return(RedirectToAction("Index", "Home")); }