แก้ไข OP 2651
This commit is contained in:
@@ -12,10 +12,10 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
public interface Ieva_create_evaluation_detail_processService
|
||||
{
|
||||
List<eva_create_evaluation_detail_processViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id, int? emp_id);
|
||||
List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model, int? emp_id);
|
||||
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);
|
||||
eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id, int? emp_id, string path);
|
||||
eva_create_evaluation_detail_processWithSelectionViewModel GetBlankItem();
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ namespace TodoAPI2.Models
|
||||
public string search_employee_code { get; set; }
|
||||
|
||||
public string search_employee_fullname { get; set; }
|
||||
|
||||
|
||||
public string path { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace TodoAPI2.Models
|
||||
#region Public Functions
|
||||
#region Query Functions
|
||||
|
||||
public eva_create_evaluation_detail_processWithSelectionViewModel Get(int id, int? emp_id)
|
||||
public eva_create_evaluation_detail_processWithSelectionViewModel Get(int id, int? emp_id, string path)
|
||||
{
|
||||
var allemp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
@@ -112,13 +112,13 @@ namespace TodoAPI2.Models
|
||||
m_eva_create_evaluation_detail_process.chief,
|
||||
fk_eva_create_evaluationResult10.employee_id,
|
||||
fk_eva_create_evaluationResult10.supervisor1_id,
|
||||
fk_eva_create_evaluationResult10.supervisor2_id),
|
||||
fk_eva_create_evaluationResult10.supervisor2_id, path),
|
||||
|
||||
role_desc = getRoleName(emp_id, m_eva_create_evaluation_detail_process.chief,
|
||||
m_eva_create_evaluation_detail_process.chief,
|
||||
fk_eva_create_evaluationResult10.employee_id,
|
||||
fk_eva_create_evaluationResult10.supervisor1_id,
|
||||
fk_eva_create_evaluationResult10.supervisor2_id),
|
||||
fk_eva_create_evaluationResult10.supervisor2_id, path),
|
||||
|
||||
remark_hrm_work_record = fk_external_employee.remark_hrm_work_record,
|
||||
|
||||
@@ -130,9 +130,9 @@ namespace TodoAPI2.Models
|
||||
|
||||
return data[0];
|
||||
}
|
||||
public eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id, int? emp_id)
|
||||
public eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id, int? emp_id, string path)
|
||||
{
|
||||
var item = Get(id, emp_id);
|
||||
var item = Get(id, emp_id, path);
|
||||
item.item_org_id = ext.GetDepartmentData();
|
||||
item.item_level_score = (from i in _repository.Context.eva_level_score
|
||||
orderby i.min_score
|
||||
@@ -151,14 +151,14 @@ namespace TodoAPI2.Models
|
||||
return i;
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_processViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id, int? emp_id)
|
||||
public List<eva_create_evaluation_detail_processViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id, int? emp_id, string path)
|
||||
{
|
||||
var model = new eva_create_evaluation_detail_processSearchModel();
|
||||
model.create_evaluation_id = create_evaluation_id;
|
||||
return GetListBySearch(model, emp_id);
|
||||
return GetListBySearch(model, emp_id, path);
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model, int? emp_id)
|
||||
public List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model, int? emp_id, string path)
|
||||
{
|
||||
var allemp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
@@ -221,17 +221,19 @@ namespace TodoAPI2.Models
|
||||
status_supervisor1A = m_eva_create_evaluation_detail_process.status_supervisor1A,
|
||||
status_supervisor2A = m_eva_create_evaluation_detail_process.status_supervisor2A,
|
||||
|
||||
role_code = getRoleCode(emp_id, m_eva_create_evaluation_detail_process.chief,
|
||||
role_code = getRoleCodeSearch(emp_id, m_eva_create_evaluation_detail_process.chief,
|
||||
m_eva_create_evaluation_detail_process.chief,
|
||||
fk_eva_create_evaluationResult10.employee_id,
|
||||
fk_eva_create_evaluationResult10.supervisor1_id,
|
||||
fk_eva_create_evaluationResult10.supervisor2_id),
|
||||
fk_eva_create_evaluationResult10.supervisor2_id,
|
||||
m_eva_create_evaluation_detail_process.status_chief
|
||||
),
|
||||
|
||||
role_desc = getRoleName(emp_id, m_eva_create_evaluation_detail_process.chief,
|
||||
m_eva_create_evaluation_detail_process.chief,
|
||||
fk_eva_create_evaluationResult10.employee_id,
|
||||
fk_eva_create_evaluationResult10.supervisor1_id,
|
||||
fk_eva_create_evaluationResult10.supervisor2_id),
|
||||
fk_eva_create_evaluationResult10.supervisor2_id, path),
|
||||
|
||||
isActive = m_eva_create_evaluation_detail_process.isActive,
|
||||
Created = m_eva_create_evaluation_detail_process.created,
|
||||
@@ -242,9 +244,10 @@ namespace TodoAPI2.Models
|
||||
return data;
|
||||
}
|
||||
|
||||
private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A)
|
||||
private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path)
|
||||
{
|
||||
if (emp_id == chief) return "1";
|
||||
if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && path == "d2") return "2";
|
||||
else if (emp_id == chief) return "1";
|
||||
else if (emp_id == supervisor1) return "1";
|
||||
else if (emp_id == supervisor2) return "2";
|
||||
else if (emp_id == supervisor1A) return "3";
|
||||
@@ -252,11 +255,23 @@ namespace TodoAPI2.Models
|
||||
return "";
|
||||
}
|
||||
|
||||
private string getRoleName(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A)
|
||||
private string getRoleCodeSearch(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string status_chief)
|
||||
{
|
||||
if (emp_id == chief) return "ผู้ประเมิน";
|
||||
if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && status_chief=="Y") return "2";
|
||||
else if (emp_id == chief) return "1";
|
||||
else if (emp_id == supervisor1) return "1";
|
||||
else if (emp_id == supervisor2) return "2";
|
||||
else if (emp_id == supervisor1A) return "3";
|
||||
else if (emp_id == supervisor2A) return "4";
|
||||
return "";
|
||||
}
|
||||
|
||||
private string getRoleName(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path)
|
||||
{
|
||||
if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && path == "d2") return "ผู้ประเมินสูงสุด";
|
||||
else if (emp_id == chief) return "ผู้ประเมิน";
|
||||
else if (emp_id == supervisor1) return "ผู้ประเมิน";
|
||||
else if (emp_id == supervisor2) return "ผู้ประเมินสูสุด";
|
||||
else if (emp_id == supervisor2) return "ผู้ประเมินสูงสุด";
|
||||
else if (emp_id == supervisor1A) return "ผู้บังคับบัญชาเหนือขึ้นไป";
|
||||
else if (emp_id == supervisor2A) return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)";
|
||||
return "";
|
||||
|
||||
Reference in New Issue
Block a user