เสร็จงานอนุมัติ ปรับเลื่อนเงินเดือน และ โควต้า

This commit is contained in:
nakorn
2022-05-06 07:54:55 +07:00
parent bfb9c80fac
commit ccef30e588
15 changed files with 146 additions and 19 deletions

View File

@@ -23,6 +23,8 @@ namespace TodoAPI2.Models
rep_eva_savemessageReportRequestModel setModelFor_rep_eva_savemessageReport(rep_eva_savemessageReportRequestModel model);
DataContext GetContext();
void updateAllpostponement(int id);
}
}

View File

@@ -70,6 +70,39 @@ namespace TodoAPI2.Models
return GetDto(entity);
}
private string isStringNull(string a, string b)
{
if (!string.IsNullOrEmpty(a)) return a;
else return b;
}
private T isNull<T>(T a, T b)
{
if (a != null) return a;
else return b;
}
public void updateAllpostponement(int id)
{
var entity = _repository.Get(id);
var postponement = from x in _repository.Context.eva_adjust_postponement
where x.fiscal_year == entity.fiscal_year
&& x.theRound == entity.theRound
&& x.id != entity.id
select x;
foreach(var i in postponement)
{
//i.postponement_status = entity.postponement_status;
i.quota_status = entity.quota_status;
i.quota_final_status = entity.quota_final_status;
}
_repository.Context.SaveChanges();
}
public eva_adjust_postponement_quotaWithSelectionViewModel GetWithSelection(int id)
{
var entity = _repository.Get(id);
@@ -84,6 +117,19 @@ namespace TodoAPI2.Models
select new external_linkageViewModel { external_id = x.theRound, external_name = x.theRound.ToString() }
).Distinct().OrderByDescending(x => x.external_id).ToList();
var postponement = from x in _repository.Context.eva_adjust_postponement
join e in emp.GetAllEmployee() on isNull(x.managed_by, x.postponement_status_by) equals e.id
join v in ext.GetAgreeDisagree4() on isStringNull(x.postponement_status, "W") equals v.external_code
join c in _repository.Context.eva_create_evaluation on x.create_evaluation_id equals c.id
join d in _repository.Context.eva_evaluation_group on c.evaluation_group_id equals d.id
where x.fiscal_year == entity.fiscal_year
&& x.theRound == entity.theRound
&& x.id != entity.id
select d.thegroup + " โดย " + e.fullname + " " + v.external_name;
i.approve_status = postponement.ToList();
return i;
}
public eva_adjust_postponement_quotaWithSelectionViewModel GetBlankItem()

View File

@@ -10,5 +10,7 @@ namespace TodoAPI2.Models
public List<external_employeeViewModel> item_managed_by { get; set; }
public List<external_linkageViewModel> item_fiscal_year_search { get; set; }
public List<external_linkageViewModel> item_theRound_search { get; set; }
public List<string> approve_status { get; set; }
}
}
}