This commit is contained in:
nakorn
2021-10-05 22:26:47 +07:00
parent e5cb49c75e
commit be227895a5
28 changed files with 2446 additions and 62 deletions

View File

@@ -81,6 +81,12 @@ namespace TodoAPI2.Models
public string employee_no_at_this_time { get; set; }
public bool? is_for_postponement { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new { get; set; }
public decimal? reward_new2 { get; set; }
}
}

View File

@@ -48,6 +48,10 @@ namespace TodoAPI2.Models
public string eva_result { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -141,9 +141,15 @@ namespace TodoAPI2.Models
adjust_postponement_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult1.fiscal_year,
employee_id_external_linkage_external_name = fk_external_linkageResult2.fullname,
reward_old = m_eva_adjust_postponement_detail_normal.reward_old,
reward_new = m_eva_adjust_postponement_detail_normal.reward_new,
isActive = m_eva_adjust_postponement_detail_normal.isActive,
Created = m_eva_adjust_postponement_detail_normal.created,
Updated = m_eva_adjust_postponement_detail_normal.updated
Updated = m_eva_adjust_postponement_detail_normal.updated,
salary_max = fk_external_linkageResult2.salary_max,
themax = fk_external_linkageResult2.themax
}
).ToList();
@@ -203,6 +209,8 @@ namespace TodoAPI2.Models
//existingEntity.emp_level = model.emp_level;
//existingEntity.total_score = model.total_score;
//existingEntity.eva_result = model.eva_result;
existingEntity.reward_old = model.reward_old;
existingEntity.reward_new = model.reward_new;
var updated = _repository.Update(id, existingEntity);
@@ -467,6 +475,8 @@ namespace TodoAPI2.Models
//existingEntity.emp_level = i.emp_level;
//existingEntity.total_score = i.total_score;
//existingEntity.eva_result = i.eva_result;
existingEntity.reward_old = i.reward_old;
existingEntity.reward_new = i.reward_new;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);

View File

@@ -50,8 +50,14 @@ namespace TodoAPI2.Models
public string eva_result { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new { get; set; }
public int? adjust_postponement_id_eva_adjust_postponement_fiscal_year { get; set; }
public string employee_id_external_linkage_external_name { get; set; }
public decimal? salary_max { get; set; }
public decimal? themax { get; set; }
}
}

View File

@@ -48,6 +48,10 @@ namespace TodoAPI2.Models
public string eva_result { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new { get; set; }
public string active_mode { get; set; }

View File

@@ -265,7 +265,8 @@ namespace TodoAPI2.Models
//existingEntity.emp_level = model.emp_level;
//existingEntity.total_score = model.total_score;
//existingEntity.eva_result = model.eva_result;
existingEntity.reward_old = model.reward_old;
existingEntity.reward_new = model.reward_new;
var updated = _repository.Update(id, existingEntity);
return Get(updated.id);
@@ -299,7 +300,8 @@ namespace TodoAPI2.Models
//existingEntity.emp_level = i.emp_level;
//existingEntity.total_score = i.total_score;
//existingEntity.eva_result = i.eva_result;
existingEntity.reward_old = i.reward_old;
existingEntity.reward_new = i.reward_new;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}

View File

@@ -63,5 +63,9 @@ namespace TodoAPI2.Models
public decimal? salary_max { get; set; }
public decimal? themax { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new { get; set; }
}
}

View File

