ทำหน้าจอพิเศษ นำเข้าข้อมูลเงินเดือนย้อนหลัง
This commit is contained in:
@@ -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_adjust_postponement_migrationService : IBaseService<int, eva_adjust_postponement_migrationInputModel, eva_adjust_postponement_migrationViewModel>
|
||||
{
|
||||
new eva_adjust_postponement_migrationViewModel Insert(eva_adjust_postponement_migrationInputModel model);
|
||||
new eva_adjust_postponement_migrationViewModel Update(int id, eva_adjust_postponement_migrationInputModel model);
|
||||
List<eva_adjust_postponement_migrationViewModel> GetListByfiscal_year(int? fiscal_year);
|
||||
List<eva_adjust_postponement_migrationViewModel> GetListBySearch(eva_adjust_postponement_migrationSearchModel model);
|
||||
|
||||
string UpdateMultiple(List<eva_adjust_postponement_migrationInputModel> model);
|
||||
eva_adjust_postponement_migrationWithSelectionViewModel GetWithSelection(int id);
|
||||
eva_adjust_postponement_migrationWithSelectionViewModel GetBlankItem();
|
||||
|
||||
void RefreshAutoFieldOfAllData();
|
||||
eva_adjust_postponementEntity GetEntity(int id);
|
||||
DataContext GetContext();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
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_adjust_postponement_migrationInputModel
|
||||
{
|
||||
|
||||
public int? id { get; set; }
|
||||
|
||||
public int? fiscal_year { get; set; }
|
||||
|
||||
public DateTime? theDate { get; set; }
|
||||
|
||||
public int? theRound { get; set; }
|
||||
|
||||
public int? create_evaluation_id { get; set; }
|
||||
|
||||
public decimal? limit { get; set; }
|
||||
|
||||
public decimal? limit_frame { get; set; }
|
||||
|
||||
public decimal? limit_quota { get; set; }
|
||||
|
||||
public decimal? limit_frame_quota { get; set; }
|
||||
|
||||
public decimal? percentage { get; set; }
|
||||
|
||||
public string command_no { get; set; }
|
||||
|
||||
public int? managed_by { get; set; }
|
||||
|
||||
public string imported_file { 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_adjust_postponement_migrationReportRequestModel : eva_adjust_postponement_migrationSearchModel
|
||||
{
|
||||
public string filetype { get; set; }
|
||||
|
||||
public string contentType { get { return MyHelper.GetContentType(filetype); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
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_adjust_postponement_migrationSearchModel
|
||||
{
|
||||
|
||||
public int id { get; set; }
|
||||
|
||||
public int? fiscal_year { get; set; }
|
||||
|
||||
public int? theRound { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,487 @@
|
||||
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;
|
||||
using System.IO;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_adjust_postponement_migrationService : Ieva_adjust_postponement_migrationService
|
||||
{
|
||||
private IBaseRepository2<eva_adjust_postponementEntity, int> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
private Ieva_adjust_postponement_detailService postpone_detail;
|
||||
|
||||
public eva_adjust_postponement_migrationService(IBaseRepository2<eva_adjust_postponementEntity, int> repository,
|
||||
IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp, Ieva_adjust_postponement_detailService in_postpone_detail)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
postpone_detail = in_postpone_detail;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
private eva_adjust_postponementEntity GetEntity(eva_adjust_postponement_migrationInputModel model)
|
||||
{
|
||||
return Mapper.Map<eva_adjust_postponementEntity>(model);
|
||||
}
|
||||
private List<eva_adjust_postponementEntity> GetEntityList(List<eva_adjust_postponement_migrationInputModel> models)
|
||||
{
|
||||
return Mapper.Map<List<eva_adjust_postponementEntity>>(models);
|
||||
}
|
||||
private eva_adjust_postponement_migrationViewModel GetDto(eva_adjust_postponementEntity entity)
|
||||
{
|
||||
return Mapper.Map<eva_adjust_postponement_migrationViewModel>(entity);
|
||||
}
|
||||
private List<eva_adjust_postponement_migrationViewModel> GetDtoList(List<eva_adjust_postponementEntity> entities)
|
||||
{
|
||||
return Mapper.Map<List<eva_adjust_postponement_migrationViewModel>>(entities);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
#region Query Functions
|
||||
|
||||
public eva_adjust_postponement_migrationViewModel Get(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
return GetDto(entity);
|
||||
}
|
||||
|
||||
public eva_adjust_postponementEntity GetEntity(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public DataContext GetContext()
|
||||
{
|
||||
return _repository.Context;
|
||||
}
|
||||
|
||||
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.GetListByemployee_type(null, null);
|
||||
i.item_managed_by = all_emp.ToList();
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
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.GetListByemployee_type(null, null);
|
||||
i.item_managed_by = all_emp.ToList();
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public List<eva_adjust_postponement_migrationViewModel> GetListByfiscal_year(int? fiscal_year)
|
||||
{
|
||||
var model = new eva_adjust_postponement_migrationSearchModel();
|
||||
model.fiscal_year = fiscal_year;
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
public List<eva_adjust_postponement_migrationViewModel> GetListBySearch(eva_adjust_postponement_migrationSearchModel model)
|
||||
{
|
||||
var data = (
|
||||
from m_eva_adjust_postponement_migration in _repository.Context.eva_adjust_postponement
|
||||
|
||||
join fk_eva_create_evaluation4 in _repository.Context.eva_create_evaluation on m_eva_adjust_postponement_migration.create_evaluation_id equals fk_eva_create_evaluation4.id
|
||||
into eva_create_evaluationResult4
|
||||
from fk_eva_create_evaluationResult4 in eva_create_evaluationResult4.DefaultIfEmpty()
|
||||
|
||||
join fk_external_linkage11 in emp.GetListByemployee_type(null, null) on m_eva_adjust_postponement_migration.managed_by equals fk_external_linkage11.id
|
||||
into external_linkageResult11
|
||||
from fk_external_linkageResult11 in external_linkageResult11.DefaultIfEmpty()
|
||||
|
||||
|
||||
where
|
||||
1 == 1
|
||||
&& (!model.fiscal_year.HasValue || m_eva_adjust_postponement_migration.fiscal_year == model.fiscal_year)
|
||||
&& (!model.theRound.HasValue || m_eva_adjust_postponement_migration.theRound == model.theRound)
|
||||
|
||||
|
||||
orderby m_eva_adjust_postponement_migration.created descending
|
||||
select new eva_adjust_postponement_migrationViewModel()
|
||||
{
|
||||
id = m_eva_adjust_postponement_migration.id,
|
||||
fiscal_year = m_eva_adjust_postponement_migration.fiscal_year,
|
||||
theDate = m_eva_adjust_postponement_migration.theDate,
|
||||
theRound = m_eva_adjust_postponement_migration.theRound,
|
||||
create_evaluation_id = m_eva_adjust_postponement_migration.create_evaluation_id,
|
||||
limit = m_eva_adjust_postponement_migration.limit,
|
||||
limit_frame = m_eva_adjust_postponement_migration.limit_frame,
|
||||
limit_quota = m_eva_adjust_postponement_migration.limit_quota,
|
||||
limit_frame_quota = m_eva_adjust_postponement_migration.limit_frame_quota,
|
||||
percentage = m_eva_adjust_postponement_migration.percentage,
|
||||
command_no = m_eva_adjust_postponement_migration.command_no,
|
||||
managed_by = m_eva_adjust_postponement_migration.managed_by,
|
||||
imported_file = m_eva_adjust_postponement_migration.imported_file,
|
||||
imported_fileDisplay = m_eva_adjust_postponement_migration.imported_fileDisplay,
|
||||
|
||||
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,
|
||||
|
||||
isActive = m_eva_adjust_postponement_migration.isActive,
|
||||
Created = m_eva_adjust_postponement_migration.created,
|
||||
Updated = m_eva_adjust_postponement_migration.updated
|
||||
}
|
||||
).Take(1000).ToList();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Manipulation Functions
|
||||
|
||||
|
||||
public int GetNewPrimaryKey()
|
||||
{
|
||||
int? newkey = 0;
|
||||
|
||||
var x = (from i in _repository.Context.eva_adjust_postponement
|
||||
orderby i.id descending
|
||||
select i).Take(1).ToList();
|
||||
|
||||
if (x.Count > 0)
|
||||
{
|
||||
newkey = x[0].id + 1;
|
||||
}
|
||||
|
||||
return newkey.Value;
|
||||
}
|
||||
|
||||
|
||||
public eva_adjust_postponement_migrationViewModel Insert(eva_adjust_postponement_migrationInputModel model)
|
||||
{
|
||||
var entity = GetEntity(model);
|
||||
entity.id = GetNewPrimaryKey();
|
||||
|
||||
if (!string.IsNullOrEmpty(model.imported_file))
|
||||
{
|
||||
//Move file from temp to physical
|
||||
string imported_fileFileName = FileUtil.MoveTempUploadFileToActualPath(
|
||||
model.imported_file, FilePathConstant.DirType.FilesTestUpload, entity.id);
|
||||
entity.imported_file = imported_fileFileName;
|
||||
|
||||
var filepath = FileUtil.GetFileInfo(TTSW.Constant.FilePathConstant.DirType.FilesTestUpload, entity.id, entity.imported_file).PhysicalPath;
|
||||
entity.command_no = AddItems(filepath, entity.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("ไม่ได้แนบไฟล์เข้ามา ไม่สามารถเพิ่มรายการประวัติเงินเดือนย้อนหลัง ได้");
|
||||
}
|
||||
|
||||
entity.imported_date = DateTime.Now;
|
||||
|
||||
var inserted = _repository.Insert(entity);
|
||||
return Get(inserted.id);
|
||||
}
|
||||
|
||||
private string AddItems(string filepath, int id)
|
||||
{
|
||||
string return_text = "";
|
||||
|
||||
var excel = GetDataTableFromExcel(filepath);
|
||||
|
||||
var all_emp = (from q in emp.GetAllEmployee()
|
||||
select q).ToList();
|
||||
|
||||
var newkey = postpone_detail.GetNewPrimaryKey();
|
||||
|
||||
for (int j = 0; j < excel.Rows.Count; j++)
|
||||
{
|
||||
string employee_no = "N/A";
|
||||
|
||||
try
|
||||
{
|
||||
string position = excel.Rows[j]["position"].ToString();
|
||||
string level = excel.Rows[j]["level"].ToString();
|
||||
employee_no = excel.Rows[j]["employee_no"].ToString();
|
||||
decimal? old_salary = Convert.ToDecimal(excel.Rows[j]["old_salary"]);
|
||||
decimal? old_cost_living = Convert.ToDecimal(excel.Rows[j]["old_cost_living"]);
|
||||
decimal? middle = Convert.ToDecimal(excel.Rows[j]["middle"]);
|
||||
decimal? promoted_percentage = Convert.ToDecimal(excel.Rows[j]["promoted_percentage"]);
|
||||
decimal? total_promote = Convert.ToDecimal(excel.Rows[j]["total_promote"]);
|
||||
decimal? receive_quota = Convert.ToDecimal(excel.Rows[j]["receive_quota"]);
|
||||
decimal? new_sarary_with_quota = Convert.ToDecimal(excel.Rows[j]["new_sarary_with_quota"]);
|
||||
decimal? new_cost_living = Convert.ToDecimal(excel.Rows[j]["new_cost_living"]);
|
||||
string remark = excel.Rows[j]["remark"].ToString();
|
||||
|
||||
var item = new eva_adjust_postponement_detailEntity();
|
||||
item.id = newkey;
|
||||
newkey += 1;
|
||||
|
||||
item.adjust_postponement_id = id;
|
||||
item.adjust_postponement_quota_id = id;
|
||||
|
||||
var employee = (from qq in all_emp where qq.employee_no == employee_no select qq).FirstOrDefault();
|
||||
if (employee == null)
|
||||
{
|
||||
return_text += " ไม่พบ " + employee_no;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.employee_id = employee.id;
|
||||
item.sarary = old_salary;
|
||||
item.cost_living = old_cost_living;
|
||||
item.middle = middle;
|
||||
item.promoted_percentage = promoted_percentage;
|
||||
item.total_promote = total_promote;
|
||||
item.new_sarary = old_salary + total_promote;
|
||||
item.new_cost_living = new_cost_living;
|
||||
item.remark = remark;
|
||||
item.receive_quota = receive_quota;
|
||||
item.new_sarary_with_quota = new_sarary_with_quota;
|
||||
item.position_this_time = position;
|
||||
item.level_this_time = level;
|
||||
|
||||
_repository.Context.Add(item);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
throw new Exception("มีความผิดพลาดในการแปลงข้อมูลของ "+ employee_no + " = "+ ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return return_text;
|
||||
}
|
||||
|
||||
private DataTable GetDataTableFromExcel(string path, bool hasHeader = true)
|
||||
{
|
||||
using (var pck = new OfficeOpenXml.ExcelPackage())
|
||||
{
|
||||
using (var stream = File.OpenRead(path))
|
||||
{
|
||||
pck.Load(stream);
|
||||
}
|
||||
var ws = pck.Workbook.Worksheets.First();
|
||||
DataTable tbl = new DataTable();
|
||||
foreach (var firstRowCell in ws.Cells[1, 1, 1, ws.Dimension.End.Column])
|
||||
{
|
||||
tbl.Columns.Add(hasHeader ? firstRowCell.Text : string.Format("Column {0}", firstRowCell.Start.Column));
|
||||
}
|
||||
var startRow = hasHeader ? 2 : 1;
|
||||
for (int rowNum = startRow; rowNum <= ws.Dimension.End.Row; rowNum++)
|
||||
{
|
||||
var wsRow = ws.Cells[rowNum, 1, rowNum, ws.Dimension.End.Column];
|
||||
DataRow row = tbl.Rows.Add();
|
||||
foreach (var cell in wsRow)
|
||||
{
|
||||
row[cell.Start.Column - 1] = cell.Text;
|
||||
}
|
||||
}
|
||||
return tbl;
|
||||
}
|
||||
}
|
||||
|
||||
public eva_adjust_postponement_migrationViewModel Update(int id, eva_adjust_postponement_migrationInputModel model)
|
||||
{
|
||||
var existingEntity = _repository.Get(id);
|
||||
if (existingEntity != null)
|
||||
{
|
||||
existingEntity.fiscal_year = model.fiscal_year;
|
||||
existingEntity.theDate = model.theDate;
|
||||
existingEntity.theRound = model.theRound;
|
||||
existingEntity.create_evaluation_id = model.create_evaluation_id;
|
||||
existingEntity.limit = model.limit;
|
||||
existingEntity.limit_frame = model.limit_frame;
|
||||
existingEntity.limit_quota = model.limit_quota;
|
||||
existingEntity.limit_frame_quota = model.limit_frame_quota;
|
||||
existingEntity.percentage = model.percentage;
|
||||
existingEntity.command_no = model.command_no;
|
||||
existingEntity.managed_by = model.managed_by;
|
||||
if (!string.IsNullOrEmpty(model.imported_file))
|
||||
{
|
||||
if (model.imported_file.StartsWith("Uploads"))
|
||||
{
|
||||
var imported_fileFileName = FileUtil.MoveTempUploadFileToActualPath(
|
||||
model.imported_file, FilePathConstant.DirType.FilesTestUpload, existingEntity.id, existingEntity.imported_file);
|
||||
existingEntity.imported_file = imported_fileFileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
existingEntity.imported_file = model.imported_file;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
existingEntity.imported_file = null;
|
||||
}
|
||||
|
||||
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
return Get(updated.id);
|
||||
}
|
||||
else
|
||||
throw new NotificationException("No data to update");
|
||||
}
|
||||
|
||||
public string UpdateMultiple(List<eva_adjust_postponement_migrationInputModel> 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;
|
||||
if (!string.IsNullOrEmpty(i.imported_file))
|
||||
{
|
||||
if (i.imported_file.StartsWith("Uploads"))
|
||||
{
|
||||
var imported_fileFileName = FileUtil.MoveTempUploadFileToActualPath(
|
||||
i.imported_file, FilePathConstant.DirType.FilesTestUpload, existingEntity.id, existingEntity.imported_file);
|
||||
existingEntity.imported_file = imported_fileFileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
existingEntity.imported_file = i.imported_file;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
existingEntity.imported_file = null;
|
||||
}
|
||||
|
||||
|
||||
//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
|
||||
}
|
||||
}
|
||||
_repository.Context.SaveChanges();
|
||||
|
||||
return model.Count().ToString();
|
||||
}
|
||||
|
||||
public eva_adjust_postponement_migrationViewModel SetAsActive(int id)
|
||||
{
|
||||
var updated = _repository.SetAsActive(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
public eva_adjust_postponement_migrationViewModel SetAsInactive(int id)
|
||||
{
|
||||
var updated = _repository.SetAsInActive(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
public void Delete(int id)
|
||||
{
|
||||
var postponement = (from i in _repository.Context.eva_adjust_postponement
|
||||
where i.id == id
|
||||
select i).FirstOrDefault();
|
||||
if (postponement == null || !postponement.imported_date.HasValue)
|
||||
{
|
||||
throw new Exception("ไม่สามารถลบรายการได้ เพราะ ไม่ใช่รายการที่นำเข้าย้อนหลัง");
|
||||
}
|
||||
|
||||
var items = (from i in _repository.Context.eva_adjust_postponement_detail
|
||||
where i.adjust_postponement_id == id
|
||||
|| i.adjust_postponement_quota_id == id
|
||||
select i).ToList();
|
||||
_repository.Context.RemoveRange(items);
|
||||
|
||||
_repository.Delete(id);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public void RefreshAutoFieldOfAllData()
|
||||
{
|
||||
var all_items = from i in _repository.Context.eva_adjust_postponement
|
||||
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("fiscal_year", "ปีงบประมาณ ");
|
||||
i.Add("theDate", "วันที่เลื่อน");
|
||||
i.Add("txt_theDate", "วันที่เลื่อน");
|
||||
i.Add("theRound", "ครั้งที่เลื่อน");
|
||||
i.Add("create_evaluation_id", "กลุ่มการประเมิน");
|
||||
i.Add("create_evaluation_id_eva_create_evaluation_performance_plan_id", "กลุ่มการประเมิน");
|
||||
i.Add("limit", "บริหารวงเงิน");
|
||||
i.Add("limit_frame", "กรอบวงเงินร้อยละ");
|
||||
i.Add("limit_quota", "จำนวนเงินที่สามารถบริหารวงเงินหรือวงเงินโควต้าพิเศษ");
|
||||
i.Add("limit_frame_quota", "กรอบโควต้าพิเศษร้อยละ");
|
||||
i.Add("percentage", "ร้อยละที่ได้เลื่อน");
|
||||
i.Add("command_no", "เลขที่คำสั่ง");
|
||||
i.Add("managed_by", "ผู้จัดทำข้อมูล");
|
||||
i.Add("managed_by_external_linkage_external_name", "ผู้จัดทำข้อมูล");
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Match Item
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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_adjust_postponement_migrationViewModel : BaseViewModel2<int>
|
||||
{
|
||||
|
||||
public int? fiscal_year { get; set; }
|
||||
|
||||
public DateTime? theDate { get; set; }
|
||||
|
||||
public string txt_theDate { get { return MyHelper.GetDateStringForReport(this.theDate); } }
|
||||
|
||||
public int? theRound { get; set; }
|
||||
|
||||
public int? create_evaluation_id { get; set; }
|
||||
|
||||
public decimal? limit { get; set; }
|
||||
|
||||
public decimal? limit_frame { get; set; }
|
||||
|
||||
public decimal? limit_quota { get; set; }
|
||||
|
||||
public decimal? limit_frame_quota { get; set; }
|
||||
|
||||
public decimal? percentage { get; set; }
|
||||
|
||||
public string command_no { get; set; }
|
||||
|
||||
public int? managed_by { get; set; }
|
||||
|
||||
public string imported_file { get; set; }
|
||||
public string imported_fileDisplay { get; set; }
|
||||
|
||||
public string txt_imported_file
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string.IsNullOrEmpty(imported_file) ? "" :
|
||||
$"<a href='../{imported_fileDisplay}' target='_blank'>{imported_file}</a>");
|
||||
}
|
||||
}
|
||||
|
||||
public Guid? create_evaluation_id_eva_create_evaluation_performance_plan_id { get; set; }
|
||||
public string managed_by_external_linkage_external_name { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
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_employeeViewModel> item_managed_by { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user