ปรับปรุง flow การบันทึกและแสดงคะแนนของทุก actor

This commit is contained in:
Nakorn Rientrakrunchai
2020-08-17 16:26:49 +07:00
parent 29b7e1856e
commit c2b65272e6
20 changed files with 1439 additions and 191 deletions

View File

@@ -14,8 +14,6 @@ namespace TodoAPI2.Models
{
public class eva_create_evaluation_detailEntity : BaseEntity2<int>
{
public int? create_evaluation_id { get; set; }
public int? employee_id { get; set; }
@@ -122,5 +120,40 @@ namespace TodoAPI2.Models
public DateTime? status_supervisor_click_date { get; set; }
public DateTime? status_supervisor1A_click_date { get; set; }
public DateTime? status_supervisor2A_click_date { get; set; }
public decimal? total_summary_supervisor1A { get; set; }
public decimal? Final_summary_supervisor1A { get; set; }
public decimal? total_summary_competency_supervisor1A { get; set; }
public decimal? Final_summary_competency_supervisor1A { get; set; }
public decimal? achievement_supervisor1A { get; set; }
public decimal? competency_supervisor1A { get; set; }
public decimal? score_supervisor1A { get; set; }
[MaxLength(255)]
public string level_score_supervisor1A { get; set; }
public decimal? total_summary_supervisor2A { get; set; }
public decimal? Final_summary_supervisor2A { get; set; }
public decimal? total_summary_competency_supervisor2A { get; set; }
public decimal? Final_summary_competency_supervisor2A { get; set; }
public decimal? achievement_supervisor2A { get; set; }
public decimal? competency_supervisor2A { get; set; }
public decimal? score_supervisor2A { get; set; }
[MaxLength(255)]
public string level_score_supervisor2A { get; set; }
}
}

View File

