เพิ่มคิวรี่ ตรวจสอบสิทธิ ของหน้า ทำข้อตกลง
This commit is contained in:
@@ -69,10 +69,20 @@ namespace TodoAPI2.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
var result = _repository.GetWithSelection(id);
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
|
||||
return Ok(result);
|
||||
if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"]))
|
||||
{
|
||||
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
|
||||
var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
|
||||
var result = _repository.GetWithSelection(id, e.id);
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Unauthorized();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace TodoAPI2.Models
|
||||
List<eva_create_evaluation_detail_firstdocViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id, int? emp_id);
|
||||
List<eva_create_evaluation_detail_firstdocViewModel> GetListBySearch(eva_create_evaluation_detail_firstdocSearchModel model, int? emp_id);
|
||||
|
||||
eva_create_evaluation_detail_firstdocWithSelectionViewModel GetWithSelection(int id);
|
||||
eva_create_evaluation_detail_firstdocWithSelectionViewModel GetWithSelection(int id, int? emp_id);
|
||||
eva_create_evaluation_detail_firstdocWithSelectionViewModel GetBlankItem();
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace TodoAPI2.Models
|
||||
return "";
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_firstdocViewModel Get(int id)
|
||||
public eva_create_evaluation_detail_firstdocViewModel Get(int id, int? emp_id)
|
||||
{
|
||||
var allemp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
@@ -140,6 +140,20 @@ namespace TodoAPI2.Models
|
||||
score1 = fk_eva_create_evaluationResult10.score1,
|
||||
score2 = fk_eva_create_evaluationResult10.score2,
|
||||
|
||||
role_code = getRoleCode(emp_id,
|
||||
m_eva_create_evaluation_detail_agreement.chief,
|
||||
m_eva_create_evaluation_detail_agreement.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_agreement.chief,
|
||||
m_eva_create_evaluation_detail_agreement.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_agreement.isActive,
|
||||
Created = m_eva_create_evaluation_detail_agreement.created,
|
||||
Updated = m_eva_create_evaluation_detail_agreement.updated
|
||||
@@ -149,6 +163,26 @@ namespace TodoAPI2.Models
|
||||
return data[0];
|
||||
}
|
||||
|
||||
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 "";
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detailEntity GetEntity(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
@@ -161,9 +195,9 @@ namespace TodoAPI2.Models
|
||||
return _repository.Context;
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_firstdocWithSelectionViewModel GetWithSelection(int id)
|
||||
public eva_create_evaluation_detail_firstdocWithSelectionViewModel GetWithSelection(int id, int? emp_id)
|
||||
{
|
||||
var entity = Get(id);
|
||||
var entity = Get(id, emp_id);
|
||||
var i = Mapper.Map<eva_create_evaluation_detail_firstdocWithSelectionViewModel>(entity);
|
||||
i.item_org_id = ext.GetDepartmentData();
|
||||
|
||||
@@ -249,6 +283,20 @@ namespace TodoAPI2.Models
|
||||
|
||||
plan_round_year = checkNull(fk_planResult.theTime) + "/" + checkNull(fk_planResult.fiscal_year),
|
||||
|
||||
role_code = getRoleCode(emp_id,
|
||||
m_eva_create_evaluation_detail_agreement.chief,
|
||||
m_eva_create_evaluation_detail_agreement.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_agreement.chief,
|
||||
m_eva_create_evaluation_detail_agreement.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_agreement.isActive,
|
||||
Created = m_eva_create_evaluation_detail_agreement.created,
|
||||
Updated = m_eva_create_evaluation_detail_agreement.updated
|
||||
|
||||
@@ -77,6 +77,10 @@ namespace TodoAPI2.Models
|
||||
public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date); } }
|
||||
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date); } }
|
||||
|
||||
public string role_desc { get; set; }
|
||||
|
||||
public string role_code { get; set; }
|
||||
|
||||
private string getStatusText(string s)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(s))
|
||||
|
||||
@@ -276,8 +276,8 @@
|
||||
<script src="~/js/eva_create_evaluation_detail_review0A/eva_create_evaluation_detail_review0A_d.js?version=@MyHelper.GetDummyText()"></script>
|
||||
<script>
|
||||
|
||||
var status_self = "";
|
||||
var status_chief = "";
|
||||
var status_self_a = "";
|
||||
var status_chief_a = "";
|
||||
|
||||
$(document).ready(function () {
|
||||
var id = getUrlParameter("id");
|
||||
|
||||
Reference in New Issue
Block a user