Unused AllowAnonymous Hide

This commit is contained in:
Mohaimen Hasan 2026-11-04 19:03:36 +06:00
parent 96ffa17045
commit 81262f19d6
9 changed files with 325 additions and 324 deletions

View File

@ -1103,26 +1103,25 @@ namespace HRM.UI.Controllers
} }
} }
[HttpGet] [HttpGet]
[Route("getUserByEmail/{email}")] [Route("getUserByEmail/{email}")]
[AllowAnonymous] public ActionResult GetUserByEmail(string email)
public ActionResult GetUserByEmail(string email) {
{ User user = null;
User user = null;
try try
{ {
user = _userService.GetByEmail(email); user = _userService.GetByEmail(email);
} }
catch (Exception ex) catch (Exception ex)
{ {
//return ex; //return ex;
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
} }
return Ok(user); return Ok(user);
} }
[HttpGet] [HttpGet]
[Route("GetLogInUserType")] [Route("GetLogInUserType")]
public ActionResult GetLogInUserType() public ActionResult GetLogInUserType()
{ {
@ -1439,27 +1438,27 @@ namespace HRM.UI.Controllers
} }
// password history // password history
[HttpGet] //[HttpGet]
[Route("getPasswordHistoryList")] //[Route("getPasswordHistoryList")]
[AllowAnonymous] //[AllowAnonymous]
public ActionResult GetPasswordHistoryList() //public ActionResult GetPasswordHistoryList()
{ //{
List<PasswordHistory> items = new List<PasswordHistory>(); // List<PasswordHistory> items = new List<PasswordHistory>();
CurrentUser user = CurrentUser.GetCurrentUser(HttpContext.User); // CurrentUser user = CurrentUser.GetCurrentUser(HttpContext.User);
int userId = user.UserID; // int userId = user.UserID;
try // try
{ // {
items = _passwordHistoryService.Get(userId); // items = _passwordHistoryService.Get(userId);
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
//return ex; // //return ex;
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); // return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
} // }
return Ok(items); // return Ok(items);
} //}
[HttpPost("changePasswordbyAdmin")] [HttpPost("changePasswordbyAdmin")]
public ActionResult changePasswordbyAdmin(dynamic data) public ActionResult changePasswordbyAdmin(dynamic data)

View File

@ -560,51 +560,51 @@ namespace HRM.UI.Controllers.Payroll
return postedPayrollTypeID > 0 ? postedPayrollTypeID : 0; return postedPayrollTypeID > 0 ? postedPayrollTypeID : 0;
} }
[HttpPost] //[HttpPost]
[Route("get-download-file")] //[Route("get-download-file")]
[AllowAnonymous] //[AllowAnonymous]
[IgnoreAntiforgeryToken] //[IgnoreAntiforgeryToken]
[ProducesResponseType(StatusCodes.Status200OK)] //[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<IActionResult> EmployeeDownload(dynamic data) //public async Task<IActionResult> EmployeeDownload(dynamic data)
{ //{
//var uploads = Path.Combine(_hostingEnvironment.WebRootPath, "uploads"); // //var uploads = Path.Combine(_hostingEnvironment.WebRootPath, "uploads");
//var filePath = Path.Combine(uploads, file); // //var filePath = Path.Combine(uploads, file);
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data)); // var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
string tempfileName = (string) item["fileName"].ToObject<string>(); // string tempfileName = (string) item["fileName"].ToObject<string>();
string tempmappingpath = (string) item["mappingPath"].ToObject<string>(); // string tempmappingpath = (string) item["mappingPath"].ToObject<string>();
var fileName = _filePath + tempmappingpath; // var fileName = _filePath + tempmappingpath;
var contentType = GetFileType(data); // var contentType = GetFileType(data);
string fullPath = System.IO.Path.Combine(System.Environment.CurrentDirectory, fileName); // string fullPath = System.IO.Path.Combine(System.Environment.CurrentDirectory, fileName);
if (!System.IO.File.Exists(fullPath)) // if (!System.IO.File.Exists(fullPath))
return NotFound(); // return NotFound();
var memory = new MemoryStream(); // var memory = new MemoryStream();
using (var stream = new FileStream(fullPath, FileMode.Open)) // using (var stream = new FileStream(fullPath, FileMode.Open))
{ // {
await stream.CopyToAsync(memory); // await stream.CopyToAsync(memory);
} // }
memory.Position = 0; // memory.Position = 0;
return File(memory, GetContentType(fullPath)); // return File(memory, GetContentType(fullPath));
} //}
[HttpPost] //[HttpPost]
[Route("get-file-type")] //[Route("get-file-type")]
[AllowAnonymous] //[AllowAnonymous]
[IgnoreAntiforgeryToken] //[IgnoreAntiforgeryToken]
[ProducesResponseType(StatusCodes.Status200OK)] //[ProducesResponseType(StatusCodes.Status200OK)]
public string GetFileType(dynamic data) //public string GetFileType(dynamic data)
{ //{
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data)); // var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
string fileName = (string) item["fileName"].ToObject<string>(); // string fileName = (string) item["fileName"].ToObject<string>();
string contentType; // string contentType;
new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType); // new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType);
return contentType ?? "application/octet-stream"; // return contentType ?? "application/octet-stream";
} //}
private string GetContentType(string path) private string GetContentType(string path)