@@ -34,6 +34,8 @@ namespace TodoAPI2.Models
public string level_score_supervisor { get; set; }
public string who_update { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -20,14 +20,14 @@ namespace TodoAPI2.Models
public class eva_create_evaluation_detail_summary2Service : Ieva_create_evaluation_detail_summary2Service
{
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_summary2Service(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_summary2ViewModel>>(entities);
}
#endregion
#region Public Functions
@@ -77,18 +77,18 @@ namespace TodoAPI2.Models
public List<eva_create_evaluation_detail_summary2ViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id)
{
var model = new eva_create_evaluation_detail_summary2SearchModel();
var model = new eva_create_evaluation_detail_summary2SearchModel();
model.create_evaluation_id = create_evaluation_id;
return GetListBySearch(model);
}
public List<eva_create_evaluation_detail_summary2ViewModel> GetListBySearch(eva_create_evaluation_detail_summary2SearchModel model)
public List<eva_create_evaluation_detail_summary2ViewModel> GetListBySearch(eva_create_evaluation_detail_summary2SearchModel model)
{
var data = (
from m_eva_create_evaluation_detail_summary2 in _repository.Context.eva_create_evaluation_detail
where 1==1
where 1 == 1
//&& (m_eva_create_evaluation_detail_summary2.id == model.id || !model.id.HasValue)
&& (m_eva_create_evaluation_detail_summary2.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue)
@@ -98,6 +98,7 @@ namespace TodoAPI2.Models
{
id = m_eva_create_evaluation_detail_summary2.id,
create_evaluation_id = m_eva_create_evaluation_detail_summary2.create_evaluation_id,
total_summary_supervisor = m_eva_create_evaluation_detail_summary2.total_summary_supervisor,
Final_summary_supervisor = m_eva_create_evaluation_detail_summary2.Final_summary_supervisor,
total_summary_competency_supervisor = m_eva_create_evaluation_detail_summary2.total_summary_competency_supervisor,
@@ -107,6 +108,23 @@ namespace TodoAPI2.Models
score_supervisor = m_eva_create_evaluation_detail_summary2.score_supervisor,
level_score_supervisor = m_eva_create_evaluation_detail_summary2.level_score_supervisor,
total_summary_supervisor1A = m_eva_create_evaluation_detail_summary2.total_summary_supervisor1A,
Final_summary_supervisor1A = m_eva_create_evaluation_detail_summary2.Final_summary_supervisor1A,
total_summary_competency_supervisor1A = m_eva_create_evaluation_detail_summary2.total_summary_competency_supervisor1A,
Final_summary_competency_supervisor1A = m_eva_create_evaluation_detail_summary2.Final_summary_competency_supervisor1A,
achievement_supervisor1A = m_eva_create_evaluation_detail_summary2.achievement_supervisor1A,
competency_supervisor1A = m_eva_create_evaluation_detail_summary2.competency_supervisor1A,
score_supervisor1A = m_eva_create_evaluation_detail_summary2.score_supervisor1A,
level_score_supervisor1A = m_eva_create_evaluation_detail_summary2.level_score_supervisor1A,
total_summary_supervisor2A = m_eva_create_evaluation_detail_summary2.total_summary_supervisor2A,
Final_summary_supervisor2A = m_eva_create_evaluation_detail_summary2.Final_summary_supervisor2A,
total_summary_competency_supervisor2A = m_eva_create_evaluation_detail_summary2.total_summary_competency_supervisor2A,
Final_summary_competency_supervisor2A = m_eva_create_evaluation_detail_summary2.Final_summary_competency_supervisor2A,
achievement_supervisor2A = m_eva_create_evaluation_detail_summary2.achievement_supervisor2A,
competency_supervisor2A = m_eva_create_evaluation_detail_summary2.competency_supervisor2A,
score_supervisor2A = m_eva_create_evaluation_detail_summary2.score_supervisor2A,
level_score_supervisor2A = m_eva_create_evaluation_detail_summary2.level_score_supervisor2A,
isActive = m_eva_create_evaluation_detail_summary2.isActive,
Created = m_eva_create_evaluation_detail_summary2.created,
@@ -126,10 +144,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;
}
@@ -145,7 +163,7 @@ namespace TodoAPI2.Models
var inserted = _repository.Insert(entity);
return Get(inserted.id);
}
@@ -155,6 +173,7 @@ namespace TodoAPI2.Models
if (existingEntity != null)
{
existingEntity.create_evaluation_id = model.create_evaluation_id;
existingEntity.total_summary_supervisor = model.total_summary_supervisor;
existingEntity.Final_summary_supervisor = model.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor = model.total_summary_competency_supervisor;
@@ -169,28 +188,71 @@ namespace TodoAPI2.Models
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_summary2InputModel> model)
public string UpdateMultiple(List<eva_create_evaluation_detail_summary2InputModel> 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.total_summary_supervisor = i.total_summary_supervisor;
existingEntity.Final_summary_supervisor = i.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor = i.total_summary_competency_supervisor;
existingEntity.Final_summary_competency_supervisor = i.Final_summary_competency_supervisor;
existingEntity.achievement_supervisor = i.achievement_supervisor;
existingEntity.competency_supervisor = i.competency_supervisor;
existingEntity.score_supervisor = i.score_supervisor;
existingEntity.level_score_supervisor = i.level_score_supervisor;
existingEntity.create_evaluation_id = i.create_evaluation_id;
if(i.who_update == "2")
{
existingEntity.total_summary_supervisor = i.total_summary_supervisor;
existingEntity.Final_summary_supervisor = i.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor = i.total_summary_competency_supervisor;
existingEntity.Final_summary_competency_supervisor = i.Final_summary_competency_supervisor;
existingEntity.achievement_supervisor = i.achievement_supervisor;
existingEntity.competency_supervisor = i.competency_supervisor;
existingEntity.score_supervisor = i.score_supervisor;
existingEntity.level_score_supervisor = i.level_score_supervisor;
existingEntity.total_summary_supervisor1A = i.total_summary_supervisor;
existingEntity.Final_summary_supervisor1A = i.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor1A = i.total_summary_competency_supervisor;
existingEntity.Final_summary_competency_supervisor1A = i.Final_summary_competency_supervisor;
existingEntity.achievement_supervisor1A = i.achievement_supervisor;
existingEntity.competency_supervisor1A = i.competency_supervisor;
existingEntity.score_supervisor1A = i.score_supervisor;
existingEntity.level_score_supervisor1A = i.level_score_supervisor;
}
else if (i.who_update == "3")
{
existingEntity.total_summary_supervisor1A = i.total_summary_supervisor;
existingEntity.Final_summary_supervisor1A = i.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor1A = i.total_summary_competency_supervisor;
existingEntity.Final_summary_competency_supervisor1A = i.Final_summary_competency_supervisor;
existingEntity.achievement_supervisor1A = i.achievement_supervisor;
existingEntity.competency_supervisor1A = i.competency_supervisor;
existingEntity.score_supervisor1A = i.score_supervisor;
existingEntity.level_score_supervisor1A = i.level_score_supervisor;
existingEntity.total_summary_supervisor2A = i.total_summary_supervisor;
existingEntity.Final_summary_supervisor2A = i.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor2A = i.total_summary_competency_supervisor;
existingEntity.Final_summary_competency_supervisor2A = i.Final_summary_competency_supervisor;
existingEntity.achievement_supervisor2A = i.achievement_supervisor;
existingEntity.competency_supervisor2A = i.competency_supervisor;
existingEntity.score_supervisor2A = i.score_supervisor;
existingEntity.level_score_supervisor2A = i.level_score_supervisor;
}
else if (i.who_update == "4")
{
existingEntity.total_summary_supervisor2A = i.total_summary_supervisor;
existingEntity.Final_summary_supervisor2A = i.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor2A = i.total_summary_competency_supervisor;
existingEntity.Final_summary_competency_supervisor2A = i.Final_summary_competency_supervisor;
existingEntity.achievement_supervisor2A = i.achievement_supervisor;
existingEntity.competency_supervisor2A = i.competency_supervisor;
existingEntity.score_supervisor2A = i.score_supervisor;
existingEntity.level_score_supervisor2A = i.level_score_supervisor;
}
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}
@@ -202,15 +264,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();
}

View File

@@ -32,6 +32,36 @@ namespace TodoAPI2.Models
public string level_score_supervisor { get; set; }
public decimal? total_summary_supervisor1A { get; set; }
public decimal? Final_summary_supervisor1A { get; set; }
public decimal? total_summary_competency_supervisor1A { get; set; }
public decimal? Final_summary_competency_supervisor1A { get; set; }
public decimal? achievement_supervisor1A { get; set; }
public decimal? competency_supervisor1A { get; set; }
public decimal? score_supervisor1A { get; set; }
public string level_score_supervisor1A { get; set; }
public decimal? total_summary_supervisor2A { get; set; }
public decimal? Final_summary_supervisor2A { get; set; }
public decimal? total_summary_competency_supervisor2A { get; set; }
public decimal? Final_summary_competency_supervisor2A { get; set; }
public decimal? achievement_supervisor2A { get; set; }
public decimal? competency_supervisor2A { get; set; }
public decimal? score_supervisor2A { get; set; }
public string level_score_supervisor2A { get; set; }
}
}

