Example #1
0
        //
        // GET: /Student/Delete/5

        public ActionResult Delete(string id)
        {
            try
            {
                bool success = StudentClientService.DeleteStudent(id);

                if (success)
                {
                    return(RedirectToAction("Index"));
                }

                return(RedirectToAction("Error"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Filter(string yearFilter, string quarterFilter)
        {
            if (yearFilter == null)
            {
                yearFilter = "";
            }

            if (quarterFilter == null)
            {
                quarterFilter = "";
            }

            string student_id = Session["id"].ToString();

            PLStudent student = StudentClientService.GetStudentDetail(student_id);

            ViewBag.student = student;

            List <PLScheduledCourse> scheduleList = ScheduleClientService.GetScheduleList(Convert.ToInt32(yearFilter), quarterFilter);

            return(Json(scheduleList));
        }
Example #3
0
        public ActionResult ChangePassword(string id, FormCollection collection)
        {
            PLStudent student = StudentClientService.GetStudentDetail(id);//new PLStudent();

            if (collection.Count == 0)
            {
                return(View("ChangePassword", student));
            }

            try
            {
                //PLStudent student = StudentClientService.GetStudentDetail(collection["ID"]);//new PLStudent();
                student.Password = collection["Password"];
                StudentClientService.UpdateStudent(student);
                return(RedirectToAction("Index"));// this brings us to the student List page
            }
            catch (Exception e)
            {
                Console.Write(e.ToString());
                return(RedirectToAction("Error"));
            }
            //return View("ChangePassword", student);
        }
Example #4
0
 public ActionResult Edit(string id, FormCollection collection)
 {
     try
     {
         PLStudent student = new PLStudent();
         student.ID           = id;//collection["ID"];
         student.FirstName    = collection["FirstName"];
         student.LastName     = collection["LastName"];
         student.SSN          = collection["SSN"];
         student.EmailAddress = collection["EmailAddress"];
         student.Password     = collection["Password"];
         student.ShoeSize     = float.Parse(collection["ShoeSize"]);
         student.Weight       = Convert.ToInt32(collection["Weight"]);
         student.StudentLevel = collection["StudentLevel"];
         student.Major        = Convert.ToInt32(collection["Major"]);
         student.Status       = Convert.ToInt32(collection["Status"]);
         StudentClientService.UpdateStudent(student);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View("Error"));
     }
 }
        //
        // GET: /StudentHome/

        public ActionResult Index()
        {
            if (Session["role"] != null)
            {
                if (Session["role"].Equals("student"))
                {
                    PLStudent           student        = StudentClientService.GetStudentDetail(Session["id"].ToString());
                    PLMajor             major          = MajorClientService.GetMajorDetail(student.Major);
                    PLDepartment        department     = new PLDepartment();
                    List <PLDepartment> departmentList = DepartmentClientService.GetDepartmentList();
                    foreach (PLDepartment dept in departmentList)
                    {
                        if (dept.ID == major.dept_id)
                        {
                            department = dept;
                            break;
                        }
                    }

                    string studentName    = student.LastName + ", " + student.FirstName;
                    string majorName      = major.major_name;
                    string departmentName = department.deptName;

                    string studentLevel = "";
                    switch (Convert.ToInt32(student.StudentLevel))
                    {
                    case 0:
                        studentLevel = "freshman";
                        break;

                    case 1:
                        studentLevel = "sophomore";
                        break;

                    case 2:
                        studentLevel = "junior";
                        break;

                    case 3:
                        studentLevel = "senior";
                        break;

                    case 4:
                        studentLevel = "grad";
                        break;

                    case 5:
                        studentLevel = "phd";
                        break;
                    }

                    string studentStatus = "";
                    switch (Convert.ToInt32(student.Status))
                    {
                    case 0:
                        studentStatus = "Good Standing";
                        break;

                    case 1:
                        studentStatus = "Probation";
                        break;

                    case 2:
                        studentStatus = "Subject for Disqualification";
                        break;

                    case 3:
                        studentStatus = "Disqualification";
                        break;
                    }

                    ViewData["studentName"]     = studentName;
                    ViewData["studentSSN"]      = student.SSN;
                    ViewData["studentEmail"]    = student.EmailAddress;
                    ViewData["studentShoeSize"] = student.ShoeSize;
                    ViewData["studentWeight"]   = student.Weight;
                    ViewData["studentLevel"]    = studentLevel;
                    ViewData["studentStatus"]   = studentStatus;
                    ViewData["majorName"]       = majorName;
                    ViewData["departmentName"]  = departmentName;

                    return(View());
                }
            }

            return(View("Error"));
        }
Example #6
0
        public JsonResult GetSampleStudent(int idx)
        {
            List <PLStudent> list = StudentClientService.GetStudentList();

            return(this.Json(list[idx], JsonRequestBehavior.AllowGet));
        }
Example #7
0
        public string GetNumStudentsTotal()
        {
            List <PLStudent> list = StudentClientService.GetStudentList();

            return(list.Count.ToString());
        }