|
|
|
|
@@ -20,14 +20,14 @@ namespace TodoAPI2.Models
|
|
|
|
|
public class eva_performance_planService : Ieva_performance_planService
|
|
|
|
|
{
|
|
|
|
|
private IBaseRepository<eva_performance_planEntity, Guid> _repository;
|
|
|
|
|
private IMyDatabase db;
|
|
|
|
|
private Iexternal_linkageService ext;
|
|
|
|
|
private IMyDatabase db;
|
|
|
|
|
private Iexternal_linkageService ext;
|
|
|
|
|
|
|
|
|
|
public eva_performance_planService(IBaseRepository<eva_performance_planEntity, Guid> 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_performance_planViewModel>>(entities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<eva_performance_planEntity> GetListWithoutBase64Fields(IQueryable<eva_performance_planEntity> listQuery)
|
|
|
|
|
{
|
|
|
|
|
return listQuery.Select(c => new eva_performance_planEntity()
|
|
|
|
|
@@ -98,7 +98,7 @@ namespace TodoAPI2.Models
|
|
|
|
|
id = m_eva_performance_plan.id,
|
|
|
|
|
fiscal_year = m_eva_performance_plan.fiscal_year,
|
|
|
|
|
theTime = m_eva_performance_plan.theTime,
|
|
|
|
|
|
|
|
|
|
percent = m_eva_performance_plan.percent,
|
|
|
|
|
|
|
|
|
|
isActive = m_eva_performance_plan.isActive,
|
|
|
|
|
Created = m_eva_performance_plan.created,
|
|
|
|
|
@@ -115,7 +115,7 @@ namespace TodoAPI2.Models
|
|
|
|
|
from m_eva_performance_plan in _repository.Context.eva_performance_plan
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
where m_eva_performance_plan.fiscal_year == fiscal_year || !fiscal_year.HasValue
|
|
|
|
|
where m_eva_performance_plan.fiscal_year == fiscal_year || !fiscal_year.HasValue
|
|
|
|
|
|
|
|
|
|
orderby m_eva_performance_plan.created descending
|
|
|
|
|
select new eva_performance_planViewModel()
|
|
|
|
|
@@ -123,7 +123,7 @@ namespace TodoAPI2.Models
|
|
|
|
|
id = m_eva_performance_plan.id,
|
|
|
|
|
fiscal_year = m_eva_performance_plan.fiscal_year,
|
|
|
|
|
theTime = m_eva_performance_plan.theTime,
|
|
|
|
|
|
|
|
|
|
percent = m_eva_performance_plan.percent,
|
|
|
|
|
|
|
|
|
|
isActive = m_eva_performance_plan.isActive,
|
|
|
|
|
Created = m_eva_performance_plan.created,
|
|
|
|
|
@@ -134,13 +134,13 @@ namespace TodoAPI2.Models
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<eva_performance_planViewModel> GetListBySearch(eva_performance_planSearchModel model)
|
|
|
|
|
public List<eva_performance_planViewModel> GetListBySearch(eva_performance_planSearchModel model)
|
|
|
|
|
{
|
|
|
|
|
var data = (
|
|
|
|
|
from m_eva_performance_plan in _repository.Context.eva_performance_plan
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
where 1==1
|
|
|
|
|
where 1 == 1
|
|
|
|
|
&& (m_eva_performance_plan.fiscal_year == model.fiscal_year || !model.fiscal_year.HasValue)
|
|
|
|
|
&& (m_eva_performance_plan.theTime == model.theTime || !model.theTime.HasValue)
|
|
|
|
|
|
|
|
|
|
@@ -151,7 +151,7 @@ namespace TodoAPI2.Models
|
|
|
|
|
id = m_eva_performance_plan.id,
|
|
|
|
|
fiscal_year = m_eva_performance_plan.fiscal_year,
|
|
|
|
|
theTime = m_eva_performance_plan.theTime,
|
|
|
|
|
|
|
|
|
|
percent = m_eva_performance_plan.percent,
|
|
|
|
|
|
|
|
|
|
isActive = m_eva_performance_plan.isActive,
|
|
|
|
|
Created = m_eva_performance_plan.created,
|
|
|
|
|
@@ -173,7 +173,7 @@ namespace TodoAPI2.Models
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var inserted = _repository.Insert(entity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Get(inserted.id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -184,27 +184,27 @@ namespace TodoAPI2.Models
|
|
|
|
|
{
|
|
|
|
|
existingEntity.fiscal_year = model.fiscal_year;
|
|
|
|
|
existingEntity.theTime = model.theTime;
|
|
|
|
|
|
|
|
|
|
existingEntity.percent = model.percent;
|
|
|
|
|
|
|
|
|
|
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_performance_planInputModel> model)
|
|
|
|
|
public string UpdateMultiple(List<eva_performance_planInputModel> 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.fiscal_year = i.fiscal_year;
|
|
|
|
|
existingEntity.theTime = i.theTime;
|
|
|
|
|
|
|
|
|
|
existingEntity.fiscal_year = i.fiscal_year;
|
|
|
|
|
existingEntity.theTime = i.theTime;
|
|
|
|
|
existingEntity.percent = i.percent;
|
|
|
|
|
|
|
|
|
|
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
|
|
|
|
|
}
|
|
|
|
|
@@ -216,15 +216,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();
|
|
|
|
|
}
|
|
|
|
|
|