View File

@ -157,49 +157,49 @@ namespace HRM.UI.Controllers
[HttpPost] //[HttpPost]
[Route("dataintergration")] //[Route("dataintergration")]
[AllowAnonymous] //[AllowAnonymous]
public ActionResult dataintergration([FromBody] DataIntegrationHeader data) //public ActionResult dataintergration([FromBody] DataIntegrationHeader data)
{ //{
IntregraionReponse returnItem = new IntregraionReponse(); // IntregraionReponse returnItem = new IntregraionReponse();
try // try
{ // {
_dataIntergrationRequestService.SaveBulkRequest(_oHRDataUploads); // _dataIntergrationRequestService.SaveBulkRequest(_oHRDataUploads);
_oHRDataUploads = data.Items; // _oHRDataUploads = data.Items;
CheckFieldValidation(); // CheckFieldValidation();
if (_oErrorList.Count > 0) // if (_oErrorList.Count > 0)
{ // {
foreach (var item in _oErrorList) // foreach (var item in _oErrorList)
{ // {
item.Type = EnumDataIntegrationType.EmployeeBasic; // item.Type = EnumDataIntegrationType.EmployeeBasic;
} // }
_dataIntergrationRequestService.BulkSave(_oErrorList); // _dataIntergrationRequestService.BulkSave(_oErrorList);
throw new Exception("There occurs some errors while validating data"); // throw new Exception("There occurs some errors while validating data");
} // }
_dataIntergrationRequestService.ImportEmpBasicInfo(_oHRDataUploads, 1, 1); // _dataIntergrationRequestService.ImportEmpBasicInfo(_oHRDataUploads, 1, 1);
//var response = new IntregraionReponse() // //var response = new IntregraionReponse()
//{ // //{
// ReturnCode = HttpStatusCode.OK.ToString(), // // ReturnCode = HttpStatusCode.OK.ToString(),
// ReturnName = "OK", // // ReturnName = "OK",
// InternalError = ex.Message, // // InternalError = ex.Message,
// Details = _oErrorList // // Details = _oErrorList
//}; // //};
return Ok(); // return Ok();
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
var response = new IntregraionReponse() // var response = new IntregraionReponse()
{ // {
ReturnCode = HttpStatusCode.InternalServerError.ToString(), // ReturnCode = HttpStatusCode.InternalServerError.ToString(),
ReturnName = "Internal Server Error", // ReturnName = "Internal Server Error",
InternalError = ex.Message, // InternalError = ex.Message,
Details = _oErrorList // Details = _oErrorList
}; // };
return StatusCode(500, response); // return StatusCode(500, response);
} // }
} //}
[HttpGet] [HttpGet]
[Route("employeebasicintegrationapi/{empNo}")] [Route("employeebasicintegrationapi/{empNo}")]

View File