@@ -52,6 +52,10 @@ namespace TodoAPI2.Models
public string eva_result { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new2 { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -20,16 +20,16 @@ namespace TodoAPI2.Models
public class eva_adjust_postponement_detail_quota_02Service : Ieva_adjust_postponement_detail_quota_02Service
{
private IBaseRepository2<eva_adjust_postponement_detailEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private IMyDatabase db;
private Iexternal_linkageService ext;
private Iexternal_employeeService emp;
public eva_adjust_postponement_detail_quota_02Service(IBaseRepository2<eva_adjust_postponement_detailEntity, int> repository,
public eva_adjust_postponement_detail_quota_02Service(IBaseRepository2<eva_adjust_postponement_detailEntity, int> repository,
IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp)
{
_repository = repository;
db = mydb;
ext = inext;
db = mydb;
ext = inext;
emp = inemp;
}
@@ -50,7 +50,7 @@ namespace TodoAPI2.Models
{
return Mapper.Map<List<eva_adjust_postponement_detail_quota_02ViewModel>>(entities);
}
#endregion
#region Public Functions
@@ -80,13 +80,13 @@ namespace TodoAPI2.Models
public List<eva_adjust_postponement_detail_quota_02ViewModel> GetListByadjust_postponement_quota_id(int? adjust_postponement_quota_id)
{
var model = new eva_adjust_postponement_detail_quota_02SearchModel();
var model = new eva_adjust_postponement_detail_quota_02SearchModel();
model.adjust_postponement_quota_id = adjust_postponement_quota_id;
return GetListBySearch(model);
}
public string GetWorkTimeText(DateTime? startDate, DateTime? endDate)
{
{
if (!endDate.HasValue || !startDate.HasValue)
return "";
@@ -98,7 +98,7 @@ namespace TodoAPI2.Models
return "";
}
public List<eva_adjust_postponement_detail_quota_02ViewModel> GetListBySearch(eva_adjust_postponement_detail_quota_02SearchModel model)
public List<eva_adjust_postponement_detail_quota_02ViewModel> GetListBySearch(eva_adjust_postponement_detail_quota_02SearchModel model)
{
var all_emp = emp.GetListByemployee_type(null, null);
@@ -112,10 +112,10 @@ namespace TodoAPI2.Models
into eva_adjust_postponementResult1A
from fk_eva_adjust_postponementResult1A in eva_adjust_postponementResult1A.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
// on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
// into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
// on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
// into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
join create_data in _repository.Context.eva_create_evaluation
on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_data.id
@@ -142,12 +142,12 @@ namespace TodoAPI2.Models
join fk_external_linkage2 in all_emp on m_eva_adjust_postponement_detail_quota_02.employee_id equals fk_external_linkage2.id
into external_linkageResult2
from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty()
from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
//on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
//into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
//on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
//into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
join sort_dep in ext.GetSortingDep() on m_eva_adjust_postponement_detail_quota_02.org_at_this_time.HasValue ? m_eva_adjust_postponement_detail_quota_02.org_at_this_time : fk_external_linkageResult2.department_id equals sort_dep.id
into sort_depResult2
@@ -162,7 +162,7 @@ namespace TodoAPI2.Models
into external_linkageResult11
from fk_external_linkageResult11 in sort_depResult2.DefaultIfEmpty()
where 1==1
where 1 == 1
//&& (m_eva_adjust_postponement_detail_quota_02.id == model.id || !model.id.HasValue)
&& (m_eva_adjust_postponement_detail_quota_02.adjust_postponement_quota_id == model.adjust_postponement_quota_id || !model.adjust_postponement_quota_id.HasValue)
//&& (fk_create_detailResult.employee_id == m_eva_adjust_postponement_detail_quota_02.employee_id || fk_create_detailResult == null)
@@ -203,7 +203,7 @@ namespace TodoAPI2.Models
emp_department_name = !string.IsNullOrEmpty(fk_external_linkageResult11.external_name) ? fk_external_linkageResult11.external_name : fk_sort_depResult2.external_name,
total_score = m_eva_adjust_postponement_detail_quota_02.migration_total_score.HasValue? m_eva_adjust_postponement_detail_quota_02.migration_total_score : m_eva_adjust_postponement_detail_quota_02.score_final,
total_score = m_eva_adjust_postponement_detail_quota_02.migration_total_score.HasValue ? m_eva_adjust_postponement_detail_quota_02.migration_total_score : m_eva_adjust_postponement_detail_quota_02.score_final,
eva_result = !string.IsNullOrEmpty(m_eva_adjust_postponement_detail_quota_02.migration_eva_result) ? m_eva_adjust_postponement_detail_quota_02.migration_eva_result : m_eva_adjust_postponement_detail_quota_02.level_score_final,
adjust_postponement_quota_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult1.fiscal_year,
@@ -213,9 +213,16 @@ namespace TodoAPI2.Models
startDate = fk_external_linkageResult2.packing_date,
endDate = endDate,
reward_old = m_eva_adjust_postponement_detail_quota_02.reward_old,
reward_new2 = m_eva_adjust_postponement_detail_quota_02.reward_new2,
salary_max = fk_external_linkageResult2.salary_max,
themax = fk_external_linkageResult2.themax,
isActive = m_eva_adjust_postponement_detail_quota_02.isActive,
Created = m_eva_adjust_postponement_detail_quota_02.created,
Updated = m_eva_adjust_postponement_detail_quota_02.updated
}
).ToList();
@@ -231,10 +238,10 @@ namespace TodoAPI2.Models
int? newkey = 0;
var x = (from i in _repository.Context.eva_adjust_postponement_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;
}
@@ -250,7 +257,7 @@ namespace TodoAPI2.Models
var inserted = _repository.Insert(entity);
return Get(inserted.id);
}
@@ -277,44 +284,46 @@ namespace TodoAPI2.Models
//existingEntity.emp_level = model.emp_level;
//existingEntity.total_score = model.total_score;
//existingEntity.eva_result = model.eva_result;
existingEntity.reward_old = model.reward_old;
existingEntity.reward_new2 = model.reward_new2;
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_adjust_postponement_detail_quota_02InputModel> model)
public string UpdateMultiple(List<eva_adjust_postponement_detail_quota_02InputModel> 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.adjust_postponement_quota_id = i.adjust_postponement_quota_id;
//existingEntity.employee_id = i.employee_id;
//existingEntity.sarary = i.sarary;
//existingEntity.cost_living = i.cost_living;
//existingEntity.middle = i.middle;
//existingEntity.promoted_percentage = i.promoted_percentage;
//existingEntity.total_promote = i.total_promote;
//existingEntity.new_sarary = i.new_sarary;
//existingEntity.new_cost_living = i.new_cost_living;
existingEntity.remark = i.remark;
existingEntity.receive_quota = i.receive_quota;
existingEntity.new_sarary_with_quota = i.new_sarary_with_quota;
//existingEntity.emp_code = i.emp_code;
//existingEntity.emp_fullname = i.emp_fullname;
//existingEntity.emp_position = i.emp_position;
//existingEntity.emp_level = i.emp_level;
//existingEntity.total_score = i.total_score;
//existingEntity.eva_result = i.eva_result;
//existingEntity.adjust_postponement_quota_id = i.adjust_postponement_quota_id;
//existingEntity.employee_id = i.employee_id;
//existingEntity.sarary = i.sarary;
//existingEntity.cost_living = i.cost_living;
//existingEntity.middle = i.middle;
//existingEntity.promoted_percentage = i.promoted_percentage;
//existingEntity.total_promote = i.total_promote;
//existingEntity.new_sarary = i.new_sarary;
//existingEntity.new_cost_living = i.new_cost_living;
existingEntity.remark = i.remark;
existingEntity.receive_quota = i.receive_quota;
existingEntity.new_sarary_with_quota = i.new_sarary_with_quota;
//existingEntity.emp_code = i.emp_code;
//existingEntity.emp_fullname = i.emp_fullname;
//existingEntity.emp_position = i.emp_position;
//existingEntity.emp_level = i.emp_level;
//existingEntity.total_score = i.total_score;
//existingEntity.eva_result = i.eva_result;
existingEntity.reward_old = i.reward_old;
existingEntity.reward_new2 = i.reward_new2;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}
@@ -326,15 +335,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

@@ -60,5 +60,13 @@ namespace TodoAPI2.Models
public DateTime? startDate { get; set; }
public DateTime? endDate { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new2 { get; set; }
public decimal? salary_max { get; set; }
public decimal? themax { get; set; }
}
}