ปรับปรุง คนที่ได้สิทธิพิเศษ ให้ดูรายชื่อได้ทั้งเนติ
This commit is contained in:
@@ -71,6 +71,9 @@ namespace TodoAPI2.Models
|
||||
|
||||
public eva_create_evaluation_detail_firstdocViewModel Get(int id, int? emp_id)
|
||||
{
|
||||
object special_person = (from x in _repository.Context.eva_setup_permission
|
||||
select x.employee_id).ToArray();
|
||||
|
||||
var allemp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
var endDate = (from m_eva_create_evaluation_detail_agreement in _repository.Context.eva_create_evaluation_detail
|
||||
@@ -148,7 +151,8 @@ namespace TodoAPI2.Models
|
||||
m_eva_create_evaluation_detail_agreement.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_agreement.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
|
||||
m_eva_create_evaluation_detail_agreement.employee_id,
|
||||
m_eva_create_evaluation_detail_agreement.status_self_a,
|
||||
m_eva_create_evaluation_detail_agreement.status_chief_a
|
||||
m_eva_create_evaluation_detail_agreement.status_chief_a,
|
||||
special_person
|
||||
),
|
||||
|
||||
role_desc = getRoleName(emp_id,
|
||||
@@ -159,7 +163,9 @@ namespace TodoAPI2.Models
|
||||
fk_eva_create_evaluationResult10.supervisor2_id,
|
||||
m_eva_create_evaluation_detail_agreement.employee_id,
|
||||
m_eva_create_evaluation_detail_agreement.status_self_a,
|
||||
m_eva_create_evaluation_detail_agreement.status_chief_a),
|
||||
m_eva_create_evaluation_detail_agreement.status_chief_a,
|
||||
special_person
|
||||
),
|
||||
|
||||
isActive = m_eva_create_evaluation_detail_agreement.isActive,
|
||||
Created = m_eva_create_evaluation_detail_agreement.created,
|
||||
@@ -171,7 +177,7 @@ namespace TodoAPI2.Models
|
||||
}
|
||||
|
||||
private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, int? self,
|
||||
string status_self_a, string status_chief_a)
|
||||
string status_self_a, string status_chief_a, object special_person)
|
||||
{
|
||||
if (emp_id == self && status_self_a != "Y") return ""; // ผู้รับการประเมิน
|
||||
if (self == chief && emp_id == chief && status_chief_a != "Y") return "1";
|
||||
@@ -179,6 +185,7 @@ namespace TodoAPI2.Models
|
||||
if (self == supervisor2 && emp_id == supervisor2 && status_chief_a == "Y") return "2";
|
||||
if (self == supervisor1A && emp_id == supervisor1A && status_chief_a == "Y") return "3";
|
||||
if (self == supervisor2A && emp_id == supervisor2A && status_chief_a == "Y") return "4";
|
||||
if (((int?[])special_person).Contains(emp_id)) return "99";
|
||||
|
||||
if (emp_id == chief) return "1";
|
||||
else if (emp_id == supervisor1) return "1";
|
||||
@@ -189,7 +196,7 @@ namespace TodoAPI2.Models
|
||||
}
|
||||
|
||||
private string getRoleName(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, int? self,
|
||||
string status_self_a, string status_chief_a)
|
||||
string status_self_a, string status_chief_a, object special_person)
|
||||
{
|
||||
if (emp_id == self && status_self_a != "Y") return ""; // ผู้รับการประเมิน
|
||||
if (self == chief && emp_id == chief && status_chief_a != "Y") return "ผู้ประเมิน";
|
||||
@@ -197,6 +204,7 @@ namespace TodoAPI2.Models
|
||||
if (self == supervisor2 && emp_id == supervisor2 && status_chief_a == "Y") return "ผู้ประเมินสูงสุด";
|
||||
if (self == supervisor1A && emp_id == supervisor1A && status_chief_a == "Y") return "ผู้บังคับบัญชาเหนือขึ้นไป";
|
||||
if (self == supervisor2A && emp_id == supervisor2A && status_chief_a == "Y") return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)";
|
||||
if (((int?[])special_person).Contains(emp_id)) return "ผู้ตรวจสอบ";
|
||||
|
||||
if (emp_id == chief) return "ผู้ประเมิน";
|
||||
else if (emp_id == supervisor1) return "ผู้ประเมิน";
|
||||
@@ -223,11 +231,14 @@ namespace TodoAPI2.Models
|
||||
var entity = Get(id, emp_id);
|
||||
var i = Mapper.Map<eva_create_evaluation_detail_firstdocWithSelectionViewModel>(entity);
|
||||
|
||||
var special_person = (from x in _repository.Context.eva_setup_permission
|
||||
select x.employee_id).ToList();
|
||||
|
||||
var dep = (from x in emp.GetAllEmployee()
|
||||
where x.id == emp_id
|
||||
where x.id == emp_id
|
||||
select x.department_id).FirstOrDefault();
|
||||
var alldep = (from x in emp.GetDeptMapping()
|
||||
where x.id == dep || x.id2 == dep
|
||||
where x.id == dep || x.id2 == dep || special_person.Contains(emp_id)
|
||||
select x.id);
|
||||
var option_1 = new external_linkageViewModel();
|
||||
option_1.id_guid = Guid.Empty;
|
||||
@@ -243,6 +254,7 @@ namespace TodoAPI2.Models
|
||||
|| y.eva_employee_id == emp_id
|
||||
|| y.supervisor1_id == emp_id
|
||||
|| y.supervisor2_id == emp_id
|
||||
|| special_person.Contains(emp_id)
|
||||
select y.employee_id).ToList();
|
||||
|
||||
i.item_org_id = (from q in ext.GetDepartmentData() where alldep.Contains(q.id) select q).ToList();
|
||||
@@ -268,11 +280,14 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
var i = new eva_create_evaluation_detail_firstdocWithSelectionViewModel();
|
||||
|
||||
var special_person = (from x in _repository.Context.eva_setup_permission
|
||||
select x.employee_id).ToList();
|
||||
|
||||
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
|
||||
where x.id == dep || x.id2 == dep || special_person.Contains(emp_id)
|
||||
select x.id);
|
||||
var option_1 = new external_linkageViewModel();
|
||||
option_1.id_guid = Guid.Empty;
|
||||
@@ -288,6 +303,7 @@ namespace TodoAPI2.Models
|
||||
|| y.eva_employee_id == emp_id
|
||||
|| y.supervisor1_id == emp_id
|
||||
|| y.supervisor2_id == emp_id
|
||||
|| special_person.Contains(emp_id)
|
||||
select y.employee_id).ToList();
|
||||
|
||||
i.item_org_id = (from q in ext.GetDepartmentData() where alldep.Contains(q.id) select q).ToList();
|
||||
@@ -334,6 +350,9 @@ namespace TodoAPI2.Models
|
||||
|
||||
public List<eva_create_evaluation_detail_firstdocViewModel> GetListBySearch(eva_create_evaluation_detail_firstdocSearchModel model, int? emp_id)
|
||||
{
|
||||
object special_person = (from x in _repository.Context.eva_setup_permission
|
||||
select x.employee_id).ToArray();
|
||||
|
||||
if (string.IsNullOrEmpty(model.evaluation_round_search))
|
||||
{
|
||||
model.evaluation_round_search = (from x in _repository.Context.eva_performance_plan
|
||||
@@ -385,7 +404,7 @@ namespace TodoAPI2.Models
|
||||
&& (fk_external_employee.department_id == model.org_id || !model.org_id.HasValue)
|
||||
&& (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)
|
||||
&& (m_eva_create_evaluation_detail_agreement.employee_id == emp_id || m_eva_create_evaluation_detail_agreement.chief == emp_id || ((int?[])special_person).Contains(emp_id))
|
||||
|
||||
orderby
|
||||
fk_sort_depResult2.external_code,
|
||||
@@ -439,7 +458,9 @@ namespace TodoAPI2.Models
|
||||
m_eva_create_evaluation_detail_agreement.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_agreement.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
|
||||
m_eva_create_evaluation_detail_agreement.employee_id,
|
||||
m_eva_create_evaluation_detail_agreement.status_self_a,
|
||||
m_eva_create_evaluation_detail_agreement.status_chief_a),
|
||||
m_eva_create_evaluation_detail_agreement.status_chief_a,
|
||||
special_person
|
||||
),
|
||||
|
||||
role_desc = getRoleName(emp_id,
|
||||
m_eva_create_evaluation_detail_agreement.chief,
|
||||
@@ -449,7 +470,9 @@ namespace TodoAPI2.Models
|
||||
m_eva_create_evaluation_detail_agreement.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_agreement.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
|
||||
m_eva_create_evaluation_detail_agreement.employee_id,
|
||||
m_eva_create_evaluation_detail_agreement.status_self_a,
|
||||
m_eva_create_evaluation_detail_agreement.status_chief_a),
|
||||
m_eva_create_evaluation_detail_agreement.status_chief_a,
|
||||
special_person
|
||||
),
|
||||
|
||||
isActive = m_eva_create_evaluation_detail_agreement.isActive,
|
||||
Created = m_eva_create_evaluation_detail_agreement.created,
|
||||
|
||||
Reference in New Issue
Block a user