1144 lines
35 KiB
C#
1144 lines
35 KiB
C#
|
using Microsoft.AspNetCore.Http;
|
|||
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using HRM.BO;
|
|||
|
using HRM.BO.Configuration;
|
|||
|
using Microsoft.Extensions.Options;
|
|||
|
using System.Text;
|
|||
|
using HRM.DA;
|
|||
|
|
|||
|
namespace HRM.UI.Controllers.Workflow
|
|||
|
{
|
|||
|
[Route("api/Workflow")]
|
|||
|
[ApiController]
|
|||
|
public class WorkflowController : ControllerBase
|
|||
|
{
|
|||
|
private readonly IDelegateResponsibilityService _delegateResponsibilityService;
|
|||
|
private readonly IWFMovementTranService _wfMovementTranService;
|
|||
|
private readonly IWFSetupService _wfSetupService;
|
|||
|
private readonly IWFTypeService _wfTypeService;
|
|||
|
private readonly IWFRuleService _wfruleService;
|
|||
|
private readonly IProfileUpdateRequestService _profileUpdateRequestService;
|
|||
|
private readonly IOptions<AdminPendingJob> _adminPendingJob;
|
|||
|
|
|||
|
public WorkflowController(IDelegateResponsibilityService delegateResponsibilityService,
|
|||
|
IWFMovementTranService wfMovementTranService,
|
|||
|
IWFSetupService wfSetupService,
|
|||
|
IWFTypeService wfTypeService, IWFRuleService wfrulesrv,
|
|||
|
IProfileUpdateRequestService profileUpdateRequestService,
|
|||
|
IOptions<AdminPendingJob> adminPendingJob)
|
|||
|
{
|
|||
|
this._delegateResponsibilityService = delegateResponsibilityService;
|
|||
|
this._wfMovementTranService = wfMovementTranService;
|
|||
|
this._wfSetupService = wfSetupService;
|
|||
|
this._wfTypeService = wfTypeService;
|
|||
|
this._wfruleService = wfrulesrv;
|
|||
|
_profileUpdateRequestService = profileUpdateRequestService;
|
|||
|
this._adminPendingJob = adminPendingJob;
|
|||
|
}
|
|||
|
|
|||
|
// DelegateResponsibility
|
|||
|
[HttpGet("getDelegateResponsibilityByEmpId/{employeeId}")]
|
|||
|
public ActionResult GetDelegateResponsibilityByEmpId(int employeeId)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|||
|
DelegateResponsibility item = new DelegateResponsibility();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _delegateResponsibilityService.Get(employeeId, payrollTypeId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getDelegateResponsibilityListWithPayrollType")]
|
|||
|
public ActionResult GetDelegateResponsibilityListWithPayrollType()
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|||
|
List<DelegateResponsibility> items = new List<DelegateResponsibility>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _delegateResponsibilityService.GetWithPayrollType(payrollTypeId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getDelegateResponsibilityById/{ids}")]
|
|||
|
public ActionResult GetDelegateResponsibilityById(string ids)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|||
|
List<DelegateResponsibility> items = new List<DelegateResponsibility>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _delegateResponsibilityService.Get(ids, payrollTypeId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getDelegateResponsibilityListByEmpId/{employeeId}")]
|
|||
|
public ActionResult GetDelegateResponsibilityListByEmpId(int employeeId)
|
|||
|
{
|
|||
|
List<DelegateResponsibility> items = new List<DelegateResponsibility>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _delegateResponsibilityService.GetByEmployeeID(employeeId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getDelegateResponsibility/{id}")]
|
|||
|
public ActionResult GetDelegateResponsibility(int id)
|
|||
|
{
|
|||
|
DelegateResponsibility item = new DelegateResponsibility();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _delegateResponsibilityService.Get(id);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveDelegateResponsibility")]
|
|||
|
public ActionResult SaveDelegateResponsibility(DelegateResponsibility item)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_delegateResponsibilityService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("savewfRule")]
|
|||
|
public ActionResult savewfRule(WFRule item)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
|
|||
|
|
|||
|
if (item.IsNew == true)
|
|||
|
{
|
|||
|
item.CreatedBy = currentUser.UserID;
|
|||
|
item.CreatedDate = DateTime.Today;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
item.ModifiedBy = currentUser.UserID;
|
|||
|
item.ModifiedDate = DateTime.Today;
|
|||
|
}
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
this._wfruleService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getwfRule/{id}")]
|
|||
|
public ActionResult getwfRules(int id)
|
|||
|
{
|
|||
|
WFRule item = null;
|
|||
|
try
|
|||
|
{
|
|||
|
item = _wfruleService.Get(id);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[HttpGet("getAllwfRules")]
|
|||
|
public ActionResult getAllwfRules()
|
|||
|
{
|
|||
|
List<WFRule> orules = new List<WFRule>();
|
|||
|
try
|
|||
|
{
|
|||
|
orules = _wfruleService.Get();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(orules);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveDelegateResponsibilityList")]
|
|||
|
public ActionResult SaveDelegateResponsibilityList(List<DelegateResponsibility> items)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_delegateResponsibilityService.Save(items);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("deleteDelegateResponsibility")]
|
|||
|
public ActionResult DeleteDelegateResponsibility(string id)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_delegateResponsibilityService.Delete(id);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("updateDelegateResponsibilityReadStatus")]
|
|||
|
public ActionResult UpdateDelegateResponsibilityReadStatus(int objId)
|
|||
|
{
|
|||
|
bool isRead = true;
|
|||
|
try
|
|||
|
{
|
|||
|
_delegateResponsibilityService.UpdateReadStatus(objId, isRead);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("updateDelegateResponsibilityStatus")]
|
|||
|
public ActionResult UpdateDelegateResponsibilityStatus(int objId)
|
|||
|
{
|
|||
|
EnumStatus status = EnumStatus.Active;
|
|||
|
try
|
|||
|
{
|
|||
|
_delegateResponsibilityService.UpdateStatus(objId, status);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
// WFMovementTran
|
|||
|
[HttpGet("getWFMovementTranById/{id}")]
|
|||
|
public ActionResult GetWFMovementTranById(int id)
|
|||
|
{
|
|||
|
WFMovementTran item = new WFMovementTran();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _wfMovementTranService.Get(id);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getReceivedWFNext/{wfSetupId}/{objectID}")]
|
|||
|
public ActionResult GetReceivedWFNext(int wfSetupId, int objectID)
|
|||
|
{
|
|||
|
WFMovementNext item = new WFMovementNext();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _wfMovementTranService.GetReceivedWFNext(wfSetupId, objectID);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getAllWFMovementTran")]
|
|||
|
public ActionResult GetAllWFMovementTran()
|
|||
|
{
|
|||
|
List<WFMovementTran> items = new List<WFMovementTran>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfMovementTranService.Get();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getWFMovementTask/{movementTaskId}")]
|
|||
|
public ActionResult GetWFMovementTask(int movementTaskId)
|
|||
|
{
|
|||
|
WFMovementTask item = new WFMovementTask();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _wfMovementTranService.GetWFMovementTask(movementTaskId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("get4WFMovementTaskById/{id}")]
|
|||
|
public ActionResult Get4WFMovementTaskById(int id)
|
|||
|
{
|
|||
|
List<WFMovementTask> items = new List<WFMovementTask>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfMovementTranService.Get4WFMovementTask(id);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("get4WFMovementNextByTranId/{tranId}")]
|
|||
|
public ActionResult Get4WFMovementNextByTranId(int tranId)
|
|||
|
{
|
|||
|
List<WFMovementNext> items = new List<WFMovementNext>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfMovementTranService.Get4WFMovementNext(tranId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("get4WFMovementNextWithTranID/{uniqueNumber}")]
|
|||
|
public ActionResult Get4WFMovementNextWithTranID(int uniqueNumber)
|
|||
|
{
|
|||
|
List<WFMovementNext> items = new List<WFMovementNext>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfMovementTranService.Get4WFMovementNextWithTranID(uniqueNumber);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("initiatorNodeOrganogramBasic/{uniqueNumber}")]
|
|||
|
public ActionResult InitiatorNodeOrganogramBasic(int uniqueNumber)
|
|||
|
{
|
|||
|
OrganogramBasic item = new OrganogramBasic();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _wfMovementTranService.InitiatorNode(uniqueNumber);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("initiatorNodeWFMovementTran/{uniqueNumber}")]
|
|||
|
public ActionResult InitiatorNodeWFMovementTran(int uniqueNumber)
|
|||
|
{
|
|||
|
WFMovementTran item = new WFMovementTran();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _wfMovementTranService.InitiatorTran(uniqueNumber);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
//[HttpGet("getUniqueNumber")]
|
|||
|
//public ActionResult GetUniqueNumber()
|
|||
|
//{
|
|||
|
// int ans;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// ans = _wfMovementTranService.GetUniqueNumber();
|
|||
|
// }
|
|||
|
// catch (Exception e)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(ans);
|
|||
|
//}
|
|||
|
|
|||
|
[HttpGet("receivedItems/{employeeId}")]
|
|||
|
public ActionResult ReceivedItems(int employeeId)
|
|||
|
{
|
|||
|
List<WFMovementTran> items = new List<WFMovementTran>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfMovementTranService.ReceivedItems(employeeId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("receivedItemsCount/{employeeId}")]
|
|||
|
public ActionResult ReceivedItemsCount(int employeeId)
|
|||
|
{
|
|||
|
int ans;
|
|||
|
try
|
|||
|
{
|
|||
|
ans = _wfMovementTranService.ReceivedItemsCount(employeeId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getPendingJob/{employeeId}")]
|
|||
|
public ActionResult GetPendingJob(int employeeId)
|
|||
|
{
|
|||
|
List<PendingItemDTO> items = new List<PendingItemDTO>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfMovementTranService.GetPendingJob(employeeId);
|
|||
|
|
|||
|
bool isHrmPRoject = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.UI, "hrinterface", "hnmprojectnotifi");
|
|||
|
if(isHrmPRoject== true)
|
|||
|
{
|
|||
|
foreach (var item in items)
|
|||
|
{
|
|||
|
StringBuilder resultBuilder = new StringBuilder();
|
|||
|
bool insideAngleBrackets = false;
|
|||
|
foreach (char c in item.ObjectDescription)
|
|||
|
{
|
|||
|
if (c == '<')
|
|||
|
{
|
|||
|
insideAngleBrackets = true;
|
|||
|
}
|
|||
|
else if (c == '>')
|
|||
|
{
|
|||
|
insideAngleBrackets = false;
|
|||
|
}
|
|||
|
else if (!insideAngleBrackets)
|
|||
|
{
|
|||
|
resultBuilder.Append(c);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
item.ObjectDescription = resultBuilder.ToString();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getAdminPendingJob")]
|
|||
|
public ActionResult getAdminPendingJob()
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
|||
|
List<PendingItemDTO> items = new List<PendingItemDTO>();
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
if (currentUser.LoginID == this._adminPendingJob.Value.Profile)
|
|||
|
{
|
|||
|
int totalRequest = _profileUpdateRequestService.TotalProfileUpdateRequested();
|
|||
|
PendingItemDTO item = new PendingItemDTO();
|
|||
|
item.Name = "Profile Update";
|
|||
|
item.Link = "/ess/profile-update-admin";
|
|||
|
item.ObjectDescription = $"You have {totalRequest} pending profile update request";
|
|||
|
item.SENTTIME = DateTime.Today;
|
|||
|
items.Add(item);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[HttpGet("getPendingItems/{employeeId}")]
|
|||
|
public ActionResult GetPendingItems(int employeeId)
|
|||
|
{
|
|||
|
List<WFMovementNext> items = new List<WFMovementNext>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfMovementTranService.GetPendingItems(employeeId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("GetReceivedItems/{wftypeid}/{employeeid}")]
|
|||
|
public ActionResult GetReceivedItems(string wftypeid, string employeeid)
|
|||
|
{
|
|||
|
int? wfid = GlobalFunctions.GetApiDefaultIntData(wftypeid);
|
|||
|
int? empid = GlobalFunctions.GetApiDefaultIntData(employeeid);
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
System.Data.DataTable oitems = null;
|
|||
|
try
|
|||
|
{
|
|||
|
oitems = _wfMovementTranService.GetReceivedItems((int) currentUser.PayrollTypeID, wfid, empid);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(oitems);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[HttpGet("GetApproversName/{tranID}/{empID}")]
|
|||
|
public ActionResult GetApproversName(int tranid, int empid)
|
|||
|
{
|
|||
|
string str = "";
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
str = _wfMovementTranService.GetApproversName(tranid, (int) currentUser.EmployeeID);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(str);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[HttpGet("getFlowHistory/{tranID}/{uniqueNumber}")]
|
|||
|
public ActionResult getFlowHistory(int? tranid, int? uniqueNumber)
|
|||
|
{
|
|||
|
List<WFFlowHistory> items = new List<WFFlowHistory>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfMovementTranService.GetFlowHistories(tranid, uniqueNumber);
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getFlowHistoriesByObjectID/{objectId}/{wfTypeId}/{employeeId}")]
|
|||
|
public ActionResult GetFlowHistoriesByObjectID(int? objectId, int wfTypeId,int employeeId)
|
|||
|
{
|
|||
|
List<WFFlowHistory> items = new List<WFFlowHistory>();
|
|||
|
try
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
if (employeeId == 0)
|
|||
|
employeeId = (int)currentUser.EmployeeID;
|
|||
|
items = _wfMovementTranService.GetFlowHistoriesByObjectID(objectId, wfTypeId, employeeId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[HttpGet("getNotificationItems/{employeeId}")]
|
|||
|
public ActionResult GetNotificationItems(int employeeId)
|
|||
|
{
|
|||
|
List<WFMovementTask> items = new List<WFMovementTask>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfMovementTranService.GetNotificationItems(employeeId);
|
|||
|
bool isHrmPRoject = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.UI, "hrinterface", "hnmprojectnotifi");
|
|||
|
if(isHrmPRoject== true)
|
|||
|
{
|
|||
|
foreach (var item in items)
|
|||
|
{
|
|||
|
StringBuilder resultBuilder = new StringBuilder();
|
|||
|
bool insideAngleBrackets = false;
|
|||
|
foreach (char c in item.Description)
|
|||
|
{
|
|||
|
if (c == '<')
|
|||
|
{
|
|||
|
insideAngleBrackets = true;
|
|||
|
}
|
|||
|
else if (c == '>')
|
|||
|
{
|
|||
|
insideAngleBrackets = false;
|
|||
|
}
|
|||
|
else if (!insideAngleBrackets)
|
|||
|
{
|
|||
|
resultBuilder.Append(c);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
item.Description = resultBuilder.ToString();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getNotificationItemCount/{employeeId}")]
|
|||
|
public ActionResult GetNotificationItemCount(int employeeId)
|
|||
|
{
|
|||
|
int ans;
|
|||
|
try
|
|||
|
{
|
|||
|
ans = _wfMovementTranService.GetNotificationItemCount(employeeId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getAllItems/{uniqueNumber}")]
|
|||
|
public ActionResult GetAllItems(int uniqueNumber)
|
|||
|
{
|
|||
|
List<WFMovementTran> items = new List<WFMovementTran>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfMovementTranService.GetAllItems(uniqueNumber);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getAllWFMovementTasks")]
|
|||
|
public ActionResult GetAllWFMovementTasks()
|
|||
|
{
|
|||
|
List<WFMovementTask> items = new List<WFMovementTask>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfMovementTranService.GetWFMovementTasks();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getWFMovementByWFType/{wftTypeId}")]
|
|||
|
public ActionResult GetWFMovementByWFType(int wftTypeId)
|
|||
|
{
|
|||
|
List<WFMovementTran> items = new List<WFMovementTran>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfMovementTranService.GetWFMovementByWFType(wftTypeId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
[HttpGet("pendingLoanAndWorkflowCount/{empid}")]
|
|||
|
public ActionResult pendingLoanAndWorkflowCount(int empid)
|
|||
|
{
|
|||
|
int ncount = 0;
|
|||
|
try
|
|||
|
{
|
|||
|
ncount = new WFMovementTranService().pendingLoanAndWorkflowCount(empid);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ncount);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//[HttpPost]
|
|||
|
//[Route("saveWFMovementTran")]
|
|||
|
//public ActionResult SaveWFMovementTran(WFMovementTran item)
|
|||
|
//{
|
|||
|
// try
|
|||
|
// {
|
|||
|
// _wfMovementTranService.Save(item);
|
|||
|
// }
|
|||
|
// catch (Exception e)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok();
|
|||
|
//}
|
|||
|
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("ForceComplete")]
|
|||
|
public ActionResult ForceComplete(List<WFMovementTran> otrans)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_wfMovementTranService.ForceComplete(otrans);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("deleteWFMovementTran")]
|
|||
|
public ActionResult DeleteWFMovementTran(int id)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_wfMovementTranService.Delete(id);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
//[HttpPost]
|
|||
|
//[Route("submitWFMovementTran")]
|
|||
|
//public ActionResult SubmitWFMovementTran(WFMovementTran item)
|
|||
|
//{
|
|||
|
// WFMovementTran item2 = new WFMovementTran();
|
|||
|
// try
|
|||
|
// {
|
|||
|
// _wfMovementTranService.Submit(item, item2);
|
|||
|
// }
|
|||
|
// catch (Exception e)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok();
|
|||
|
//}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("updateSysNotification")]
|
|||
|
public ActionResult UpdateSysNotification(WFMovementTask otask)
|
|||
|
{
|
|||
|
bool status = true;
|
|||
|
try
|
|||
|
{
|
|||
|
_wfMovementTranService.UpdateSysNotification(otask.ID, status);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("update_MovementNext")]
|
|||
|
public ActionResult Update_MovementNext(int tranId)
|
|||
|
{
|
|||
|
int newEmployeeID = 1;
|
|||
|
int empID = 1;
|
|||
|
int NodeID = 1;
|
|||
|
string remarks = "";
|
|||
|
try
|
|||
|
{
|
|||
|
_wfMovementTranService.Update_MovementNext(tranId, newEmployeeID, empID, remarks);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
// WFSetup
|
|||
|
|
|||
|
[HttpGet("getWFSetupById/{id}")]
|
|||
|
public ActionResult GetWFSetupById(int id)
|
|||
|
{
|
|||
|
WFSetup item = new WFSetup();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _wfSetupService.Get(id);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getWFSetupByWFTypeID/{type}")]
|
|||
|
public ActionResult GetWFSetupByWFTypeID(int type)
|
|||
|
{
|
|||
|
WFSetup item = new WFSetup();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _wfSetupService.GetByWFTypeID(type);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[HttpGet("getAllWFSetup")]
|
|||
|
public ActionResult GetAllWFSetup()
|
|||
|
{
|
|||
|
List<WFSetup> items = new List<WFSetup>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfSetupService.Get();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("get4WFRuleDD/{ruleId}")]
|
|||
|
public ActionResult Get4WFRuleDD(int ruleId)
|
|||
|
{
|
|||
|
List<WFRuleDetailDesignation> items = new List<WFRuleDetailDesignation>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfSetupService.Get4WFRuleDD(ruleId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("get4WFRuleNode/{ruleId}")]
|
|||
|
public ActionResult Get4WFRuleNode(int ruleId)
|
|||
|
{
|
|||
|
List<WFRuleDetailNode> items = new List<WFRuleDetailNode>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfSetupService.Get4WFRuleNode(ruleId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("get4WFSetupRule/{id}")]
|
|||
|
public ActionResult Get4WFSetupRule(int id)
|
|||
|
{
|
|||
|
List<WFSetupRule> items = new List<WFSetupRule>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfSetupService.Get4WFSetupRule(id);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("get4WFRuleDetailOS/{ruleId}")]
|
|||
|
public ActionResult Get4WFRuleDetailOS(int ruleId)
|
|||
|
{
|
|||
|
List<WFRuleDetailOS> items = new List<WFRuleDetailOS>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfSetupService.Get4WFRuleDetailOS(ruleId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("get4WFRuleDetailManual/{ruleId}")]
|
|||
|
public ActionResult Get4WFRuleDetailManual(int ruleId)
|
|||
|
{
|
|||
|
List<WFRuleDetailManual> items = new List<WFRuleDetailManual>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfSetupService.Get4WFRuleDetailManual(ruleId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveWFSetup")]
|
|||
|
public ActionResult SaveWFSetup(WFSetup wsSetup)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_wfSetupService.Save(wsSetup);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("deleteWFSetup")]
|
|||
|
public ActionResult DeleteWFSetup(int id)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_wfSetupService.Delete(id);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("deleteWFRule")]
|
|||
|
public ActionResult deleteWFRule(WFRule orule)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_wfruleService.Delete(orule.ID);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
// WFType
|
|||
|
[HttpGet("getWFType/{id}")]
|
|||
|
public ActionResult GetWFType(int id)
|
|||
|
{
|
|||
|
WFType item = new WFType();
|
|||
|
try
|
|||
|
{
|
|||
|
item = _wfTypeService.Get(id);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(item);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[HttpGet("getAllwfRulesByTypeID/{wfTypeID}")]
|
|||
|
public ActionResult getAllwfRulesByTypeID(int wfTypeID)
|
|||
|
{
|
|||
|
List<WFRule> items = new List<WFRule>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfruleService.GetRules(wfTypeID);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getAllWFType")]
|
|||
|
public ActionResult GetAllWFType()
|
|||
|
{
|
|||
|
List<WFType> items = new List<WFType>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _wfTypeService.Get();
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveWFType")]
|
|||
|
public ActionResult SaveWFType(WFSetup item)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_wfSetupService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("deleteWFType")]
|
|||
|
public ActionResult DeleteWFType(int id)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_wfSetupService.Delete(id);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok();
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet("getWfTranByObjectId/{objectId}/{wfTypeId}/{wfruleId}")]
|
|||
|
public ActionResult GetWfTranByObjectId(int objectId, int wfTypeId, int wfruleId)
|
|||
|
{
|
|||
|
WFMovementTran wftran = null;
|
|||
|
try
|
|||
|
{
|
|||
|
wftran = _wfMovementTranService.GetWfTranByObjectId(objectId, wfTypeId, wfruleId);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(wftran);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|