Example #1
0
        public AlumniVM()
        {
            //this method is a constructor that tied list of alumniPO to the AllAlumni,
            AllAlumni = new List <AlumniPO>();

            //tied select list items to the department drop down,
            DepartmentDropDown = new List <SelectListItem>();

            //tied alumniPO to the alumni form to give value to the property.
            AlumniForm = new AlumniPO();
        }
Example #2
0
        public static AlumniPO MapAlumniBOtoPO(AlumniBO frmAlumniBO)
        {
            AlumniPO toAlumniPO = new AlumniPO();

            toAlumniPO.RecordID      = frmAlumniBO.RecordID;
            toAlumniPO.CompleteName  = frmAlumniBO.CompleteName;
            toAlumniPO.YearGraduated = frmAlumniBO.YearGraduated;
            toAlumniPO.Position      = frmAlumniBO.Position;
            toAlumniPO.Company       = frmAlumniBO.Company;
            toAlumniPO.ContactNumber = frmAlumniBO.ContactNumber;
            toAlumniPO.DepartmentID  = frmAlumniBO.DepartmentID;
            return(toAlumniPO);
        }
Example #3
0
        public static AlumniPO MapAlumniDOtoPO(AlumniDO frmAlumniDO)
        {
            //the method holds info of an AlumniDataObject and pass on an info
            //that is being converted to a presentation object.

            AlumniPO toAlumniPO = new AlumniPO();

            toAlumniPO.RecordID      = frmAlumniDO.RecordID;
            toAlumniPO.CompleteName  = frmAlumniDO.CompleteName;
            toAlumniPO.YearGraduated = frmAlumniDO.YearGraduated;
            toAlumniPO.Position      = frmAlumniDO.Position;
            toAlumniPO.Company       = frmAlumniDO.Company;
            toAlumniPO.ContactNumber = frmAlumniDO.ContactNumber;
            toAlumniPO.DepartmentID  = frmAlumniDO.DepartmentID;
            toAlumniPO.Department    = frmAlumniDO.Department.DeptName;
            return(toAlumniPO);
        }
        public ActionResult ViewAllAlumni()
        {
            //a default value for action result
            ActionResult response = null;

            if (Session["RoleID"] != null)
            {
                //session that check if someone log in or none
                //if there is log in run the condition.
                //if there is none then go to else option

                if ((int)Session["RoleID"] == 1 || (int)Session["RoleID"] == 2 || (int)Session["RoleID"] == 3)
                {
                    //session that determine what user is log in.
                    //if any of these role is not log in then go to else option.

                    //an instance to hold new list of AlumniPO info
                    List <AlumniPO> alumniList = new List <AlumniPO>();

                    //alumni data object identifier that holds program of read alumni record method.
                    List <AlumniDO> alumniObjectList = AlumniDataAccessLayer.ReadAlumniRecord();

                    foreach (AlumniDO objectList in alumniObjectList)
                    {
                        //a program which data object is being converted to a presentation object
                        //one by one,using a foreach loop then by mapper to convert.
                        AlumniPO mappedAlumni = Mapper.MapAlumniDOtoPO(objectList);
                        alumniList.Add(mappedAlumni);
                    }
                    //passing on all the converted info to identifier alumniList to be viewed.
                    response = View(alumniList);
                }
                else
                {
                    response = RedirectToAction("Index", "Home");
                }
            }
            else
            {
                response = RedirectToAction("Index", "Home");
            }
            //returning a list value or redirect.
            return(response);
        }