Unused AllowAnonymous Hide
This commit is contained in:
parent
96ffa17045
commit
81262f19d6
|
|
@ -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<PasswordHistory> items = new List<PasswordHistory>();
|
||||
CurrentUser user = CurrentUser.GetCurrentUser(HttpContext.User);
|
||||
int userId = user.UserID;
|
||||
//[HttpGet]
|
||||
//[Route("getPasswordHistoryList")]
|
||||
//[AllowAnonymous]
|
||||
//public ActionResult GetPasswordHistoryList()
|
||||
//{
|
||||
// List<PasswordHistory> items = new List<PasswordHistory>();
|
||||
// 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)
|
||||
|
|
|
|||
|
|
@ -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<IActionResult> 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<IActionResult> 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>();
|
||||
string tempmappingpath = (string) item["mappingPath"].ToObject<string>();
|
||||
// var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
||||
// string tempfileName = (string) item["fileName"].ToObject<string>();
|
||||
// string tempmappingpath = (string) item["mappingPath"].ToObject<string>();
|
||||
|
||||
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>();
|
||||
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>();
|
||||
// string contentType;
|
||||
// new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType);
|
||||
// return contentType ?? "application/octet-stream";
|
||||
//}
|
||||
|
||||
|
||||
private string GetContentType(string path)
|
||||
|
|
|
|||
|
|
@ -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}")]
|
||||
|
|
|
|||
|
|
@ -2214,66 +2214,66 @@ namespace HRM.UI.Controllers
|
|||
}
|
||||
|
||||
|
||||
[HttpPost("getEmpApiResponse")]
|
||||
[AllowAnonymous]
|
||||
public ActionResult GetEmpApiResponse(EmployeeApiInfo userData)
|
||||
{
|
||||
EmployeeApiInfo employeeApiInfo = _employeeApiInfo.Value;
|
||||
List<Employee> employees = new List<Employee>();
|
||||
List<EmpApiResponse> empApiResponses = new List<EmpApiResponse>();
|
||||
List<Department> departments = new List<Department>();
|
||||
List<Designation> designations = new List<Designation>();
|
||||
List<HRM.BO.Location> locations = new List<HRM.BO.Location>();
|
||||
List<Costcenter> costCenters = new List<Costcenter>();
|
||||
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<Employee> employees = new List<Employee>();
|
||||
// List<EmpApiResponse> empApiResponses = new List<EmpApiResponse>();
|
||||
// List<Department> departments = new List<Department>();
|
||||
// List<Designation> designations = new List<Designation>();
|
||||
// List<HRM.BO.Location> locations = new List<HRM.BO.Location>();
|
||||
// List<Costcenter> costCenters = new List<Costcenter>();
|
||||
// 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)
|
||||
|
|
|
|||
|
|
@ -136,82 +136,82 @@ namespace HRM.UI.Controllers
|
|||
}
|
||||
|
||||
|
||||
[HttpPost("uploadExcelfile")]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> uploadExcelfile()
|
||||
{
|
||||
try
|
||||
{
|
||||
var files = Request.Form.Files;
|
||||
List<UploaderItems> uploadedList = new List<UploaderItems>();
|
||||
int i = 0;
|
||||
int cntSuccess = 0;
|
||||
var uploadedFileNames = new List<string>();
|
||||
string result = string.Empty;
|
||||
//[HttpPost("uploadExcelfile")]
|
||||
//[AllowAnonymous]
|
||||
//public async Task<IActionResult> uploadExcelfile()
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// var files = Request.Form.Files;
|
||||
// List<UploaderItems> uploadedList = new List<UploaderItems>();
|
||||
// int i = 0;
|
||||
// int cntSuccess = 0;
|
||||
// var uploadedFileNames = new List<string>();
|
||||
// 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.<br/>";
|
||||
// i++;
|
||||
// }
|
||||
// result = cntSuccess.ToString() + " files uploaded succesfully.<br/>";
|
||||
|
||||
result += "<ul>";
|
||||
// result += "<ul>";
|
||||
|
||||
foreach (var f in uploadedFileNames)
|
||||
{
|
||||
result += "<li>" + f + "</li>";
|
||||
}
|
||||
// foreach (var f in uploadedFileNames)
|
||||
// {
|
||||
// result += "<li>" + f + "</li>";
|
||||
// }
|
||||
|
||||
result += "</ul>";
|
||||
// result += "</ul>";
|
||||
|
||||
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));
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
[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";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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]
|
||||
[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("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]
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -619,8 +619,6 @@ namespace HRM.UI.Controllers
|
|||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
||||
}
|
||||
|
||||
|
||||
return Ok(base64String);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user