ปรับปรุงการค้นหา ต่อจากเดิม

This commit is contained in:
LAPTOP-KB8JC2K2\acer
2021-09-11 14:19:35 +07:00
parent 98dd8b0860
commit fdb09a2427
6 changed files with 126 additions and 10 deletions

View File

@@ -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);
}
}

View File

@@ -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();