public async Task <IActionResult> History(string employeeId) { var viewModel = new AttendanceViewModel(); if (!string.IsNullOrEmpty(employeeId)) { var employee = await _employeeService.GetByEmployeeIdWithDetailAsync(employeeId); 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 filter = new AttendanceFilter { EmployeeId = employeeId, StartDate = DateTime.Today.AddDays(-10).ToString("yyyy/MM/dd"), EndDate = DateTime.Today.ToString("yyyy/MM/dd") }; var attendances = await _attendanceService.GetHistoryAsync(filter); viewModel.FilterModel = filter; viewModel.Employee = employee; viewModel.Attendances = attendances; } return(View(viewModel)); }
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.BirthDate = employee.BirthDate; viewModel.HireDate = employee.HireDate; viewModel.EmploymentDuration = CalculateDurationOfEmployment(employee.HireDate); if (employee.EmployeeState != null) { viewModel.DepartmentName = employee.EmployeeState.Department.DepartmentName; viewModel.SectionName = employee.EmployeeState.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.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); } return(viewModel); }
public IActionResult GetByEmployeeId(int employeeId) { var result = _employeeImageService.GetByEmployeeId(employeeId); if (result.Success) { return(Ok(result)); } return(BadRequest()); }
public IActionResult EmployeeDetail(int employeeId) { var model = new EmployeeListViewModel { EmployeeImage = _employeeImageService.GetByEmployeeId(employeeId), GetByIdEmployee = _employeeService.GetById(employeeId), CurrentEmployee = Convert.ToInt32(HttpContext.Request.Query["employeeId"]) }; return(View(model)); }
public IActionResult EmployeeUpdate(int employeeId) { var model = new EmployeeListViewModel { EmployeeImage = _employeeImageService.GetByEmployeeId(employeeId), EmployeeDetails = _employeeService.GetEmployeeDetails(), GetByIdEmployee = _employeeService.GetById(employeeId), CurrentEmployee = Convert.ToInt32(HttpContext.Request.Query["employeeId"]), employeeDetail = new EmployeeDetail(), Depatments = _departmentService.GetAll() }; return(View(model)); }
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)); }