ปรับปรุงการค้นหา

This commit is contained in:
LAPTOP-KB8JC2K2\acer
2021-09-11 12:28:00 +07:00
parent edc9bf053e
commit 98dd8b0860
14 changed files with 103 additions and 39 deletions

View File

@@ -20,9 +20,9 @@ namespace TodoAPI2.Models
public int? org_id { get; set; }
public string search_employee_code { get; set; }
public int? employee_id { get; set; }
public string search_employee_fullname { get; set; }
public string evaluation_round_search { get; set; }
}
}

View File

@@ -223,16 +223,30 @@ 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();
i.item_employee_id = (from x in emp.GetAllEmployee()
where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
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();
i.item_org_id = ext.GetDepartmentData();
i.item_employee_id = (from x in emp.GetAllEmployee()
where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
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;
}
@@ -245,6 +259,14 @@ namespace TodoAPI2.Models
public List<eva_create_evaluation_detail_firstdocViewModel> GetListBySearch(eva_create_evaluation_detail_firstdocSearchModel model, int? emp_id)
{
if (string.IsNullOrEmpty(model.evaluation_round_search))
{
model.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) }
).FirstOrDefault().id_guid.ToString();
}
var allemp = emp.GetListByemployee_type(null, null);
var dept = ext.GetDepartmentData();
@@ -282,8 +304,8 @@ namespace TodoAPI2.Models
where 1 == 1
&& (m_eva_create_evaluation_detail_agreement.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue)
&& (fk_external_employee.department_id == model.org_id || !model.org_id.HasValue)
&& (fk_external_employee.employee_no == model.search_employee_code || string.IsNullOrEmpty(model.search_employee_code))
&& (fk_external_employee.fullname.Contains(model.search_employee_fullname) || string.IsNullOrEmpty(model.search_employee_fullname))
&& (fk_external_employee.id == model.employee_id || !model.employee_id.HasValue)
&& (string.IsNullOrEmpty(model.evaluation_round_search) || fk_planResult.id == Guid.Parse(model.evaluation_round_search))
&& (m_eva_create_evaluation_detail_agreement.employee_id == emp_id || m_eva_create_evaluation_detail_agreement.chief == emp_id)
orderby

View File

@@ -8,6 +8,8 @@ namespace TodoAPI2.Models
public class eva_create_evaluation_detail_firstdocWithSelectionViewModel: eva_create_evaluation_detail_firstdocViewModel
{
public List<external_linkageViewModel> item_org_id { get; set; }
public List<external_linkageViewModel> item_employee_id { get; set; }
public List<external_linkageViewModel> item_evaluation_round_search { get; set; }
}
}

View File

@@ -24,6 +24,8 @@ namespace TodoAPI2.Models
public int? employee_id { get; set; }
public string evaluation_round_search { get; set; }
public string path { get; set; }
}
}

View File

@@ -222,7 +222,11 @@ namespace TodoAPI2.Models
item.item_level_score = (from i in _repository.Context.eva_level_score
orderby i.min_score
select Mapper.Map<eva_level_scoreViewModel>(i)).ToList();
item.item_employee_id = (from x in emp.GetAllEmployee() where x.count_resigns == 0 select x).ToList();
item.item_employee_id = (from x in emp.GetAllEmployee() where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา" select x).ToList();
item.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 item;
}
@@ -231,9 +235,10 @@ namespace TodoAPI2.Models
var i = new eva_create_evaluation_detail_processWithSelectionViewModel();
i.item_org_id = ext.GetDepartmentData();
i.item_employee_id = (from x in emp.GetAllEmployee() where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา" select x).ToList();
//i.item_level_score = (from j in _repository.Context.eva_level_score
// orderby j.min_score
// select Mapper.Map<eva_level_scoreViewModel>(i)).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;
}
@@ -260,6 +265,14 @@ namespace TodoAPI2.Models
public List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model, int? emp_id, string path)
{
if (string.IsNullOrEmpty(model.evaluation_round_search))
{
model.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) }
).FirstOrDefault().id_guid.ToString();
}
var allemp = emp.GetListByemployee_type(null, null);
var all_org_id = from i in ext.GetAllChildInDep(model.org_id) select i.external_id;
@@ -295,6 +308,7 @@ namespace TodoAPI2.Models
&& (all_org_id.Contains(fk_external_employee.department_id) || !model.org_id.HasValue)
&& (fk_external_employee.employee_no == model.search_employee_code || string.IsNullOrEmpty(model.search_employee_code))
&& (fk_external_employee.fullname.Contains(model.search_employee_fullname) || string.IsNullOrEmpty(model.search_employee_fullname))
&& (string.IsNullOrEmpty(model.evaluation_round_search) || fk_planResult.id == Guid.Parse(model.evaluation_round_search))
&& emp_id.HasValue
&& (
(m_eva_create_evaluation_detail_process.chief.HasValue && emp_id == m_eva_create_evaluation_detail_process.chief)

View File

@@ -13,6 +13,8 @@ namespace TodoAPI2.Models
public List<external_employeeViewModel> item_employee_id { get; set; }
public List<external_linkageViewModel> item_evaluation_round_search { get; set; }
public decimal? create_evaluation_score1 { get; set; }
public decimal? create_evaluation_score2 { get; set; }