ปรับปรุงการค้นหา
This commit is contained in:
@@ -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; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user