Example #1
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);
        }
        public ActionResult ViewAllDepartment()
        {
            ActionResult response = null;

            if (Session["RoleID"] != null)
            {
                if ((int)Session["RoleID"] == 1 || (int)Session["RoleID"] == 2 || (int)Session["RoleID"] == 3)
                {
                    List <DepartmentDO> departmentObjectList = DepartmentDataAccessLayer.ReadDepartment();

                    List <DepartmentBO> departmentBOList = new List <DepartmentBO>();
                    foreach (DepartmentDO objectList in departmentObjectList)
                    {
                        DepartmentBO mappedDepartmentBO = Mapper.MapDepartmentDOtoBO(objectList);
                        departmentBOList.Add(mappedDepartmentBO);
                    }
                    List <AlumniBO> alumniBOList     = new List <AlumniBO>();
                    AlumniDAL       alumniDataAccess = new AlumniDAL();

                    List <AlumniDO> alumniDAOList = alumniDataAccess.ReadAlumniRecord();
                    foreach (AlumniDO objectList in alumniDAOList)
                    {
                        AlumniBO mappedAlumniBO = Mapper.MapAlumniDOtoBO(objectList);
                        alumniBOList.Add(mappedAlumniBO);
                    }


                    List <DepartmentBO> departmentBOListCount = AlumniBusinessLogicLayer.LinkedToAlumniAndDepartment(departmentBOList, alumniBOList);

                    List <DepartmentPO> departmentList = new List <DepartmentPO>();
                    foreach (DepartmentBO objectList in departmentBOList)
                    {
                        DepartmentPO mappedDepartmentPO = Mapper.MapDepartmentBOtoPO(objectList);
                        departmentList.Add(mappedDepartmentPO);
                    }

                    response = View(departmentList);
                }
                else
                {
                    response = RedirectToAction("Index", "Home");
                }
            }
            else
            {
                response = RedirectToAction("Index", "Home");
            }
            return(response);
        }