コード例 #1
0
ファイル: MajorController.cs プロジェクト: ysugiant/cse136fe
        //
        // GET: /Major/Get/
        public ActionResult Get()
        {
            if (HttpContext != null)
            {
                UrlHelper url = new UrlHelper(HttpContext.Request.RequestContext);
                ViewBag.breadCrumbData  = "<a href='" + url.Action("Get", "Major") + "'>Get Major</a>";
                ViewBag.breadCrumbData += " > Get";
            }
            PLMajor major = new PLMajor();

            return(View("Get", major));
        }
コード例 #2
0
ファイル: MajorController.cs プロジェクト: ysugiant/cse136fe
        //
        // 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));
        }
コード例 #3
0
ファイル: MajorController.cs プロジェクト: ysugiant/cse136fe
 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());
     }
 }
コード例 #4
0
ファイル: MajorController.cs プロジェクト: ysugiant/cse136fe
 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());
     }
 }
コード例 #5
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"));
        }