using MTWorkHR.Application.Models; using MTWorkHR.Core.UnitOfWork; using MTWorkHR.Application.Services.Interfaces; using MTWorkHR.Core.Entities; using Microsoft.AspNetCore.Identity; using MTWorkHR.Application.Mapper; using MTWorkHR.Core.Global; using MTWorkHR.Infrastructure.Entities; using MTWorkHR.Infrastructure.Repositories; using MTWorkHR.Infrastructure.UnitOfWorks; using MTWorkHR.Core.IRepositories.Base; using Microsoft.AspNetCore.Http; using System.IO; using MTWorkHR.Infrastructure.Reports; using MTWorkHR.Core.Entities.Base; using Microsoft.Extensions.Logging; using MTWorkHR.Application.Identity; namespace MTWorkHR.Application.Services { public class ContractPdfService { // private readonly IContractService _contractService; // // private readonly IFileService _fileService; // private readonly IUnitOfWork _unitOfWork; //// private ILogger _logger; // private readonly IUserService _userService; // public ContractPdfService(IUnitOfWork unitOfWork, IContractService contractService, IUserService userService) // { // _unitOfWork = unitOfWork; // _userService = userService; // _contractService = contractService; // // _fileService = fileService; // } // public async Task GenerateContractPdf(string outputPath, long contractId) // { // try // { // // var contractData = await _unitOfWork.Contract.GetByIdWithAllChildren(contractId); // // // var contractData = new Contract { CompanyId = 1, JobTitleName = "SW Developer", ProjectStages = new List { new ProjectStage { Title = "Team Project", ScopeOfWork = "testing" } } }; // // var contract = MapperObject.Mapper.Map(contractData); // // var user = await _userService.GetUserById(contractData.UserId); // // if (user != null) // // { // // contract.EmployeeName = user.FirstName + " " + user.LastName; // // contract.EmployeeEmail = user.Email; // // contract.EmployeePassport = user.PassportNumber; // // contract.EmployeePhone = user.PhoneNumber; // // contract.EmployeeUniversity = user.UniversityName; // // contract.AcademicQualification = user.QualificationName; // // contract.EmployeeJobName = user.JobTitleName; // // } // var contract = await _contractService.GetByIdReport(contractId); // var x = await new ContractPdfGenerator().GenerateContractPdf(outputPath, contract); // }catch(Exception e) // { // // _logger.LogError(e, "Failed to generate contract PDF for contractId {ContractId}", contractId); // var msg = e.Message; // } // } } }