ทำหน้าจอพิเศษ นำเข้าข้อมูลเงินเดือนย้อนหลัง
This commit is contained in:
@@ -41,6 +41,19 @@ namespace TodoAPI2.Models
|
||||
|
||||
public int? managed_by { get; set; }
|
||||
|
||||
[MaxLength(1000)]
|
||||
public string imported_file { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string imported_fileDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string.IsNullOrEmpty(imported_file) ? "" :
|
||||
FileUtil.GetFileInfo(TTSW.Constant.FilePathConstant.DirType.FilesTestUpload, id, imported_file).RelativePath).Replace(@"\", "/");
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime? imported_date { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,19 +20,19 @@ namespace TodoAPI2.Models
|
||||
public class eva_adjust_postponementService : Ieva_adjust_postponementService
|
||||
{
|
||||
private IBaseRepository2<eva_adjust_postponementEntity, int> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
private Ieva_adjust_postponement_detail_normalService detail;
|
||||
|
||||
public eva_adjust_postponementService(IBaseRepository2<eva_adjust_postponementEntity, int> repository,
|
||||
public eva_adjust_postponementService(IBaseRepository2<eva_adjust_postponementEntity, int> repository,
|
||||
IMyDatabase mydb, Iexternal_linkageService inext,
|
||||
Iexternal_employeeService inemp,
|
||||
Ieva_adjust_postponement_detail_normalService indetail)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
detail = indetail;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
return Mapper.Map<List<eva_adjust_postponementViewModel>>(entities);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
@@ -89,12 +89,12 @@ namespace TodoAPI2.Models
|
||||
|
||||
public List<eva_adjust_postponementViewModel> GetListByfiscal_year(int? fiscal_year)
|
||||
{
|
||||
var model = new eva_adjust_postponementSearchModel();
|
||||
var model = new eva_adjust_postponementSearchModel();
|
||||
model.fiscal_year = fiscal_year;
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
public List<eva_adjust_postponementViewModel> GetListBySearch(eva_adjust_postponementSearchModel model)
|
||||
public List<eva_adjust_postponementViewModel> GetListBySearch(eva_adjust_postponementSearchModel model)
|
||||
{
|
||||
var all_emp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace TodoAPI2.Models
|
||||
from fk_external_linkageResult11 in external_linkageResult11.DefaultIfEmpty()
|
||||
|
||||
|
||||
where 1==1
|
||||
where 1 == 1
|
||||
//&& (m_eva_adjust_postponement.id == model.id || !model.id.HasValue)
|
||||
&& (m_eva_adjust_postponement.fiscal_year == model.fiscal_year || !model.fiscal_year.HasValue)
|
||||
&& (m_eva_adjust_postponement.theRound == model.theRound || !model.theRound.HasValue)
|
||||
@@ -153,10 +153,10 @@ namespace TodoAPI2.Models
|
||||
int? newkey = 0;
|
||||
|
||||
var x = (from i in _repository.Context.eva_adjust_postponement
|
||||
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;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ namespace TodoAPI2.Models
|
||||
var inserted = _repository.Insert(entity);
|
||||
|
||||
detail.ReCreatePostponementDetailNormal(entity);
|
||||
|
||||
|
||||
return Get(inserted.id);
|
||||
}
|
||||
|
||||
@@ -198,29 +198,29 @@ 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_adjust_postponementInputModel> model)
|
||||
public string UpdateMultiple(List<eva_adjust_postponementInputModel> 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.theDate = i.theDate;
|
||||
existingEntity.theRound = i.theRound;
|
||||
existingEntity.create_evaluation_id = i.create_evaluation_id;
|
||||
existingEntity.limit = i.limit;
|
||||
existingEntity.limit_frame = i.limit_frame;
|
||||
existingEntity.limit_quota = i.limit_quota;
|
||||
existingEntity.limit_frame_quota = i.limit_frame_quota;
|
||||
existingEntity.percentage = i.percentage;
|
||||
existingEntity.command_no = i.command_no;
|
||||
existingEntity.managed_by = i.managed_by;
|
||||
existingEntity.fiscal_year = i.fiscal_year;
|
||||
existingEntity.theDate = i.theDate;
|
||||
existingEntity.theRound = i.theRound;
|
||||
existingEntity.create_evaluation_id = i.create_evaluation_id;
|
||||
existingEntity.limit = i.limit;
|
||||
existingEntity.limit_frame = i.limit_frame;
|
||||
existingEntity.limit_quota = i.limit_quota;
|
||||
existingEntity.limit_frame_quota = i.limit_frame_quota;
|
||||
existingEntity.percentage = i.percentage;
|
||||
existingEntity.command_no = i.command_no;
|
||||
existingEntity.managed_by = i.managed_by;
|
||||
|
||||
|
||||
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
|
||||
@@ -233,15 +233,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();
|
||||
}
|
||||
@@ -259,8 +259,7 @@ namespace TodoAPI2.Models
|
||||
return Get(updated.id);
|
||||
}
|
||||
public void Delete(int id)
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
_repository.Delete(id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user