แก้ไข 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 "";
|
||||
|
||||
@@ -20,14 +20,14 @@ namespace TodoAPI2.Models
|
||||
public class eva_create_evaluation_detail_review01Service : Ieva_create_evaluation_detail_review01Service
|
||||
{
|
||||
private IBaseRepository2<eva_create_evaluation_detailEntity, int> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
|
||||
public eva_create_evaluation_detail_review01Service(IBaseRepository2<eva_create_evaluation_detailEntity, int> repository, IMyDatabase mydb, Iexternal_linkageService inext)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
@@ -47,7 +47,7 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
return Mapper.Map<List<eva_create_evaluation_detail_review01ViewModel>>(entities);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
@@ -79,12 +79,12 @@ namespace TodoAPI2.Models
|
||||
|
||||
public List<eva_create_evaluation_detail_review01ViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id)
|
||||
{
|
||||
var model = new eva_create_evaluation_detail_review01SearchModel();
|
||||
var model = new eva_create_evaluation_detail_review01SearchModel();
|
||||
model.create_evaluation_id = create_evaluation_id;
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_review01ViewModel> GetListBySearch(eva_create_evaluation_detail_review01SearchModel model)
|
||||
public List<eva_create_evaluation_detail_review01ViewModel> GetListBySearch(eva_create_evaluation_detail_review01SearchModel model)
|
||||
{
|
||||
var data = (
|
||||
from m_eva_create_evaluation_detail_review01 in _repository.Context.eva_create_evaluation_detail
|
||||
@@ -94,7 +94,7 @@ namespace TodoAPI2.Models
|
||||
from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty()
|
||||
|
||||
|
||||
where 1==1
|
||||
where 1 == 1
|
||||
//&& (m_eva_create_evaluation_detail_review01.id == model.id || !model.id.HasValue)
|
||||
&& (m_eva_create_evaluation_detail_review01.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue)
|
||||
|
||||
@@ -129,10 +129,10 @@ namespace TodoAPI2.Models
|
||||
int? newkey = 0;
|
||||
|
||||
var x = (from i in _repository.Context.eva_create_evaluation_detail
|
||||
orderby i.id descending
|
||||
select i).Take(1).ToList();
|
||||
orderby i.id descending
|
||||
select i).Take(1).ToList();
|
||||
|
||||
if(x.Count > 0)
|
||||
if (x.Count > 0)
|
||||
{
|
||||
newkey = x[0].id + 1;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ namespace TodoAPI2.Models
|
||||
|
||||
|
||||
var inserted = _repository.Insert(entity);
|
||||
|
||||
|
||||
return Get(inserted.id);
|
||||
}
|
||||
|
||||
@@ -161,6 +161,10 @@ namespace TodoAPI2.Models
|
||||
where k.id == model.id
|
||||
select k).FirstOrDefault();
|
||||
|
||||
var current_eva = (from k in _repository.Context.eva_create_evaluation
|
||||
where k.id == current_detail.create_evaluation_id
|
||||
select k).FirstOrDefault();
|
||||
|
||||
if (current_detail.status_chief == "Y")
|
||||
{
|
||||
throw new Exception("ผู้ประเมิน ส่งแบบประเมินไปแล้ว บันทึกไม่ได้");
|
||||
@@ -172,28 +176,35 @@ namespace TodoAPI2.Models
|
||||
existingEntity.supervisor1_remark = model.supervisor1_remark;
|
||||
existingEntity.supervisor1_date = DateTime.Now;
|
||||
|
||||
if (current_eva.employee_id == current_detail.chief) // หัวหน้าและผู้ประเมินสูงสุด เป็นคนคนเดียวกัน
|
||||
{
|
||||
existingEntity.supervisor2 = model.supervisor1;
|
||||
existingEntity.supervisor2_result = "Y";
|
||||
existingEntity.supervisor2_remark = model.supervisor1_remark;
|
||||
existingEntity.supervisor2_date = DateTime.Now;
|
||||
}
|
||||
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
return Get(updated.id);
|
||||
}
|
||||
else
|
||||
throw new NotificationException("No data to update");
|
||||
throw new NotificationException("No data to update");
|
||||
}
|
||||
|
||||
public string UpdateMultiple(List<eva_create_evaluation_detail_review01InputModel> model)
|
||||
public string UpdateMultiple(List<eva_create_evaluation_detail_review01InputModel> model)
|
||||
{
|
||||
foreach(var i in model)
|
||||
foreach (var i in model)
|
||||
{
|
||||
if (i.active_mode == "1" && i.id.HasValue) // update
|
||||
{
|
||||
{
|
||||
var existingEntity = _repository.Get(i.id.Value);
|
||||
if (existingEntity != null)
|
||||
{
|
||||
existingEntity.create_evaluation_id = i.create_evaluation_id;
|
||||
existingEntity.supervisor1 = i.supervisor1;
|
||||
existingEntity.create_evaluation_id = i.create_evaluation_id;
|
||||
existingEntity.supervisor1 = i.supervisor1;
|
||||
existingEntity.supervisor1_result = null; //i.supervisor1_result;
|
||||
existingEntity.supervisor1_remark = i.supervisor1_remark;
|
||||
existingEntity.supervisor1_date = i.supervisor1_date;
|
||||
existingEntity.supervisor1_remark = i.supervisor1_remark;
|
||||
existingEntity.supervisor1_date = i.supervisor1_date;
|
||||
|
||||
|
||||
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
|
||||
@@ -206,15 +217,15 @@ namespace TodoAPI2.Models
|
||||
_repository.InsertWithoutCommit(entity);
|
||||
}
|
||||
else if (i.active_mode == "0" && i.id.HasValue) // remove
|
||||
{
|
||||
{
|
||||
_repository.DeleteWithoutCommit(i.id.Value);
|
||||
}
|
||||
else if (i.active_mode == "0" && !i.id.HasValue)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
}
|
||||
_repository.Context.SaveChanges();
|
||||
_repository.Context.SaveChanges();
|
||||
|
||||
return model.Count().ToString();
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@ namespace TodoAPI2.Models
|
||||
public class eva_create_evaluation_detail_statusService : Ieva_create_evaluation_detail_statusService
|
||||
{
|
||||
private IBaseRepository2<eva_create_evaluation_detailEntity, int> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
|
||||
public eva_create_evaluation_detail_statusService(IBaseRepository2<eva_create_evaluation_detailEntity, int> repository, IMyDatabase mydb, Iexternal_linkageService inext)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
@@ -47,7 +47,7 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
return Mapper.Map<List<eva_create_evaluation_detail_statusViewModel>>(entities);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
@@ -77,18 +77,18 @@ namespace TodoAPI2.Models
|
||||
|
||||
public List<eva_create_evaluation_detail_statusViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id)
|
||||
{
|
||||
var model = new eva_create_evaluation_detail_statusSearchModel();
|
||||
var model = new eva_create_evaluation_detail_statusSearchModel();
|
||||
model.create_evaluation_id = create_evaluation_id;
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_statusViewModel> GetListBySearch(eva_create_evaluation_detail_statusSearchModel model)
|
||||
public List<eva_create_evaluation_detail_statusViewModel> GetListBySearch(eva_create_evaluation_detail_statusSearchModel model)
|
||||
{
|
||||
var data = (
|
||||
from m_eva_create_evaluation_detail_status in _repository.Context.eva_create_evaluation_detail
|
||||
|
||||
|
||||
where 1==1
|
||||
where 1 == 1
|
||||
//&& (m_eva_create_evaluation_detail_status.id == model.id || !model.id.HasValue)
|
||||
&& (m_eva_create_evaluation_detail_status.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue)
|
||||
|
||||
@@ -123,10 +123,10 @@ namespace TodoAPI2.Models
|
||||
int? newkey = 0;
|
||||
|
||||
var x = (from i in _repository.Context.eva_create_evaluation_detail
|
||||
orderby i.id descending
|
||||
select i).Take(1).ToList();
|
||||
orderby i.id descending
|
||||
select i).Take(1).ToList();
|
||||
|
||||
if(x.Count > 0)
|
||||
if (x.Count > 0)
|
||||
{
|
||||
newkey = x[0].id + 1;
|
||||
}
|
||||
@@ -142,13 +142,18 @@ namespace TodoAPI2.Models
|
||||
|
||||
|
||||
var inserted = _repository.Insert(entity);
|
||||
|
||||
|
||||
return Get(inserted.id);
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_statusViewModel Update(int id, eva_create_evaluation_detail_statusInputModel model)
|
||||
{
|
||||
var existingEntity = _repository.Get(id);
|
||||
|
||||
var current_eva = (from k in _repository.Context.eva_create_evaluation
|
||||
where k.id == existingEntity.create_evaluation_id
|
||||
select k).FirstOrDefault();
|
||||
|
||||
if (existingEntity != null)
|
||||
{
|
||||
existingEntity.create_evaluation_id = model.create_evaluation_id;
|
||||
@@ -158,26 +163,31 @@ namespace TodoAPI2.Models
|
||||
existingEntity.status_supervisor1A = model.status_supervisor1A;
|
||||
existingEntity.status_supervisor2A = model.status_supervisor2A;
|
||||
|
||||
if (current_eva.employee_id == existingEntity.chief) // หัวหน้าและผู้ประเมินสูงสุด เป็นคนคนเดียวกัน
|
||||
{
|
||||
if(existingEntity.status_chief == "Y") existingEntity.status_supervisor = existingEntity.status_chief;
|
||||
}
|
||||
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
return Get(updated.id);
|
||||
}
|
||||
else
|
||||
throw new NotificationException("No data to update");
|
||||
throw new NotificationException("No data to update");
|
||||
}
|
||||
|
||||
public string UpdateMultiple(List<eva_create_evaluation_detail_statusInputModel> model)
|
||||
public string UpdateMultiple(List<eva_create_evaluation_detail_statusInputModel> model)
|
||||
{
|
||||
foreach(var i in model)
|
||||
foreach (var i in model)
|
||||
{
|
||||
if (i.active_mode == "1" && i.id.HasValue) // update
|
||||
{
|
||||
{
|
||||
var existingEntity = _repository.Get(i.id.Value);
|
||||
if (existingEntity != null)
|
||||
{
|
||||
existingEntity.create_evaluation_id = i.create_evaluation_id;
|
||||
existingEntity.status_self = i.status_self;
|
||||
existingEntity.status_chief = i.status_chief;
|
||||
existingEntity.status_supervisor = i.status_supervisor;
|
||||
existingEntity.create_evaluation_id = i.create_evaluation_id;
|
||||
existingEntity.status_self = i.status_self;
|
||||
existingEntity.status_chief = i.status_chief;
|
||||
existingEntity.status_supervisor = i.status_supervisor;
|
||||
existingEntity.status_supervisor1A = i.status_supervisor1A;
|
||||
existingEntity.status_supervisor2A = i.status_supervisor2A;
|
||||
|
||||
@@ -192,15 +202,15 @@ namespace TodoAPI2.Models
|
||||
_repository.InsertWithoutCommit(entity);
|
||||
}
|
||||
else if (i.active_mode == "0" && i.id.HasValue) // remove
|
||||
{
|
||||
{
|
||||
_repository.DeleteWithoutCommit(i.id.Value);
|
||||
}
|
||||
else if (i.active_mode == "0" && !i.id.HasValue)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
}
|
||||
_repository.Context.SaveChanges();
|
||||
_repository.Context.SaveChanges();
|
||||
|
||||
return model.Count().ToString();
|
||||
}
|
||||
|
||||
@@ -202,10 +202,14 @@ namespace TodoAPI2.Models
|
||||
where k.id == existingEntity.create_evaluation_detail_id
|
||||
select k).FirstOrDefault();
|
||||
|
||||
var current_eva = (from k in _repository.Context.eva_create_evaluation
|
||||
where k.id == current_detail.create_evaluation_id
|
||||
select k).FirstOrDefault();
|
||||
|
||||
if (current_detail.status_chief == "Y")
|
||||
{
|
||||
throw new Exception("ผู้ประเมิน ส่งแบบประเมินไปแล้ว บันทึกไม่ได้");
|
||||
}
|
||||
}
|
||||
|
||||
if (existingEntity != null)
|
||||
{
|
||||
@@ -214,8 +218,18 @@ namespace TodoAPI2.Models
|
||||
//existingEntity.weight = i.weight;
|
||||
existingEntity.score = i.score;
|
||||
existingEntity.sumary = i.sumary;
|
||||
existingEntity.score2 = i.score;
|
||||
existingEntity.sumary2 = i.sumary;
|
||||
|
||||
if(current_eva.employee_id == current_detail.chief) // หัวหน้าและผู้ประเมินสูงสุด เป็นคนคนเดียวกัน
|
||||
{
|
||||
existingEntity.score2 = i.score;
|
||||
existingEntity.sumary2 = i.sumary;
|
||||
}
|
||||
//else // เป็นคนละคน (แต่ดึงค่า default ไปใส่ให้)
|
||||
//{
|
||||
// existingEntity.score2 = i.score;
|
||||
// existingEntity.sumary2 = i.sumary;
|
||||
//}
|
||||
|
||||
existingEntity.target_score1 = i.target_score1;
|
||||
existingEntity.target_score2 = i.target_score2;
|
||||
existingEntity.target_score3 = i.target_score3;
|
||||
|
||||
@@ -197,6 +197,10 @@ namespace TodoAPI2.Models
|
||||
where k.id == existingEntity.create_evaluation_detail_id
|
||||
select k).FirstOrDefault();
|
||||
|
||||
var current_eva = (from k in _repository.Context.eva_create_evaluation
|
||||
where k.id == current_detail.create_evaluation_id
|
||||
select k).FirstOrDefault();
|
||||
|
||||
if (current_detail.status_chief == "Y")
|
||||
{
|
||||
throw new Exception("ผู้ประเมิน ส่งแบบประเมินไปแล้ว บันทึกไม่ได้");
|
||||
@@ -207,6 +211,18 @@ namespace TodoAPI2.Models
|
||||
//existingEntity.weight = i.weight;
|
||||
existingEntity.score = i.score;
|
||||
existingEntity.sumary = i.sumary;
|
||||
|
||||
if (current_eva.employee_id == current_detail.chief) // หัวหน้าและผู้ประเมินสูงสุด เป็นคนคนเดียวกัน
|
||||
{
|
||||
existingEntity.score2 = i.score;
|
||||
existingEntity.sumary2 = i.sumary;
|
||||
}
|
||||
//else // เป็นคนละคน (แต่ดึงค่า default ไปใส่ให้)
|
||||
//{
|
||||
// existingEntity.score2 = i.score;
|
||||
// existingEntity.sumary2 = i.sumary;
|
||||
//}
|
||||
|
||||
existingEntity.target_score1 = i.target_score1;
|
||||
existingEntity.target_score2 = i.target_score2;
|
||||
existingEntity.target_score3 = i.target_score3;
|
||||
|
||||
Reference in New Issue
Block a user