ปรับปรุงการค้นหา ต่อจากเดิม
This commit is contained in:
@@ -17,6 +17,7 @@ namespace TodoAPI2.Models
|
||||
|
||||
eva_create_evaluation_detail_firstdocWithSelectionViewModel GetWithSelection(int id, int? emp_id);
|
||||
eva_create_evaluation_detail_firstdocWithSelectionViewModel GetBlankItem();
|
||||
eva_create_evaluation_detail_firstdocWithSelectionViewModel GetBlankItemWithEmp(int? emp_id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,9 +222,28 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
var entity = Get(id, emp_id);
|
||||
var i = Mapper.Map<eva_create_evaluation_detail_firstdocWithSelectionViewModel>(entity);
|
||||
i.item_org_id = ext.GetDepartmentData();
|
||||
|
||||
var dep = (from x in emp.GetAllEmployee()
|
||||
where x.id == emp_id
|
||||
select x.department_id).FirstOrDefault();
|
||||
var alldep = (from x in emp.GetDeptMapping()
|
||||
where x.id == dep || x.id2 == dep
|
||||
select x.id);
|
||||
var alleva = (from x in _repository.Context.eva_create_evaluation
|
||||
join y in _repository.Context.eva_create_evaluation_detail on x.id equals y.create_evaluation_id
|
||||
where x.employee_id == emp_id
|
||||
|| x.supervisor1_id == emp_id
|
||||
|| x.supervisor2_id == emp_id
|
||||
|| y.chief == emp_id
|
||||
|| y.eva_employee_id == emp_id
|
||||
|| y.supervisor1_id == emp_id
|
||||
|| y.supervisor2_id == emp_id
|
||||
select y.employee_id).ToList();
|
||||
|
||||
i.item_org_id = (from q in ext.GetDepartmentData() where alldep.Contains(q.id) select q).ToList();
|
||||
i.item_employee_id = (from x in emp.GetAllEmployee()
|
||||
where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
|
||||
&& alleva.Contains(x.id)
|
||||
orderby x.fullname
|
||||
select new external_linkageViewModel { external_id = x.id, external_name = x.fullname }
|
||||
).ToList();
|
||||
@@ -234,6 +253,42 @@ namespace TodoAPI2.Models
|
||||
).ToList();
|
||||
return i;
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_firstdocWithSelectionViewModel GetBlankItemWithEmp(int? emp_id)
|
||||
{
|
||||
var i = new eva_create_evaluation_detail_firstdocWithSelectionViewModel();
|
||||
|
||||
var dep = (from x in emp.GetAllEmployee()
|
||||
where x.id == emp_id
|
||||
select x.department_id).FirstOrDefault();
|
||||
var alldep = (from x in emp.GetDeptMapping()
|
||||
where x.id == dep || x.id2 == dep
|
||||
select x.id);
|
||||
var alleva = (from x in _repository.Context.eva_create_evaluation
|
||||
join y in _repository.Context.eva_create_evaluation_detail on x.id equals y.create_evaluation_id
|
||||
where x.employee_id == emp_id
|
||||
|| x.supervisor1_id == emp_id
|
||||
|| x.supervisor2_id == emp_id
|
||||
|| y.chief == emp_id
|
||||
|| y.eva_employee_id == emp_id
|
||||
|| y.supervisor1_id == emp_id
|
||||
|| y.supervisor2_id == emp_id
|
||||
select y.employee_id).ToList();
|
||||
|
||||
i.item_org_id = (from q in ext.GetDepartmentData() where alldep.Contains(q.id) select q).ToList();
|
||||
i.item_employee_id = (from x in emp.GetAllEmployee()
|
||||
where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
|
||||
&& alleva.Contains(x.id)
|
||||
orderby x.fullname
|
||||
select new external_linkageViewModel { external_id = x.id, external_name = x.fullname }
|
||||
).ToList();
|
||||
i.item_evaluation_round_search = (from x in _repository.Context.eva_performance_plan
|
||||
orderby x.fiscal_year descending, x.theTime descending
|
||||
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
|
||||
).ToList();
|
||||
return i;
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_firstdocWithSelectionViewModel GetBlankItem()
|
||||
{
|
||||
var i = new eva_create_evaluation_detail_firstdocWithSelectionViewModel();
|
||||
|
||||
Reference in New Issue
Block a user