diff --git a/HRM.UI/Controllers/Auth/AuthController.cs b/HRM.UI/Controllers/Auth/AuthController.cs index 9655adc..2901925 100644 --- a/HRM.UI/Controllers/Auth/AuthController.cs +++ b/HRM.UI/Controllers/Auth/AuthController.cs @@ -1103,26 +1103,25 @@ namespace HRM.UI.Controllers } } - [HttpGet] - [Route("getUserByEmail/{email}")] - [AllowAnonymous] - public ActionResult GetUserByEmail(string email) - { - User user = null; + [HttpGet] + [Route("getUserByEmail/{email}")] + public ActionResult GetUserByEmail(string email) + { + User user = null; - try - { - user = _userService.GetByEmail(email); - } - catch (Exception ex) - { - //return ex; - return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); - } - return Ok(user); - } + try + { + user = _userService.GetByEmail(email); + } + catch (Exception ex) + { + //return ex; + return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); + } + return Ok(user); + } - [HttpGet] + [HttpGet] [Route("GetLogInUserType")] public ActionResult GetLogInUserType() { @@ -1439,27 +1438,27 @@ namespace HRM.UI.Controllers } // password history - [HttpGet] - [Route("getPasswordHistoryList")] - [AllowAnonymous] - public ActionResult GetPasswordHistoryList() - { - List items = new List(); - CurrentUser user = CurrentUser.GetCurrentUser(HttpContext.User); - int userId = user.UserID; + //[HttpGet] + //[Route("getPasswordHistoryList")] + //[AllowAnonymous] + //public ActionResult GetPasswordHistoryList() + //{ + // List items = new List(); + // CurrentUser user = CurrentUser.GetCurrentUser(HttpContext.User); + // int userId = user.UserID; - try - { - items = _passwordHistoryService.Get(userId); - } - catch (Exception ex) - { - //return ex; - return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); - } + // try + // { + // items = _passwordHistoryService.Get(userId); + // } + // catch (Exception ex) + // { + // //return ex; + // return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); + // } - return Ok(items); - } + // return Ok(items); + //} [HttpPost("changePasswordbyAdmin")] public ActionResult changePasswordbyAdmin(dynamic data) diff --git a/HRM.UI/Controllers/CommonInterface/DataUploadController.cs b/HRM.UI/Controllers/CommonInterface/DataUploadController.cs index d94e9c7..3ecace1 100644 --- a/HRM.UI/Controllers/CommonInterface/DataUploadController.cs +++ b/HRM.UI/Controllers/CommonInterface/DataUploadController.cs @@ -560,51 +560,51 @@ namespace HRM.UI.Controllers.Payroll return postedPayrollTypeID > 0 ? postedPayrollTypeID : 0; } - [HttpPost] - [Route("get-download-file")] - [AllowAnonymous] - [IgnoreAntiforgeryToken] - [ProducesResponseType(StatusCodes.Status200OK)] - public async Task EmployeeDownload(dynamic data) - { - //var uploads = Path.Combine(_hostingEnvironment.WebRootPath, "uploads"); - //var filePath = Path.Combine(uploads, file); + //[HttpPost] + //[Route("get-download-file")] + //[AllowAnonymous] + //[IgnoreAntiforgeryToken] + //[ProducesResponseType(StatusCodes.Status200OK)] + //public async Task EmployeeDownload(dynamic data) + //{ + // //var uploads = Path.Combine(_hostingEnvironment.WebRootPath, "uploads"); + // //var filePath = Path.Combine(uploads, file); - var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data)); - string tempfileName = (string) item["fileName"].ToObject(); - string tempmappingpath = (string) item["mappingPath"].ToObject(); + // var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data)); + // string tempfileName = (string) item["fileName"].ToObject(); + // string tempmappingpath = (string) item["mappingPath"].ToObject(); - var fileName = _filePath + tempmappingpath; - var contentType = GetFileType(data); - string fullPath = System.IO.Path.Combine(System.Environment.CurrentDirectory, fileName); + // var fileName = _filePath + tempmappingpath; + // var contentType = GetFileType(data); + // string fullPath = System.IO.Path.Combine(System.Environment.CurrentDirectory, fileName); - if (!System.IO.File.Exists(fullPath)) - return NotFound(); + // if (!System.IO.File.Exists(fullPath)) + // return NotFound(); - var memory = new MemoryStream(); - using (var stream = new FileStream(fullPath, FileMode.Open)) - { - await stream.CopyToAsync(memory); - } + // var memory = new MemoryStream(); + // using (var stream = new FileStream(fullPath, FileMode.Open)) + // { + // await stream.CopyToAsync(memory); + // } - memory.Position = 0; + // memory.Position = 0; - return File(memory, GetContentType(fullPath)); - } + // return File(memory, GetContentType(fullPath)); + //} - [HttpPost] - [Route("get-file-type")] - [AllowAnonymous] - [IgnoreAntiforgeryToken] - [ProducesResponseType(StatusCodes.Status200OK)] - public string GetFileType(dynamic data) - { - var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data)); - string fileName = (string) item["fileName"].ToObject(); - string contentType; - new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType); - return contentType ?? "application/octet-stream"; - } + //[HttpPost] + //[Route("get-file-type")] + //[AllowAnonymous] + //[IgnoreAntiforgeryToken] + //[ProducesResponseType(StatusCodes.Status200OK)] + //public string GetFileType(dynamic data) + //{ + // var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data)); + // string fileName = (string) item["fileName"].ToObject(); + // string contentType; + // new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType); + // return contentType ?? "application/octet-stream"; + //} private string GetContentType(string path) diff --git a/HRM.UI/Controllers/DataIntegration/DataIntegrationController.cs b/HRM.UI/Controllers/DataIntegration/DataIntegrationController.cs index 441832a..482696b 100644 --- a/HRM.UI/Controllers/DataIntegration/DataIntegrationController.cs +++ b/HRM.UI/Controllers/DataIntegration/DataIntegrationController.cs @@ -157,49 +157,49 @@ namespace HRM.UI.Controllers - [HttpPost] - [Route("dataintergration")] - [AllowAnonymous] - public ActionResult dataintergration([FromBody] DataIntegrationHeader data) - { - IntregraionReponse returnItem = new IntregraionReponse(); - try - { - _dataIntergrationRequestService.SaveBulkRequest(_oHRDataUploads); - _oHRDataUploads = data.Items; - CheckFieldValidation(); - if (_oErrorList.Count > 0) - { - foreach (var item in _oErrorList) - { - item.Type = EnumDataIntegrationType.EmployeeBasic; - } - _dataIntergrationRequestService.BulkSave(_oErrorList); - throw new Exception("There occurs some errors while validating data"); - } - _dataIntergrationRequestService.ImportEmpBasicInfo(_oHRDataUploads, 1, 1); - //var response = new IntregraionReponse() - //{ - // ReturnCode = HttpStatusCode.OK.ToString(), - // ReturnName = "OK", - // InternalError = ex.Message, - // Details = _oErrorList - //}; + //[HttpPost] + //[Route("dataintergration")] + //[AllowAnonymous] + //public ActionResult dataintergration([FromBody] DataIntegrationHeader data) + //{ + // IntregraionReponse returnItem = new IntregraionReponse(); + // try + // { + // _dataIntergrationRequestService.SaveBulkRequest(_oHRDataUploads); + // _oHRDataUploads = data.Items; + // CheckFieldValidation(); + // if (_oErrorList.Count > 0) + // { + // foreach (var item in _oErrorList) + // { + // item.Type = EnumDataIntegrationType.EmployeeBasic; + // } + // _dataIntergrationRequestService.BulkSave(_oErrorList); + // throw new Exception("There occurs some errors while validating data"); + // } + // _dataIntergrationRequestService.ImportEmpBasicInfo(_oHRDataUploads, 1, 1); + // //var response = new IntregraionReponse() + // //{ + // // ReturnCode = HttpStatusCode.OK.ToString(), + // // ReturnName = "OK", + // // InternalError = ex.Message, + // // Details = _oErrorList + // //}; - return Ok(); - } - catch (Exception ex) - { - var response = new IntregraionReponse() - { - ReturnCode = HttpStatusCode.InternalServerError.ToString(), - ReturnName = "Internal Server Error", - InternalError = ex.Message, - Details = _oErrorList - }; - return StatusCode(500, response); - } - } + // return Ok(); + // } + // catch (Exception ex) + // { + // var response = new IntregraionReponse() + // { + // ReturnCode = HttpStatusCode.InternalServerError.ToString(), + // ReturnName = "Internal Server Error", + // InternalError = ex.Message, + // Details = _oErrorList + // }; + // return StatusCode(500, response); + // } + //} [HttpGet] [Route("employeebasicintegrationapi/{empNo}")] diff --git a/HRM.UI/Controllers/Employee/EmployeeController.cs b/HRM.UI/Controllers/Employee/EmployeeController.cs index dfdeca8..483d51a 100644 --- a/HRM.UI/Controllers/Employee/EmployeeController.cs +++ b/HRM.UI/Controllers/Employee/EmployeeController.cs @@ -2214,66 +2214,66 @@ namespace HRM.UI.Controllers } - [HttpPost("getEmpApiResponse")] - [AllowAnonymous] - public ActionResult GetEmpApiResponse(EmployeeApiInfo userData) - { - EmployeeApiInfo employeeApiInfo = _employeeApiInfo.Value; - List employees = new List(); - List empApiResponses = new List(); - List departments = new List(); - List designations = new List(); - List locations = new List(); - List costCenters = new List(); - try - { - if (!(userData.UserId == employeeApiInfo.UserId && userData.Password == employeeApiInfo.Password)) - return BadRequest("UserId or Password Is Invalid"); - employees = _EmployeeService.GetAllEmps(); - departments = _departmentService.GetAll(1); - designations = _designationService.GetAllDesignation(1, EnumStatus.Active, String.Empty, String.Empty); - locations = _locationService.GetLocations(); - costCenters = _costCenterService.Get(); - foreach (var employee in employees) - { - var empApiResponse = new EmpApiResponse(); - empApiResponse.EmpCode = employee.GeId; - empApiResponse.EmpDName = employee.ExtraField1; - empApiResponse.EmpFName = employee.FirstName; - empApiResponse.EmpLName = employee.LastName; - empApiResponse.EmpEmail = employee.EmailAddress; - empApiResponse.EmpMobile = employee.MobileNo; - empApiResponse.PayrollId = employee.EmployeeNo; - empApiResponse.GenderName = Enum.GetName(typeof(EnumGender), employee.Gender); - var dept = departments.Find(x => x.ID == employee.DepartmentID); - empApiResponse.DepartmentName = dept == null ? "" : dept.Name; - var designation = designations.Find(x => x.ID == employee.DesignationID); - empApiResponse.DesignationName = designation == null ? "" : designation.Name; - var lineManager = employees.Find((x => x.ID == employee.LineManagerID)); - empApiResponse.LineManager = lineManager == null ? "" : lineManager.Name; - empApiResponse.BaseStation = Enum.GetName(typeof(EnumBaseStation), employee.ExtraField2); - empApiResponse.VendorCode = employee.VendorCode; - var costCenter = costCenters.Find(x => x.ID == employee.CrgId); - empApiResponse.CostCenterCode = costCenter == null ? "" : costCenter.Code; - empApiResponse.CostCenterName = costCenter == null ? "" : costCenter.Name; - empApiResponse.BaseStation = Enum.GetName(typeof(EnumBaseStation), employee.ExtraField2); - var location = locations.Find(x => x.ID == employee.LocationID); - empApiResponse.Location = location == null ? "" : location.Name; - empApiResponse.TypeName = employee.ExtraField3; - empApiResponse.EmpActive = Enum.GetName(typeof(EnumEmpStatus), employee.Status); - empApiResponse.MinValue = employee.ExtraField4; - empApiResponse.MaxValue = employee.ExtraField5; - empApiResponses.Add(empApiResponse); - } - } - catch (Exception ex) - { - return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); - } + //[HttpPost("getEmpApiResponse")] + //[AllowAnonymous] + //public ActionResult GetEmpApiResponse(EmployeeApiInfo userData) + //{ + // EmployeeApiInfo employeeApiInfo = _employeeApiInfo.Value; + // List employees = new List(); + // List empApiResponses = new List(); + // List departments = new List(); + // List designations = new List(); + // List locations = new List(); + // List costCenters = new List(); + // try + // { + // if (!(userData.UserId == employeeApiInfo.UserId && userData.Password == employeeApiInfo.Password)) + // return BadRequest("UserId or Password Is Invalid"); + // employees = _EmployeeService.GetAllEmps(); + // departments = _departmentService.GetAll(1); + // designations = _designationService.GetAllDesignation(1, EnumStatus.Active, String.Empty, String.Empty); + // locations = _locationService.GetLocations(); + // costCenters = _costCenterService.Get(); + // foreach (var employee in employees) + // { + // var empApiResponse = new EmpApiResponse(); + // empApiResponse.EmpCode = employee.GeId; + // empApiResponse.EmpDName = employee.ExtraField1; + // empApiResponse.EmpFName = employee.FirstName; + // empApiResponse.EmpLName = employee.LastName; + // empApiResponse.EmpEmail = employee.EmailAddress; + // empApiResponse.EmpMobile = employee.MobileNo; + // empApiResponse.PayrollId = employee.EmployeeNo; + // empApiResponse.GenderName = Enum.GetName(typeof(EnumGender), employee.Gender); + // var dept = departments.Find(x => x.ID == employee.DepartmentID); + // empApiResponse.DepartmentName = dept == null ? "" : dept.Name; + // var designation = designations.Find(x => x.ID == employee.DesignationID); + // empApiResponse.DesignationName = designation == null ? "" : designation.Name; + // var lineManager = employees.Find((x => x.ID == employee.LineManagerID)); + // empApiResponse.LineManager = lineManager == null ? "" : lineManager.Name; + // empApiResponse.BaseStation = Enum.GetName(typeof(EnumBaseStation), employee.ExtraField2); + // empApiResponse.VendorCode = employee.VendorCode; + // var costCenter = costCenters.Find(x => x.ID == employee.CrgId); + // empApiResponse.CostCenterCode = costCenter == null ? "" : costCenter.Code; + // empApiResponse.CostCenterName = costCenter == null ? "" : costCenter.Name; + // empApiResponse.BaseStation = Enum.GetName(typeof(EnumBaseStation), employee.ExtraField2); + // var location = locations.Find(x => x.ID == employee.LocationID); + // empApiResponse.Location = location == null ? "" : location.Name; + // empApiResponse.TypeName = employee.ExtraField3; + // empApiResponse.EmpActive = Enum.GetName(typeof(EnumEmpStatus), employee.Status); + // empApiResponse.MinValue = employee.ExtraField4; + // empApiResponse.MaxValue = employee.ExtraField5; + // empApiResponses.Add(empApiResponse); + // } + // } + // catch (Exception ex) + // { + // return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); + // } - return Ok(empApiResponses); - } + // return Ok(empApiResponses); + //} [HttpPost("getEmployeesByEmpIDs")] public ActionResult GetEmployeesByEmpIDs(dynamic data) diff --git a/HRM.UI/Controllers/FileManagerController.cs b/HRM.UI/Controllers/FileManagerController.cs index 08b63c0..61eb675 100644 --- a/HRM.UI/Controllers/FileManagerController.cs +++ b/HRM.UI/Controllers/FileManagerController.cs @@ -136,82 +136,82 @@ namespace HRM.UI.Controllers } - [HttpPost("uploadExcelfile")] - [AllowAnonymous] - public async Task uploadExcelfile() - { - try - { - var files = Request.Form.Files; - List uploadedList = new List(); - int i = 0; - int cntSuccess = 0; - var uploadedFileNames = new List(); - string result = string.Empty; + //[HttpPost("uploadExcelfile")] + //[AllowAnonymous] + //public async Task uploadExcelfile() + //{ + // try + // { + // var files = Request.Form.Files; + // List uploadedList = new List(); + // int i = 0; + // int cntSuccess = 0; + // var uploadedFileNames = new List(); + // string result = string.Empty; - long size = files.Sum(f => f.Length); - foreach (var formFile in files) - { - var fileSize = formFile.Length; - var originalFile = formFile.FileName; - var generatedFile = Guid.NewGuid().ToString().Replace("-", ""); - var uploaderItem = new UploaderItems(); - uploaderItem.OriginalFileName = originalFile; - // uploaderItem.GeneratedFileName = generatedFile; - //var supportedTypes = new[] { "jpg", "png", "jpeg", "pdf" }; - var fileExt = System.IO.Path.GetExtension(originalFile).Substring(1); - uploaderItem.GeneratedFileName = generatedFile + "." + fileExt; - //if (supportedTypes.Contains(fileExt)) - //{ - // if (fileSize > (500 * 1024)) - // { - // result = "Maximum file size permitted is 500KB"; - // throw new System.ArgumentException(result); - // } - //} - var fileName = _filePath + uploaderItem.OriginalFileName; - string fullPath = System.IO.Path.Combine(System.Environment.CurrentDirectory, fileName); - uploaderItem.Path = fullPath; + // long size = files.Sum(f => f.Length); + // foreach (var formFile in files) + // { + // var fileSize = formFile.Length; + // var originalFile = formFile.FileName; + // var generatedFile = Guid.NewGuid().ToString().Replace("-", ""); + // var uploaderItem = new UploaderItems(); + // uploaderItem.OriginalFileName = originalFile; + // // uploaderItem.GeneratedFileName = generatedFile; + // //var supportedTypes = new[] { "jpg", "png", "jpeg", "pdf" }; + // var fileExt = System.IO.Path.GetExtension(originalFile).Substring(1); + // uploaderItem.GeneratedFileName = generatedFile + "." + fileExt; + // //if (supportedTypes.Contains(fileExt)) + // //{ + // // if (fileSize > (500 * 1024)) + // // { + // // result = "Maximum file size permitted is 500KB"; + // // throw new System.ArgumentException(result); + // // } + // //} + // var fileName = _filePath + uploaderItem.OriginalFileName; + // string fullPath = System.IO.Path.Combine(System.Environment.CurrentDirectory, fileName); + // uploaderItem.Path = fullPath; - try - { - if (System.IO.File.Exists(fullPath)) - { - System.IO.File.Delete(fullPath); - } - using (var stream = new FileStream(fullPath, FileMode.Create)) - { - formFile.CopyTo(stream); - } - uploadedFileNames.Add(formFile.FileName); - uploadedList.Add(uploaderItem); - cntSuccess++; - } - catch (Exception ex) - { - throw ex; - } + // try + // { + // if (System.IO.File.Exists(fullPath)) + // { + // System.IO.File.Delete(fullPath); + // } + // using (var stream = new FileStream(fullPath, FileMode.Create)) + // { + // formFile.CopyTo(stream); + // } + // uploadedFileNames.Add(formFile.FileName); + // uploadedList.Add(uploaderItem); + // cntSuccess++; + // } + // catch (Exception ex) + // { + // throw ex; + // } - i++; - } - result = cntSuccess.ToString() + " files uploaded succesfully.
"; + // i++; + // } + // result = cntSuccess.ToString() + " files uploaded succesfully.
"; - result += "
    "; + // result += "
      "; - foreach (var f in uploadedFileNames) - { - result += "
    • " + f + "
    • "; - } + // foreach (var f in uploadedFileNames) + // { + // result += "
    • " + f + "
    • "; + // } - result += "
    "; + // result += "
"; - return Ok(uploadedList); - } - catch (Exception ex) - { - return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); - } - } + // return Ok(uploadedList); + // } + // catch (Exception ex) + // { + // return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); + // } + //} [HttpPost("removeExcelfile")] @@ -552,11 +552,12 @@ namespace HRM.UI.Controllers return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); } } - [HttpPost] - [Route("get-file-type")] - [AllowAnonymous] - [IgnoreAntiforgeryToken] - [ProducesResponseType(StatusCodes.Status200OK)] + + //[HttpPost] + //[Route("get-file-type")] + //[AllowAnonymous] + //[IgnoreAntiforgeryToken] + //[ProducesResponseType(StatusCodes.Status200OK)] public string GetFileType(string originalFileName) { //var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data)); diff --git a/HRM.UI/Controllers/LetterRequest/LetterRequestController.cs b/HRM.UI/Controllers/LetterRequest/LetterRequestController.cs index 9b20d4e..ed337f4 100644 --- a/HRM.UI/Controllers/LetterRequest/LetterRequestController.cs +++ b/HRM.UI/Controllers/LetterRequest/LetterRequestController.cs @@ -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 fileName = originalFileName; - string contentType; - new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType); - return contentType ?? "application/octet-stream"; - } + [HttpPost] [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 fileName = originalFileName; + string contentType; + new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType); + return contentType ?? "application/octet-stream"; + } + + } } \ No newline at end of file diff --git a/HRM.UI/Controllers/Recruitment/RecruitmentController.cs b/HRM.UI/Controllers/Recruitment/RecruitmentController.cs index 59c5e6f..31b0657 100644 --- a/HRM.UI/Controllers/Recruitment/RecruitmentController.cs +++ b/HRM.UI/Controllers/Recruitment/RecruitmentController.cs @@ -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 fileName = originalFileName; + string contentType; + new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType); + return contentType ?? "application/octet-stream"; + } - [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 fileName = originalFileName; - string contentType; - new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType); - return contentType ?? "application/octet-stream"; - } - - [HttpPost] + [HttpPost] [Route("saveCV")] public ActionResult saveCV(CV ob) { @@ -2865,47 +2864,47 @@ namespace HRM.UI.Controllers return Ok(erCircularList); } - [HttpPost("uploadFile")] - [AllowAnonymous] - public ActionResult uploadFile() - { - string base64String = ""; - try - { - //var files = Request.Form.Files; - //foreach (var formFile in files) - //{ - // var fileSize = formFile.Length; - // var originalFile = formFile.FileName; - // var fileExt = System.IO.Path.GetExtension(originalFile).Substring(1); - // var fileName = _filePath + formFile.FileName; - // var ms = new MemoryStream(); - // formFile.CopyTo(ms); - // byte[] textAsBytes = ms.ToArray(); - // base64String = Convert.ToBase64String(textAsBytes); - // using (PdfReader pdfReader = new PdfReader(ms)) - // { - // for (int page = 1; page <= pdfReader.NumberOfPages; page++) - // { - // ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy(); - // string currentText = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy); + //[HttpPost("uploadFile")] + //[AllowAnonymous] + //public ActionResult uploadFile() + //{ + // string base64String = ""; + // try + // { + // //var files = Request.Form.Files; + // //foreach (var formFile in files) + // //{ + // // var fileSize = formFile.Length; + // // var originalFile = formFile.FileName; + // // var fileExt = System.IO.Path.GetExtension(originalFile).Substring(1); + // // var fileName = _filePath + formFile.FileName; + // // var ms = new MemoryStream(); + // // formFile.CopyTo(ms); + // // byte[] textAsBytes = ms.ToArray(); + // // base64String = Convert.ToBase64String(textAsBytes); + // // using (PdfReader pdfReader = new PdfReader(ms)) + // // { + // // for (int page = 1; page <= pdfReader.NumberOfPages; page++) + // // { + // // ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy(); + // // string currentText = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy); - // currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(currentText))); - // text.Append(currentText); - // } - // } + // // currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(currentText))); + // // text.Append(currentText); + // // } + // // } - //} + // //} - } - catch (Exception ex) - { - return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); - } + // } + // catch (Exception ex) + // { + // return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); + // } - return Ok(base64String); - } + // return Ok(base64String); + //} [HttpPost("readPDf")] [AllowAnonymous] diff --git a/HRM.UI/Controllers/Tax/TaxController.cs b/HRM.UI/Controllers/Tax/TaxController.cs index b67ae45..ade64db 100644 --- a/HRM.UI/Controllers/Tax/TaxController.cs +++ b/HRM.UI/Controllers/Tax/TaxController.cs @@ -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.Net.Http; using System.Threading.Tasks; -using HRM.BO; -using HRM.DA; -using HRM.UI.DTOs.Training; -using Microsoft.AspNetCore.Mvc; namespace HRM.UI.Controllers.Attendance { [Route("api/[controller]")] [ApiController] - public class TaxController : ControllerBase + [Authorize] + public class TaxController : ControllerBase { // private readonly ShiftService _ShiftService; diff --git a/HRM.UI/Controllers/Training/TrainingController.cs b/HRM.UI/Controllers/Training/TrainingController.cs index f2b7b41..c646836 100644 --- a/HRM.UI/Controllers/Training/TrainingController.cs +++ b/HRM.UI/Controllers/Training/TrainingController.cs @@ -619,8 +619,6 @@ namespace HRM.UI.Controllers { return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); } - - return Ok(base64String); }