This commit is contained in:
nakorn
2021-10-13 15:49:07 +07:00
parent 40de9ca053
commit 07d70e4a66
2 changed files with 102 additions and 0 deletions

View File

@@ -78,8 +78,59 @@ namespace TodoAPI2.Models
return i;
}
private (decimal?, string) getData(eva_create_evaluation_detailEntity detail)
{
if (detail.status_supervisor2A == "Y")
{
return (detail.score_supervisor2A, detail.level_score_supervisor2A);
}
else if (detail.status_supervisor1A == "Y")
{
return (detail.score_supervisor1A, detail.level_score_supervisor1A);
}
else if (detail.status_supervisor == "Y")
{
return (detail.score_supervisor, detail.level_score_supervisor);
}
else if (detail.status_chief == "Y")
{
return (detail.score_chief, detail.level_score_chief);
}
else
{
return (0, null);
}
}
private void ReloadPostponement(int? adjust_postponement_id)
{
var rawData = from i in _repository.Context.eva_adjust_postponement_detail
where i.adjust_postponement_id == adjust_postponement_id
select i;
var baseScore = from i in _repository.Context.eva_adjust_postponement_detail
join j in _repository.Context.eva_adjust_postponement on i.adjust_postponement_id equals j.id
join k in _repository.Context.eva_create_evaluation on j.create_evaluation_id equals k.id
join m in _repository.Context.eva_create_evaluation_detail on k.id equals m.create_evaluation_id
where i.adjust_postponement_id == adjust_postponement_id
&& m.employee_id == i.employee_id
select m;
foreach(var x in rawData)
{
var y = (from i in baseScore
where i.employee_id == x.employee_id
select getData(i)).FirstOrDefault();
x.level_score_final = y.Item2;
x.score_final = y.Item1;
}
_repository.Context.SaveChanges();
}
public List<eva_adjust_postponement_detail_normal_02ViewModel> GetListByadjust_postponement_id(int? adjust_postponement_id)
{
ReloadPostponement(adjust_postponement_id);
var model = new eva_adjust_postponement_detail_normal_02SearchModel();
model.adjust_postponement_id = adjust_postponement_id;
return GetListBySearch(model);

View File

@@ -78,8 +78,59 @@ namespace TodoAPI2.Models
return i;
}
private (decimal?, string) getData(eva_create_evaluation_detailEntity detail)
{
if (detail.status_supervisor2A == "Y")
{
return (detail.score_supervisor2A, detail.level_score_supervisor2A);
}
else if (detail.status_supervisor1A == "Y")
{
return (detail.score_supervisor1A, detail.level_score_supervisor1A);
}
else if (detail.status_supervisor == "Y")
{
return (detail.score_supervisor, detail.level_score_supervisor);
}
else if (detail.status_chief == "Y")
{
return (detail.score_chief, detail.level_score_chief);
}
else
{
return (0, null);
}
}
private void ReloadPostponement(int? adjust_postponement_quota_id)
{
var rawData = from i in _repository.Context.eva_adjust_postponement_detail
where i.adjust_postponement_quota_id == adjust_postponement_quota_id
select i;
var baseScore = from i in _repository.Context.eva_adjust_postponement_detail
join j in _repository.Context.eva_adjust_postponement on i.adjust_postponement_id equals j.id
join k in _repository.Context.eva_create_evaluation on j.create_evaluation_id equals k.id
join m in _repository.Context.eva_create_evaluation_detail on k.id equals m.create_evaluation_id
where i.adjust_postponement_quota_id == adjust_postponement_quota_id
&& m.employee_id == i.employee_id
select m;
foreach (var x in rawData)
{
var y = (from i in baseScore
where i.employee_id == x.employee_id
select getData(i)).FirstOrDefault();
x.level_score_final = y.Item2;
x.score_final = y.Item1;
}
_repository.Context.SaveChanges();
}
public List<eva_adjust_postponement_detail_quota_02ViewModel> GetListByadjust_postponement_quota_id(int? adjust_postponement_quota_id)
{
ReloadPostponement(adjust_postponement_quota_id);
var model = new eva_adjust_postponement_detail_quota_02SearchModel();
model.adjust_postponement_quota_id = adjust_postponement_quota_id;
return GetListBySearch(model);