View File

@@ -39,11 +39,13 @@ namespace TodoAPI2.Models
}
public decimal? score { get; set; }
public decimal? sumary { get; set; }
public decimal? score2 { get; set; }
public decimal? sumary2 { get; set; }
public decimal? score3 { get; set; }
public decimal? sumary3 { get; set; }
public decimal? score4 { get; set; }
public decimal? sumary4 { get; set; }
[MaxLength(255)]
public string target_score1 { get; set; }

View File

@@ -40,6 +40,8 @@ namespace TodoAPI2.Models
public string target_score5 { get; set; }
public string who_update { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -106,10 +106,16 @@ namespace TodoAPI2.Models
weight = m_eva_evaluation_achievement_process2.weight,
thefile = m_eva_evaluation_achievement_process2.thefile,
thefileDisplay = m_eva_evaluation_achievement_process2.thefileDisplay,
score = m_eva_evaluation_achievement_process2.score,
sumary = m_eva_evaluation_achievement_process2.sumary,
score2 = m_eva_evaluation_achievement_process2.score2,
sumary2 = m_eva_evaluation_achievement_process2.sumary2,
score3 = m_eva_evaluation_achievement_process2.score3,
sumary3 = m_eva_evaluation_achievement_process2.sumary3,
score4 = m_eva_evaluation_achievement_process2.score4,
sumary4 = m_eva_evaluation_achievement_process2.sumary4,
target_score1 = m_eva_evaluation_achievement_process2.target_score1,
target_score2 = m_eva_evaluation_achievement_process2.target_score2,
target_score3 = m_eva_evaluation_achievement_process2.target_score3,
@@ -220,10 +226,10 @@ namespace TodoAPI2.Models
where k.id == existingEntity.create_evaluation_detail_id
select k).FirstOrDefault();
if (current_detail.status_supervisor == "Y")
{
throw new Exception("ผู้ประเมินสูงสุด ส่งแบบประเมินไปแล้ว บันทึกไม่ได้");
}
//if (current_detail.status_supervisor == "Y")
//{
// throw new Exception("ผู้ประเมินสูงสุด ส่งแบบประเมินไปแล้ว บันทึกไม่ได้");
//}
if (existingEntity != null)
{
@@ -249,8 +255,27 @@ namespace TodoAPI2.Models
}
//existingEntity.score = i.score;
existingEntity.score2 = i.score2;
existingEntity.sumary2 = i.sumary2;
if (i.who_update == "2")
{
existingEntity.score2 = i.score2;
existingEntity.sumary2 = i.sumary2;
existingEntity.score3 = i.score2;
existingEntity.sumary3 = i.sumary2;
}
else if (i.who_update == "3")
{
existingEntity.score3 = i.score2;
existingEntity.sumary3 = i.sumary2;
existingEntity.score4 = i.score2;
existingEntity.sumary4 = i.sumary2;
}
else if (i.who_update == "4")
{
existingEntity.score4 = i.score2;
existingEntity.sumary4 = i.sumary2;
}
//existingEntity.target_score1 = i.target_score1;
//existingEntity.target_score2 = i.target_score2;
//existingEntity.target_score3 = i.target_score3;