@ -2214,66 +2214,66 @@ namespace HRM.UI.Controllers
} }
[HttpPost("getEmpApiResponse")] //[HttpPost("getEmpApiResponse")]
[AllowAnonymous] //[AllowAnonymous]
public ActionResult GetEmpApiResponse(EmployeeApiInfo userData) //public ActionResult GetEmpApiResponse(EmployeeApiInfo userData)
{ //{
EmployeeApiInfo employeeApiInfo = _employeeApiInfo.Value; // EmployeeApiInfo employeeApiInfo = _employeeApiInfo.Value;
List<Employee> employees = new List<Employee>(); // List<Employee> employees = new List<Employee>();
List<EmpApiResponse> empApiResponses = new List<EmpApiResponse>(); // List<EmpApiResponse> empApiResponses = new List<EmpApiResponse>();
List<Department> departments = new List<Department>(); // List<Department> departments = new List<Department>();
List<Designation> designations = new List<Designation>(); // List<Designation> designations = new List<Designation>();
List<HRM.BO.Location> locations = new List<HRM.BO.Location>(); // List<HRM.BO.Location> locations = new List<HRM.BO.Location>();
List<Costcenter> costCenters = new List<Costcenter>(); // List<Costcenter> costCenters = new List<Costcenter>();
try // try
{ // {
if (!(userData.UserId == employeeApiInfo.UserId && userData.Password == employeeApiInfo.Password)) // if (!(userData.UserId == employeeApiInfo.UserId && userData.Password == employeeApiInfo.Password))
return BadRequest("UserId or Password Is Invalid"); // return BadRequest("UserId or Password Is Invalid");
employees = _EmployeeService.GetAllEmps(); // employees = _EmployeeService.GetAllEmps();
departments = _departmentService.GetAll(1); // departments = _departmentService.GetAll(1);
designations = _designationService.GetAllDesignation(1, EnumStatus.Active, String.Empty, String.Empty); // designations = _designationService.GetAllDesignation(1, EnumStatus.Active, String.Empty, String.Empty);
locations = _locationService.GetLocations(); // locations = _locationService.GetLocations();
costCenters = _costCenterService.Get(); // costCenters = _costCenterService.Get();
foreach (var employee in employees) // foreach (var employee in employees)
{ // {
var empApiResponse = new EmpApiResponse(); // var empApiResponse = new EmpApiResponse();
empApiResponse.EmpCode = employee.GeId; // empApiResponse.EmpCode = employee.GeId;
empApiResponse.EmpDName = employee.ExtraField1; // empApiResponse.EmpDName = employee.ExtraField1;
empApiResponse.EmpFName = employee.FirstName; // empApiResponse.EmpFName = employee.FirstName;
empApiResponse.EmpLName = employee.LastName; // empApiResponse.EmpLName = employee.LastName;
empApiResponse.EmpEmail = employee.EmailAddress; // empApiResponse.EmpEmail = employee.EmailAddress;
empApiResponse.EmpMobile = employee.MobileNo; // empApiResponse.EmpMobile = employee.MobileNo;
empApiResponse.PayrollId = employee.EmployeeNo; // empApiResponse.PayrollId = employee.EmployeeNo;
empApiResponse.GenderName = Enum.GetName(typeof(EnumGender), employee.Gender); // empApiResponse.GenderName = Enum.GetName(typeof(EnumGender), employee.Gender);
var dept = departments.Find(x => x.ID == employee.DepartmentID); // var dept = departments.Find(x => x.ID == employee.DepartmentID);
empApiResponse.DepartmentName = dept == null ? "" : dept.Name; // empApiResponse.DepartmentName = dept == null ? "" : dept.Name;
var designation = designations.Find(x => x.ID == employee.DesignationID); // var designation = designations.Find(x => x.ID == employee.DesignationID);
empApiResponse.DesignationName = designation == null ? "" : designation.Name; // empApiResponse.DesignationName = designation == null ? "" : designation.Name;
var lineManager = employees.Find((x => x.ID == employee.LineManagerID)); // var lineManager = employees.Find((x => x.ID == employee.LineManagerID));
empApiResponse.LineManager = lineManager == null ? "" : lineManager.Name; // empApiResponse.LineManager = lineManager == null ? "" : lineManager.Name;
empApiResponse.BaseStation = Enum.GetName(typeof(EnumBaseStation), employee.ExtraField2); // empApiResponse.BaseStation = Enum.GetName(typeof(EnumBaseStation), employee.ExtraField2);
empApiResponse.VendorCode = employee.VendorCode; // empApiResponse.VendorCode = employee.VendorCode;
var costCenter = costCenters.Find(x => x.ID == employee.CrgId); // var costCenter = costCenters.Find(x => x.ID == employee.CrgId);
empApiResponse.CostCenterCode = costCenter == null ? "" : costCenter.Code; // empApiResponse.CostCenterCode = costCenter == null ? "" : costCenter.Code;
empApiResponse.CostCenterName = costCenter == null ? "" : costCenter.Name; // empApiResponse.CostCenterName = costCenter == null ? "" : costCenter.Name;
empApiResponse.BaseStation = Enum.GetName(typeof(EnumBaseStation), employee.ExtraField2); // empApiResponse.BaseStation = Enum.GetName(typeof(EnumBaseStation), employee.ExtraField2);
var location = locations.Find(x => x.ID == employee.LocationID); // var location = locations.Find(x => x.ID == employee.LocationID);
empApiResponse.Location = location == null ? "" : location.Name; // empApiResponse.Location = location == null ? "" : location.Name;
empApiResponse.TypeName = employee.ExtraField3; // empApiResponse.TypeName = employee.ExtraField3;
empApiResponse.EmpActive = Enum.GetName(typeof(EnumEmpStatus), employee.Status); // empApiResponse.EmpActive = Enum.GetName(typeof(EnumEmpStatus), employee.Status);
empApiResponse.MinValue = employee.ExtraField4; // empApiResponse.MinValue = employee.ExtraField4;
empApiResponse.MaxValue = employee.ExtraField5; // empApiResponse.MaxValue = employee.ExtraField5;
empApiResponses.Add(empApiResponse); // empApiResponses.Add(empApiResponse);
} // }
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); // return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
} // }
return Ok(empApiResponses); // return Ok(empApiResponses);
} //}
[HttpPost("getEmployeesByEmpIDs")] [HttpPost("getEmployeesByEmpIDs")]
public ActionResult GetEmployeesByEmpIDs(dynamic data) public ActionResult GetEmployeesByEmpIDs(dynamic data)

