1848 lines
68 KiB
C#
1848 lines
68 KiB
C#
|
using HRM.BO;
|
|||
|
using Microsoft.AspNetCore.Authorization;
|
|||
|
using Microsoft.AspNetCore.Http;
|
|||
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using HRM.BO.Configuration;
|
|||
|
using Microsoft.Extensions.Options;
|
|||
|
using Newtonsoft.Json;
|
|||
|
using HRM.DA;
|
|||
|
using System.Linq;
|
|||
|
using static iTextSharp.text.pdf.AcroFields;
|
|||
|
using AutoMapper.Internal;
|
|||
|
using NPOI.SS.Formula.Functions;
|
|||
|
using System.IO;
|
|||
|
|
|||
|
|
|||
|
namespace HRM.UI.Controllers.Talent_Management
|
|||
|
{
|
|||
|
[Route("api/Pmp")]
|
|||
|
[ApiController]
|
|||
|
[Authorize]
|
|||
|
public class PmpController : ControllerBase
|
|||
|
{
|
|||
|
private readonly IEmployeeService _EmployeeService;
|
|||
|
private readonly IPMPProcessService _pmpProcessService;
|
|||
|
private readonly IObjectiveTypeService _objectiveTypeService;
|
|||
|
private readonly IOrganogramService _organogramService;
|
|||
|
private readonly IObjectiveCategoryService _objectiveCategoryService;
|
|||
|
private readonly IObjectiveCategoryGradesService _objectiveCategoryGradesService;
|
|||
|
private readonly IObjectiveService _objectiveService;
|
|||
|
private readonly IEmployeeService _employeeService;
|
|||
|
private readonly IObjectiveSetService _objectiveSetService;
|
|||
|
private readonly IObjectiveSetRemarksService _objectiveSetRemarksService;
|
|||
|
private readonly IAssesmentValueDetailsService _assesmentValueDetailsService;
|
|||
|
private readonly IAppraisalPointRatingService _appraisalPointRatingService;
|
|||
|
private readonly IAppraisalPointService _appraisalPointService;
|
|||
|
private readonly IEmpAppraisalRatingService _empAppraisalRatingService;
|
|||
|
private readonly IEmployeeAppraisalService _employeeAppraisalService;
|
|||
|
private readonly IYearEndValuesRatingService _yearEndValuesRatingService;
|
|||
|
private readonly IOptions<EmailSettings> _emailSettings;
|
|||
|
private readonly ICompetencyService _competencyService;
|
|||
|
private readonly IQuestionnaireService _questionnaireService;
|
|||
|
private readonly IPMPValueBehaviorService _pmpValueBehaviorService;
|
|||
|
private readonly IDevelopmentPlanService _developmentPlanService;
|
|||
|
private readonly IPMPValueBehaviorSettingService _pmpValueBehaviorSettingService;
|
|||
|
private readonly ISuccessionRoleService _successionRoleService;
|
|||
|
private readonly ISuccessionPlanningService _successionPlanningService;
|
|||
|
private readonly IPMPRatingService _pmpRatingService;
|
|||
|
private readonly IPMSObjectiveProgressService _pmsObjectiveProgressService;
|
|||
|
private readonly IPMSObjectiveProgressAttachmentService _pmsObjectiveProgressAttachmentService;
|
|||
|
|
|||
|
|
|||
|
public PmpController(IPMPProcessService pmpProcessService,
|
|||
|
IObjectiveTypeService objectiveTypeService,
|
|||
|
IOrganogramService organogramService,
|
|||
|
IObjectiveCategoryService objectiveCategoryService,
|
|||
|
IObjectiveCategoryGradesService objectiveCategoryGradesService,
|
|||
|
IObjectiveService objectiveService,
|
|||
|
IEmployeeService employeeService,
|
|||
|
IObjectiveSetService objectiveSetService,
|
|||
|
IObjectiveSetRemarksService objectiveSetRemarksService,
|
|||
|
IAssesmentValueDetailsService assesmentValueDetailsService,
|
|||
|
IAppraisalPointRatingService appraisalPointRatingService,
|
|||
|
IAppraisalPointService appraisalPointService,
|
|||
|
IEmpAppraisalRatingService empAppraisalRatingService,
|
|||
|
IEmployeeAppraisalService employeeAppraisalService,
|
|||
|
IYearEndValuesRatingService yearEndValuesRatingService,
|
|||
|
IOptions<EmailSettings> emailSettings,
|
|||
|
ICompetencyService competencyService,
|
|||
|
IQuestionnaireService questionnaireService,
|
|||
|
IPMPValueBehaviorService pmpValueBehaviorService,
|
|||
|
IDevelopmentPlanService developmentPlanService,
|
|||
|
IEmployeeService empService,
|
|||
|
IPMPValueBehaviorSettingService pmpValueBehaviorSettingService,
|
|||
|
ISuccessionRoleService successionRoleService,
|
|||
|
ISuccessionPlanningService successionPlanningService,
|
|||
|
IPMPRatingService pmpRatingService,
|
|||
|
IPMSObjectiveProgressService pmsObjectiveProgressService,
|
|||
|
IPMSObjectiveProgressAttachmentService pmsObjectiveProgressAttachmentService)
|
|||
|
{
|
|||
|
_pmpProcessService = pmpProcessService;
|
|||
|
_objectiveTypeService = objectiveTypeService;
|
|||
|
_organogramService = organogramService;
|
|||
|
_objectiveCategoryService = objectiveCategoryService;
|
|||
|
_objectiveCategoryGradesService = objectiveCategoryGradesService;
|
|||
|
_objectiveService = objectiveService;
|
|||
|
_employeeService = employeeService;
|
|||
|
_objectiveSetService = objectiveSetService;
|
|||
|
_objectiveSetRemarksService = objectiveSetRemarksService;
|
|||
|
_assesmentValueDetailsService = assesmentValueDetailsService;
|
|||
|
_appraisalPointRatingService = appraisalPointRatingService;
|
|||
|
_appraisalPointService = appraisalPointService;
|
|||
|
_yearEndValuesRatingService = yearEndValuesRatingService;
|
|||
|
_emailSettings = emailSettings;
|
|||
|
_competencyService = competencyService;
|
|||
|
_questionnaireService = questionnaireService;
|
|||
|
_empAppraisalRatingService = empAppraisalRatingService;
|
|||
|
_employeeAppraisalService = employeeAppraisalService;
|
|||
|
_pmpValueBehaviorService = pmpValueBehaviorService;
|
|||
|
_developmentPlanService = developmentPlanService;
|
|||
|
_pmpValueBehaviorSettingService = pmpValueBehaviorSettingService;
|
|||
|
_EmployeeService = empService;
|
|||
|
_successionRoleService = successionRoleService;
|
|||
|
_successionPlanningService = successionPlanningService;
|
|||
|
_pmpRatingService = pmpRatingService;
|
|||
|
_pmsObjectiveProgressService = pmsObjectiveProgressService;
|
|||
|
_pmsObjectiveProgressAttachmentService = pmsObjectiveProgressAttachmentService;
|
|||
|
}
|
|||
|
|
|||
|
// PMPProcess
|
|||
|
[HttpGet]
|
|||
|
[Route("getAllPmpProcess")]
|
|||
|
public ActionResult GetAllPmpProcess()
|
|||
|
{
|
|||
|
List<PMPProcess> items = new List<PMPProcess>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _pmpProcessService.Get(EnumStatus.Regardless);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("savePmpProcess")]
|
|||
|
public ActionResult SavePmpProcess(PMPProcess item)
|
|||
|
{
|
|||
|
int ans;
|
|||
|
try
|
|||
|
{
|
|||
|
ans = _pmpProcessService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("deletePmpProcess")]
|
|||
|
public ActionResult DeletePmpProcess(PMPProcess item)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_pmpProcessService.Delete(item.ID);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getCurrentYear")]
|
|||
|
public ActionResult GetCurrentYear()
|
|||
|
{
|
|||
|
PMPProcess item = new PMPProcess();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _pmpProcessService.GetCurrentPMPYear(false);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getPmpProcessByYear/{pmpYear}")]
|
|||
|
public ActionResult GetPmpProcessByYear(int pmpYear)
|
|||
|
{
|
|||
|
PMPProcess item = new PMPProcess();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _pmpProcessService.GetByYear(pmpYear);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getAllObjectiveTypes")]
|
|||
|
public ActionResult GetAllObjectiveTypes()
|
|||
|
{
|
|||
|
List<ObjectiveType> items = new List<ObjectiveType>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _objectiveTypeService.Get(EnumStatus.Regardless);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getMaxTier")]
|
|||
|
public ActionResult GetMaxTier()
|
|||
|
{
|
|||
|
int ans = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
ans = _organogramService.MaxTier();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveObjectiveCategory")]
|
|||
|
public ActionResult SaveObjectiveCategoryGrade(ObjectiveCategory item)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
this._objectiveCategoryService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
// ObjectiveCategoryGrades
|
|||
|
[HttpGet]
|
|||
|
[Route("getObjectiveCategoryGradesByPmpYearIdAndCategory/{pmpYearId}/{categoryId}")]
|
|||
|
public ActionResult GetObjectiveCategoryGradesByPmpYearIdAndCategory(int pmpYearId, int categoryId)
|
|||
|
{
|
|||
|
List<ObjectiveCategoryGrades> items = new List<ObjectiveCategoryGrades>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _objectiveCategoryGradesService.Get(pmpYearId, categoryId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getByGradeId/{gradeId}/{pmpYearId}")]
|
|||
|
public ActionResult GetByGradeId(int gradeId, int pmpYearId)
|
|||
|
{
|
|||
|
List<ObjectiveCategoryGrades> items = new List<ObjectiveCategoryGrades>();
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int employeeId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
Employee employee = new Employee();
|
|||
|
try
|
|||
|
{
|
|||
|
if (gradeId == 0)
|
|||
|
{
|
|||
|
employee = _employeeService.Get(employeeId);
|
|||
|
gradeId = employee.GradeID.GetValueOrDefault();
|
|||
|
}
|
|||
|
|
|||
|
items = _objectiveCategoryGradesService.GetByGradeId(gradeId, pmpYearId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
// Objective
|
|||
|
[HttpPost]
|
|||
|
[Route("saveObjective")]
|
|||
|
public ActionResult SaveObjective(Objective item)
|
|||
|
{
|
|||
|
int ans;
|
|||
|
if (item.EmployeeID <= 0)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int employeeId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
item.EmployeeID = employeeId;
|
|||
|
}
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
ans = this._objectiveService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("DeleteObjective")]
|
|||
|
public ActionResult DeleteObjective(Objective item)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
this._objectiveService.Delete(item.ID);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(true);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getForValidation/{empId}/{pmpYearId}/{objectiveTypeId}")]
|
|||
|
public ActionResult GetForValidation(int empId, int pmpYearId, int objectiveTypeId)
|
|||
|
{
|
|||
|
List<Objective> items = new List<Objective>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _objectiveService.GetForValidation(empId, pmpYearId, objectiveTypeId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getObjectiveListByEmployeeId/{pmpYearId}/{employeeId}")]
|
|||
|
public ActionResult GetObjectiveListByEmployeeId(int pmpYearId, int employeeId)
|
|||
|
{
|
|||
|
List<Objective> items = new List<Objective>();
|
|||
|
if (employeeId == 0)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
employeeId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
}
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
items = _objectiveService.GetByEmployeeID(employeeId, pmpYearId, false);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("getObjectiveByEmpIds")]
|
|||
|
public ActionResult GetObjectiveByEmpIds(dynamic data)
|
|||
|
{
|
|||
|
List<Objective> items = new List<Objective>();
|
|||
|
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|||
|
string empIds = (string)item["ids"].ToObject<string>();
|
|||
|
int pmpYearId = item["selectedYear"].ToObject<int>();
|
|||
|
;
|
|||
|
try
|
|||
|
{
|
|||
|
items = _objectiveService.GetByEmployeeID(empIds, pmpYearId, false);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
// ObjectiveSet
|
|||
|
[HttpGet]
|
|||
|
[Route("getObjectiveSetByEmpId/{pmpYearId}/{employeeId}")]
|
|||
|
public ActionResult GetObjectiveSetByEmpId(int pmpYearId, int employeeId)
|
|||
|
{
|
|||
|
ObjectiveSet item = new ObjectiveSet();
|
|||
|
if (employeeId == 0)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
employeeId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
}
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
item = _objectiveSetService.GetByEmployeeID(employeeId, pmpYearId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("getObjectiveSetByEmpIds")]
|
|||
|
public ActionResult GetObjectiveSetByEmpIds(dynamic data)
|
|||
|
{
|
|||
|
List<ObjectiveSet> items = new List<ObjectiveSet>();
|
|||
|
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|||
|
string empIds = (string)item["ids"].ToObject<string>();
|
|||
|
int pmpYearId = item["selectedYear"].ToObject<int>();
|
|||
|
;
|
|||
|
try
|
|||
|
{
|
|||
|
items = _objectiveSetService.GetByEmpIds(pmpYearId, empIds);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getAllObjectiveSet")]
|
|||
|
public ActionResult GetAllObjectiveSet()
|
|||
|
{
|
|||
|
List<ObjectiveSet> items = new List<ObjectiveSet>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _objectiveSetService.Get();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getObjectiveSetWithChild/{employeeId}/{pmpYearId}")]
|
|||
|
public ActionResult GetObjectiveSetWithChild(int employeeId, int pmpYearId)
|
|||
|
{
|
|||
|
ObjectiveSet item = new ObjectiveSet();
|
|||
|
if (employeeId == 0)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
employeeId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
}
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
item = _objectiveSetService.GetObjectiveSetWithChild(employeeId, pmpYearId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getObjectiveSetByDepartment/{pmpYearId}")]
|
|||
|
public ActionResult GetObjectiveSetByDepartment(int pmpYearId)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int empId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
List<ObjectiveSet> items = new List<ObjectiveSet>();
|
|||
|
Employee employee = null;
|
|||
|
try
|
|||
|
{
|
|||
|
employee = _employeeService.Get(empId);
|
|||
|
if (employee.DepartmentID == null)
|
|||
|
throw new Exception("No Department Found");
|
|||
|
int deptId = employee.DepartmentID.GetValueOrDefault();
|
|||
|
items = _objectiveSetService.GetObjectiveSetByDepartment(deptId, pmpYearId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveObjectiveSet")]
|
|||
|
public ActionResult SaveObjectiveSet(ObjectiveSet item)
|
|||
|
{
|
|||
|
int ans;
|
|||
|
try
|
|||
|
{
|
|||
|
ans = _objectiveSetService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveObjSetWithChild")]
|
|||
|
public ActionResult SaveObjSetWithChild(ObjectiveSet item)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_objectiveSetService.SaveWithChild(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getByPMPYear/{pmpYearId}/{empIds}")]
|
|||
|
public ActionResult GetByPMPYear(int pmpYearId, string empIds)
|
|||
|
{
|
|||
|
List<ObjectiveSet> items = new List<ObjectiveSet>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _objectiveSetService.GetByPMPYear(pmpYearId, empIds);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getObjectiveSetByPMPYear/{pmpYearId}")]
|
|||
|
public ActionResult GetObjectiveSetByPMPYear(int pmpYearId)
|
|||
|
{
|
|||
|
List<ObjectiveSet> items = new List<ObjectiveSet>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _objectiveSetService.GetByPMPYear(pmpYearId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
// ObjectiveSetRemarks
|
|||
|
[HttpGet]
|
|||
|
[Route("getByObjectiveSetId/{objSetId}")]
|
|||
|
public ActionResult GetByObjectiveSetId(int objSetId)
|
|||
|
{
|
|||
|
ObjectiveSetRemarks item = new ObjectiveSetRemarks();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _objectiveSetRemarksService.GetByObjectiveSetID(objSetId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
// AssesmentValueDetails
|
|||
|
[HttpGet]
|
|||
|
[Route("getAllAssessmentDetails")]
|
|||
|
public ActionResult GetAllAssessmentDetails()
|
|||
|
{
|
|||
|
List<AssesmentValueDetails> items = new List<AssesmentValueDetails>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _assesmentValueDetailsService.Get(EnumStatus.Regardless);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
// AppraisalPointRating
|
|||
|
[HttpGet]
|
|||
|
[Route("getAllAppraisalPointRating")]
|
|||
|
public ActionResult GetAllAppraisalPointRating()
|
|||
|
{
|
|||
|
List<AppraisalPointRating> items = new List<AppraisalPointRating>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _appraisalPointRatingService.Get();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
[HttpGet]
|
|||
|
[Route("getAllAppraisalPointRatings/{year}")]
|
|||
|
public ActionResult GetAllAppraisalPointRatings(DateTime year)
|
|||
|
{
|
|||
|
List<AppraisalPointRating> items = new List<AppraisalPointRating>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _appraisalPointRatingService.Get(year);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
[HttpGet]
|
|||
|
[Route("getAllAppraisalPointRatingsTypeWise/{type}")]
|
|||
|
[Route("getAllAppraisalPointRatingsTypeWise/{type}/{year}")]
|
|||
|
public ActionResult getAllAppraisalPointRatingsTypeWise(EnumAppraisalPointType type, DateTime? year)
|
|||
|
{
|
|||
|
List<AppraisalPointRating> items = new List<AppraisalPointRating>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _appraisalPointRatingService.Get(type, year);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
[HttpPost]
|
|||
|
[Route("saveAppraisalPointRating")]
|
|||
|
public ActionResult saveAppraisalPointRating(AppraisalPointRating oAppraisalPointRating)
|
|||
|
{
|
|||
|
int item;
|
|||
|
try
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
|||
|
if (oAppraisalPointRating.IsNew == true)
|
|||
|
{
|
|||
|
oAppraisalPointRating.CreatedBy = currentUser.UserID;
|
|||
|
oAppraisalPointRating.CreatedDate = DateTime.Today;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oAppraisalPointRating.ModifiedBy = currentUser.UserID;
|
|||
|
oAppraisalPointRating.ModifiedDate = DateTime.Today;
|
|||
|
}
|
|||
|
item = _appraisalPointRatingService.Save(oAppraisalPointRating);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
[HttpPost]
|
|||
|
[Route("deleteAppraisalPointRatingbyId")]
|
|||
|
public ActionResult deleteAppraisalPointRatingbyId(AppraisalPointRating oAppraisalPointRating)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_appraisalPointRatingService.Delete(oAppraisalPointRating.ID);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
// AppraisalPoint
|
|||
|
[HttpGet]
|
|||
|
[Route("getAllAppraisalPoint")]
|
|||
|
public ActionResult GetAllAppraisalPoint()
|
|||
|
{
|
|||
|
List<AppraisalPoint> items = new List<AppraisalPoint>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _appraisalPointService.Get(EnumStatus.Regardless);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
// PMPRating
|
|||
|
[HttpGet]
|
|||
|
[Route("getAllPMPRating")]
|
|||
|
public ActionResult GetAllPMPRating()
|
|||
|
{
|
|||
|
List<PMPRating> items = new List<PMPRating>();
|
|||
|
List<PMPProcess> processItems = _pmpProcessService.Get(EnumStatus.Regardless);
|
|||
|
try
|
|||
|
{
|
|||
|
items = new PMPRatingService().Get(EnumStatus.Regardless);
|
|||
|
foreach (PMPRating item in items)
|
|||
|
{
|
|||
|
if (item.PMPYearId > 0)
|
|||
|
item.PMPYear = processItems.FirstOrDefault(i => i.ID == item.PMPYearId).PmpYear;
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("savePmpRating")]
|
|||
|
public ActionResult SavePmpRating(PMPRating item)
|
|||
|
{
|
|||
|
int ans;
|
|||
|
try
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
|||
|
if (item.IsNew == true)
|
|||
|
{
|
|||
|
item.CreatedBy = currentUser.UserID;
|
|||
|
item.CreatedDate = DateTime.Today;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
item.ModifiedBy = currentUser.UserID;
|
|||
|
item.ModifiedDate = DateTime.Today;
|
|||
|
}
|
|||
|
ans = new PMPRatingService().Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("deletePmpRating")]
|
|||
|
public ActionResult DeletePmpRating(PMPRating item)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
new PMPRatingService().Delete(item.ID);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getPMPRatingByTypeAndYear/{type}/{pmpYearId}")]
|
|||
|
public ActionResult GetPMPRatingByTypeAndYear(EnumPMPRatingType type, int pmpYearId)
|
|||
|
{
|
|||
|
List<PMPRating> items = new List<PMPRating>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _pmpRatingService.GetPMPRatingByTypeAndYear(type, pmpYearId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
// Send Email
|
|||
|
[HttpPost]
|
|||
|
[Route("sendEmailForPMS")]
|
|||
|
public ActionResult SendEmailForPms(dynamic data)
|
|||
|
{
|
|||
|
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|||
|
int empId = item["employeeId"].ToObject<int>();
|
|||
|
string message = (string)item["message"].ToObject<string>();
|
|||
|
string subject = (string)item["subject"].ToObject<string>();
|
|||
|
Employee employee = new Employee();
|
|||
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
try
|
|||
|
{
|
|||
|
if (empId == 0)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
empId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
employee = _employeeService.GetLineManager(empId);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
employee = _employeeService.Get(empId);
|
|||
|
}
|
|||
|
|
|||
|
MailSender mailSender = new MailSender();
|
|||
|
mailSender.AddTo(employee.EmailAddress);
|
|||
|
mailSender.Subject = subject;
|
|||
|
mailSender.Body = "<p>" + message + "</p>";
|
|||
|
mailSender.SendMail(emailSettings);
|
|||
|
System.Threading.Thread.Sleep(500);
|
|||
|
|
|||
|
/*MailSender mailSender = new MailSender();
|
|||
|
mailSender.AddTo("ikramul@celimited.com");
|
|||
|
mailSender.Subject = "This is PMS Email";
|
|||
|
mailSender.Body = "<p>" + message + "</p>";
|
|||
|
mailSender.SendMail(emailSettings);
|
|||
|
System.Threading.Thread.Sleep(500);*/
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("sendEmailForPmsMultiple")]
|
|||
|
public ActionResult SendEmailForPmsMultiple(dynamic data)
|
|||
|
{
|
|||
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
var employees = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data.list));
|
|||
|
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|||
|
string subject = (string)item["emailSubject"].ToObject<string>();
|
|||
|
string body = (string)item["emailBody"].ToObject<string>();
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (var employee in employees)
|
|||
|
{
|
|||
|
MailSender mailSender = new MailSender();
|
|||
|
mailSender.AddTo(employee.emailAddress.ToString());
|
|||
|
mailSender.Subject = subject;
|
|||
|
mailSender.Body = "<p>" + body + "</p>";
|
|||
|
mailSender.SendMail(emailSettings);
|
|||
|
System.Threading.Thread.Sleep(500);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("sendEmailNotification")]
|
|||
|
public ActionResult SendEmailNotification(dynamic data)
|
|||
|
{
|
|||
|
List<Employee> employees = new List<Employee>();
|
|||
|
EmailSettings emailSettings = _emailSettings.Value;
|
|||
|
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|||
|
string empIds = (string)item["empIds"].ToObject<string>();
|
|||
|
string subject = (string)item["emailSubject"].ToObject<string>();
|
|||
|
string body = (string)item["emailBody"].ToObject<string>();
|
|||
|
try
|
|||
|
{
|
|||
|
employees = _employeeService.GetByEmpIDs(empIds);
|
|||
|
foreach (var employee in employees)
|
|||
|
{
|
|||
|
MailSender mailSender = new MailSender();
|
|||
|
mailSender.AddTo(employee.EmailAddress);
|
|||
|
mailSender.Subject = subject;
|
|||
|
mailSender.Body = "<p>" + body + "</p>";
|
|||
|
mailSender.SendMail(emailSettings);
|
|||
|
System.Threading.Thread.Sleep(500);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getPmsLmGoalReport/{pmpYearId}")]
|
|||
|
public ActionResult GetPmsLmGoalReport(int pmpYearId)
|
|||
|
{
|
|||
|
DataSet ds = new DataSet();
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int employeeId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
try
|
|||
|
{
|
|||
|
ds = _objectiveService.GetPmsLmGoalReport(pmpYearId, employeeId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ds);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getPmsIndividualGoalData/{pmpYearId}")]
|
|||
|
public ActionResult GetPmsIndividualGoalData(int pmpYearId)
|
|||
|
{
|
|||
|
DataSet ds = new DataSet();
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int employeeId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
try
|
|||
|
{
|
|||
|
ds = _objectiveService.GetPmsIndividualGoalData(pmpYearId, employeeId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ds);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("getPmsDataDepartmentWise")]
|
|||
|
public ActionResult GetPmsDataDepartmentWise(dynamic data)
|
|||
|
{
|
|||
|
DataSet ds = new DataSet();
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
|||
|
string empIds = (string)item["empIds"].ToObject<string>();
|
|||
|
int pmpYearId = item["pmsYear"].ToObject<int>();
|
|||
|
int employeeId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
try
|
|||
|
{
|
|||
|
if (empIds.Length > 0)
|
|||
|
{
|
|||
|
ds = _objectiveService.GetPmsDataEmployeeWise(pmpYearId, empIds);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ds);
|
|||
|
}
|
|||
|
|
|||
|
#region Competency
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getCompetencys")]
|
|||
|
public ActionResult getCompetencys()
|
|||
|
{
|
|||
|
List<Competency> oCompetency = new List<Competency>();
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|||
|
try
|
|||
|
{
|
|||
|
oCompetency = _competencyService.Get(EnumStatus.Regardless, payrollTypeId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(oCompetency);
|
|||
|
}
|
|||
|
|
|||
|
#endregion Competency
|
|||
|
|
|||
|
#region Questionnaire
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getQuestionnaires")]
|
|||
|
public ActionResult getQuestionnaires()
|
|||
|
{
|
|||
|
List<Questionnaire> oQuestionnaire = new List<Questionnaire>();
|
|||
|
try
|
|||
|
{
|
|||
|
oQuestionnaire = _questionnaireService.Get();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(oQuestionnaire);
|
|||
|
}
|
|||
|
[HttpPost]
|
|||
|
[Route("saveQuestionnaires")]
|
|||
|
public ActionResult saveQuestionnaires(Questionnaire oQuestionnaire)
|
|||
|
{
|
|||
|
Questionnaire item = new Questionnaire();
|
|||
|
oQuestionnaire.GradeIDsInString = string.Join(",", oQuestionnaire.GradeIDs.Select(x => x.ToString()).ToList());
|
|||
|
try
|
|||
|
{
|
|||
|
item.ID = _questionnaireService.Save(oQuestionnaire);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item.ID);
|
|||
|
}
|
|||
|
[HttpPost]
|
|||
|
[Route("deleteQuestionnaireById")]
|
|||
|
public ActionResult deleteQuestionnaireById(Questionnaire oQuestionnaire)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_questionnaireService.Delete(oQuestionnaire.ID);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
#endregion Questionnaire
|
|||
|
|
|||
|
#region Calibration
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getCalibrationByPmpYearId/{pmpYearId}")]
|
|||
|
public ActionResult GetCalibrationByPmpYearId(int pmpYearId)
|
|||
|
{
|
|||
|
List<Calibration> items = new List<Calibration>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = new CalibrationService().GetByPmpYearId(pmpYearId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getCalibrationByEmpIdAndPmpYearId/{empId}/{pmpYearId}")]
|
|||
|
public ActionResult GetCalibrationByEmpIdAndPmpYearId(int empId, int pmpYearId)
|
|||
|
{
|
|||
|
Calibration item = new Calibration();
|
|||
|
try
|
|||
|
{
|
|||
|
item = new CalibrationService().GetByEmpIdAndPmpYearId(empId, pmpYearId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getSubordinatesCalibration/{pmpYearId}")]
|
|||
|
public ActionResult GetSubordinatesCalibration(int pmpYearId)
|
|||
|
{
|
|||
|
List<Calibration> items = new List<Calibration>();
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int empId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
try
|
|||
|
{
|
|||
|
items = new CalibrationService().GetSubordinatesCalibration(pmpYearId, empId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveCalibration")]
|
|||
|
public ActionResult SaveCalibration(Calibration item)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
|||
|
if (item.IsNew == true)
|
|||
|
{
|
|||
|
item.CreatedBy = currentUser.UserID;
|
|||
|
item.CreatedDate = DateTime.Today;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
item.ModifiedBy = currentUser.UserID;
|
|||
|
item.ModifiedDate = DateTime.Today;
|
|||
|
}
|
|||
|
if (item.CalibrationAudiances.Count > 0)
|
|||
|
{
|
|||
|
foreach(CalibrationAudiance calibrationAudiance in item.CalibrationAudiances)
|
|||
|
if (calibrationAudiance.IsNew == true)
|
|||
|
{
|
|||
|
calibrationAudiance.CreatedBy = currentUser.UserID;
|
|||
|
calibrationAudiance.CreatedDate = DateTime.Today;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
calibrationAudiance.ModifiedBy = currentUser.UserID;
|
|||
|
calibrationAudiance.ModifiedDate = DateTime.Today;
|
|||
|
}
|
|||
|
}
|
|||
|
new CalibrationService().Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveCalibrationEss")]
|
|||
|
public ActionResult SaveCalibrationEss(Calibration item)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
|||
|
if (item.IsNew == true)
|
|||
|
{
|
|||
|
item.CreatedBy = currentUser.UserID;
|
|||
|
item.CreatedDate = DateTime.Today;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
item.ModifiedBy = currentUser.UserID;
|
|||
|
item.ModifiedDate = DateTime.Today;
|
|||
|
}
|
|||
|
new CalibrationService().SaveCalibrationEss(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("deleteCalibration")]
|
|||
|
public ActionResult DeleteCalibration(Calibration item)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
new CalibrationService().Delete(item.ID);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getEmployeeWithRatings/{pmpYearId}/{ratingStr}")]
|
|||
|
public ActionResult GetEmployeeWithRatings(int pmpYearId, string ratingStr)
|
|||
|
{
|
|||
|
DataSet ds = new DataSet();
|
|||
|
try
|
|||
|
{
|
|||
|
ds = new CalibrationService().GetEmployeeWithRatings(pmpYearId, ratingStr);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ds.Tables[0]);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion Calibration
|
|||
|
|
|||
|
#region CalibrationAudiance
|
|||
|
[HttpGet]
|
|||
|
[Route("getCalibrationAudianceByCalibrationId/{calibrationId}")]
|
|||
|
public ActionResult getCalibrationAudianceByCalibrationId(int calibrationId)
|
|||
|
{
|
|||
|
List<CalibrationAudiance> items = new List<CalibrationAudiance>();
|
|||
|
try
|
|||
|
{
|
|||
|
//items = new CalibrationAudianceService().Get(calibrationId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region PMPValueBehavior
|
|||
|
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getPMPValueBehaviors")]
|
|||
|
public ActionResult getPMPValueBehaviors()
|
|||
|
{
|
|||
|
List<PMPValueBehavior> oPMPValueBehavior = new List<PMPValueBehavior>();
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|||
|
try
|
|||
|
{
|
|||
|
oPMPValueBehavior = _pmpValueBehaviorService.Get(EnumStatus.Regardless);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(oPMPValueBehavior);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getPMPValueBehaviors/{pmpYearId}/{employeeId}")]
|
|||
|
public ActionResult getPMPValueBehaviors(int pmpYearId, int employeeId)
|
|||
|
{
|
|||
|
List<PMPValueBehavior> oPMPValueBehaviors = new List<PMPValueBehavior>();
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|||
|
|
|||
|
List<PMPValueBehaviorSetting> oPMPValueBehaviorSettings = null;
|
|||
|
|
|||
|
DataRow oDR = null;
|
|||
|
DataTable oPMPValueBehaviorsDT = new DataTable();
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("Id", typeof(int));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("PMPValueBehaviorSettingID", typeof(int));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("Code", typeof(string));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("Name", typeof(string));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("Description", typeof(string));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("Question", typeof(string));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("ParentID", typeof(int));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("Tier", typeof(int));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("PayrollTypeID", typeof(int));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("TargetRating", typeof(int));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("EmpComments", typeof(string));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("EmpCommentsDate", typeof(DateTime));
|
|||
|
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("MyEmpRating", typeof(int));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("MyEmpComments", typeof(string));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("MyEmpCommentsDate", typeof(DateTime));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("MyLMRating", typeof(int));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("MyLMComments", typeof(string));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("MyLMCommentDate", typeof(DateTime));
|
|||
|
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("YeEmpRating", typeof(int));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("YeEmpComments", typeof(string));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("YeEmpCommentsDate", typeof(DateTime));
|
|||
|
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("YeLMRating", typeof(int));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("YeLMComments", typeof(string));
|
|||
|
oPMPValueBehaviorsDT.Columns.Add("YeLMCommentDate", typeof(DateTime));
|
|||
|
|
|||
|
int count = 0;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
int maxTire = Convert.ToInt32(new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "pmpvaluebehavior", "tier"));
|
|||
|
|
|||
|
oPMPValueBehaviors = _pmpValueBehaviorService.Get(EnumStatus.Regardless);
|
|||
|
ObjectiveSet oObjectiveSet = _objectiveSetService.GetByEmployeeID(employeeId, pmpYearId);
|
|||
|
|
|||
|
if (oObjectiveSet != null)
|
|||
|
{
|
|||
|
oPMPValueBehaviorSettings = _pmpValueBehaviorSettingService.GetByObjectiveSetID(oObjectiveSet.ID);
|
|||
|
}
|
|||
|
|
|||
|
foreach (PMPValueBehavior item in oPMPValueBehaviors)
|
|||
|
{
|
|||
|
oDR = oPMPValueBehaviorsDT.NewRow();
|
|||
|
oDR["Id"] = item.ID;
|
|||
|
oDR["Code"] = item.Code;
|
|||
|
oDR["Name"] = item.Name;
|
|||
|
oDR["Description"] = item.Description;
|
|||
|
oDR["Question"] = item.Question;
|
|||
|
if(item.ParentID != null)
|
|||
|
oDR["ParentID"] = item.ParentID;
|
|||
|
oDR["Tier"] = item.Tier;
|
|||
|
oDR["PayrollTypeID"] = item.PayrollTypeID;
|
|||
|
if (maxTire == item.Tier)
|
|||
|
{
|
|||
|
if (oPMPValueBehaviorSettings != null && oPMPValueBehaviorSettings.Count > 0)
|
|||
|
{
|
|||
|
foreach (PMPValueBehaviorSetting oPMPValueBehaviorSettingItem in oPMPValueBehaviorSettings)
|
|||
|
{
|
|||
|
if (item.ID == oPMPValueBehaviorSettingItem.PMPValueBehaviorID)
|
|||
|
{
|
|||
|
oDR["PMPValueBehaviorSettingID"] = oPMPValueBehaviorSettingItem.ID;
|
|||
|
oDR["TargetRating"] = oPMPValueBehaviorSettingItem.TargetRating;
|
|||
|
oDR["EmpComments"] = oPMPValueBehaviorSettingItem.EmpComments;
|
|||
|
if (oPMPValueBehaviorSettingItem.EmpCommentsDate != null)
|
|||
|
oDR["EmpCommentsDate"] = oPMPValueBehaviorSettingItem.EmpCommentsDate;
|
|||
|
|
|||
|
//if(oPMPValueBehaviorSettingItem.MyEmpRating != null)
|
|||
|
// oDR["MyEmpRating"] = oPMPValueBehaviorSettingItem.MyEmpRating;
|
|||
|
if (oPMPValueBehaviorSettingItem.MyEmpComments != null)
|
|||
|
oDR["MyEmpComments"] = oPMPValueBehaviorSettingItem.MyEmpComments;
|
|||
|
if (oPMPValueBehaviorSettingItem.MyEmpCommentsDate != null)
|
|||
|
oDR["MyEmpCommentsDate"] = oPMPValueBehaviorSettingItem.MyEmpCommentsDate;
|
|||
|
|
|||
|
//if(oPMPValueBehaviorSettingItem.MyLMRating != null)
|
|||
|
// oDR["MyLMRating"] = oPMPValueBehaviorSettingItem.MyLMRating;
|
|||
|
if (oPMPValueBehaviorSettingItem.MyLMComments != null)
|
|||
|
oDR["MyLMComments"] = oPMPValueBehaviorSettingItem.MyLMComments;
|
|||
|
if (oPMPValueBehaviorSettingItem.MyLMCommentDate != null)
|
|||
|
oDR["MyLMCommentDate"] = oPMPValueBehaviorSettingItem.MyLMCommentDate;
|
|||
|
|
|||
|
if(oPMPValueBehaviorSettingItem.YeEmpRating != null)
|
|||
|
oDR["YeEmpRating"] = oPMPValueBehaviorSettingItem.YeEmpRating;
|
|||
|
if (oPMPValueBehaviorSettingItem.YeEmpComments != null)
|
|||
|
oDR["YeEmpComments"] = oPMPValueBehaviorSettingItem.YeEmpComments;
|
|||
|
if (oPMPValueBehaviorSettingItem.YeEmpCommentsDate != null)
|
|||
|
oDR["YeEmpCommentsDate"] = oPMPValueBehaviorSettingItem.YeEmpCommentsDate;
|
|||
|
|
|||
|
if (oPMPValueBehaviorSettingItem.YeLMRating != null)
|
|||
|
oDR["YeLMRating"] = oPMPValueBehaviorSettingItem.YeLMRating;
|
|||
|
if (oPMPValueBehaviorSettingItem.YeLMComments != null)
|
|||
|
oDR["YeLMComments"] = oPMPValueBehaviorSettingItem.YeLMComments;
|
|||
|
if (oPMPValueBehaviorSettingItem.YeLMCommentDate != null)
|
|||
|
oDR["YeLMCommentDate"] = oPMPValueBehaviorSettingItem.YeLMCommentDate;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
oPMPValueBehaviorsDT.Rows.Add(oDR);
|
|||
|
|
|||
|
count++;
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(oPMPValueBehaviorsDT);
|
|||
|
}
|
|||
|
|
|||
|
#endregion PMPValueBehavior
|
|||
|
|
|||
|
|
|||
|
#region DevelopmentPlan
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveDevelopmentPlan")]
|
|||
|
public ActionResult SaveDevelopmentPlan(DevelopmentPlan item)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
item.EmployeeID = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
|
|||
|
int ans;
|
|||
|
try
|
|||
|
{
|
|||
|
ObjectiveSet objectiveSet = _objectiveSetService.GetByEmployeeID(item.EmployeeID, item.PMPYearID);
|
|||
|
item.ObjectiveSetID = objectiveSet.ID;
|
|||
|
|
|||
|
ans = _developmentPlanService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getDevelopmentPlansEmployee/{pmpYearId}/{currentYear}")]
|
|||
|
public ActionResult GetDevelopmentPlan(int pmpYearId, bool currentYear)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int employeeId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
|
|||
|
List<DevelopmentPlan> items = null;
|
|||
|
try
|
|||
|
{
|
|||
|
if (currentYear)
|
|||
|
{
|
|||
|
ObjectiveSet objectiveSet = _objectiveSetService.GetByEmployeeID(employeeId, pmpYearId);
|
|||
|
if (objectiveSet != null)
|
|||
|
items = _developmentPlanService.GetByObjectiveSetId(objectiveSet.ID);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
//items = _developmentPlanService.GetPreviousYears(employeeId, pmpYearId);
|
|||
|
items = _developmentPlanService.GetPreviousYears(employeeId, _pmpProcessService.GetByPMPProcessID(pmpYearId).PmpYear);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getDevelopmentPlansEmployee/{employeeId}/{pmpYearId}/{currentYear}")]
|
|||
|
public ActionResult GetDevelopmentPlan(int employeeId, int pmpYearId, bool currentYear)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
|||
|
List<DevelopmentPlan> items = null;
|
|||
|
try
|
|||
|
{
|
|||
|
if (currentYear)
|
|||
|
{
|
|||
|
ObjectiveSet objectiveSet = _objectiveSetService.GetByEmployeeID(employeeId, pmpYearId);
|
|||
|
if (objectiveSet != null)
|
|||
|
items = _developmentPlanService.GetByObjectiveSetId(objectiveSet.ID);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
items = _developmentPlanService.GetPreviousYears(employeeId, pmpYearId);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
#endregion DevelopmentPlan
|
|||
|
|
|||
|
#region PMPValueBehaviorSetting
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("savePMPValueBehaviorSetting")]
|
|||
|
public ActionResult SavePMPValueBehaviorSetting(List<PMPValueBehaviorSetting> items)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
//item.EmployeeID = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
|
|||
|
int ans;
|
|||
|
try
|
|||
|
{
|
|||
|
//ObjectiveSet objectiveSet = _objectiveSetService.GetByEmployeeID(item.EmployeeID, item.PMPYearID);
|
|||
|
//item.ObjectiveSetID = objectiveSet.ID;
|
|||
|
|
|||
|
//ans = _developmentPlanService.Save(item);
|
|||
|
_pmpValueBehaviorSettingService.Save(items);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
#endregion PMPValueBehaviorSetting
|
|||
|
|
|||
|
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getTrainingNeedAnalysis/{pmpYearId}")]
|
|||
|
public ActionResult GetTrainingNeedAnalysis(int pmpYearId)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
List<DevelopmentPlan> items = null;
|
|||
|
List<Employee> employees = new List<Employee>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _developmentPlanService.GetByPmpYearId(pmpYearId);
|
|||
|
employees = _EmployeeService.GetAllEmps();
|
|||
|
int? payrolltypeid = null;
|
|||
|
if (currentUser.PayrollTypeID != null)
|
|||
|
payrolltypeid = (int)currentUser.PayrollTypeID;
|
|||
|
|
|||
|
if (payrolltypeid != null)
|
|||
|
{
|
|||
|
List<Grade> grades = new GradeService().Get(EnumStatus.Regardless, (int)payrolltypeid);
|
|||
|
List<Designation> designations =
|
|||
|
new DesignationService().Get(EnumStatus.Regardless, (int)payrolltypeid);
|
|||
|
List<Department> departments =
|
|||
|
new DepartmentService().Get(EnumStatus.Regardless, (int)payrolltypeid);
|
|||
|
|
|||
|
items.ForEach(x =>
|
|||
|
{
|
|||
|
var employee = employees.FirstOrDefault(d => d.ID == x.EmployeeID);
|
|||
|
x.EmployeeName = employee.Name;
|
|||
|
x.EmployeeNo = employee.EmployeeNo;
|
|||
|
var designation = designations.FirstOrDefault(d => d.ID == employee.DesignationID);
|
|||
|
if (designation != null)
|
|||
|
x.DesignationName = designation.Name;
|
|||
|
var department = departments.FirstOrDefault(d => d.ID == employee.DepartmentID);
|
|||
|
if (department != null)
|
|||
|
x.DepartmentName = department.Name;
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getTrainingNeedAnalysisCount/{pmpYearId}")]
|
|||
|
public ActionResult GetTrainingNeedAnalysisCount(int pmpYearId)
|
|||
|
{
|
|||
|
DataSet ds = new DataSet();
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int employeeId = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
try
|
|||
|
{
|
|||
|
ds = _developmentPlanService.GetTrainingNeedAnalysisCount(pmpYearId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ds.Tables[0]);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getsuccessionroles")]
|
|||
|
public ActionResult GetSuccessionRoles()
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
List<SuccessionRole> roles = new List<SuccessionRole>();
|
|||
|
try
|
|||
|
{
|
|||
|
roles = _successionRoleService.Get(EnumStatus.Active, (int)currentUser.PayrollTypeID);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(roles);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveSuccessionPlanning")]
|
|||
|
public ActionResult saveSuccessionPlanning(SuccessionPlanning item)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
// item.EmployeeID = currentUser.EmployeeID.GetValueOrDefault();
|
|||
|
|
|||
|
int ans;
|
|||
|
try
|
|||
|
{
|
|||
|
item.PlanningYear = DateTime.Now;
|
|||
|
item.CreatedBy = currentUser.UserID;
|
|||
|
item.CreatedDate = DateTime.Now;
|
|||
|
ans = _successionPlanningService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getsuccessionplanning")]
|
|||
|
public ActionResult Getsuccessionplanning()
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
//List<SuccessionRole> roles = new List<SuccessionRole>();
|
|||
|
List<SuccessionPlanning> plannings = new List<SuccessionPlanning>();
|
|||
|
List<Employee> employees = new List<Employee>();
|
|||
|
try
|
|||
|
{
|
|||
|
List<Designation> designations = new DesignationService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|||
|
employees = _employeeService.GetAllEmps();
|
|||
|
plannings = _successionPlanningService.Get();
|
|||
|
if (plannings != null && plannings.Count > 0)
|
|||
|
{
|
|||
|
foreach (SuccessionPlanning plan in plannings)
|
|||
|
{
|
|||
|
var employee = new Employee();
|
|||
|
employee = employees.Find(x => x.ID == plan.EmployeeID);
|
|||
|
plan.EmployeeName = employee.Name;
|
|||
|
if (employee.Status == EnumEmployeeStatus.Discontinued)
|
|||
|
plan.IsDiscontinueEmployee = true;
|
|||
|
else
|
|||
|
plan.IsDiscontinueEmployee = false;
|
|||
|
plan.DesignationName= designations?.Find(y=>y.ID == employee.ID)?.Name;
|
|||
|
|
|||
|
|
|||
|
var successionOne = new Employee();
|
|||
|
successionOne = employees.Find(x => x.ID == plan.SuccessorOneID);
|
|||
|
plan.SuccessionOneName = successionOne.Name;
|
|||
|
if (successionOne.Status == EnumEmployeeStatus.Discontinued)
|
|||
|
plan.IsDiscontinueOne = true;
|
|||
|
else
|
|||
|
plan.IsDiscontinueOne = false;
|
|||
|
plan.SuccessionOneDesignation = designations?.Find(y => y.ID == successionOne.ID)?.Name;
|
|||
|
|
|||
|
var successionTwo = new Employee();
|
|||
|
successionTwo = employees.Find(x => x.ID == plan.SuccessorTwoID);
|
|||
|
plan.SuccessionTwoName = successionTwo.Name;
|
|||
|
if (successionOne.Status == EnumEmployeeStatus.Discontinued)
|
|||
|
plan.IsDiscontinueTwo = true;
|
|||
|
else
|
|||
|
plan.IsDiscontinueTwo = false;
|
|||
|
plan.SuccessionTwoDesignation = designations?.Find(y => y.ID == successionTwo.ID)?.Name;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(plannings);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("deleteSuccessionPlanning")]
|
|||
|
public ActionResult DeleteSuccessionPlanning(SuccessionPlanning item)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_successionPlanningService.Delete(item.ID);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getSecondLineManagerData")]
|
|||
|
public ActionResult getSecondLineManagerData()
|
|||
|
{
|
|||
|
DataTable dt = new DataTable();
|
|||
|
dt.Columns.Add("EmployeeId", typeof(int));
|
|||
|
dt.Columns.Add("EmployeeNo", typeof(string));
|
|||
|
dt.Columns.Add("EmployeeName", typeof(string));
|
|||
|
dt.Columns.Add("LineManagerID", typeof(int));
|
|||
|
dt.Columns.Add("LineManager", typeof(string));
|
|||
|
dt.Columns.Add("EmpRating", typeof(double));
|
|||
|
dt.Columns.Add("LmRating", typeof(double));
|
|||
|
dt.Columns.Add("YEEmpComplete", typeof(string));
|
|||
|
dt.Columns.Add("YELMComplete", typeof(string));
|
|||
|
dt.Columns.Add("YeTotalObjectiveEmpMark", typeof(double));
|
|||
|
dt.Columns.Add("YeTotalObjectiveLmMark", typeof(double));
|
|||
|
|
|||
|
//List<SearchEmployee> oEmployees = null;
|
|||
|
List<Employee> myTeam = null;
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
try
|
|||
|
{
|
|||
|
List<Employee> allEmployees = new EmployeeService().GetAllEmps();
|
|||
|
//oEmployees = new SearchEmployeeService().GetTeam((int)currentUser.EmployeeID, EnumStatus.Active);
|
|||
|
List<Employee> oEmployees = new EmployeeService().GetSubordinatesByLineManager((int)currentUser.EmployeeID).FindAll(x => x.Status == EnumEmployeeStatus.Live);
|
|||
|
myTeam = oEmployees.ToList();
|
|||
|
|
|||
|
foreach (Employee emp in oEmployees)
|
|||
|
{
|
|||
|
foreach (Employee item in allEmployees.FindAll(x => x.LineManagerID == emp.ID).FindAll(x => x.Status == EnumEmployeeStatus.Live))
|
|||
|
{
|
|||
|
myTeam.Add(item);
|
|||
|
}
|
|||
|
}
|
|||
|
//PMPProcess oPMPProcess = _pmpProcessService.GetCurrentPMPYear(false);
|
|||
|
|
|||
|
List<ObjectiveSet> oObjectiveSets = _objectiveSetService.GetByPMPYear(_pmpProcessService.GetCurrentPMPYear(false).ID, null);
|
|||
|
|
|||
|
|
|||
|
DataRow dr = null;
|
|||
|
int count = 0;
|
|||
|
|
|||
|
foreach(Employee item in myTeam)
|
|||
|
{
|
|||
|
dr = dt.NewRow();
|
|||
|
dr["EmployeeId"] = item.ID;
|
|||
|
dr["EmployeeNo"] = item.EmployeeNo;
|
|||
|
dr["EmployeeName"] = item.Name;
|
|||
|
if(item.LineManagerID != null)
|
|||
|
{
|
|||
|
dr["LineManagerID"] = item.LineManagerID;
|
|||
|
dr["LineManager"] = allEmployees.Find(x => x.ID == item.LineManagerID).Name;
|
|||
|
}
|
|||
|
|
|||
|
ObjectiveSet objectiveSet = oObjectiveSets.Find(x => x.EmployeeID == item.ID);
|
|||
|
if(objectiveSet != null)
|
|||
|
{
|
|||
|
dr["EmpRating"] = objectiveSet.EMPOverallRating;
|
|||
|
dr["LmRating"] = objectiveSet.LMOverallRating;
|
|||
|
if(objectiveSet.YeTotalObjectiveEmpMark != null)
|
|||
|
dr["YeTotalObjectiveEmpMark"] = objectiveSet.YeTotalObjectiveEmpMark;
|
|||
|
if (objectiveSet.YeTotalObjectiveLmMark != null)
|
|||
|
dr["YeTotalObjectiveLmMark"] = objectiveSet.YeTotalObjectiveLmMark;
|
|||
|
|
|||
|
dr["YEEmpComplete"] = objectiveSet.YEEmpComplete.ToString().Replace('_', ' ');
|
|||
|
dr["YELMComplete"] = objectiveSet.YELMComplete.ToString().Replace('_', ' ');
|
|||
|
}
|
|||
|
|
|||
|
dt.Rows.Add(dr);
|
|||
|
count++;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(dt);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getPMSObjectiveProgressHistory/{objectiveID}/{employeeID}")]
|
|||
|
public ActionResult GetPMSObjectiveProgressHistory(int objectiveID, int employeeID)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
List<PMSObjectiveProgress> items = new List<PMSObjectiveProgress>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _pmsObjectiveProgressService.GetByObjectiveID(objectiveID, employeeID);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("savePMSObjectiveProgressHistory")]
|
|||
|
public ActionResult savePMSObjectiveProgressHistory(PMSObjectiveProgress item)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
|||
|
int ans;
|
|||
|
try
|
|||
|
{
|
|||
|
item.UpdateTime = DateTime.Now;
|
|||
|
item.CreatedBy = currentUser.UserID;
|
|||
|
item.CreatedDate = DateTime.Now;
|
|||
|
ans = _pmsObjectiveProgressService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost("uploadPMSObjectiveProgressHistoryWithAttachment")]
|
|||
|
[AllowAnonymous]
|
|||
|
public ActionResult uploadPMSObjectiveProgressHistoryWithAttachment()
|
|||
|
{
|
|||
|
PMSObjectiveProgressAttachment item = new PMSObjectiveProgressAttachment();
|
|||
|
string base64String = "";
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
var fdata = Request.Form.Files["fileData"];
|
|||
|
//Upload Image
|
|||
|
item.PMSObjectiveProgressID= Convert.ToInt32(Request.Form["pmsObjectiveProgressID"]);
|
|||
|
item.FileName = Convert.ToString(Request.Form["fileName"]);
|
|||
|
item.FileType = Convert.ToInt32(Request.Form["filetype"]);
|
|||
|
string employeeNo = Convert.ToString(Request.Form["employeeNo"]);
|
|||
|
|
|||
|
using (var ms = new MemoryStream())
|
|||
|
{
|
|||
|
fdata.CopyTo(ms);
|
|||
|
item.FileData = ms.ToArray();
|
|||
|
item.FileName = employeeNo.ToString() + "-" + fdata.FileName.ToString();//$" {Path.GetExtension(fdata.FileName)}";
|
|||
|
item.UploadTime = DateTime.Now;
|
|||
|
byte[] textAsBytes = ms.ToArray();
|
|||
|
this._pmsObjectiveProgressAttachmentService.Save(item);
|
|||
|
base64String = Convert.ToBase64String(textAsBytes);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return Ok(base64String);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("GetPMSObjectiveProgressHistoryWithAttachment/{pmsObjectiveProgressID}")]
|
|||
|
public ActionResult GetPMSObjectiveProgressHistoryWithAttachment(int pmsObjectiveProgressID)
|
|||
|
{
|
|||
|
PMSObjectiveProgressAttachment item = new PMSObjectiveProgressAttachment();
|
|||
|
|
|||
|
|
|||
|
item = this._pmsObjectiveProgressAttachmentService.GetbyPMSObjectiveProgressID(pmsObjectiveProgressID);
|
|||
|
if (item != null)
|
|||
|
{
|
|||
|
byte[] textAsBytes = (byte[])item.FileData;
|
|||
|
string base64String = "";
|
|||
|
if (item != null)
|
|||
|
{
|
|||
|
base64String = Convert.ToBase64String(textAsBytes);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(base64String);
|
|||
|
}
|
|||
|
else return Ok("");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|