2048 lines
71 KiB
C#
2048 lines
71 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net.Http.Headers;
|
|
using System.Threading.Tasks;
|
|
using AutoMapper.Configuration;
|
|
using HRM.BO;
|
|
using HRM.BO.Report;
|
|
using HRM.DA;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.StaticFiles;
|
|
using Microsoft.Extensions.Configuration;
|
|
using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration;
|
|
|
|
// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
|
|
|
namespace Erecruitment.UI.Controllers
|
|
{
|
|
[ApiController]
|
|
[Route("api/Recruitment")]
|
|
[Authorize]
|
|
public class RecruitmentController : Controller
|
|
{
|
|
#region Declerations
|
|
|
|
private readonly ICVService _cvService;
|
|
private readonly IHeadCountApprovalRequestService _headCountApprovalRequestService;
|
|
private readonly IInternalRecruitmentService _internalRecruitmentService;
|
|
private readonly ICandidateService _candidateService;
|
|
private readonly IRecruitementProcessService _recruitementProcessService;
|
|
private readonly IRecruitmentLettersService _recruitementLettterService;
|
|
private readonly IConfiguration _config;
|
|
private readonly IEmployeeService _employeeService;
|
|
private readonly IErCircularService _erCircularService;
|
|
private readonly IErCircularSurveyService _erCircularSurveyService;
|
|
private readonly IErCircularDetailService _erCircularDetailService;
|
|
private readonly IEducationLevelService _educationLevelService;
|
|
private readonly IErCVService _ercvService;
|
|
private readonly IErAppliedApplicantService _erAppliedApplicantService;
|
|
private readonly IErJobUserService _erJobUserService;
|
|
private readonly ISurveyEmployeeService _surveyEmployeeService;
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
public RecruitmentController(IConfiguration config,
|
|
ICVService cvService,
|
|
IErCVService ercvService,
|
|
IHeadCountApprovalRequestService headCountService,
|
|
IInternalRecruitmentService internalRecruitmentService,
|
|
ICandidateService candidateService, IRecruitementProcessService recruitementProcessService,
|
|
IEmployeeService employeeService
|
|
, IRecruitmentLettersService recruitementLettterService,
|
|
IErCircularService erCircularService,
|
|
IErCircularSurveyService erCircularSurveyService,
|
|
IErCircularDetailService erCircularDetailService,
|
|
IEducationLevelService educationLevelService,
|
|
IErAppliedApplicantService erAppliedApplicantService,
|
|
IErJobUserService erJobUserService,
|
|
ISurveyEmployeeService surveyEmployeeService
|
|
)
|
|
{
|
|
_config = config;
|
|
_cvService = cvService;
|
|
_headCountApprovalRequestService = headCountService;
|
|
_internalRecruitmentService = internalRecruitmentService;
|
|
_candidateService = candidateService;
|
|
this._recruitementProcessService = recruitementProcessService;
|
|
this._recruitementLettterService = recruitementLettterService;
|
|
_employeeService = employeeService;
|
|
_erCircularService = erCircularService;
|
|
_erCircularSurveyService = erCircularSurveyService;
|
|
_erCircularDetailService = erCircularDetailService;
|
|
_educationLevelService = educationLevelService;
|
|
_ercvService = ercvService;
|
|
_erAppliedApplicantService = erAppliedApplicantService;
|
|
_erJobUserService = erJobUserService;
|
|
_surveyEmployeeService = surveyEmployeeService;
|
|
}
|
|
|
|
#endregion
|
|
|
|
[HttpGet]
|
|
[Route("getCVById/{cvId}")]
|
|
public ActionResult getCVById(int cvID)
|
|
{
|
|
CV oCV = new CV();
|
|
try
|
|
{
|
|
oCV = _cvService.Get(cvID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(oCV);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("getCVsByIds")]
|
|
public ActionResult getCVsByIds(dynamic cvIds)
|
|
{
|
|
List<CV> oCVs = new List<CV>();
|
|
List<int> cvids = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(cvIds.ToString());
|
|
string strIDs = "";
|
|
cvids.ForEach(x => { strIDs = strIDs + x + ","; });
|
|
try
|
|
{
|
|
if (strIDs.Length > 0)
|
|
{
|
|
strIDs = strIDs.Substring(0, strIDs.Length - 1);
|
|
oCVs = _cvService.GetCVByIDs(strIDs);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(oCVs);
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("getFileAttachments/{cvID}")]
|
|
public ActionResult getFileAttachments(int cvID)
|
|
{
|
|
List<FileAttachment> attachments = null;
|
|
try
|
|
{
|
|
attachments = _cvService.GetAllAttachments(cvID, EnumFileType.CV);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(attachments);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("dtGetCVByID/{cvId}")]
|
|
public ActionResult dtGetCVByID(int cvID)
|
|
{
|
|
DataTable oCV = new DataTable();
|
|
try
|
|
{
|
|
oCV = _cvService.dtGetCVByID(cvID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(oCV);
|
|
}
|
|
|
|
//getAllCV getAllCV
|
|
[Route("getAllCV")]
|
|
public ActionResult getAllCV()
|
|
{
|
|
List<CV> oCVs = new List<CV>();
|
|
try
|
|
{
|
|
oCVs = _cvService.Get();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(oCVs);
|
|
}
|
|
|
|
//getAllOnlyCV
|
|
[Route("getAllOnlyCV")]
|
|
public ActionResult getAllOnlyCV()
|
|
{
|
|
List<CV> oCVs = new List<CV>();
|
|
try
|
|
{
|
|
oCVs = _cvService.getAllOnlyCV();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(oCVs);
|
|
}
|
|
|
|
[Route("getCVs")]
|
|
public ActionResult getCVs()
|
|
{
|
|
List<CV> oCVs = new List<CV>();
|
|
try
|
|
{
|
|
oCVs = _cvService.GetCVs();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(oCVs);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("GetByCvSearch/{name}/{email}/{mobile}")]
|
|
public ActionResult GetByCvSearch(string name, string email, string mobile)
|
|
{
|
|
name = (name == "undefined" || name == "null") ? string.Empty : name;
|
|
email = (email == "undefined" || email == "null") ? string.Empty : email;
|
|
mobile = (mobile == "undefined" || mobile == "null") ? string.Empty : mobile;
|
|
List<CV> cvs = new List<CV>();
|
|
try
|
|
{
|
|
cvs = _cvService.GetByCvSearch(name, email, mobile);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(cvs);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
[Route("saveHeadCount")]
|
|
public ActionResult saveHeadCount(HeadCountApprovalRequest ob)
|
|
{
|
|
try
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
ob.CreatedBy = currentUser.UserID;
|
|
ob.RequestDate = Ease.Core.Utility.Global.DateFunctions.LastDateOfYear(ob.RequestDate);
|
|
_headCountApprovalRequestService.Save(ob);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("saveHeadCountsData")]
|
|
public ActionResult saveHeadCountsData(List<HeadCountApprovalRequest> items)
|
|
{
|
|
try
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
foreach (var item in items)
|
|
{
|
|
item.CategoryID = null;
|
|
item.CreatedBy = (int)currentUser.UserID;
|
|
}
|
|
|
|
_headCountApprovalRequestService.SaveAuto(items);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("deleteHeadCount")]
|
|
public ActionResult deleteHeadCount(HeadCountApprovalRequest ob)
|
|
{
|
|
try
|
|
{
|
|
_headCountApprovalRequestService.Delete(ob.ID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("deleteCv")]
|
|
public ActionResult deleteCv(CV ob)
|
|
{
|
|
try
|
|
{
|
|
_cvService.Delete(ob);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("deleteReceuitmentCv")]
|
|
public ActionResult deleteReceuitmentCv(CV ob)
|
|
{
|
|
try
|
|
{
|
|
_candidateService.DeleteCandidateCVCollection(ob.CandidateID);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("getAllHeadCount")]
|
|
public ActionResult getAllHeadCount()
|
|
{
|
|
List<HeadCountApprovalRequest> oHeadCountApprovalRequests = new List<HeadCountApprovalRequest>();
|
|
try
|
|
{
|
|
oHeadCountApprovalRequests = _headCountApprovalRequestService.Get();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(oHeadCountApprovalRequests);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("getApprovdRecruitmentPicker/{approvalStatus}/{onBoardStatus}")]
|
|
public ActionResult getApprovdRecruitmentPicker(EnumRequisitionApprovalStatus? approvalStatus, EnumOnBoradStatus? onBoardStatus)
|
|
{
|
|
List<InternalRecruitment> oInternalRecuitmentList = new List<InternalRecruitment>();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
List<Grade> grades = new GradeService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|
List<Designation> designations = new DesignationService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|
List<Department> departments = new DepartmentService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|
try
|
|
{
|
|
oInternalRecuitmentList = _internalRecruitmentService.GetApprovedRequisitionsPicker(approvalStatus, null); // should be changes according to new requiremenr
|
|
|
|
if (oInternalRecuitmentList != null && oInternalRecuitmentList.Count > 0)
|
|
{
|
|
oInternalRecuitmentList.ForEach(x =>
|
|
{
|
|
var grd = grades.FirstOrDefault(d => d.ID == x.GradeId);
|
|
if (grd != null) x.GradeCode = grd.Code;
|
|
|
|
var designation = designations.FirstOrDefault(d => d.ID == x.DesignationId);
|
|
if (designation != null) x.DesignationName = designation.Name;
|
|
|
|
var department = departments.FirstOrDefault(d => d.ID == x.DepartmentId);
|
|
if (department != null)
|
|
{
|
|
x.DepartmentCode = department.Code;
|
|
x.DepartmentName = department.Name;
|
|
}
|
|
|
|
x.RequisitionApprovalStatusString = EnumHelper.GetEnumDescription(x.RequisitionApprovalStatus);
|
|
});
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(oInternalRecuitmentList);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("saveInternalRecruitment")]
|
|
public ActionResult SaveInternalRecruitment(InternalRecruitment item)
|
|
{
|
|
//var connectionString = _config.GetConnectionString("DbContextSettings:ConnectionString");
|
|
// string connectionString = Startup
|
|
string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
|
|
//string connectionString = "";
|
|
int ans;
|
|
var isNew = item.ID <= 0;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
if (isNew)
|
|
{
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
}
|
|
else
|
|
{
|
|
item.ModifiedBy = currentUser.UserID;
|
|
item.ModifiedDate = DateTime.Today;
|
|
}
|
|
|
|
try
|
|
{
|
|
ans = _internalRecruitmentService.Save(item, connectionString);
|
|
if (ans > 0 && currentUser.EmployeeID != null)
|
|
{
|
|
_internalRecruitmentService.InitiateRecruitmentRequisitionWorkFlow(item, (int)currentUser.EmployeeID, item.CreatedBy);
|
|
}
|
|
|
|
if (item.IRFileAttacments != null && item.IRFileAttacments.Count > 0)
|
|
{
|
|
foreach (var file in item.IRFileAttacments)
|
|
{
|
|
if (System.IO.File.Exists(file.FilePath))
|
|
{
|
|
System.IO.File.Delete(file.FilePath);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(ans);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
[Route("InitiateOfferLetterWorkFlow")]
|
|
public ActionResult InitiateOfferLetterWorkFlow(InternalRecruitment item)
|
|
{
|
|
//var connectionString = _config.GetConnectionString("DbContextSettings:ConnectionString");
|
|
// string connectionString = Startup
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
try
|
|
{
|
|
_internalRecruitmentService.InitiateOfferLetterWorkFlow(item, item.offLttrAppRaiseEmpID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
[Route("ApproveOfferLetter")]
|
|
public ActionResult ApproveOfferLetter(WFMovementTran otran)
|
|
{
|
|
//var connectionString = _config.GetConnectionString("DbContextSettings:ConnectionString");
|
|
// string connectionString = Startup
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
otran.FromEmployeeID = (int)currentUser.EmployeeID;
|
|
|
|
try
|
|
{
|
|
_internalRecruitmentService.ApproveOfferLetter(otran);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("ApproveRequisition")]
|
|
public ActionResult ApproveRequisition(WFMovementTran otran)
|
|
{
|
|
//var connectionString = _config.GetConnectionString("DbContextSettings:ConnectionString");
|
|
// string connectionString = Startup
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
otran.FromEmployeeID = (int)currentUser.EmployeeID;
|
|
|
|
try
|
|
{
|
|
_internalRecruitmentService.ApproveRecruitmentRequisition(otran);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
|
|
//[HttpGet]
|
|
//[Route("getAllInternalRecruitment")]
|
|
//public ActionResult getAllInternalRecruitment()
|
|
//{
|
|
// List<InternalRecruitment> oInternalRecuitmentList = new List<InternalRecruitment>();
|
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
// List<Grade> grades = new GradeService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|
// List<Designation> designations =
|
|
// new DesignationService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|
// List<Department> departments =
|
|
// new DepartmentService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|
// try
|
|
// {
|
|
// oInternalRecuitmentList = _internalRecruitmentService.Get();
|
|
// if (oInternalRecuitmentList != null && oInternalRecuitmentList.Count > 0)
|
|
// {
|
|
// oInternalRecuitmentList.ForEach(x =>
|
|
// {
|
|
// var grd = grades.FirstOrDefault(d => d.ID == x.GradeId);
|
|
// if (grd != null) x.GradeCode = grd.Code;
|
|
|
|
// var designation = designations.FirstOrDefault(d => d.ID == x.DesignationId);
|
|
// if (designation != null) x.DesignationName = designation.Name;
|
|
|
|
// var department = departments.FirstOrDefault(d => d.ID == x.DepartmentId);
|
|
// if (department != null) x.DepartmentCode = department.Code;
|
|
// });
|
|
// }
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
// }
|
|
|
|
// return Ok(oInternalRecuitmentList);
|
|
//}
|
|
|
|
[HttpGet]
|
|
[Route("getInternalRecruitmentByID/{recruitmentId}")]
|
|
public ActionResult getInternalRecruitmentByID(int recruitmentId)
|
|
{
|
|
InternalRecruitment oInternalRecuitment = new InternalRecruitment();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
List<Grade> grades = new GradeService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|
List<Designation> designations =
|
|
new DesignationService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|
List<Department> departments =
|
|
new DepartmentService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|
try
|
|
{
|
|
oInternalRecuitment = _internalRecruitmentService.Get(recruitmentId);
|
|
if (oInternalRecuitment != null)
|
|
{
|
|
var grd = grades.FirstOrDefault(d => d.ID == oInternalRecuitment.GradeId);
|
|
if (grd != null) oInternalRecuitment.GradeCode = grd.Code;
|
|
|
|
var designation = designations.FirstOrDefault(d => d.ID == oInternalRecuitment.DesignationId);
|
|
if (designation != null) oInternalRecuitment.DesignationName = designation.Name;
|
|
|
|
var department = departments.FirstOrDefault(d => d.ID == oInternalRecuitment.DepartmentId);
|
|
if (department != null) oInternalRecuitment.DepartmentCode = department.Code;
|
|
|
|
oInternalRecuitment.IREmployees = new List<IREmployee>();
|
|
oInternalRecuitment.IREmployees = _internalRecruitmentService.GetIREmployeess(recruitmentId);
|
|
|
|
oInternalRecuitment.IRFileAttacments = new List<FileAttachment>();
|
|
oInternalRecuitment.IRFileAttacments =
|
|
_internalRecruitmentService.GetIRFileAttachments(recruitmentId);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(oInternalRecuitment);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("get-download-file")]
|
|
[AllowAnonymous]
|
|
[IgnoreAntiforgeryToken]
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
public async Task<IActionResult> GetDownloadFile(dynamic data)
|
|
{
|
|
string contentType = "";
|
|
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
try
|
|
{
|
|
List<FileAttachment> IRFileAttacments = new List<FileAttachment>();
|
|
IRFileAttacments =
|
|
_internalRecruitmentService.GetIRFileAttachmentbyID((int)item.id, (int)item.fileId);
|
|
Stream memory = new MemoryStream();
|
|
if (IRFileAttacments != null && IRFileAttacments.Count > 0)
|
|
{
|
|
byte[] buffer = new byte[16 * 1024];
|
|
contentType = GetFileType(IRFileAttacments[0].OriginalFileName);
|
|
buffer = IRFileAttacments[0].FileAsByteArray;
|
|
return File(buffer, contentType, IRFileAttacments[0].OriginalFileName);
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("File Download error");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("get-download-file-cv")]
|
|
[AllowAnonymous]
|
|
[IgnoreAntiforgeryToken]
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
public async Task<IActionResult> GetDownloadFileCV(dynamic data)
|
|
{
|
|
string contentType = "";
|
|
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|
try
|
|
{
|
|
List<FileAttachment> IRFileAttacments = new List<FileAttachment>();
|
|
IRFileAttacments =
|
|
_internalRecruitmentService.GetIRFileAttachmentbyIDCV((int)item.id, (int)item.fileId,
|
|
EnumFileType.CV);
|
|
Stream memory = new MemoryStream();
|
|
if (IRFileAttacments != null && IRFileAttacments.Count > 0)
|
|
{
|
|
byte[] buffer = new byte[16 * 1024];
|
|
contentType = GetFileType(IRFileAttacments[0].OriginalFileName);
|
|
buffer = IRFileAttacments[0].FileAsByteArray;
|
|
return File(buffer, contentType, IRFileAttacments[0].OriginalFileName);
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("File Download error");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
}
|
|
|
|
|
|
[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("saveErCV")]
|
|
public ActionResult saveErCV(ErCV ob)
|
|
{
|
|
try
|
|
{
|
|
//string connectionString = "";
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
ob.CreatedBy = currentUser.UserID;
|
|
ob.UserID = currentUser.UserID;
|
|
string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
|
|
if (ob != null)
|
|
{
|
|
//ob.ErCVProfilePhoto.FileType = EnumFileType.ErCVProfilePhoto;
|
|
if (ob.ErCVProfilePhoto.PreviousFileTobase64 != null)
|
|
{
|
|
string[] items = ob.ErCVProfilePhoto.PreviousFileTobase64.Split(new char[] { ',', ' ' }, StringSplitOptions.None);
|
|
byte[] newBytes = Convert.FromBase64String(items[1]);
|
|
ob.ErCVProfilePhoto.FileAsByteArray = newBytes;
|
|
}
|
|
else
|
|
{
|
|
if (ob.ErCVProfilePhoto?.FileTobase64 != null)
|
|
{
|
|
// string[] items = ob.ErCVProfilePhoto.PreviousFileTobase64.Split(new char[] { ',', ' ' }, StringSplitOptions.None);
|
|
byte[] newBytes = Convert.FromBase64String(ob.ErCVProfilePhoto.FileTobase64);
|
|
ob.ErCVProfilePhoto.FileAsByteArray = newBytes;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ob.IRFileAttacments != null && ob.IRFileAttacments.Count > 0)
|
|
{
|
|
foreach (var tempItem in ob.IRFileAttacments)
|
|
{
|
|
if (tempItem != null)
|
|
{
|
|
if (tempItem.ID <= 0 && tempItem.PreviousFileTobase64 != null)
|
|
{
|
|
string[] items = tempItem.PreviousFileTobase64.Split(new char[] { ',', ' ' }, StringSplitOptions.None);
|
|
byte[] newBytes = Convert.FromBase64String(items[1]);
|
|
tempItem.FileAsByteArray = newBytes;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
_ercvService.Save(ob, connectionString);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("saveMultipleCV")]
|
|
public ActionResult saveMultipleCV(List<CV> cvs)
|
|
{
|
|
List<CV> allCVs = new List<CV>();
|
|
try
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
foreach (var item in cvs)
|
|
{
|
|
var isNew = item.ID <= 0;
|
|
if (isNew)
|
|
{
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
}
|
|
else
|
|
{
|
|
item.ModifiedBy = currentUser.UserID;
|
|
item.ModifiedDate = DateTime.Today;
|
|
}
|
|
}
|
|
|
|
string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
|
|
allCVs = _cvService.SaveCVs(cvs, connectionString);
|
|
if (allCVs != null)
|
|
{
|
|
foreach (var item in cvs)
|
|
{
|
|
if (item.IRFileAttacments != null && item.IRFileAttacments.Count > 0)
|
|
{
|
|
foreach (var file in item.IRFileAttacments)
|
|
{
|
|
if (System.IO.File.Exists(file.FilePath))
|
|
{
|
|
System.IO.File.Delete(file.FilePath);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok(allCVs);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("GetCVByIDs/{cvIds}")]
|
|
public ActionResult GetCVByID(string cvIds)
|
|
{
|
|
List<CV> allCVs = new List<CV>();
|
|
try
|
|
{
|
|
allCVs = _cvService.GetCVByIDs(cvIds);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(allCVs);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("saveCVSort")]
|
|
public ActionResult saveCVSort(List<CVSort> cvsorts)
|
|
{
|
|
// List<CV> allCVs = new List<CV>();
|
|
try
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
foreach (var item in cvsorts)
|
|
{
|
|
var isNew = item.ID <= 0;
|
|
if (isNew)
|
|
{
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
}
|
|
else
|
|
{
|
|
item.ModifiedBy = currentUser.UserID;
|
|
item.ModifiedDate = DateTime.Today;
|
|
}
|
|
}
|
|
//string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
|
|
_cvService.SaveCVSort(cvsorts);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
//private string GetContentType(string path)
|
|
//{
|
|
// var provider = new FileExtensionContentTypeProvider();
|
|
// string contentType;
|
|
// if (!provider.TryGetContentType(path, out contentType))
|
|
// {
|
|
// contentType = "application/octet-stream";
|
|
// }
|
|
// return contentType;
|
|
//}
|
|
|
|
[HttpGet]
|
|
[Route("getRecruitementSteps/{recruitementID}")]
|
|
public ActionResult getRecruitementSteps(int recruitementID)
|
|
{
|
|
List<RecruitementStep> obs = new List<RecruitementStep>();
|
|
try
|
|
{
|
|
obs = this._recruitementProcessService.GetRecruitementSteps(recruitementID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("getRecruitementStep/{stepid}")]
|
|
public ActionResult getRecruitementStep(int stepid)
|
|
{
|
|
RecruitementStep obs;
|
|
try
|
|
{
|
|
obs = this._recruitementProcessService.GetRStep(stepid);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("getSessionActiveCandidatesByStepID/{StepID}")]
|
|
public ActionResult getSessionActiveCandidatesByStepID(int StepID)
|
|
{
|
|
List<InterviewSessionCandidate> obs = new List<InterviewSessionCandidate>();
|
|
try
|
|
{
|
|
obs = this._recruitementProcessService.getSessionActiveCandidatesByStepID(StepID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("getInterviewSessions/{requsitionID}")]
|
|
public ActionResult getInterviewSessions(int requsitionID)
|
|
{
|
|
List<InterviewSession> obs = new List<InterviewSession>();
|
|
try
|
|
{
|
|
obs = this._recruitementProcessService.GetInterveiwSessions(requsitionID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
// Ess Function
|
|
[HttpGet]
|
|
[Route("getCurrentEmpInterviewSessions/{BoardMemberEntryStatus}")]
|
|
public ActionResult getCurrentEmpInterviewSessions(EnumBaordMemberMarkEntryStatus BoardMemberEntryStatus)
|
|
{
|
|
List<InterviewSession> obs = new List<InterviewSession>();
|
|
DataTable otable = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
otable = this._recruitementProcessService.GetInterveiwSessionsByBoardMember(
|
|
(int)currentUser.EmployeeID, BoardMemberEntryStatus);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(otable);
|
|
}
|
|
|
|
|
|
// void SaveMembersMarkByMemberID(InterviewSession session);
|
|
// List<InterviewSession> GetInterveiwSessionsByBoardMember(int employeeid, EnumBaordMemberMarkEntryStatus MarkEntrystatus);
|
|
|
|
|
|
[HttpPost]
|
|
[Route("CompleteMembersMarkByMember")]
|
|
public ActionResult CompleteMembersMarkByMember(InterviewSession item)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
try
|
|
{
|
|
this._recruitementProcessService.CompleteMembersMarkByMember(item);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("SaveMembersMarkByMember")]
|
|
public ActionResult SaveMembersMarkByMember(InterviewSession item)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
try
|
|
{
|
|
this._recruitementProcessService.SaveMembersMarkByMember(item);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("getInterviewSession/{interviewSessionID}")]
|
|
public ActionResult getInterviewSession(int interviewSessionID)
|
|
{
|
|
InterviewSession obs = null;
|
|
try
|
|
{
|
|
obs = this._recruitementProcessService.GetInterveiwSession(interviewSessionID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("GetmemberWiseMarkBySetpID/{StepID}")]
|
|
public ActionResult GetmemberWiseMarkBySetpID(int StepID)
|
|
{
|
|
List<MemberWiseMark> obs = null;
|
|
try
|
|
{
|
|
obs = this._recruitementProcessService.GetmemberWiseMarkBySetpID(StepID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("GetmemberWiseMarkBySessionID/{SessionID}")]
|
|
public ActionResult GetmemberWiseMarkBySessionID(int SessionID)
|
|
{
|
|
List<MemberWiseMark> obs = null;
|
|
try
|
|
{
|
|
obs = this._recruitementProcessService.GetmemberWiseMarkBySessionID(SessionID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
[Route("DeleteStep")]
|
|
public ActionResult DeleteStep(RecruitementStep item)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
try
|
|
{
|
|
this._recruitementProcessService.DeleteStep(item.ID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
[Route("SaveRecruitementSteps")]
|
|
public ActionResult SaveRecruitementSteps(List<RecruitementStep> items)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
RecruitementProcess pr = this._recruitementProcessService.GetByRequisitionID(items[0].requisitionID);
|
|
if (pr == null)
|
|
{
|
|
pr = new RecruitementProcess();
|
|
pr.requisitionID = items[0].requisitionID;
|
|
pr.StartDate = items[0].StartDate;
|
|
pr.EndDate = items[items.Count - 1].EndDate;
|
|
pr.CreatedBy = currentUser.UserID;
|
|
pr.CreatedDate = DateTime.Today;
|
|
pr.ProcessStatus = EnumRecruitementProcess.None;
|
|
}
|
|
else
|
|
{
|
|
pr.ModifiedBy = currentUser.UserID;
|
|
pr.ModifiedDate = DateTime.Today;
|
|
}
|
|
|
|
pr.Steps = new List<RecruitementStep>();
|
|
pr.Steps.InsertRange(0, items);
|
|
try
|
|
{
|
|
this._recruitementProcessService.Save(pr);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
[Route("SaveInterviewSession")]
|
|
public ActionResult SaveInterviewSession(InterviewSession item)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
try
|
|
{
|
|
this._recruitementProcessService.SaveInterviewSession(item);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("SendInteviewSessionMail")]
|
|
public ActionResult SendInteviewSessionMail(InterviewSession item)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
try
|
|
{
|
|
this._recruitementProcessService.SendMailInThread(item);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("DeleteUserCvSort")]
|
|
public ActionResult DeleteUserCvSort(UserCvSort item)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
try
|
|
{
|
|
_cvService.DeleteUserCvsort(item);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
[Route("CancelInteviewSession")]
|
|
public ActionResult CancelInteviewSession(InterviewSession item)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
try
|
|
{
|
|
this._recruitementProcessService.CancelInterViewSession(item);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
[Route("RescheduleInteviewSession")]
|
|
public ActionResult RescheduleInteviewSession(InterviewSession item)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
try
|
|
{
|
|
this._recruitementProcessService.RescheduleInterViewSession(item);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
[Route("SaveMemberWiseMark")]
|
|
public ActionResult SaveMemberWiseMark(InterviewSession session)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
foreach (MemberWiseMark item in session.BoadMemberWiseMarks)
|
|
{
|
|
if (item.IsNew == true)
|
|
{
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
}
|
|
else
|
|
{
|
|
item.ModifiedBy = currentUser.UserID;
|
|
item.ModifiedDate = DateTime.Today;
|
|
}
|
|
}
|
|
|
|
try
|
|
{
|
|
this._recruitementProcessService.SaveMemberWiseMark(session);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
[Route("CompleteSessionStatus")]
|
|
public ActionResult CompleteSessionStatus(InterviewSession item)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
this._recruitementProcessService.CompleteInterviewSession(item);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("CompleteRecruitementStep")]
|
|
public ActionResult CompleteRecruitementStep(RecruitementStep item)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
this._recruitementProcessService.CompleteRecruitementStep(item);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
[Route("SaveRecruitementLetters")]
|
|
public ActionResult SaveRecruitementLetters(List<RecruitmentLetters> items)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
foreach (RecruitmentLetters item in items)
|
|
{
|
|
item.CreatedDate = DateTime.Today;
|
|
item.CreatedBy = currentUser.UserID;
|
|
}
|
|
|
|
try
|
|
{
|
|
this._recruitementLettterService.Save(items);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(true);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("GetRecruitementRellters/{requisitionID}")]
|
|
public ActionResult GetRecruitementRellters(int requisitionID)
|
|
{
|
|
List<RecruitmentLetters> obs = null;
|
|
try
|
|
{
|
|
obs = this._recruitementLettterService.GetbyRequisitionID(requisitionID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
|
|
[HttpGet("getBudgetHeadCount/{departmentId}/{designationId}/{positionDate}")]
|
|
public ActionResult GetCurrentHeadCount(int departmentId, int designationId, DateTime positionDate)
|
|
{
|
|
int empCount = 0;
|
|
try
|
|
{
|
|
empCount = _headCountApprovalRequestService.GetBudgetedHeadCount(departmentId, designationId,
|
|
positionDate);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(empCount);
|
|
}
|
|
|
|
[HttpGet("getBudgetHeadCountByRequisitionID/{positionDate}")]
|
|
public ActionResult GetBudgetedHeadCountByrequisitionID(DateTime positionDate)
|
|
{
|
|
List<HeadCountApprovalRequest> obs = new List<HeadCountApprovalRequest>();
|
|
try
|
|
{
|
|
obs = _headCountApprovalRequestService.GetBudgetedHeadCountByrequisitionID(positionDate);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
|
|
#region Assign Candidate
|
|
|
|
[HttpGet]
|
|
[Route("getCandidateByProcessid/{pId}")]
|
|
public ActionResult getCandidateByProcessid(int pID)
|
|
{
|
|
List<Candidate> obs = new List<Candidate>();
|
|
try
|
|
{
|
|
obs = _candidateService.GetCanditates(pID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("saveCandidates")]
|
|
public ActionResult saveCandidates(List<Candidate> items)
|
|
{
|
|
try
|
|
{
|
|
string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
|
|
_candidateService.Save(items, connectionString);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("saveCandidatesforRecruitment")]
|
|
public ActionResult saveCandidatesforRecruitment(List<Candidate> items)
|
|
{
|
|
try
|
|
{
|
|
// string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
|
|
_candidateService.SaveCandidateAnDUpdateCV(items);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("updateCVOnInitiateDone")]
|
|
public ActionResult UpdateCVOnInitiateDone(List<Candidate> items)
|
|
{
|
|
try
|
|
{
|
|
// string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
|
|
_candidateService.UpdateCVOnInitiateDone(items);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("saveUserCVSort")]
|
|
public ActionResult saveUserCVSort(UserCvSort item)
|
|
{
|
|
try
|
|
{
|
|
var isNew = item.ID <= 0;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
if (isNew)
|
|
{
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
}
|
|
else
|
|
{
|
|
item.ModifiedBy = currentUser.UserID;
|
|
item.ModifiedDate = DateTime.Today;
|
|
}
|
|
|
|
// string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
|
|
_cvService.SaveUserCVSort(item);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("getFilesByCVId/{cId}")]
|
|
public ActionResult getFilesByCVId(int cId)
|
|
{
|
|
List<FileAttachment> obs = new List<FileAttachment>();
|
|
try
|
|
{
|
|
obs = _cvService.GetCVAttachmentbyID(cId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("dtGetRecruitmentbyCVSort")]
|
|
public ActionResult dtGetRecruitmentbyCVSort()
|
|
{
|
|
Employee ohrEmp = null;
|
|
List<RecruitmentByCVSort> sortItems = new List<RecruitmentByCVSort>();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
if (currentUser.EmployeeID == null)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, "Employee Not Found");
|
|
}
|
|
|
|
// DataTable oCV = new DataTable();
|
|
try
|
|
{
|
|
sortItems = _cvService.dtGetRecruitmentbyCVSort((int)currentUser.EmployeeID);
|
|
//foreach(DataRow item in oCV.Rows)
|
|
//{
|
|
// int recid = Convert.ToInt32(item["cvSortID"].ToString());
|
|
// int recid = item["cvSortID"] is DBNull ? 0 : Convert.ToInt32(item["cvSortID"].ToString());
|
|
//}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(sortItems);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("dtCVSortDetails/{positionID}")]
|
|
public ActionResult dtCVSortDetails(int positionID)
|
|
{
|
|
Employee ohrEmp = null;
|
|
List<CVSortDetails> sortItems = new List<CVSortDetails>();
|
|
try
|
|
{
|
|
sortItems = _cvService.dtCVSortDetails(positionID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(sortItems);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("getPreciousCV/{positionId}")]
|
|
public ActionResult GetPreciousCV(int positionId)
|
|
{
|
|
List<CV> allCVs = new List<CV>();
|
|
try
|
|
{
|
|
allCVs = _cvService.GetPreviousCVbyRequisitionID(positionId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(allCVs);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("IsRequisitionComplete/{positionId}")]
|
|
public ActionResult IsRequisitionComplete(int positionId)
|
|
{
|
|
bool isComplete;
|
|
try
|
|
{
|
|
isComplete = _cvService.IsRequisitionComplete(positionId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(isComplete);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("updateCompleteStatus/{positionId}")]
|
|
public ActionResult UpdateCompleteStatus(int positionId)
|
|
{
|
|
try
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
if (currentUser.EmployeeID == null)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, "Employee Not Found");
|
|
}
|
|
|
|
_cvService.UpdateCompleteStatus(positionId, (int)currentUser.EmployeeID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("updateReqCompleteStatus/{positionId}")]
|
|
public ActionResult UpdateReqCompleteStatus(int positionId)
|
|
{
|
|
try
|
|
{
|
|
_internalRecruitmentService.UpdateCompleteStatus(positionId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("getEmployeesRequisitionID/{requisitionID}")]
|
|
public ActionResult getEmployeesRequisitionID(int requisitionID)
|
|
{
|
|
List<Employee> obs = new List<Employee>();
|
|
try
|
|
{
|
|
obs = _employeeService.GetEmployeesRequisitionID(requisitionID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
#endregion
|
|
|
|
[HttpPost]
|
|
[Route("saveRecruitmentPublish")]
|
|
public ActionResult SaveRecruitmentPublish(ErCircular item)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
item.ModifiedBy = currentUser.UserID;
|
|
item.ModifiedDate = DateTime.Today;
|
|
|
|
try
|
|
{
|
|
_erCircularService.Save(item);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[AllowAnonymous]
|
|
[HttpGet]
|
|
[Route("getrecruitmentpublish")]
|
|
public ActionResult GetRecruitmentPublish()
|
|
{
|
|
List<ErCircular> obs = null;
|
|
try
|
|
{
|
|
obs = this._erCircularService.Get();
|
|
if (obs != null && obs.Count > 0)
|
|
{
|
|
foreach (var item in obs)
|
|
{
|
|
item.ErCircularDetails = new List<ErCircularDetail>();
|
|
item.ErCircularDetails = _erCircularDetailService.GetByParentId(item.ID);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
[AllowAnonymous]
|
|
[HttpGet]
|
|
[Route("getErCirculatById/{id}")]
|
|
public ActionResult GetErCirculatById(int id)
|
|
{
|
|
ErCircular erCircular = null;
|
|
try
|
|
{
|
|
erCircular = this._erCircularService.Get(id);
|
|
if (erCircular != null)
|
|
{
|
|
erCircular.ErCircularDetails = new List<ErCircularDetail>();
|
|
erCircular.ErCircularDetails = _erCircularDetailService.GetByParentId(erCircular.ID);
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(erCircular);
|
|
}
|
|
[AllowAnonymous]
|
|
[HttpGet]
|
|
[Route("getByErCircularID/{id}")]
|
|
public ActionResult GetByErCircularID(int id)
|
|
{
|
|
bool result = false;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
List<SurveyEmployee> surveyEmployees = new List<SurveyEmployee>();
|
|
try
|
|
{
|
|
var response = this._erCircularSurveyService.GetByErCircularID(id);
|
|
result = response.Count> 0 ? true : false;
|
|
|
|
if(currentUser != null && result)
|
|
{
|
|
surveyEmployees = _surveyEmployeeService.GetCompleteExamByCandidate((int)currentUser.UserID, id);
|
|
result = surveyEmployees.Count > 0 ? false : true;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(result);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("getSurveyEmployeebyJobId/{id}")]
|
|
public ActionResult getSurveyEmployeebyJobId(int id)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
List<SurveyEmployee> surveyEmployees = new List<SurveyEmployee>();
|
|
try
|
|
{
|
|
var response = this._erCircularSurveyService.GetByErCircularID(id);
|
|
|
|
if (currentUser != null)
|
|
{
|
|
surveyEmployees = _surveyEmployeeService.GetCompleteExamByCandidate((int)currentUser.UserID, id);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(surveyEmployees);
|
|
}
|
|
|
|
|
|
//[HttpGet]
|
|
//[Route("getSurveyEmployeebyJobId/{jobId}")]
|
|
//public ActionResult GetSurveyEmployeebyJobId(int jobId)
|
|
//{
|
|
// Survey survey = new Survey();
|
|
// bool isExamCompleted = false;
|
|
// try
|
|
// {
|
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
// List<SurveyEmployee> surveyEmployees = new List<SurveyEmployee>();
|
|
|
|
// surveyEmployees = _surveyEmployeeService.GetSurveyEmployeebyJobId((int)currentUser.UserID, jobId);
|
|
// if (surveyEmployees != null && surveyEmployees.Count > 0)
|
|
// {
|
|
// isExamCompleted = true;
|
|
// }
|
|
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
// }
|
|
|
|
// return Ok(isExamCompleted);
|
|
//}
|
|
|
|
[HttpPost]
|
|
[Route("saveErAppliedApplicant")]
|
|
public ActionResult saveErAppliedApplicant(ErAppliedApplicant item)
|
|
{
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.CreatedDate = DateTime.Today;
|
|
item.ModifiedBy = currentUser.UserID;
|
|
item.ModifiedDate = DateTime.Today;
|
|
item.ApplyDate = DateTime.Today;
|
|
item.UserID = currentUser.UserID;
|
|
try
|
|
{
|
|
_erAppliedApplicantService.Save(item);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("getJobUpdateByUserId/{jobId}")]
|
|
public ActionResult getJobUpdateByUserId(int jobId)
|
|
{
|
|
List<ErJobupdate> obs = new List<ErJobupdate>();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
obs = _erAppliedApplicantService.GetJobupdateByUserId(currentUser.UserID, jobId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("getRecruitementStepForOfferLetter/{recruitementID}")]
|
|
public ActionResult getRecruitementStepForOfferLetter(int recruitementID)
|
|
{
|
|
List<RecruitementStep> obs = new List<RecruitementStep>();
|
|
RecruitementStep finalStep;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
bool isOfferLetterEnable = false;
|
|
try
|
|
{
|
|
obs = this._recruitementProcessService.GetRecruitementSteps(recruitementID);
|
|
var internalRecruitment = _internalRecruitmentService.Get(recruitementID);
|
|
if (obs != null && obs[obs.Count - 1].AssesmentStatus == EnumAssesmentStatus.Complete)
|
|
{
|
|
finalStep = new RecruitementStep();
|
|
finalStep = this._recruitementProcessService.GetRStep(obs[obs.Count - 1].ID);
|
|
if (finalStep != null)
|
|
{
|
|
foreach (var item in finalStep.SelectedCandidates)
|
|
{
|
|
var cv = _cvService.Get(item.cvid);
|
|
if (cv != null)
|
|
{
|
|
var ercv = _ercvService.Get((int)cv.ErCvID);
|
|
if (ercv.UserID == currentUser.UserID && (internalRecruitment.offerLetterApproveStatus == EnumOfferLetterStatus.Approved))
|
|
{
|
|
isOfferLetterEnable = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(isOfferLetterEnable);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("getApplicantDocByUserId/{jobId}")]
|
|
public ActionResult getApplicantDocByUserId(int jobId)
|
|
{
|
|
List<ErApplicantDoc> obs = new List<ErApplicantDoc>();
|
|
ErApplicantDoc erApplicantDoc = new ErApplicantDoc();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
obs = _erAppliedApplicantService.GetApplicantDocByUserID(currentUser.UserID, jobId);
|
|
erApplicantDoc = obs[0];
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(erApplicantDoc);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("getJobApplicantByUserId/{jobId}")]
|
|
public ActionResult GetJobApplicantByUserId(int jobId)
|
|
{
|
|
List<ErAppliedApplicant> obs = new List<ErAppliedApplicant>();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
bool isJobAlreadyExist = false;
|
|
try
|
|
{
|
|
obs = _erAppliedApplicantService.GetJobApplicantByUserId(currentUser.UserID, jobId);
|
|
if (obs != null && obs.Count > 0)
|
|
{
|
|
isJobAlreadyExist = true;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(isJobAlreadyExist);
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("getJobApplicant/{jobId}")]
|
|
public ActionResult getJobApplicant(int jobId)
|
|
{
|
|
ErAppliedApplicant obs = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
bool isJobAlreadyExist = false;
|
|
try
|
|
{
|
|
obs = _erAppliedApplicantService.GetJobApplicantByUserId(currentUser.UserID, jobId).ToList().FirstOrDefault();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("getAllJobApplicantByUserId")]
|
|
public ActionResult getAllJobApplicantByUserId()
|
|
{
|
|
List<ErAppliedApplicant> obs = new List<ErAppliedApplicant>();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
obs = _erAppliedApplicantService.GetAllJobApplicantByUserId(currentUser.UserID).ToList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(obs);
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("acceptOfferLetter/{jobId}")]
|
|
public ActionResult AcceptOfferLetter(int jobId)
|
|
{
|
|
List<ErAppliedApplicant> obs = new List<ErAppliedApplicant>();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
try
|
|
{
|
|
ErAppliedApplicant erAppliedApplicant = _erAppliedApplicantService.GetJobApplicantByUserId(currentUser.UserID, jobId).ToList().FirstOrDefault();
|
|
ErCircular ercircular = _erCircularService.Get(jobId);
|
|
ErCV ercv = _ercvService.GetErCvByUserID(erAppliedApplicant.UserID);
|
|
CV cv = _cvService.GetByErcvId(ercv.ID);
|
|
Candidate candidate = _candidateService.GetCanditatebyCvID(cv.ID, ercircular.RecruitementID);
|
|
obs = _erAppliedApplicantService.GetJobApplicantByUserId(currentUser.UserID, jobId);
|
|
RecruitmentLetters item = new RecruitmentLetters();
|
|
item.CreatedDate = DateTime.Today;
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.RequisitionID = ercircular.RecruitementID;
|
|
item.CandidateID = candidate.ID;
|
|
item.AcceptOfferDate = DateTime.Now;
|
|
item.IssueAppLetterDate = erAppliedApplicant.OfferLetterIssueDate;
|
|
this._recruitementLettterService.Save(item, 0);
|
|
|
|
erAppliedApplicant.IsOfferLetteraccepted = true;
|
|
erAppliedApplicant.OfferletterAcceptBy = currentUser.UserID;
|
|
erAppliedApplicant.OfferletterAcceptDate = DateTime.Now;
|
|
erAppliedApplicant.ModifiedDate = DateTime.Today;
|
|
erAppliedApplicant.ModifiedBy = currentUser.UserID;
|
|
_erAppliedApplicantService.Save(erAppliedApplicant);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("rejectOfferLetter/{jobId}/{rejectRemarks}")]
|
|
public ActionResult RejectOfferLetter(int jobId, string rejectRemarks)
|
|
{
|
|
List<ErAppliedApplicant> obs = new List<ErAppliedApplicant>();
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
try
|
|
{
|
|
ErAppliedApplicant erAppliedApplicant = _erAppliedApplicantService.GetJobApplicantByUserId(currentUser.UserID, jobId).ToList().FirstOrDefault();
|
|
ErCircular ercircular = _erCircularService.Get(jobId);
|
|
ErCV ercv = _ercvService.GetErCvByUserID(erAppliedApplicant.UserID);
|
|
CV cv = _cvService.GetByErcvId(ercv.ID);
|
|
Candidate candidate = _candidateService.GetCanditatebyCvID(cv.ID, ercircular.RecruitementID);
|
|
obs = _erAppliedApplicantService.GetJobApplicantByUserId(currentUser.UserID, jobId);
|
|
RecruitmentLetters item = new RecruitmentLetters();
|
|
item.CreatedDate = DateTime.Today;
|
|
item.CreatedBy = currentUser.UserID;
|
|
item.RequisitionID = ercircular.RecruitementID;
|
|
item.CandidateID = candidate.ID;
|
|
item.RejectAppLetterDate = DateTime.Now;
|
|
item.RejectOfferDate = DateTime.Now;
|
|
item.RejectAppLetterReason = rejectRemarks;
|
|
item.RejectOfferReason = rejectRemarks;
|
|
item.IssueAppLetterDate = erAppliedApplicant.OfferLetterIssueDate;
|
|
this._recruitementLettterService.Save(item, 0);
|
|
|
|
erAppliedApplicant.IsOfferLetteraccepted = false;
|
|
erAppliedApplicant.OfferletterRejectReason = rejectRemarks;
|
|
erAppliedApplicant.ModifiedDate = DateTime.Today;
|
|
erAppliedApplicant.ModifiedBy = currentUser.UserID;
|
|
_erAppliedApplicantService.Save(erAppliedApplicant);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok();
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("IsUserHaveErCV/{jobId}")]
|
|
public ActionResult IsUserHaveErCV(int jobId)
|
|
{
|
|
bool IsUserHaveErCV = false;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
try
|
|
{
|
|
ErCV ercv = _ercvService.GetErCvByUserID(currentUser.UserID);
|
|
if (ercv != null && ercv.ID > 0)
|
|
{
|
|
IsUserHaveErCV = true;
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(IsUserHaveErCV);
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("getCvInformation/{userId}")]
|
|
public ActionResult getCvInformation(int userId)
|
|
{
|
|
ErCV ercv = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
|
|
try
|
|
{
|
|
ercv = _ercvService.GetErCvByUserID(userId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(ercv);
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("getInterViewInforBycandidateId/{jobId}")]
|
|
public ActionResult getInterViewInforBycandidateId(int jobId)
|
|
{
|
|
DataTable otable = null;
|
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|
try
|
|
{
|
|
otable = this._recruitementProcessService.GetInterViewInforBycandidateId(jobId,
|
|
(int)currentUser.UserID);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|
}
|
|
|
|
return Ok(otable);
|
|
}
|
|
|
|
}
|
|
} |