แก้ Change Request OP 2599

This commit is contained in:
Nakorn Rientrakrunchai
2020-07-22 11:50:27 +07:00
parent 764cd3c398
commit f9a4d7e0b7
5 changed files with 63 additions and 14 deletions

View File

@@ -18,8 +18,8 @@ namespace TodoAPI2.Models
List<eva_adjust_postponement_normalViewModel> GetListBySearch(eva_adjust_postponement_normalSearchModel model);
string UpdateMultiple(List<eva_adjust_postponement_normalInputModel> model);
eva_adjust_postponement_normalWithSelectionViewModel GetWithSelection(int id);
eva_adjust_postponement_normalWithSelectionViewModel GetBlankItem();
eva_adjust_postponement_normalWithSelectionViewModel GetWithSelection(int id, int emp_id);
eva_adjust_postponement_normalWithSelectionViewModel GetBlankItem(int emp_id);

View File

@@ -22,6 +22,7 @@ namespace TodoAPI2.Models
public int? org_id { get; set; }
public int? emp_id { get; set; }
}
}

View File

@@ -72,11 +72,17 @@ namespace TodoAPI2.Models
return GetDto(entity);
}
public eva_adjust_postponement_normalWithSelectionViewModel GetWithSelection(int id)
public eva_adjust_postponement_normalWithSelectionViewModel GetWithSelection(int id, int emp_id)
{
var avaliable_eva = (from j in _repository.Context.eva_create_evaluation
where j.employee_id == emp_id
select j.id).ToList();
var entity = _repository.Get(id);
var i = Mapper.Map<eva_adjust_postponement_normalWithSelectionViewModel>(entity);
i.item_create_evaluation_id = create.GetListBySearch(new eva_create_evaluationSearchModel());
var temp = create.GetListBySearch(new eva_create_evaluationSearchModel());
i.item_create_evaluation_id = (from x in temp where avaliable_eva.Contains(x.id) select x).ToList();
var all_emp = emp.GetListByemployee_type(null, null);
i.item_managed_by = all_emp.ToList();
i.item_org_id = (from x in ext.GetDepartmentData() select x).ToList();
@@ -84,10 +90,15 @@ namespace TodoAPI2.Models
return i;
}
public eva_adjust_postponement_normalWithSelectionViewModel GetBlankItem()
public eva_adjust_postponement_normalWithSelectionViewModel GetBlankItem(int emp_id)
{
var avaliable_eva = (from j in _repository.Context.eva_create_evaluation
where j.employee_id == emp_id
select j.id).ToList();
var i = new eva_adjust_postponement_normalWithSelectionViewModel();
i.item_create_evaluation_id = create.GetListBySearch(new eva_create_evaluationSearchModel());
var temp = create.GetListBySearch(new eva_create_evaluationSearchModel());
i.item_create_evaluation_id = (from x in temp where avaliable_eva.Contains(x.id) select x).ToList();
var all_emp = emp.GetListByemployee_type(null, null);
i.item_managed_by = all_emp.ToList();
i.item_org_id = (from x in ext.GetDepartmentData() select x).ToList();
@@ -108,6 +119,10 @@ namespace TodoAPI2.Models
var all_emp = emp.GetListByemployee_type(null, null);
var dep = ext.GetDepartmentData();
var avaliable_eva = (from j in _repository.Context.eva_create_evaluation
where j.employee_id == model.emp_id
select j.id).ToList();
var data = (
from m_eva_adjust_postponement_normal in _repository.Context.eva_adjust_postponement
@@ -132,6 +147,7 @@ namespace TodoAPI2.Models
from fk_eva_evaluation_groupResult5 in eva_evaluation_groupResult5.DefaultIfEmpty()
where 1==1
&& avaliable_eva.Contains(m_eva_adjust_postponement_normal.create_evaluation_id.Value)
//&& (m_eva_adjust_postponement_normal.id == model.id || !model.id.HasValue)
&& (m_eva_adjust_postponement_normal.fiscal_year == model.fiscal_year || !model.fiscal_year.HasValue)
&& (m_eva_adjust_postponement_normal.theRound == model.theRound || !model.theRound.HasValue)