ปรับปรุง flow การบันทึกและแสดงคะแนนของทุก actor
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user