ปรับปรุงสิทธิการมองเห็นต่างๆ

This commit is contained in:
Nakorn Rientrakrunchai
2020-03-01 17:17:43 +07:00
parent c65c179e85
commit f8f46bb346
29 changed files with 448 additions and 696 deletions

View File

@@ -157,6 +157,15 @@ namespace TodoAPI2.Models
throw new Exception("ไม่สามารถบันทึกค่าน้ำหนักในส่วนผลสัมฤทธิ์ของงาน ได้เกิน 100");
}
var current_detail = (from i in _repository.Context.eva_create_evaluation_detail
where i.id == model.create_evaluation_detail_id
select i).FirstOrDefault();
if(current_detail.status_self == "Y")
{
throw new Exception("คุณนำส่งข้อตกลงการประเมินไปแล้ว ไม่สามารถบันทึกได้");
}
if (!string.IsNullOrEmpty(model.thefile))
{
//Move file from temp to physical
@@ -185,6 +194,15 @@ namespace TodoAPI2.Models
throw new Exception("ไม่สามารถบันทึกค่าน้ำหนักในส่วนผลสัมฤทธิ์ของงาน ได้เกิน 100");
}
var current_detail = (from i in _repository.Context.eva_create_evaluation_detail
where i.id == model.create_evaluation_detail_id
select i).FirstOrDefault();
if (current_detail.status_self == "Y")
{
throw new Exception("คุณนำส่งข้อตกลงการประเมินไปแล้ว ไม่สามารถบันทึกได้");
}
var existingEntity = _repository.Get(id);
if (existingEntity != null)
{
@@ -231,6 +249,15 @@ namespace TodoAPI2.Models
var existingEntity = _repository.Get(i.id.Value);
if (existingEntity != null)
{
var current_detail = (from k in _repository.Context.eva_create_evaluation_detail
where k.id == existingEntity.create_evaluation_detail_id
select k).FirstOrDefault();
if (current_detail.status_self == "Y")
{
throw new Exception("ผู้รับการประเมิน ส่งแบบประเมินไปแล้ว บันทึกไม่ได้");
}
existingEntity.create_evaluation_detail_id = i.create_evaluation_detail_id;
existingEntity.achievement = i.achievement;
existingEntity.weight = i.weight;