View File

@@ -39,6 +39,12 @@ namespace TodoAPI2.Models
public decimal? score2 { get; set; }
public decimal? sumary2 { get; set; }
public decimal? score3 { get; set; }
public decimal? sumary3 { get; set; }
public decimal? score4 { get; set; }
public decimal? sumary4 { get; set; }
public string target_score1 { get; set; }

View File

@@ -26,11 +26,13 @@ namespace TodoAPI2.Models
public decimal? weight { get; set; }
public decimal? score { get; set; }
public decimal? sumary { get; set; }
public decimal? score2 { get; set; }
public decimal? sumary2 { get; set; }
public decimal? score3 { get; set; }
public decimal? sumary3 { get; set; }
public decimal? score4 { get; set; }
public decimal? sumary4 { get; set; }
[MaxLength(255)]
public string target_score1 { get; set; }

View File

@@ -38,6 +38,8 @@ namespace TodoAPI2.Models
public string target_score5 { get; set; }
public string who_update { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -104,10 +104,16 @@ namespace TodoAPI2.Models
create_evaluation_detail_id = m_eva_evaluation_behavior_process2.create_evaluation_detail_id,
behavior = m_eva_evaluation_behavior_process2.behavior_fix,
weight = m_eva_evaluation_behavior_process2.weight,
score = m_eva_evaluation_behavior_process2.score,
sumary = m_eva_evaluation_behavior_process2.sumary,
score2 = m_eva_evaluation_behavior_process2.score2,
sumary2 = m_eva_evaluation_behavior_process2.sumary2,
score3 = m_eva_evaluation_behavior_process2.score3,
sumary3 = m_eva_evaluation_behavior_process2.sumary3,
score4 = m_eva_evaluation_behavior_process2.score4,
sumary4 = m_eva_evaluation_behavior_process2.sumary4,
target_score1 = m_eva_evaluation_behavior_process2.target_score1,
target_score2 = m_eva_evaluation_behavior_process2.target_score2,
target_score3 = m_eva_evaluation_behavior_process2.target_score3,
@@ -195,17 +201,36 @@ namespace TodoAPI2.Models
where k.id == existingEntity.create_evaluation_detail_id
select k).FirstOrDefault();
if (current_detail.status_supervisor == "Y")
{
throw new Exception("ผู้ประเมินสูงสุด ส่งแบบประเมินไปแล้ว บันทึกไม่ได้");
}
//if (current_detail.status_supervisor == "Y")
//{
// throw new Exception("ผู้ประเมินสูงสุด ส่งแบบประเมินไปแล้ว บันทึกไม่ได้");
//}
//existingEntity.create_evaluation_detail_id = i.create_evaluation_detail_id;
//existingEntity.behavior = i.behavior;
existingEntity.weight = i.weight;
//existingEntity.score = i.score;
existingEntity.score2 = i.score2;
existingEntity.sumary2 = i.sumary2;
if (i.who_update == "2")
{
existingEntity.score2 = i.score2;
existingEntity.sumary2 = i.sumary2;
existingEntity.score3 = i.score2;
existingEntity.sumary3 = i.sumary2;
}
else if (i.who_update == "3")
{
existingEntity.score3 = i.score2;
existingEntity.sumary3 = i.sumary2;
existingEntity.score4 = i.score2;
existingEntity.sumary4 = i.sumary2;
}
else if (i.who_update == "4")
{
existingEntity.score4 = i.score2;
existingEntity.sumary4 = i.sumary2;
}
existingEntity.target_score1 = i.target_score1;
existingEntity.target_score2 = i.target_score2;
existingEntity.target_score3 = i.target_score3;

View File

@@ -28,6 +28,14 @@ namespace TodoAPI2.Models
public decimal? sumary2 { get; set; }
public decimal? score3 { get; set; }
public decimal? sumary3 { get; set; }
public decimal? score4 { get; set; }
public decimal? sumary4 { get; set; }
public string target_score1 { get; set; }
public string target_score2 { get; set; }