เสร็จงานอนุมัติ ปรับเลื่อนเงินเดือน และ โควต้า
This commit is contained in:
@@ -23,15 +23,18 @@ 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_final_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
|
||||
@@ -164,13 +167,18 @@ namespace TodoAPI2.Models
|
||||
return newkey.Value;
|
||||
}
|
||||
|
||||
|
||||
public eva_adjust_quota_update_final_statusViewModel Update(int id,
|
||||
eva_adjust_quota_update_final_statusInputModel model, bool is_force_save, int? updateby)
|
||||
{
|
||||
var existingEntity = _repository.Get(id);
|
||||
|
||||
if (existingEntity != null)
|
||||
{
|
||||
if(model.quota_final_status == "Y" && existingEntity.quota_status != "Y")
|
||||
{
|
||||
throw new Exception("ผู้อนุมัติวงเงินที่กันไว้ คนแรก, ยังไม่ได้อนุมัติ วงเงินที่กันไว้");
|
||||
}
|
||||
|
||||
existingEntity.quota_final_status = model.quota_final_status;
|
||||
existingEntity.quota_final_status_date = DateTime.Now;
|
||||
existingEntity.quota_final_status_by = updateby;
|
||||
@@ -183,6 +191,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