Exemplo n.º 1
0
        //
        // GET: /Student/Create
        public ActionResult Edit(string id)
        {
            if (HttpContext != null)
            {
                UrlHelper url = new UrlHelper(HttpContext.Request.RequestContext);
                ViewBag.breadCrumbData  = "<a href='" + url.Action("Index", "Department") + "'>Department List</a>";
                ViewBag.breadCrumbData += " > Edit";
            }

            PLDepartment department = DepartmentClientService.GetDepartmentDetail(id);

            List <PLStaff>        st  = StaffClientService.GetStaffList();
            List <SelectListItem> res = new List <SelectListItem>();

            foreach (PLStaff tmp in st)
            {
                if (tmp.Department.deptName.Equals(id))
                {
                    res.Add(new SelectListItem {
                        Value = tmp.ID.ToString(), Text = tmp.FirstName + " " + tmp.LastName
                    });
                }
            }
            ViewBag.listStaff = res;

            return(View("Edit", department));
        }
Exemplo n.º 2
0
        /// <summary>
        /// this is data transfer object for Department.
        /// Converting from presentation layer Department object to business layer Department object
        /// </summary>
        /// <param name="staffMember"></param>
        /// <returns>instance of SLDepartment</returns>
        private static SLStaff.Department DTO_to_SL(PLDepartment dept)
        {
            SLStaff.Department slDept = new SLStaff.Department();
            slDept.id       = dept.ID;
            slDept.deptName = dept.deptName;
            slDept.chairID  = dept.chair_id;

            return(slDept);
        }
Exemplo n.º 3
0
        /// <summary>
        /// This is the data transfer object for Department.
        /// Converting business layer Department object to presentation layer Department object
        /// </summary>
        /// <param name="Staff"></param>
        /// <returns> a presentation layer Department object</returns>
        private static PLDepartment DTO_to_PL(SLStaff.Department dept)
        {
            PLDepartment plDept = new PLDepartment();

            plDept.ID       = dept.id;
            plDept.deptName = dept.deptName;
            plDept.chair_id = dept.chairID;

            return(plDept);
        }
Exemplo n.º 4
0
        //
        // GET: /Student/Create
        public ActionResult Create()
        {
            if (HttpContext != null)
            {
                UrlHelper url = new UrlHelper(HttpContext.Request.RequestContext);
                ViewBag.breadCrumbData  = "<a href='" + url.Action("Index", "Department") + "'>Department List</a>";
                ViewBag.breadCrumbData += " > Create";
            }
            PLDepartment department = new PLDepartment();

            return(View("Create", department));
        }
Exemplo n.º 5
0
 public ActionResult Create(FormCollection collection)
 {
     try
     {
         PLDepartment department = new PLDepartment();
         department.chair_id = Convert.ToInt32(collection["chairID"]);
         department.deptName = collection["deptName"];
         DepartmentClientService.CreateDepartment(department);
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         Console.Write(e.ToString());
         return(View());
     }
 }
Exemplo n.º 6
0
        public ActionResult Edit(FormCollection collection)
        {
            PLDepartment dpt = DepartmentClientService.GetDepartmentDetail(collection["ID"]);

            try
            {
                PLDepartment department = new PLDepartment();
                department.ID       = Convert.ToInt32(dpt.ID);
                department.deptName = collection["deptName"];
                department.chair_id = Convert.ToInt32(collection["chair_id"]);
                DepartmentClientService.UpdateDepartment(department);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 7
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"));
        }