รวม code ส่งเข้า ZD
This commit is contained in:
@@ -64,22 +64,28 @@ namespace TodoAPI2.Models
|
||||
}
|
||||
public eva_create_evaluationWithSelectionViewModel GetWithSelection(int id)
|
||||
{
|
||||
var all_emp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
var entity = _repository.Get(id);
|
||||
var i = Mapper.Map<eva_create_evaluationWithSelectionViewModel>(entity);
|
||||
i.item_performance_plan_id = (from x in _repository.Context.eva_performance_plan select x).ToList();
|
||||
i.item_employee_id = emp.GetListByemployee_type(null, null);
|
||||
i.item_employee_id = all_emp;
|
||||
i.item_evaluation_group_id = (from x in _repository.Context.eva_evaluation_group select x).ToList();
|
||||
|
||||
i.item_supervisor1_id = all_emp;
|
||||
i.item_supervisor2_id = all_emp;
|
||||
|
||||
return i;
|
||||
}
|
||||
public eva_create_evaluationWithSelectionViewModel GetBlankItem()
|
||||
{
|
||||
var all_emp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
var i = new eva_create_evaluationWithSelectionViewModel();
|
||||
i.item_performance_plan_id = (from x in _repository.Context.eva_performance_plan select x).ToList();
|
||||
i.item_employee_id = emp.GetListByemployee_type(null, null);
|
||||
i.item_employee_id = all_emp;
|
||||
i.item_evaluation_group_id = (from x in _repository.Context.eva_evaluation_group select x).ToList();
|
||||
|
||||
i.item_supervisor1_id = all_emp;
|
||||
i.item_supervisor2_id = all_emp;
|
||||
|
||||
return i;
|
||||
}
|
||||
@@ -93,6 +99,8 @@ namespace TodoAPI2.Models
|
||||
|
||||
public List<eva_create_evaluationViewModel> GetListBySearch(eva_create_evaluationSearchModel model)
|
||||
{
|
||||
var all_emp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
var data = (
|
||||
from m_eva_create_evaluation in _repository.Context.eva_create_evaluation
|
||||
|
||||
@@ -100,7 +108,7 @@ namespace TodoAPI2.Models
|
||||
into eva_performance_planResult1
|
||||
from fk_eva_performance_planResult1 in eva_performance_planResult1.DefaultIfEmpty()
|
||||
|
||||
join fk_external_linkage2 in emp.GetListByemployee_type(null,null) on m_eva_create_evaluation.employee_id equals fk_external_linkage2.id
|
||||
join fk_external_linkage2 in all_emp on m_eva_create_evaluation.employee_id equals fk_external_linkage2.id
|
||||
into external_linkageResult2
|
||||
from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty()
|
||||
|
||||
@@ -108,8 +116,15 @@ namespace TodoAPI2.Models
|
||||
into eva_evaluation_groupResult5
|
||||
from fk_eva_evaluation_groupResult5 in eva_evaluation_groupResult5.DefaultIfEmpty()
|
||||
|
||||
join fk_external_linkage6 in all_emp on m_eva_create_evaluation.supervisor1_id equals fk_external_linkage6.id
|
||||
into external_linkageResult6
|
||||
from fk_external_linkageResult6 in external_linkageResult6.DefaultIfEmpty()
|
||||
|
||||
where 1==1
|
||||
join fk_external_linkage7 in all_emp on m_eva_create_evaluation.supervisor2_id equals fk_external_linkage7.id
|
||||
into external_linkageResult7
|
||||
from fk_external_linkageResult7 in external_linkageResult7.DefaultIfEmpty()
|
||||
|
||||
where 1==1
|
||||
&& (m_eva_create_evaluation.performance_plan_id == model.performance_plan_id || !model.performance_plan_id.HasValue)
|
||||
&& (m_eva_create_evaluation.evaluation_group_id == model.evaluation_group_id || !model.evaluation_group_id.HasValue)
|
||||
|
||||
@@ -123,10 +138,14 @@ namespace TodoAPI2.Models
|
||||
score1 = m_eva_create_evaluation.score1,
|
||||
score2 = m_eva_create_evaluation.score2,
|
||||
evaluation_group_id = m_eva_create_evaluation.evaluation_group_id,
|
||||
supervisor1_id = m_eva_create_evaluation.supervisor1_id,
|
||||
supervisor2_id = m_eva_create_evaluation.supervisor2_id,
|
||||
|
||||
performance_plan_id_eva_performance_plan_fiscal_year = fk_eva_performance_planResult1.fiscal_year,
|
||||
employee_id_external_linkage_external_name = fk_external_linkageResult2.fullname,
|
||||
evaluation_group_id_eva_evaluation_group_code = fk_eva_evaluation_groupResult5.thegroup,
|
||||
evaluation_group_id_eva_evaluation_group_code = fk_eva_evaluation_groupResult5.code,
|
||||
supervisor1_id_external_linkage_external_name = fk_external_linkageResult6.fullname,
|
||||
supervisor2_id_external_linkage_external_name = fk_external_linkageResult7.fullname,
|
||||
|
||||
isActive = m_eva_create_evaluation.isActive,
|
||||
Created = m_eva_create_evaluation.created,
|
||||
@@ -180,6 +199,8 @@ namespace TodoAPI2.Models
|
||||
existingEntity.score1 = model.score1;
|
||||
existingEntity.score2 = model.score2;
|
||||
existingEntity.evaluation_group_id = model.evaluation_group_id;
|
||||
existingEntity.supervisor1_id = model.supervisor1_id;
|
||||
existingEntity.supervisor2_id = model.supervisor2_id;
|
||||
|
||||
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
@@ -198,11 +219,13 @@ namespace TodoAPI2.Models
|
||||
var existingEntity = _repository.Get(i.id.Value);
|
||||
if (existingEntity != null)
|
||||
{
|
||||
existingEntity.performance_plan_id = i.performance_plan_id;
|
||||
existingEntity.employee_id = i.employee_id;
|
||||
existingEntity.score1 = i.score1;
|
||||
existingEntity.score2 = i.score2;
|
||||
existingEntity.evaluation_group_id = i.evaluation_group_id;
|
||||
existingEntity.performance_plan_id = i.performance_plan_id;
|
||||
existingEntity.employee_id = i.employee_id;
|
||||
existingEntity.score1 = i.score1;
|
||||
existingEntity.score2 = i.score2;
|
||||
existingEntity.evaluation_group_id = i.evaluation_group_id;
|
||||
existingEntity.supervisor1_id = i.supervisor1_id;
|
||||
existingEntity.supervisor2_id = i.supervisor2_id;
|
||||
|
||||
|
||||
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
|
||||
|
||||
Reference in New Issue
Block a user