ปรับปรุงหน้าจก eva detail
This commit is contained in:
@@ -132,7 +132,7 @@ namespace TodoAPI2.Models
|
||||
&& (m_eva_create_evaluation.evaluation_group_id == model.evaluation_group_id || !model.evaluation_group_id.HasValue)
|
||||
|
||||
|
||||
orderby m_eva_create_evaluation.created descending
|
||||
orderby fk_eva_performance_planResult1.fiscal_year, fk_eva_performance_planResult1.theTime, fk_eva_evaluation_groupResult5.code
|
||||
select new eva_create_evaluationViewModel()
|
||||
{
|
||||
id = m_eva_create_evaluation.id,
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detailEntity : BaseEntity2<int>
|
||||
{
|
||||
[ForeignKey("create_evaluation_id")]
|
||||
public eva_create_evaluationEntity eva_create_evaluation_create_evaluation_id { get; set; }
|
||||
public int? create_evaluation_id { get; set; }
|
||||
|
||||
public int? employee_id { get; set; }
|
||||
@@ -177,6 +179,18 @@ namespace TodoAPI2.Models
|
||||
|
||||
[MaxLength(1000)]
|
||||
public string chief_a_reject_reason { get; set; }
|
||||
|
||||
public int? eva_employee_id { get; set; }
|
||||
|
||||
public int? supervisor1_id { get; set; }
|
||||
|
||||
public int? supervisor2_id { get; set; }
|
||||
|
||||
public decimal? work_period { get; set; }
|
||||
|
||||
public int? order_of_data { get; set; }
|
||||
|
||||
public int? help_org_id { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,18 @@ namespace TodoAPI2.Models
|
||||
|
||||
public int? chief { get; set; }
|
||||
|
||||
public int? eva_employee_id { get; set; }
|
||||
|
||||
public int? supervisor1_id { get; set; }
|
||||
|
||||
public int? supervisor2_id { get; set; }
|
||||
|
||||
public decimal? work_period { get; set; }
|
||||
|
||||
public int? order_of_data { get; set; }
|
||||
|
||||
public int? help_org_id { get; set; }
|
||||
|
||||
public string active_mode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,18 +20,18 @@ namespace TodoAPI2.Models
|
||||
public class eva_create_evaluation_detailService : Ieva_create_evaluation_detailService
|
||||
{
|
||||
private IBaseRepository2<eva_create_evaluation_detailEntity, int> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
private Iexternal_competencyService com;
|
||||
|
||||
public eva_create_evaluation_detailService(IBaseRepository2<eva_create_evaluation_detailEntity, int> repository,
|
||||
public eva_create_evaluation_detailService(IBaseRepository2<eva_create_evaluation_detailEntity, int> repository,
|
||||
IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp,
|
||||
Iexternal_competencyService incom)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
com = incom;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
return Mapper.Map<List<eva_create_evaluation_detailViewModel>>(entities);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
@@ -68,31 +68,46 @@ namespace TodoAPI2.Models
|
||||
public eva_create_evaluation_detailWithSelectionViewModel GetWithSelection(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
var plan = (from x in _repository.Context.eva_create_evaluation where x.id == entity.create_evaluation_id select x.performance_plan_id).FirstOrDefault();
|
||||
|
||||
var i = Mapper.Map<eva_create_evaluation_detailWithSelectionViewModel>(entity);
|
||||
i.item_create_evaluation_id = (from x in _repository.Context.eva_create_evaluation
|
||||
join y in _repository.Context.eva_evaluation_group on x.evaluation_group_id equals y.id
|
||||
where x.performance_plan_id==plan
|
||||
orderby y.code
|
||||
select new external_linkageViewModel { external_id = x.id, external_name = y.thegroup }).ToList();
|
||||
i.item_employee_id = emp.GetAllEmployee();
|
||||
i.item_chief = i.item_employee_id;
|
||||
|
||||
i.item_eva_employee_id = i.item_employee_id;
|
||||
i.item_supervisor1_id = i.item_employee_id;
|
||||
i.item_supervisor2_id = i.item_employee_id;
|
||||
i.item_help_org_id = ext.GetDepartmentData();
|
||||
|
||||
return i;
|
||||
}
|
||||
public eva_create_evaluation_detailWithSelectionViewModel GetBlankItem()
|
||||
{
|
||||
var i = new eva_create_evaluation_detailWithSelectionViewModel();
|
||||
i.item_create_evaluation_id = null;
|
||||
i.item_employee_id = emp.GetAllEmployee();
|
||||
i.item_chief = i.item_employee_id;
|
||||
|
||||
i.item_eva_employee_id = i.item_employee_id;
|
||||
i.item_supervisor1_id = i.item_employee_id;
|
||||
i.item_supervisor2_id = i.item_employee_id;
|
||||
i.item_help_org_id = ext.GetDepartmentData();
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detailViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id)
|
||||
{
|
||||
var model = new eva_create_evaluation_detailSearchModel();
|
||||
var model = new eva_create_evaluation_detailSearchModel();
|
||||
model.create_evaluation_id = create_evaluation_id;
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detailViewModel> GetListBySearch(eva_create_evaluation_detailSearchModel model)
|
||||
public List<eva_create_evaluation_detailViewModel> GetListBySearch(eva_create_evaluation_detailSearchModel model)
|
||||
{
|
||||
var allemp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
@@ -119,9 +134,13 @@ namespace TodoAPI2.Models
|
||||
into sort_depResult2
|
||||
from fk_sort_depResult2 in sort_depResult2.DefaultIfEmpty()
|
||||
|
||||
where 1 ==1
|
||||
join fk_external_linkage46 in ext.GetDepartmentData() on m_eva_create_evaluation_detail.help_org_id equals fk_external_linkage46.id
|
||||
into external_linkageResult46
|
||||
from fk_external_linkageResult46 in external_linkageResult46.DefaultIfEmpty()
|
||||
|
||||
where 1 == 1
|
||||
&& (m_eva_create_evaluation_detail.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue)
|
||||
|
||||
|
||||
orderby
|
||||
fk_sort_depResult2.external_code,
|
||||
//fk_external_linkageResult2.department_degree_id,
|
||||
@@ -163,6 +182,13 @@ namespace TodoAPI2.Models
|
||||
status_chief = m_eva_create_evaluation_detail.status_chief,
|
||||
status_supervisor = m_eva_create_evaluation_detail.status_supervisor,
|
||||
|
||||
eva_employee_id = m_eva_create_evaluation_detail.eva_employee_id,
|
||||
supervisor1_id = m_eva_create_evaluation_detail.supervisor1_id,
|
||||
supervisor2_id = m_eva_create_evaluation_detail.supervisor2_id,
|
||||
work_period = m_eva_create_evaluation_detail.work_period,
|
||||
order_of_data = m_eva_create_evaluation_detail.order_of_data,
|
||||
help_org_id = m_eva_create_evaluation_detail.help_org_id,
|
||||
|
||||
status_supervisor1A = m_eva_create_evaluation_detail.status_supervisor1A,
|
||||
status_supervisor2A = m_eva_create_evaluation_detail.status_supervisor2A,
|
||||
|
||||
@@ -186,6 +212,7 @@ namespace TodoAPI2.Models
|
||||
status_supervisor2A_click_date = m_eva_create_evaluation_detail.status_supervisor2A_click_date,
|
||||
|
||||
department_name = fk_external_linkageResult2.department_name,
|
||||
help_org_id_external_linkage_external_name = fk_external_linkageResult46.external_name,
|
||||
|
||||
isActive = m_eva_create_evaluation_detail.isActive,
|
||||
Created = m_eva_create_evaluation_detail.created,
|
||||
@@ -205,10 +232,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;
|
||||
}
|
||||
@@ -224,7 +251,7 @@ namespace TodoAPI2.Models
|
||||
|
||||
|
||||
var inserted = _repository.Insert(entity);
|
||||
|
||||
|
||||
return Get(inserted.id);
|
||||
}
|
||||
|
||||
@@ -236,28 +263,38 @@ namespace TodoAPI2.Models
|
||||
existingEntity.create_evaluation_id = model.create_evaluation_id;
|
||||
existingEntity.employee_id = model.employee_id;
|
||||
existingEntity.chief = model.chief;
|
||||
|
||||
existingEntity.eva_employee_id = model.eva_employee_id;
|
||||
existingEntity.supervisor1_id = model.supervisor1_id;
|
||||
existingEntity.supervisor2_id = model.supervisor2_id;
|
||||
existingEntity.work_period = model.work_period;
|
||||
existingEntity.order_of_data = model.order_of_data;
|
||||
existingEntity.help_org_id = model.help_org_id;
|
||||
|
||||
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_create_evaluation_detailInputModel> model)
|
||||
public string UpdateMultiple(List<eva_create_evaluation_detailInputModel> 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.employee_id = i.employee_id;
|
||||
existingEntity.chief = i.chief;
|
||||
|
||||
existingEntity.create_evaluation_id = i.create_evaluation_id;
|
||||
existingEntity.employee_id = i.employee_id;
|
||||
existingEntity.chief = i.chief;
|
||||
existingEntity.eva_employee_id = i.eva_employee_id;
|
||||
existingEntity.supervisor1_id = i.supervisor1_id;
|
||||
existingEntity.supervisor2_id = i.supervisor2_id;
|
||||
existingEntity.work_period = i.work_period;
|
||||
existingEntity.order_of_data = i.order_of_data;
|
||||
existingEntity.help_org_id = i.help_org_id;
|
||||
|
||||
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
|
||||
}
|
||||
@@ -269,15 +306,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();
|
||||
}
|
||||
@@ -327,6 +364,7 @@ namespace TodoAPI2.Models
|
||||
n.employee_id = i;
|
||||
n.create_evaluation_id = create_evaluation_id;
|
||||
n.chief = emp.GetLeader(i);
|
||||
n.work_period = 6;
|
||||
n.created = DateTime.Now;
|
||||
n.updated = DateTime.Now;
|
||||
n.isActive = true;
|
||||
@@ -400,7 +438,7 @@ namespace TodoAPI2.Models
|
||||
where i.create_evaluation_detail_id == id
|
||||
select i;
|
||||
_repository.Context.eva_evaluation_behavior.RemoveRange(a2);
|
||||
|
||||
|
||||
_repository.Delete(id);
|
||||
|
||||
return;
|
||||
|
||||
@@ -104,12 +104,24 @@ namespace TodoAPI2.Models
|
||||
public DateTime? status_supervisor1A_click_date { get; set; }
|
||||
public DateTime? status_supervisor2A_click_date { get; set; }
|
||||
|
||||
public int? eva_employee_id { get; set; }
|
||||
|
||||
public int? supervisor1_id { get; set; }
|
||||
|
||||
public int? supervisor2_id { get; set; }
|
||||
|
||||
public decimal? work_period { get; set; }
|
||||
public int? order_of_data { get; set; }
|
||||
|
||||
public int? help_org_id { get; set; }
|
||||
|
||||
public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date); } }
|
||||
public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date); } }
|
||||
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date); } }
|
||||
public string txt_status_supervisor1A { get { return getStatusText(status_supervisor1A) + MyHelper.GetDateStringForReport(status_supervisor1A_click_date); } }
|
||||
public string txt_status_supervisor2A { get { return getStatusText(status_supervisor2A) + MyHelper.GetDateStringForReport(status_supervisor2A_click_date); } }
|
||||
|
||||
public string help_org_id_external_linkage_external_name { get; set; }
|
||||
private string getStatusText(string s)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(s))
|
||||
|
||||
@@ -7,8 +7,12 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detailWithSelectionViewModel: eva_create_evaluation_detailViewModel
|
||||
{
|
||||
public List<external_linkageViewModel> item_create_evaluation_id { get; set; }
|
||||
public List<external_employeeViewModel> item_employee_id { get; set; }
|
||||
public List<external_employeeViewModel> item_chief { get; set; }
|
||||
|
||||
public List<external_employeeViewModel> item_eva_employee_id { get; set; }
|
||||
public List<external_employeeViewModel> item_supervisor1_id { get; set; }
|
||||
public List<external_employeeViewModel> item_supervisor2_id { get; set; }
|
||||
public List<external_linkageViewModel> item_help_org_id { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user