//
        // 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));
        }
Beispiel #2
0
        public ActionResult Create(FormCollection collection, string departmentFilter)
        {
            if (departmentFilter == null)
            {
                departmentFilter = "Computer Science and Engineering";
            }

            try
            {
                PLStaff staffMember = new PLStaff();
                //staffMember.ID = Convert.ToInt32(collection["ID"]);
                staffMember.FirstName    = collection["FirstName"];
                staffMember.LastName     = collection["LastName"];
                staffMember.EmailAddress = collection["EmailAddress"];
                staffMember.Password     = collection["Password"];
                //staffMember.Department = new PLDepartment();
                staffMember.Department = DepartmentClientService.GetDepartmentDetail(departmentFilter);//collection.Get(5).ToString());
                //staffMember.Department.deptName = collection.Get(6).ToString();//1;//new PLDepartment();//ViewBag.//DepartmentClientService.CreateDepartment((PLDepartment)(collection["Department"]));//Convert.ToInt32(collection["Department"]);
                staffMember.isInstructor = Convert.ToBoolean(collection["InstructorBit"]);
                StaffClientService.CreateStaff(staffMember);
                return(RedirectToAction("Index"));// this brings us to the staff List page
            }
            catch (Exception e)
            {
                Console.Write(e.ToString());
                return(View());
            }
        }
        public ActionResult Index()
        {
            List <PLDepartment> list = DepartmentClientService.GetDepartmentList();

            ViewBag.breadCrumbData = "Department List";

            return(View("List", list));
        }
Beispiel #4
0
        //
        // AJAX: Department dropdown list for /Major/Create
        public JsonResult GetDepartmentListForDropdown(int idx)
        {
            List <PLDepartment> list = DepartmentClientService.GetDepartmentList();

            /*
             * 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);*/
            foreach (PLDepartment d in list)
            {
                System.Diagnostics.Debug.WriteLine("deptID: " + d.ID + ", deptName: " + d.deptName + ", deptChair: " + d.chair_id);
            }

            return(this.Json(list, JsonRequestBehavior.AllowGet));
        }
 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());
     }
 }
        //
        // GET: /Student/Delete/5

        public ActionResult Delete(int id)
        {
            try
            {
                bool success = DepartmentClientService.DeleteDepartment(id);

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

                return(RedirectToAction("Error"));
            }
            catch
            {
                return(View());
            }
        }
        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());
            }
        }
Beispiel #8
0
 // GET: /Staff/Edit
 public ActionResult Edit(int id, FormCollection collection)
 {
     try
     {
         PLStaff staffMember = new PLStaff();
         staffMember.ID           = id;
         staffMember.FirstName    = collection["FirstName"];
         staffMember.LastName     = collection["LastName"];
         staffMember.EmailAddress = collection["EmailAddress"];
         staffMember.Password     = collection["Password"];
         staffMember.Department   = DepartmentClientService.GetDepartmentDetail(collection["Department"]);
         staffMember.isInstructor = Convert.ToBoolean(collection["isInstructor"]);
         StaffClientService.UpdateStaff(staffMember);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Beispiel #9
0
        // GET: /Staff/Create
        public ActionResult Create()
        {
            if (HttpContext != null)
            {
                UrlHelper url = new UrlHelper(HttpContext.Request.RequestContext);
                ViewBag.breadCrumbData  = "<a href='" + url.Action("Index", "Staff") + "'>Staff List</a>";
                ViewBag.breadCrumbData += " > Create";
            }
            PLStaff staff = new PLStaff();

            /*if (departmentFilter == null)
             *  departmentFilter = "";*/

            /*int staff_id = Convert.ToInt32(Session["id"].ToString());
             *
             * PLStaff staffMember = StaffClientService.GetStaffDetail(staff_id);
             * ViewBag.staffMember = staffMember;*/

            List <PLDepartment> departmentList = DepartmentClientService.GetDepartmentList();

            //Displaying all Department names
            List <SelectListItem> DepartmentList = new List <SelectListItem>();

            //List<int> DepartmentListOfIDs = new List<int>();
            foreach (PLDepartment dept in departmentList)
            {
                DepartmentList.Add(new SelectListItem {
                    Text = dept.deptName.ToString()
                });                                                                    //, Text = dept.ID.ToString() });
            }

            ViewBag.DepartmentList = DepartmentList;
            //ViewBag.DepartmentListOfIDs =

            return(View("Create", staff));
        }
        //
        // 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"));
        }
        public JsonResult GetSampleDepartment(int idx)
        {
            List <PLDepartment> list = DepartmentClientService.GetDepartmentList();

            return(this.Json(list[idx], JsonRequestBehavior.AllowGet));
        }
        public string GetNumDepartmentTotal()
        {
            List <PLDepartment> list = DepartmentClientService.GetDepartmentList();

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