コード例 #1
0
        public ActionResult Index(int Empcode)
        {
            int LoginEmpCode = Convert.ToInt32(Session["EmpCode"]);

            int isAccessAllow = _employeeService.GetIsProfileViewable(Empcode, LoginEmpCode);

            if (isAccessAllow == 0)
            {
                ViewBag.Error = "You do not have permission to view profile of employee code : " + Empcode;
                return(PartialView("_partialviewNotFound"));
            }
            try
            {
                ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(Empcode);
                EmployeeDetailsViewModel reEmp   = _employeeService.GetEmployeeDetails(Empcode);
                EmployeeEditViewModel    Details = _employeeService.GetEmployeeByID(Empcode);
                IEnumerable <EmployeeFamilyViewModel>   Familydetails = _employeeService.GetEmployeeFamilyByID(Empcode);
                IEnumerable <EmployeePrizeDTO>          res           = _empPrizeService.GetAllPrizeOfEmployee(Empcode);
                IEnumerable <EmployeeSkillViewModel>    skill         = _employeeService.GetEmployeeSkillsByID(Empcode);
                IEnumerable <EmployeeDocumentViewModel> document      = _employeeService.GetEmployeeDocumentsByID(Empcode);
                EmployeeDetailAdminViewModel            EmpDetails    = new EmployeeDetailAdminViewModel();


                EmpDetails.EmpDetails    = reEmp;
                EmpDetails.OtherDetails  = Details;
                EmpDetails.Familydetails = Familydetails;
                EmpDetails.Prize         = res;
                EmpDetails.Skill         = skill;
                EmpDetails.Documents     = document;

                //get current history id
                EmployeeJobHistoryDTO jobhistoryCurrent = new EmployeeJobHistoryDTO();
                EmployeeJobHistoryDTO jobhistoryAppoint = new EmployeeJobHistoryDTO();
                int currentHistoryId = _jobhistory.GetJobHistoryOfEmployeeWIthCondition(Empcode, "current");
                if (currentHistoryId > 0)
                {
                    jobhistoryCurrent = _jobhistory.GetJobHistoryById(currentHistoryId);
                }
                else
                {
                    jobhistoryCurrent = null;
                }
                //get appointment history id
                int appointHistoryId = _jobhistory.GetJobHistoryOfEmployeeWIthCondition(Empcode, "appoint");;
                if (appointHistoryId > 0)
                {
                    jobhistoryAppoint = _jobhistory.GetJobHistoryById(appointHistoryId);
                }
                else
                {
                    jobhistoryAppoint = null;
                }

                EmpDetails.EmployeeCurrentJobHistory = jobhistoryCurrent;
                EmpDetails.EmployeeAppointJobHistory = jobhistoryAppoint;


                return(View(EmpDetails));
            }
            catch (Exception Exception)
            {
                throw new Exception(Exception.ToString());
            }
        }