ปรับปรุงหน้า migration ให้ดูง่ายขึ้น และอื่นๆ อีกหลายจุด

This commit is contained in:
LAPTOP-KB8JC2K2\acer
2021-04-20 11:18:46 +07:00
parent d0dbaae151
commit a89ba725a2
11 changed files with 43 additions and 7 deletions

View File

@@ -162,6 +162,8 @@ namespace TodoAPI2.Models
employee_no_at_this_time = m_eva_adjust_postponement_detail_migration.employee_no_at_this_time,
is_for_postponement = m_eva_adjust_postponement_detail_migration.is_for_postponement,
workingstatus = fk_external_linkageResult3.workingstatus,
isActive = m_eva_adjust_postponement_detail_migration.isActive,
Created = m_eva_adjust_postponement_detail_migration.created,
Updated = m_eva_adjust_postponement_detail_migration.updated

View File

@@ -67,5 +67,9 @@ namespace TodoAPI2.Models
public string employee_id_external_linkage_external_name { get; set; }
public string org_at_this_time_external_linkage_external_name { get; set; }
public string workingstatus { get; set; }
}
}

View File

@@ -14,7 +14,6 @@ using System.Net;
using TTSW.Configure;
using Microsoft.Extensions.Options;
using System.Data;
using System.IO;
namespace TodoAPI2.Models
{
@@ -81,9 +80,18 @@ namespace TodoAPI2.Models
public eva_adjust_postponement_migrationWithSelectionViewModel GetWithSelection(int id)
{
var entity = _repository.Get(id);
var i = Mapper.Map<eva_adjust_postponement_migrationWithSelectionViewModel>(entity);
i.item_create_evaluation_id = (from x in _repository.Context.eva_create_evaluation select x).ToList();
var all_emp = emp.GetAllEmployee();
var i = Mapper.Map<eva_adjust_postponement_migrationWithSelectionViewModel>(entity);
i.item_create_evaluation_id = (from x in _repository.Context.eva_create_evaluation
join y in _repository.Context.eva_performance_plan on x.performance_plan_id equals y.id
join z in all_emp on x.employee_id equals z.id
join g in _repository.Context.eva_evaluation_group on x.evaluation_group_id equals g.id
select new external_linkageViewModel {
external_id = x.id,
external_name = y.theTime.ToString() + "/" + y.fiscal_year.ToString() + " " + g.thegroup + " " + z.fullname
}).ToList();
i.item_managed_by = all_emp.ToList();
i.item_report_type = (from x in ext.GetSalaryReportType() select x).ToList();
@@ -92,8 +100,18 @@ namespace TodoAPI2.Models
public eva_adjust_postponement_migrationWithSelectionViewModel GetBlankItem()
{
var i = new eva_adjust_postponement_migrationWithSelectionViewModel();
i.item_create_evaluation_id = (from x in _repository.Context.eva_create_evaluation select x).ToList();
var all_emp = emp.GetAllEmployee();
i.item_create_evaluation_id = (from x in _repository.Context.eva_create_evaluation
join y in _repository.Context.eva_performance_plan on x.performance_plan_id equals y.id
join z in all_emp on x.employee_id equals z.id
join g in _repository.Context.eva_evaluation_group on x.evaluation_group_id equals g.id
select new external_linkageViewModel
{
external_id = x.id,
external_name = y.theTime.ToString() + "/" + y.fiscal_year.ToString() + " " + g.thegroup + " " + z.fullname
}).ToList();
i.item_managed_by = all_emp.ToList();
i.item_report_type = (from x in ext.GetSalaryReportType() select x).ToList();
@@ -145,6 +163,7 @@ namespace TodoAPI2.Models
imported_file = m_eva_adjust_postponement_migration.imported_file,
imported_fileDisplay = m_eva_adjust_postponement_migration.imported_fileDisplay,
report_type = m_eva_adjust_postponement_migration.report_type,
workingstatus = fk_external_linkageResult11.workingstatus,
create_evaluation_id_eva_create_evaluation_performance_plan_id = fk_eva_create_evaluationResult4.performance_plan_id,
managed_by_external_linkage_external_name = fk_external_linkageResult11.fullname,
@@ -322,6 +341,8 @@ namespace TodoAPI2.Models
existingEntity.percentage = model.percentage;
existingEntity.command_no = model.command_no;
existingEntity.managed_by = model.managed_by;
existingEntity.report_type = model.report_type;
if (!string.IsNullOrEmpty(model.imported_file))
{
if (model.imported_file.StartsWith("Uploads"))

View File

@@ -55,5 +55,9 @@ namespace TodoAPI2.Models
public string report_type { get; set; }
public string workingstatus { get; set; }
public string txt_data_type { get { if (create_evaluation_id.HasValue) return "ปรับเลื่อนเงินเดือน"; else return "โควต้า"; } }
}
}

View File

@@ -7,7 +7,7 @@ namespace TodoAPI2.Models
{
public class eva_adjust_postponement_migrationWithSelectionViewModel: eva_adjust_postponement_migrationViewModel
{
public List<eva_create_evaluationEntity> item_create_evaluation_id { get; set; }
public List<external_linkageViewModel> item_create_evaluation_id { get; set; }
public List<external_employeeViewModel> item_managed_by { get; set; }
public List<external_linkageViewModel> item_report_type { get; set; }
}

View File

@@ -301,7 +301,7 @@ namespace TodoAPI2.Models
public void Delete(int id)
{
var details = from i in _repository.Context.eva_adjust_postponement_detail
where i.adjust_postponement_id == id
where i.adjust_postponement_id == id || i.adjust_postponement_quota_id == id
select i;
_repository.Context.eva_adjust_postponement_detail.RemoveRange(details);