コード例 #1
0
        public async Task <IActionResult> Index(string employeeId)
        {
            var viewModel = new EmployeeSkillViewModel();

            if (!string.IsNullOrEmpty(employeeId))
            {
                viewModel.Employee = await _employeeService.GetByEmployeeIdWithDetailAsync(employeeId);

                viewModel.EmployeeSkills = await _employeeSkillService.GetByEmployeeId(employeeId);
            }

            return(View(viewModel));
        }
コード例 #2
0
        public async Task <IActionResult> Index(string firstEmployeeId, string secondEmployeeId)
        {
            var viewModel = new SkillMappingViewModel();

            if (!string.IsNullOrEmpty(firstEmployeeId))
            {
                var image = await _employeeImageService.GetByEmployeeId(firstEmployeeId);

                if (image != null)
                {
                    var imageBase64Data = Convert.ToBase64String(image.Images);
                    viewModel.FirstProfileImage = string.Format("data:image/png;base64,{0}", imageBase64Data);
                }

                viewModel.FirstEmployee = await _employeeService.GetByEmployeeIdWithDetailAsync(firstEmployeeId);

                viewModel.FirstEmployeeSkills = await _employeeSkillService.GetByEmployeeId(firstEmployeeId);
            }

            if (!string.IsNullOrEmpty(secondEmployeeId))
            {
                var image = await _employeeImageService.GetByEmployeeId(secondEmployeeId);

                if (image != null)
                {
                    var imageBase64Data = Convert.ToBase64String(image.Images);
                    viewModel.SecondProfileImage = string.Format("data:image/png;base64,{0}", imageBase64Data);
                }

                viewModel.SecondEmployee = await _employeeService.GetByEmployeeIdWithDetailAsync(firstEmployeeId);

                viewModel.SecondEmployeeSkills = await _employeeSkillService.GetByEmployeeId(firstEmployeeId);
            }

            return(View(viewModel));
        }
コード例 #3
0
        public async Task <ProfileViewModel> GetProfile(string employeeId)
        {
            var viewModel = new ProfileViewModel();

            var employee = await _employeeService.GetByEmployeeIdWithDetailAsync(employeeId);

            if (employee != null)
            {
                viewModel.EmployeeId         = employee.EmployeeId;
                viewModel.GlobalId           = employee.GlobalId;
                viewModel.CardId             = employee.CardId;
                viewModel.EmployeeType       = employee.EmployeeType;
                viewModel.Title              = employee.Title;
                viewModel.TitleThai          = employee.TitleThai;
                viewModel.FirstName          = employee.FirstName;
                viewModel.LastName           = employee.LastName;
                viewModel.FirstNameThai      = employee.FirstNameThai;
                viewModel.LastNameThai       = employee.LastNameThai;
                viewModel.Gender             = employee.Gender;
                viewModel.Age                = CalculateAge(employee.BirthDate);
                viewModel.Height             = employee.Height;
                viewModel.Hand               = employee.Hand;
                viewModel.BirthDate          = employee.BirthDate;
                viewModel.HireDate           = employee.HireDate;
                viewModel.HireType           = employee.HireType;
                viewModel.Status             = (bool)employee.AvailableFlag;
                viewModel.EmploymentDuration = CalculateDurationOfEmployment(employee.HireDate);

                if (employee.EmployeeState != null)
                {
                    viewModel.DepartmentName = employee.EmployeeState.JobFunction.Section.Department.DepartmentName;
                    viewModel.SectionName    = employee.EmployeeState.JobFunction.Section.SectionName;
                    viewModel.ShiftName      = employee.EmployeeState.Shift.ShiftName;
                    viewModel.LevelCode      = employee.EmployeeState.Level.LevelName;
                    viewModel.PositionName   = employee.EmployeeState.Position.PositionName;
                    viewModel.FunctionName   = employee.EmployeeState.JobFunction.FunctionName;
                    viewModel.FunctionCode   = employee.EmployeeState.JobFunction.FunctionCode;
                    viewModel.RouteName      = employee.EmployeeState.BusStation.Route.RouteName;
                    viewModel.BusStationName = employee.EmployeeState.BusStation.BusStationName;
                    viewModel.JoinDate       = employee.EmployeeState.JoinDate;
                }
            }

            var address = await _employeeAddressService.GetByEmployeeId(employeeId);

            if (address != null)
            {
                viewModel.HomeAddress  = address.HomeAddress;
                viewModel.City         = address.City;
                viewModel.Country      = address.Country;
                viewModel.PostalCode   = address.PostalCode;
                viewModel.PhoneNumber  = address.PhoneNumber;
                viewModel.EmailAddress = address.EmailAddress;
            }

            var image = await _employeeImageService.GetByEmployeeId(employeeId);

            if (image != null)
            {
                var imageBase64Data = Convert.ToBase64String(image.Images);
                viewModel.ProfileImage = string.Format("data:image/png;base64,{0}", imageBase64Data);
            }

            var employeeSkills = await _employeeSkillService.GetByEmployeeId(employeeId);

            if (employeeSkills != null)
            {
                viewModel.EmployeeSkills = employeeSkills;
            }

            return(viewModel);
        }