แก้ให้ ผู้ประเมินสูงสุด พิเศษ ประเมินได้แล้ว
This commit is contained in:
@@ -197,7 +197,8 @@ namespace TodoAPI2.Models
|
||||
m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
|
||||
m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
|
||||
path,
|
||||
special_person),
|
||||
special_person,
|
||||
m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id),
|
||||
|
||||
role_desc = getRoleName(emp_id, m_eva_create_evaluation_detail_process.chief,
|
||||
m_eva_create_evaluation_detail_process.chief,
|
||||
@@ -205,7 +206,8 @@ namespace TodoAPI2.Models
|
||||
m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
|
||||
m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
|
||||
path,
|
||||
special_person),
|
||||
special_person,
|
||||
m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id),
|
||||
|
||||
remark_hrm_work_record = fk_external_employee.remark_hrm_work_record
|
||||
+ GetWorkTimeText(fk_external_employee.packing_date, end_date),
|
||||
@@ -475,6 +477,7 @@ namespace TodoAPI2.Models
|
||||
|
||||
status_supervisor1A = m_eva_create_evaluation_detail_process.status_supervisor1A,
|
||||
status_supervisor2A = m_eva_create_evaluation_detail_process.status_supervisor2A,
|
||||
status_supervisor3A = m_eva_create_evaluation_detail_process.status_supervisor3A,
|
||||
|
||||
role_code = getRoleCodeSearch(emp_id, m_eva_create_evaluation_detail_process.chief,
|
||||
m_eva_create_evaluation_detail_process.chief,
|
||||
@@ -482,7 +485,8 @@ namespace TodoAPI2.Models
|
||||
m_eva_create_evaluation_detail_process.supervisor1_id.HasValue? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
|
||||
m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
|
||||
m_eva_create_evaluation_detail_process.status_chief,
|
||||
special_person
|
||||
special_person,
|
||||
m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id
|
||||
),
|
||||
|
||||
role_desc = getRoleName(emp_id, m_eva_create_evaluation_detail_process.chief,
|
||||
@@ -491,13 +495,16 @@ namespace TodoAPI2.Models
|
||||
m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
|
||||
m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
|
||||
path,
|
||||
special_person),
|
||||
special_person,
|
||||
m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id
|
||||
),
|
||||
|
||||
status_self_click_date = m_eva_create_evaluation_detail_process.status_self_click_date,
|
||||
status_chief_click_date = m_eva_create_evaluation_detail_process.status_chief_click_date,
|
||||
status_supervisor_click_date = m_eva_create_evaluation_detail_process.status_supervisor_click_date,
|
||||
status_supervisor1A_click_date = m_eva_create_evaluation_detail_process.status_supervisor1A_click_date,
|
||||
status_supervisor2A_click_date = m_eva_create_evaluation_detail_process.status_supervisor2A_click_date,
|
||||
status_supervisor3A_click_date = m_eva_create_evaluation_detail_process.status_supervisor3A_click_date,
|
||||
|
||||
plan_round_year = checkNull(fk_planResult.theTime)+"/"+checkNull(fk_planResult.fiscal_year),
|
||||
|
||||
@@ -519,7 +526,7 @@ namespace TodoAPI2.Models
|
||||
return "";
|
||||
}
|
||||
|
||||
private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person)
|
||||
private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person, int? supervisor3A)
|
||||
{
|
||||
if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && path == "d2") return "2";
|
||||
else if (emp_id == chief) return "1";
|
||||
@@ -527,11 +534,12 @@ namespace TodoAPI2.Models
|
||||
else if (emp_id == supervisor2) return "2";
|
||||
else if (emp_id == supervisor1A) return "3";
|
||||
else if (emp_id == supervisor2A) return "4";
|
||||
else if (emp_id == supervisor3A) return "5";
|
||||
if (((int?[])special_person).Contains(emp_id)) return "99";
|
||||
return "";
|
||||
}
|
||||
|
||||
private string getRoleCodeSearch(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string status_chief, object special_person)
|
||||
private string getRoleCodeSearch(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string status_chief, object special_person, int? supervisor3A)
|
||||
{
|
||||
if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && status_chief=="Y") return "2";
|
||||
else if (emp_id == chief) return "1";
|
||||
@@ -539,11 +547,12 @@ namespace TodoAPI2.Models
|
||||
else if (emp_id == supervisor2) return "2";
|
||||
else if (emp_id == supervisor1A) return "3";
|
||||
else if (emp_id == supervisor2A) return "4";
|
||||
else if (emp_id == supervisor3A) return "5";
|
||||
if (((int?[])special_person).Contains(emp_id)) return "99";
|
||||
return "";
|
||||
}
|
||||
|
||||
private string getRoleName(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person)
|
||||
private string getRoleName(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person, int? supervisor3A)
|
||||
{
|
||||
if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && path == "d2") return "ผู้ประเมินสูงสุด";
|
||||
else if (emp_id == chief) return "ผู้ประเมิน";
|
||||
@@ -551,6 +560,7 @@ namespace TodoAPI2.Models
|
||||
else if (emp_id == supervisor2) return "ผู้ประเมินสูงสุด";
|
||||
else if (emp_id == supervisor1A) return "ผู้บังคับบัญชาเหนือขึ้นไป";
|
||||
else if (emp_id == supervisor2A) return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)";
|
||||
else if (emp_id == supervisor3A) return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (พิเศษ)";
|
||||
if (((int?[])special_person).Contains(emp_id)) return "ผู้ตรวจสอบ";
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@ namespace TodoAPI2.Models
|
||||
public class eva_create_evaluation_detail_review04Service : Ieva_create_evaluation_detail_review04Service
|
||||
{
|
||||
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_review04Service(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_review04ViewModel>>(entities);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
@@ -79,12 +79,12 @@ namespace TodoAPI2.Models
|
||||
|
||||
public List<eva_create_evaluation_detail_review04ViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id)
|
||||
{
|
||||
var model = new eva_create_evaluation_detail_review04SearchModel();
|
||||
var model = new eva_create_evaluation_detail_review04SearchModel();
|
||||
model.create_evaluation_id = create_evaluation_id;
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_review04ViewModel> GetListBySearch(eva_create_evaluation_detail_review04SearchModel model)
|
||||
public List<eva_create_evaluation_detail_review04ViewModel> GetListBySearch(eva_create_evaluation_detail_review04SearchModel model)
|
||||
{
|
||||
var data = (
|
||||
from m_eva_create_evaluation_detail_review04 in _repository.Context.eva_create_evaluation_detail
|
||||
@@ -94,7 +94,7 @@ namespace TodoAPI2.Models
|
||||
from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty()
|
||||
|
||||
|
||||
where 1==1
|
||||
where 1 == 1
|
||||
//&& (m_eva_create_evaluation_detail_review04.id == model.id || !model.id.HasValue)
|
||||
&& (m_eva_create_evaluation_detail_review04.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue)
|
||||
|
||||
@@ -129,10 +129,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;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ namespace TodoAPI2.Models
|
||||
|
||||
|
||||
var inserted = _repository.Insert(entity);
|
||||
|
||||
|
||||
return Get(inserted.id);
|
||||
}
|
||||
|
||||
@@ -168,23 +168,23 @@ 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_review04InputModel> model)
|
||||
public string UpdateMultiple(List<eva_create_evaluation_detail_review04InputModel> 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.supervisor2A = i.supervisor2A;
|
||||
existingEntity.supervisor2A_result = i.supervisor2A_result;
|
||||
existingEntity.supervisor2A_remark = i.supervisor2A_remark;
|
||||
existingEntity.supervisor2A_date = i.supervisor2A_date;
|
||||
existingEntity.create_evaluation_id = i.create_evaluation_id;
|
||||
existingEntity.supervisor2A = i.supervisor2A;
|
||||
existingEntity.supervisor2A_result = i.supervisor2A_result;
|
||||
existingEntity.supervisor2A_remark = i.supervisor2A_remark;
|
||||
existingEntity.supervisor2A_date = i.supervisor2A_date;
|
||||
|
||||
|
||||
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
|
||||
@@ -197,15 +197,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();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
using TodoAPI2.Models;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public interface Ieva_create_evaluation_detail_review05Service : IBaseService2<int, eva_create_evaluation_detail_review05InputModel, eva_create_evaluation_detail_review05ViewModel>
|
||||
{
|
||||
new eva_create_evaluation_detail_review05ViewModel Insert(eva_create_evaluation_detail_review05InputModel model, bool is_force_save);
|
||||
new eva_create_evaluation_detail_review05ViewModel Update(int id, eva_create_evaluation_detail_review05InputModel model, bool is_force_save);
|
||||
List<eva_create_evaluation_detail_review05ViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id);
|
||||
List<eva_create_evaluation_detail_review05ViewModel> GetListBySearch(eva_create_evaluation_detail_review05SearchModel model);
|
||||
|
||||
string UpdateMultiple(List<eva_create_evaluation_detail_review05InputModel> model, bool is_force_save);
|
||||
eva_create_evaluation_detail_review05WithSelectionViewModel GetWithSelection(int id);
|
||||
eva_create_evaluation_detail_review05WithSelectionViewModel GetBlankItem();
|
||||
|
||||
void RefreshAutoFieldOfAllData();
|
||||
eva_create_evaluation_detailEntity GetEntity(int id);
|
||||
DataContext GetContext();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_review05InputModel
|
||||
{
|
||||
|
||||
public int? id { get; set; }
|
||||
|
||||
public int? create_evaluation_id { get; set; }
|
||||
|
||||
public int? supervisor3A { get; set; }
|
||||
|
||||
public string supervisor3A_result { get; set; }
|
||||
|
||||
public string supervisor3A_remark { get; set; }
|
||||
|
||||
public DateTime? supervisor3A_date { get; set; }
|
||||
|
||||
public string active_mode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_review05ReportRequestModel : eva_create_evaluation_detail_review05SearchModel
|
||||
{
|
||||
public string filetype { get; set; }
|
||||
|
||||
public string contentType { get { return MyHelper.GetContentType(filetype); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_review05SearchModel
|
||||
{
|
||||
|
||||
public int id { get; set; }
|
||||
|
||||
public int? create_evaluation_id { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,307 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
using TodoAPI2.Models;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Net;
|
||||
using TTSW.Configure;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Data;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_review05Service : Ieva_create_evaluation_detail_review05Service
|
||||
{
|
||||
private IBaseRepository2<eva_create_evaluation_detailEntity, int> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
|
||||
public eva_create_evaluation_detail_review05Service(IBaseRepository2<eva_create_evaluation_detailEntity, int> repository, IMyDatabase mydb, Iexternal_linkageService inext)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
private eva_create_evaluation_detailEntity GetEntity(eva_create_evaluation_detail_review05InputModel model)
|
||||
{
|
||||
return Mapper.Map<eva_create_evaluation_detailEntity>(model);
|
||||
}
|
||||
private List<eva_create_evaluation_detailEntity> GetEntityList(List<eva_create_evaluation_detail_review05InputModel> models)
|
||||
{
|
||||
return Mapper.Map<List<eva_create_evaluation_detailEntity>>(models);
|
||||
}
|
||||
private eva_create_evaluation_detail_review05ViewModel GetDto(eva_create_evaluation_detailEntity entity)
|
||||
{
|
||||
return Mapper.Map<eva_create_evaluation_detail_review05ViewModel>(entity);
|
||||
}
|
||||
private List<eva_create_evaluation_detail_review05ViewModel> GetDtoList(List<eva_create_evaluation_detailEntity> entities)
|
||||
{
|
||||
return Mapper.Map<List<eva_create_evaluation_detail_review05ViewModel>>(entities);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
#region Query Functions
|
||||
|
||||
public eva_create_evaluation_detail_review05ViewModel Get(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
return GetDto(entity);
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detailEntity GetEntity(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public DataContext GetContext()
|
||||
{
|
||||
return _repository.Context;
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_review05WithSelectionViewModel GetWithSelection(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
var i = Mapper.Map<eva_create_evaluation_detail_review05WithSelectionViewModel>(entity);
|
||||
i.item_supervisor3A_result = (from x in ext.GetAgreeDisagree() select x).ToList();
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
public eva_create_evaluation_detail_review05WithSelectionViewModel GetBlankItem()
|
||||
{
|
||||
var i = new eva_create_evaluation_detail_review05WithSelectionViewModel();
|
||||
i.item_supervisor3A_result = (from x in ext.GetAgreeDisagree() select x).ToList();
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_review05ViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id)
|
||||
{
|
||||
var model = new eva_create_evaluation_detail_review05SearchModel();
|
||||
model.create_evaluation_id = create_evaluation_id;
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_review05ViewModel> GetListBySearch(eva_create_evaluation_detail_review05SearchModel model)
|
||||
{
|
||||
var data = (
|
||||
from m_eva_create_evaluation_detail_review05 in _repository.Context.eva_create_evaluation_detail
|
||||
|
||||
join fk_external_linkage3 in ext.GetAgreeDisagree() on m_eva_create_evaluation_detail_review05.supervisor3A_result equals fk_external_linkage3.external_code
|
||||
into external_linkageResult3
|
||||
from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty()
|
||||
|
||||
|
||||
where
|
||||
1 == 1
|
||||
&& (!model.create_evaluation_id.HasValue || m_eva_create_evaluation_detail_review05.create_evaluation_id == model.create_evaluation_id)
|
||||
|
||||
|
||||
orderby m_eva_create_evaluation_detail_review05.created descending
|
||||
select new eva_create_evaluation_detail_review05ViewModel()
|
||||
{
|
||||
id = m_eva_create_evaluation_detail_review05.id,
|
||||
create_evaluation_id = m_eva_create_evaluation_detail_review05.create_evaluation_id,
|
||||
supervisor3A = m_eva_create_evaluation_detail_review05.supervisor3A,
|
||||
supervisor3A_result = m_eva_create_evaluation_detail_review05.supervisor3A_result,
|
||||
supervisor3A_remark = m_eva_create_evaluation_detail_review05.supervisor3A_remark,
|
||||
supervisor3A_date = m_eva_create_evaluation_detail_review05.supervisor3A_date,
|
||||
|
||||
supervisor3A_result_external_linkage_external_name = fk_external_linkageResult3.external_name,
|
||||
|
||||
isActive = m_eva_create_evaluation_detail_review05.isActive,
|
||||
Created = m_eva_create_evaluation_detail_review05.created,
|
||||
Updated = m_eva_create_evaluation_detail_review05.updated
|
||||
}
|
||||
).Take(1000).ToList();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Manipulation Functions
|
||||
|
||||
|
||||
public int GetNewPrimaryKey()
|
||||
{
|
||||
int? newkey = 0;
|
||||
|
||||
var x = (from i in _repository.Context.eva_create_evaluation_detail
|
||||
orderby i.id descending
|
||||
select i).Take(1).ToList();
|
||||
|
||||
if (x.Count > 0)
|
||||
{
|
||||
newkey = x[0].id + 1;
|
||||
}
|
||||
|
||||
return newkey.Value;
|
||||
}
|
||||
|
||||
|
||||
public eva_create_evaluation_detail_review05ViewModel Insert(eva_create_evaluation_detail_review05InputModel model, bool is_force_save)
|
||||
{
|
||||
var entity = GetEntity(model);
|
||||
entity.id = GetNewPrimaryKey();
|
||||
|
||||
|
||||
//entity.SetAutoField(_repository.Context);
|
||||
|
||||
if (is_force_save)
|
||||
{
|
||||
var inserted = _repository.Insert(entity);
|
||||
//entity.DoAfterInsertUpdate(_repository.Context);
|
||||
return Get(inserted.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
_repository.InsertWithoutCommit(entity);
|
||||
//entity.DoAfterInsertUpdate(_repository.Context);
|
||||
return Mapper.Map<eva_create_evaluation_detail_review05ViewModel>(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_review05ViewModel Update(int id, eva_create_evaluation_detail_review05InputModel model, bool is_force_save)
|
||||
{
|
||||
var existingEntity = _repository.Get(id);
|
||||
if (existingEntity != null)
|
||||
{
|
||||
existingEntity.create_evaluation_id = model.create_evaluation_id;
|
||||
existingEntity.supervisor3A = model.supervisor3A;
|
||||
existingEntity.supervisor3A_result = model.supervisor3A_result;
|
||||
existingEntity.supervisor3A_remark = model.supervisor3A_remark;
|
||||
existingEntity.supervisor3A_date = model.supervisor3A_date;
|
||||
|
||||
//existingEntity.SetAutoField(_repository.Context);
|
||||
|
||||
if (is_force_save)
|
||||
{
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
//existingEntity.DoAfterInsertUpdate(_repository.Context);
|
||||
return Get(updated.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
_repository.UpdateWithoutCommit(id, existingEntity);
|
||||
//existingEntity.DoAfterInsertUpdate(_repository.Context);
|
||||
return Mapper.Map<eva_create_evaluation_detail_review05ViewModel>(existingEntity);
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new NotificationException("No data to update");
|
||||
}
|
||||
|
||||
public string UpdateMultiple(List<eva_create_evaluation_detail_review05InputModel> model, bool is_force_save)
|
||||
{
|
||||
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.supervisor3A = i.supervisor3A;
|
||||
existingEntity.supervisor3A_result = i.supervisor3A_result;
|
||||
existingEntity.supervisor3A_remark = i.supervisor3A_remark;
|
||||
existingEntity.supervisor3A_date = i.supervisor3A_date;
|
||||
|
||||
//existingEntity.SetAutoField(_repository.Context);
|
||||
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
|
||||
}
|
||||
}
|
||||
else if (i.active_mode == "1" && !i.id.HasValue) // add
|
||||
{
|
||||
var entity = GetEntity(i);
|
||||
entity.id = GetNewPrimaryKey();
|
||||
//entity.SetAutoField(_repository.Context);
|
||||
_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
|
||||
}
|
||||
}
|
||||
if (is_force_save)
|
||||
{
|
||||
_repository.Context.SaveChanges();
|
||||
}
|
||||
|
||||
return model.Count().ToString();
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_review05ViewModel SetAsActive(int id)
|
||||
{
|
||||
var updated = _repository.SetAsActive(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
public eva_create_evaluation_detail_review05ViewModel SetAsInactive(int id)
|
||||
{
|
||||
var updated = _repository.SetAsInActive(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
public void Delete(int id)
|
||||
{
|
||||
_repository.Delete(id);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public void RefreshAutoFieldOfAllData()
|
||||
{
|
||||
//var all_items = from i in _repository.Context.eva_create_evaluation_detail
|
||||
// select i;
|
||||
//foreach (var item in all_items)
|
||||
//{
|
||||
// item.SetAutoField(_repository.Context);
|
||||
//}
|
||||
//_repository.Context.SaveChanges();
|
||||
}
|
||||
|
||||
private Dictionary<string, string> GetLookupForLog()
|
||||
{
|
||||
var i = new Dictionary<string, string>();
|
||||
|
||||
|
||||
i.Add("create_evaluation_id", "แบบประเมิน");
|
||||
i.Add("supervisor3A", "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)");
|
||||
i.Add("supervisor3A_result", "ผลการประเมิน");
|
||||
i.Add("supervisor3A_result_external_linkage_external_name", "ผลการประเมิน");
|
||||
i.Add("supervisor3A_remark", "ความเห็นผู้ประเมินสูงสุด");
|
||||
i.Add("supervisor3A_date", "วันที่ประเมิน");
|
||||
i.Add("txt_supervisor3A_date", "วันที่ประเมิน");
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Match Item
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_review05ViewModel : BaseViewModel2<int>
|
||||
{
|
||||
|
||||
public int? create_evaluation_id { get; set; }
|
||||
|
||||
public int? supervisor3A { get; set; }
|
||||
|
||||
public string supervisor3A_result { get; set; }
|
||||
|
||||
public string supervisor3A_remark { get; set; }
|
||||
|
||||
public DateTime? supervisor3A_date { get; set; }
|
||||
|
||||
public string txt_supervisor3A_date { get { return MyHelper.GetDateStringForReport(this.supervisor3A_date); } }
|
||||
|
||||
public string supervisor3A_result_external_linkage_external_name { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_review05WithSelectionViewModel: eva_create_evaluation_detail_review05ViewModel
|
||||
{
|
||||
public List<external_linkageViewModel> item_supervisor3A_result { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -350,6 +350,24 @@ namespace TodoAPI2.Models
|
||||
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString();
|
||||
add_history(DateTime.Now, "แบบประเมินถูกตีกลับ โดย ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)", model.employee_id, existingEntity.id, 2);
|
||||
}
|
||||
else if (model.status_mode == "next5")
|
||||
{
|
||||
existingEntity.status_supervisor3A_click_date = DateTime.Now;
|
||||
|
||||
noti_to_employee_id2 = owner_eva_employee_id;
|
||||
noti_message2 = "แบบประเมินของ {0} ได้รับการประเมินเรียบร้อยแล้ว";
|
||||
noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString();
|
||||
add_history(DateTime.Now, "ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (พิเศษ) อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id, 2);
|
||||
}
|
||||
else if (model.status_mode == "back5")
|
||||
{
|
||||
existingEntity.status_supervisor3A_click_date = DateTime.Now;
|
||||
existingEntity.status_supervisor2A_click_date = null;
|
||||
noti_to_employee_id = current_eva.supervisor2_id;
|
||||
noti_message = "แบบประเมินของ {0} ถูกตีกลับ";
|
||||
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString();
|
||||
add_history(DateTime.Now, "แบบประเมินถูกตีกลับ โดย ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (พิเศษ)", model.employee_id, existingEntity.id, 2);
|
||||
}
|
||||
|
||||
if (need_noti)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user