เสร็จงานอนุมัติ ปรับเลื่อนเงินเดือน และ โควต้า
This commit is contained in:
@@ -23,16 +23,19 @@ namespace TodoAPI2.Models
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
private Ieva_adjust_postponement_quotaService quotaStatus;
|
||||
|
||||
public eva_adjust_quota_update_statusService(IBaseRepository2<eva_adjust_postponementEntity, int> repository,
|
||||
IMyDatabase mydb,
|
||||
Iexternal_linkageService inext,
|
||||
Iexternal_employeeService inemp)
|
||||
Iexternal_employeeService inemp,
|
||||
Ieva_adjust_postponement_quotaService inquotaStatus)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
quotaStatus = inquotaStatus;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
@@ -165,12 +168,26 @@ namespace TodoAPI2.Models
|
||||
return newkey.Value;
|
||||
}
|
||||
|
||||
|
||||
public eva_adjust_quota_update_statusViewModel Update(int id, eva_adjust_quota_update_statusInputModel model, bool is_force_save, int? updateby)
|
||||
{
|
||||
var existingEntity = _repository.Get(id);
|
||||
|
||||
if (existingEntity != null)
|
||||
{
|
||||
if (model.quota_status == "Y")
|
||||
{
|
||||
var postponement = from x in _repository.Context.eva_adjust_postponement
|
||||
where x.fiscal_year == existingEntity.fiscal_year
|
||||
&& x.theRound == existingEntity.theRound
|
||||
&& x.id != existingEntity.id
|
||||
&& x.postponement_status != "Y"
|
||||
select x;
|
||||
if (postponement.Count() > 0)
|
||||
{
|
||||
throw new Exception("ยังมีบางหน่วยงาน ยังไม่ได้อนุมัติ ปรับเลื่อนค่าตอบแทน");
|
||||
}
|
||||
}
|
||||
|
||||
existingEntity.quota_status = model.quota_status;
|
||||
existingEntity.quota_status_date = DateTime.Now;
|
||||
existingEntity.quota_status_by = updateby;
|
||||
@@ -184,6 +201,9 @@ namespace TodoAPI2.Models
|
||||
}
|
||||
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
|
||||
quotaStatus.updateAllpostponement(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user