View File

@ -136,82 +136,82 @@ namespace HRM.UI.Controllers
} }
[HttpPost("uploadExcelfile")] //[HttpPost("uploadExcelfile")]
[AllowAnonymous] //[AllowAnonymous]
public async Task<IActionResult> uploadExcelfile() //public async Task<IActionResult> uploadExcelfile()
{ //{
try // try
{ // {
var files = Request.Form.Files; // var files = Request.Form.Files;
List<UploaderItems> uploadedList = new List<UploaderItems>(); // List<UploaderItems> uploadedList = new List<UploaderItems>();
int i = 0; // int i = 0;
int cntSuccess = 0; // int cntSuccess = 0;
var uploadedFileNames = new List<string>(); // var uploadedFileNames = new List<string>();
string result = string.Empty; // string result = string.Empty;
long size = files.Sum(f => f.Length); // long size = files.Sum(f => f.Length);
foreach (var formFile in files) // foreach (var formFile in files)
{ // {
var fileSize = formFile.Length; // var fileSize = formFile.Length;
var originalFile = formFile.FileName; // var originalFile = formFile.FileName;
var generatedFile = Guid.NewGuid().ToString().Replace("-", ""); // var generatedFile = Guid.NewGuid().ToString().Replace("-", "");
var uploaderItem = new UploaderItems(); // var uploaderItem = new UploaderItems();
uploaderItem.OriginalFileName = originalFile; // uploaderItem.OriginalFileName = originalFile;
// uploaderItem.GeneratedFileName = generatedFile; // // uploaderItem.GeneratedFileName = generatedFile;
//var supportedTypes = new[] { "jpg", "png", "jpeg", "pdf" }; // //var supportedTypes = new[] { "jpg", "png", "jpeg", "pdf" };
var fileExt = System.IO.Path.GetExtension(originalFile).Substring(1); // var fileExt = System.IO.Path.GetExtension(originalFile).Substring(1);
uploaderItem.GeneratedFileName = generatedFile + "." + fileExt; // uploaderItem.GeneratedFileName = generatedFile + "." + fileExt;
//if (supportedTypes.Contains(fileExt)) // //if (supportedTypes.Contains(fileExt))
//{ // //{
// if (fileSize > (500 * 1024)) // // if (fileSize > (500 * 1024))
// { // // {
// result = "Maximum file size permitted is 500KB"; // // result = "Maximum file size permitted is 500KB";
// throw new System.ArgumentException(result); // // throw new System.ArgumentException(result);
// } // // }
//} // //}
var fileName = _filePath + uploaderItem.OriginalFileName; // var fileName = _filePath + uploaderItem.OriginalFileName;
string fullPath = System.IO.Path.Combine(System.Environment.CurrentDirectory, fileName); // string fullPath = System.IO.Path.Combine(System.Environment.CurrentDirectory, fileName);
uploaderItem.Path = fullPath; // uploaderItem.Path = fullPath;
try // try
{ // {
if (System.IO.File.Exists(fullPath)) // if (System.IO.File.Exists(fullPath))
{ // {
System.IO.File.Delete(fullPath); // System.IO.File.Delete(fullPath);
} // }
using (var stream = new FileStream(fullPath, FileMode.Create)) // using (var stream = new FileStream(fullPath, FileMode.Create))
{ // {
formFile.CopyTo(stream); // formFile.CopyTo(stream);
} // }
uploadedFileNames.Add(formFile.FileName); // uploadedFileNames.Add(formFile.FileName);
uploadedList.Add(uploaderItem); // uploadedList.Add(uploaderItem);
cntSuccess++; // cntSuccess++;
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
throw ex; // throw ex;
} // }
i++; // i++;
} // }
result = cntSuccess.ToString() + " files uploaded succesfully.<br/>"; // result = cntSuccess.ToString() + " files uploaded succesfully.<br/>";
result += "<ul>"; // result += "<ul>";
foreach (var f in uploadedFileNames) // foreach (var f in uploadedFileNames)
{ // {
result += "<li>" + f + "</li>"; // result += "<li>" + f + "</li>";
} // }
result += "</ul>"; // result += "</ul>";
return Ok(uploadedList); // return Ok(uploadedList);
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); // return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
} // }
} //}
[HttpPost("removeExcelfile")] [HttpPost("removeExcelfile")]
@ -552,11 +552,12 @@ namespace HRM.UI.Controllers
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
} }
} }
[HttpPost]
[Route("get-file-type")] //[HttpPost]
[AllowAnonymous] //[Route("get-file-type")]
[IgnoreAntiforgeryToken] //[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)] //[IgnoreAntiforgeryToken]
//[ProducesResponseType(StatusCodes.Status200OK)]
public string GetFileType(string originalFileName) public string GetFileType(string originalFileName)
{ {
//var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data)); //var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));

View File

@ -680,20 +680,7 @@ namespace HRM.UI.Controllers
} }
} }
[HttpPost]
[Route("get-file-type")]
[AllowAnonymous]
[IgnoreAntiforgeryToken]
[ProducesResponseType(StatusCodes.Status200OK)]
public string GetFileType(string originalFileName)
{
//var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
//string fileName = (string)item["fileName"].ToObject<string>();
string fileName = originalFileName;
string contentType;
new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType);
return contentType ?? "application/octet-stream";
}
[HttpPost] [HttpPost]
[Route("saveAuthorizedPerson")] [Route("saveAuthorizedPerson")]
@ -850,5 +837,20 @@ namespace HRM.UI.Controllers
} }
} }
} //[HttpPost]
//[Route("get-file-type")]
//[AllowAnonymous]
//[IgnoreAntiforgeryToken]
//[ProducesResponseType(StatusCodes.Status200OK)]
public string GetFileType(string originalFileName)
{
//var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
//string fileName = (string)item["fileName"].ToObject<string>();
string fileName = originalFileName;
string contentType;
new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType);
return contentType ?? "application/octet-stream";
}
}
} }

