ปรับปรุงสิทธิการมองเห็นต่างๆ
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);
|
||||
List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model);
|
||||
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);
|
||||
|
||||
eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id);
|
||||
eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id, int? emp_id);
|
||||
eva_create_evaluation_detail_processWithSelectionViewModel GetBlankItem();
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace TodoAPI2.Models
|
||||
#region Public Functions
|
||||
#region Query Functions
|
||||
|
||||
public eva_create_evaluation_detail_processWithSelectionViewModel Get(int id)
|
||||
public eva_create_evaluation_detail_processWithSelectionViewModel Get(int id, int? emp_id)
|
||||
{
|
||||
var allemp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
@@ -100,6 +100,22 @@ namespace TodoAPI2.Models
|
||||
create_evaluation_score1 = fk_eva_create_evaluationResult10.score1,
|
||||
create_evaluation_score2 = fk_eva_create_evaluationResult10.score2,
|
||||
|
||||
status_self = m_eva_create_evaluation_detail_process.status_self,
|
||||
status_chief = m_eva_create_evaluation_detail_process.status_chief,
|
||||
status_supervisor = m_eva_create_evaluation_detail_process.status_supervisor,
|
||||
|
||||
role_code = getRoleCode(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),
|
||||
|
||||
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),
|
||||
|
||||
isActive = m_eva_create_evaluation_detail_process.isActive,
|
||||
Created = m_eva_create_evaluation_detail_process.created,
|
||||
Updated = m_eva_create_evaluation_detail_process.updated
|
||||
@@ -108,9 +124,9 @@ namespace TodoAPI2.Models
|
||||
|
||||
return data[0];
|
||||
}
|
||||
public eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id)
|
||||
public eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id, int? emp_id)
|
||||
{
|
||||
var item = Get(id);
|
||||
var item = Get(id, emp_id);
|
||||
item.item_org_id = ext.GetDepartmentData();
|
||||
item.item_level_score = (from i in _repository.Context.eva_level_score
|
||||
orderby i.min_score
|
||||
@@ -122,21 +138,21 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
var i = new eva_create_evaluation_detail_processWithSelectionViewModel();
|
||||
i.item_org_id = ext.GetDepartmentData();
|
||||
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_level_score = (from j in _repository.Context.eva_level_score
|
||||
// orderby j.min_score
|
||||
// select Mapper.Map<eva_level_scoreViewModel>(i)).ToList();
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_processViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id)
|
||||
public List<eva_create_evaluation_detail_processViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id, int? emp_id)
|
||||
{
|
||||
var model = new eva_create_evaluation_detail_processSearchModel();
|
||||
model.create_evaluation_id = create_evaluation_id;
|
||||
return GetListBySearch(model);
|
||||
return GetListBySearch(model, emp_id);
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model)
|
||||
public List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model, int? emp_id)
|
||||
{
|
||||
var allemp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
@@ -160,7 +176,13 @@ namespace TodoAPI2.Models
|
||||
&& (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))
|
||||
|
||||
&& emp_id.HasValue
|
||||
&& (
|
||||
(m_eva_create_evaluation_detail_process.chief.HasValue && emp_id == m_eva_create_evaluation_detail_process.chief)
|
||||
|| (fk_eva_create_evaluationResult10.employee_id.HasValue && emp_id == fk_eva_create_evaluationResult10.employee_id)
|
||||
|| (fk_eva_create_evaluationResult10.supervisor1_id.HasValue && emp_id == fk_eva_create_evaluationResult10.supervisor1_id)
|
||||
|| (fk_eva_create_evaluationResult10.supervisor2_id.HasValue && emp_id == fk_eva_create_evaluationResult10.supervisor2_id)
|
||||
)
|
||||
|
||||
orderby m_eva_create_evaluation_detail_process.created descending
|
||||
select new eva_create_evaluation_detail_processViewModel()
|
||||
@@ -182,6 +204,22 @@ namespace TodoAPI2.Models
|
||||
|
||||
org_id_external_linkage_external_name = fk_external_employee.department_name,
|
||||
|
||||
status_self = m_eva_create_evaluation_detail_process.status_self,
|
||||
status_chief = m_eva_create_evaluation_detail_process.status_chief,
|
||||
status_supervisor = m_eva_create_evaluation_detail_process.status_supervisor,
|
||||
|
||||
role_code = getRoleCode(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),
|
||||
|
||||
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),
|
||||
|
||||
isActive = m_eva_create_evaluation_detail_process.isActive,
|
||||
Created = m_eva_create_evaluation_detail_process.created,
|
||||
Updated = m_eva_create_evaluation_detail_process.updated
|
||||
@@ -191,6 +229,26 @@ namespace TodoAPI2.Models
|
||||
return data;
|
||||
}
|
||||
|
||||
private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (emp_id == chief) return "ผู้ประเมิน";
|
||||
else if (emp_id == supervisor1) return "ผู้ประเมิน";
|
||||
else if (emp_id == supervisor2) return "ผู้ประเมินสูสุด";
|
||||
else if (emp_id == supervisor1A) return "ผู้บังคับบัญชาเหนือขึ้นไป";
|
||||
else if (emp_id == supervisor2A) return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)";
|
||||
return "";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
@@ -43,5 +43,15 @@ namespace TodoAPI2.Models
|
||||
public Guid? create_evaluation_id_eva_create_evaluation_performance_plan_id { get; set; }
|
||||
public string org_id_external_linkage_external_name { get; set; }
|
||||
|
||||
public string status_self { get; set; }
|
||||
|
||||
public string status_chief { get; set; }
|
||||
|
||||
public string status_supervisor { get; set; }
|
||||
|
||||
public string role_desc { get; set; }
|
||||
|
||||
public string role_code { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user