ปรับปรุงการค้นหา ต่อจากเดิม
This commit is contained in:
@@ -109,7 +109,9 @@ namespace TodoAPI2.Controllers
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
var result = _repository.GetBlankItem();
|
||||
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
|
||||
var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
|
||||
var result = _repository.GetBlankItemWithEmp(e.id);
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,10 @@ namespace TodoAPI2.Controllers
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
var result = _repository.GetBlankItem();
|
||||
|
||||
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
|
||||
var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
|
||||
var result = _repository.GetBlankItemWithEmp(e.id);
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -14,10 +14,9 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
List<eva_create_evaluation_detail_processViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id, int? emp_id, string path);
|
||||
List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model, int? emp_id, string path);
|
||||
|
||||
eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id, int? emp_id, string path);
|
||||
eva_create_evaluation_detail_processWithSelectionViewModel GetBlankItem();
|
||||
|
||||
eva_create_evaluation_detail_processWithSelectionViewModel GetBlankItemWithEmp(int? emp_id);
|
||||
eva_create_evaluation_detail_processWithSelectionViewModel Get(int id, int? emp_id, string path);
|
||||
DataContext GetDataContext();
|
||||
}
|
||||
|
||||
@@ -218,18 +218,74 @@ namespace TodoAPI2.Models
|
||||
public eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id, int? emp_id, string path)
|
||||
{
|
||||
var item = Get(id, emp_id, path);
|
||||
item.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();
|
||||
|
||||
item.item_org_id = (from i in ext.GetDepartmentData() where alldep.Contains(i.id) select i).ToList();
|
||||
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 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา" select x).ToList();
|
||||
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 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
|
||||
&& alleva.Contains(x.id)
|
||||
orderby x.fullname
|
||||
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;
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_processWithSelectionViewModel GetBlankItemWithEmp(int? emp_id)
|
||||
{
|
||||
var i = new eva_create_evaluation_detail_processWithSelectionViewModel();
|
||||
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 x).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_processWithSelectionViewModel GetBlankItem()
|
||||
{
|
||||
var i = new eva_create_evaluation_detail_processWithSelectionViewModel();
|
||||
|
||||
Reference in New Issue
Block a user