View File

@ -899,23 +899,22 @@ namespace HRM.UI.Controllers
} }
} }
//[HttpPost]
//[Route("get-file-type")]
//[AllowAnonymous]
//[IgnoreAntiforgeryToken]
//[ProducesResponseType(StatusCodes.Status200OK)]
public string GetFileType(string originalFileName)
{
//var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
//string fileName = (string)item["fileName"].ToObject<string>();
string fileName = originalFileName;
string contentType;
new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType);
return contentType ?? "application/octet-stream";
}
[HttpPost] [HttpPost]
[Route("get-file-type")]
[AllowAnonymous]
[IgnoreAntiforgeryToken]
[ProducesResponseType(StatusCodes.Status200OK)]
public string GetFileType(string originalFileName)
{
//var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
//string fileName = (string)item["fileName"].ToObject<string>();
string fileName = originalFileName;
string contentType;
new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType);
return contentType ?? "application/octet-stream";
}
[HttpPost]
[Route("saveCV")] [Route("saveCV")]
public ActionResult saveCV(CV ob) public ActionResult saveCV(CV ob)
{ {
@ -2865,47 +2864,47 @@ namespace HRM.UI.Controllers
return Ok(erCircularList); return Ok(erCircularList);
} }
[HttpPost("uploadFile")] //[HttpPost("uploadFile")]
[AllowAnonymous] //[AllowAnonymous]
public ActionResult uploadFile() //public ActionResult uploadFile()
{ //{
string base64String = ""; // string base64String = "";
try // try
{ // {
//var files = Request.Form.Files; // //var files = Request.Form.Files;
//foreach (var formFile in files) // //foreach (var formFile in files)
//{ // //{
// var fileSize = formFile.Length; // // var fileSize = formFile.Length;
// var originalFile = formFile.FileName; // // var originalFile = formFile.FileName;
// var fileExt = System.IO.Path.GetExtension(originalFile).Substring(1); // // var fileExt = System.IO.Path.GetExtension(originalFile).Substring(1);
// var fileName = _filePath + formFile.FileName; // // var fileName = _filePath + formFile.FileName;
// var ms = new MemoryStream(); // // var ms = new MemoryStream();
// formFile.CopyTo(ms); // // formFile.CopyTo(ms);
// byte[] textAsBytes = ms.ToArray(); // // byte[] textAsBytes = ms.ToArray();
// base64String = Convert.ToBase64String(textAsBytes); // // base64String = Convert.ToBase64String(textAsBytes);
// using (PdfReader pdfReader = new PdfReader(ms)) // // using (PdfReader pdfReader = new PdfReader(ms))
// { // // {
// for (int page = 1; page <= pdfReader.NumberOfPages; page++) // // for (int page = 1; page <= pdfReader.NumberOfPages; page++)
// { // // {
// ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy(); // // ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
// string currentText = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy); // // string currentText = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy);
// currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(currentText))); // // currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(currentText)));
// text.Append(currentText); // // text.Append(currentText);
// } // // }
// } // // }
//} // //}
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); // return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
} // }
return Ok(base64String); // return Ok(base64String);
} //}
[HttpPost("readPDf")] [HttpPost("readPDf")]
[AllowAnonymous] [AllowAnonymous]

View File

@ -1,17 +1,19 @@
using System; using HRM.BO;
using HRM.DA;
using HRM.UI.DTOs.Training;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using HRM.BO;
using HRM.DA;
using HRM.UI.DTOs.Training;
using Microsoft.AspNetCore.Mvc;
namespace HRM.UI.Controllers.Attendance namespace HRM.UI.Controllers.Attendance
{ {
[Route("api/[controller]")] [Route("api/[controller]")]
[ApiController] [ApiController]
public class TaxController : ControllerBase [Authorize]
public class TaxController : ControllerBase
{ {
// private readonly ShiftService _ShiftService; // private readonly ShiftService _ShiftService;

View File

@ -619,8 +619,6 @@ namespace HRM.UI.Controllers
{ {
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
} }
return Ok(base64String); return Ok(base64String);
} }