Пример #1
0
        //
        // GET: /ScheduledCourse/List/
        public ActionResult List()
        {
            List <PLMajor> list = MajorClientService.GetMajorList();

            ViewBag.breadCrumbData = "Major List";

            return(View("List", list));
        }
Пример #2
0
        public ActionResult GetMajorList()
        {
            List <PLMajor>       majorList      = MajorClientService.GetMajorList();
            JavaScriptSerializer jsonSerialiser = new JavaScriptSerializer();
            string majorListJson = jsonSerialiser.Serialize(majorList);

            // return the JSON string
            return(Content(majorListJson));
        }
Пример #3
0
        //
        // GET: /Major/Edit/
        public ActionResult Edit(string id)
        {
            if (HttpContext != null)
            {
                UrlHelper url = new UrlHelper(HttpContext.Request.RequestContext);
                ViewBag.breadCrumbData  = "<a href='" + url.Action("Edit", "Major") + "'>Edit Major</a>";
                ViewBag.breadCrumbData += " > Edit";
            }

            PLMajor major = MajorClientService.GetMajorDetail(Convert.ToInt32(id));

            return(View("Edit", major));
        }
Пример #4
0
 public ActionResult Edit(FormCollection collection)
 {
     try
     {
         PLMajor major = new PLMajor();
         major.major_id   = Convert.ToInt32(collection["major_id"]);
         major.major_name = collection["major_name"];
         major.dept_id    = Convert.ToInt32(collection["dept_id"]);
         MajorClientService.UpdateMajor(major);
         return(RedirectToAction("Edit"));
     }
     catch
     {
         return(View());
     }
 }
Пример #5
0
 public ActionResult Create(FormCollection collection)
 {
     try
     {
         PLMajor major = new PLMajor();
         major.major_id   = Convert.ToInt32(collection["major_id"]);
         major.major_name = collection["major_name"];
         major.dept_id    = Convert.ToInt32(collection["dept_id"]);
         MajorClientService.InsertMajor(major);
         return(RedirectToAction("Create"));
     }
     catch (Exception e)
     {
         Console.Write(e.ToString());
         return(View());
     }
 }
Пример #6
0
        /*
         *
         * 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);
         * }*/

        //
        // AJAX: for /Major/Create
        public JsonResult GetSampleMajor(int idx)
        {
            List <string>  errors = new List <string>();
            List <PLMajor> list   = MajorClientService.GetMajorList();

            /*System.Diagnostics.Debug.WriteLine("List Count:" + list.Count);
             * System.Diagnostics.Debug.WriteLine("MajorID:" + list[idx].major_id);
             * System.Diagnostics.Debug.WriteLine("MajorName:" + list[idx].major_name);
             * System.Diagnostics.Debug.WriteLine("DeptID:" + list[idx].dept_id);*/
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].major_id == idx)
                {
                    return(this.Json(list[i], JsonRequestBehavior.AllowGet));
                }
            }
            errors.Add("major id not found");
            return(this.Json(errors));
        }
Пример #7
0
        public ActionResult Delete(FormCollection collection)
        {
            try
            {
                int  major_id = Convert.ToInt32(collection["major_id"]);
                bool success  = MajorClientService.DeleteMajor(major_id);

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

                return(RedirectToAction("Error"));
            }
            catch
            {
                return(View());
            }
        }
Пример #8
0
        //
        // 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"));
        }