public List <string> ConvertPdfToBase64(int RequestID) { var payslips = _payslipDetailReponsitory.FindAll().Where(x => x.RequestID == RequestID).ToList(); var request = _requestDetailService.GetById(RequestID); List <string> listPdf = new List <string>(); foreach (var item in payslips) { string month = months[request.PayslipForMonth]; var employee = _employeeReponsitory.FindById(item.EmployeeID); byte[] pdfBytes = File.ReadAllBytes(@"..\OSDPayslip.Web\wwwroot\PDF\" + RequestID.ToString() + @"\" + employee.Id + "_Payslips_" + month + ".pdf"); string pdfBase64 = Convert.ToBase64String(pdfBytes); listPdf.Add(pdfBase64); } return(listPdf); }
public OutputPreviewPayslip GetPayslipPreviews(int RequestId, string EmployeeID) { var payslipDetails = _payslipDetailReponsitory.FindAll().Where(x => x.RequestID == RequestId && x.EmployeeID == EmployeeID).FirstOrDefault(); var employee = _employeeReponsitory.FindById(EmployeeID); OutputPreviewPayslip outputEmployeePayslipList = new OutputPreviewPayslip() { StandardWorkingDay = payslipDetails.StandardWorkingDay, UnpaidLeave = payslipDetails.UnpaidLeave, ActualWorkingDay = payslipDetails.ActualWorkingDay, LeaveBalance = payslipDetails.LeaveBalance, //Total grosss incom GrossSalary = payslipDetails.GrossSalary, ActuaSalary = payslipDetails.ActuaSalary, BasicSalary = payslipDetails.BasicSalary, Allowance = payslipDetails.Allowance, Bonus = payslipDetails.Bonus, Salary13Th = payslipDetails.Salary13Th, IncomeOther = payslipDetails.IncomeOther, OtherDeductions = payslipDetails.OtherDeductions, ///Deductions SocialInsurance = payslipDetails.SocialInsurance, HealthInsurance = payslipDetails.HealthInsurance, UnemploymentInsurance = payslipDetails.UnemploymentInsurance, NoOfDependants = payslipDetails.NoOfDependants, PersonalIncomeTax = payslipDetails.PersonalIncomeTax, PaymentFromSocialInsurance = payslipDetails.PaymentFromSocialInsurance, PaymentOther = payslipDetails.PaymentOther, FinalizationOfPIT = payslipDetails.FinalizationOfPIT, NetIncome = payslipDetails.NetIncome, EmployeeID = employee.Id, Status = payslipDetails.Status, Email = employee.Email, DeptTeam = employee.DeptTeam, EmployeeName = employee.FullName, Holidays = payslipDetails.Holidays, Id = payslipDetails.Holidays, Notes = payslipDetails.Notes.Split(';'), }; return(outputEmployeePayslipList); }
public EmployeeViewModel GetById(string id) { var temp = _employeeReponsitory.FindById(id); return(_mapper.Map <Employee, EmployeeViewModel> (temp)); }