รวม code แก้ไข Change Request จากทีม

This commit is contained in:
Nakorn Rientrakrunchai
2020-07-25 23:21:43 +07:00
parent fef57e2655
commit 565fa89be2
11 changed files with 146 additions and 23 deletions

View File

@@ -56,17 +56,29 @@ namespace TodoAPI2.Models
public List<search_employee_for_groupViewModel> GetListBySearch(search_employee_for_groupSearchModel model)
{
var allemp = emp.GetListByemployee_type(null, null);
var all_org_id = from i in ext.GetAllChildInDep(model.org_id) select i.external_id;
var data = (
from m_search_employee_for_group in allemp
join sort_dep in ext.GetSortingDep() on m_search_employee_for_group.department_id equals sort_dep.id
into sort_depResult2
from fk_sort_depResult2 in sort_depResult2.DefaultIfEmpty()
where 1 == 1
&& (string.IsNullOrEmpty(model.employee_number) || (!string.IsNullOrEmpty(model.employee_number) && m_search_employee_for_group.employee_no.Contains(model.employee_number)))
&& (string.IsNullOrEmpty(model.fullname) || (!string.IsNullOrEmpty(model.fullname) && m_search_employee_for_group.fullname.Contains(model.fullname)))
&& (m_search_employee_for_group.position_id == model.position_id || !model.position_id.HasValue)
&& (m_search_employee_for_group.department_id == model.org_id || !model.org_id.HasValue)
&& (all_org_id.Contains(m_search_employee_for_group.department_id) || !model.org_id.HasValue)
orderby
fk_sort_depResult2.external_code,
//fk_external_employee.department_degree_id,
//fk_external_employee.department_code,
m_search_employee_for_group.hpt_position_type_id,
m_search_employee_for_group.hpl_position_level_id,
m_search_employee_for_group.employee_no
orderby m_search_employee_for_group.fullname
select new search_employee_for_groupViewModel()
{
id = m_search_employee_for_group.id,