Merge tag 'pond_20210713_001' into develop

This commit is contained in:
Pairat Sangprasert
2021-07-14 12:27:27 +07:00
154 changed files with 13938 additions and 784 deletions

View File

@@ -0,0 +1,403 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using TTSW.Controllers;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Net;
namespace TodoAPI2.Controllers
{
//[Authorize]
[Produces("application/json")]
[Route("api/eva_create_evaluation_detail_history")]
public class eva_create_evaluation_detail_historyController : BaseController
{
#region Private Variables
private ILogger<eva_create_evaluation_detail_historyController> _logger;
private Ieva_create_evaluation_detail_historyService _repository;
private IConfiguration Configuration { get; set; }
#endregion
#region Properties
#endregion
/// <summary>
/// Default constructure for dependency injection
/// </summary>
/// <param name="repository"></param>
/// <param name="configuration"></param>
/// <param name="logger"></param>
public eva_create_evaluation_detail_historyController(ILogger<eva_create_evaluation_detail_historyController> logger, Ieva_create_evaluation_detail_historyService repository, IConfiguration configuration)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
}
/// <summary>
/// Get specific item by id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return Get specific item by id</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("{id}")]
[ProducesResponseType(typeof(eva_create_evaluation_detail_historyWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Get(int id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetWithSelection(id);
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult Get.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get Blank Item
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return a blank item</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetBlankItem")]
[ProducesResponseType(typeof(eva_create_evaluation_detail_historyWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetBlankItem()
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetBlankItem();
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by evaluation_detail_id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("")]
[ProducesResponseType(typeof(List<eva_create_evaluation_detail_historyViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetList(int? evaluation_detail_id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListByevaluation_detail_id(evaluation_detail_id));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetList.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by search
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetListBySearch")]
[ProducesResponseType(typeof(List<eva_create_evaluation_detail_historyViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetListBySearch(eva_create_evaluation_detail_historySearchModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListBySearch(model));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Download Report
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("eva_create_evaluation_detail_history_report")]
[ProducesResponseType(typeof(FileStreamResult), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult eva_create_evaluation_detail_history_report(eva_create_evaluation_detail_historyReportRequestModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
string url = $"{mainurl}{reportsite}/xxใส่ชื่อรายงานตรงนี้xx.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
if (model.filetype == "xlsx")
{
url += "&ignorePagination=true";
}
var data = httpclient.DownloadData(url);
var stream = new MemoryStream(data);
return File(stream, model.contentType);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while GetReport.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Create new item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPost("")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Insert([FromBody] eva_create_evaluation_detail_historyInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Insert(model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"เพิ่มข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while insert.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Update item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Update(int id, [FromBody] eva_create_evaluation_detail_historyInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Update(id, model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"แก้ไขข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while update {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Delete item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpDelete("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Delete(int id)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.Delete(id);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ลบข้อมูล เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while delete {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Update multiple item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("UpdateMultiple")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult UpdateMultiple([FromBody] List<eva_create_evaluation_detail_historyInputModel> model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
string rowCount = _repository.UpdateMultiple(model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = "ปรับปรุงข้อมูลเรียบร้อย จำนวน "+rowCount+" รายการ";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while UpdateMultiple.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Refresh AutoField of all items
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("RefreshAutoField")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult RefreshAutoField()
{
if (ModelState.IsValid)
{
try
{
//if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.RefreshAutoFieldOfAllData();
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ปรับปรุง Auto Field ของทุก record เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while RefreshAutoField.", ex);
return StatusCode(500, $"มีปัญหาระหว่างการปรับปรุง Auto Field. {ex.Message}");
}
}
return BadRequest(ModelState);
}
}
}

View File

@@ -27,6 +27,7 @@ namespace TodoAPI2.Controllers
private ILogger<eva_create_evaluation_detail_statusController> _logger;
private Ieva_create_evaluation_detail_statusService _repository;
private IConfiguration Configuration { get; set; }
private Iexternal_employeeService emp;
#endregion
#region Properties
@@ -37,13 +38,17 @@ namespace TodoAPI2.Controllers
/// Default constructure for dependency injection
/// </summary>
/// <param name="repository"></param>
/// <param name="configuration"></param>
/// <param name="configuration"></param>
/// <param name="inemp"></param>
/// <param name="logger"></param>
public eva_create_evaluation_detail_statusController(ILogger<eva_create_evaluation_detail_statusController> logger, Ieva_create_evaluation_detail_statusService repository, IConfiguration configuration)
public eva_create_evaluation_detail_statusController(ILogger<eva_create_evaluation_detail_statusController> logger,
Ieva_create_evaluation_detail_statusService repository, IConfiguration configuration,
Iexternal_employeeService inemp)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
emp = inemp;
}
/// <summary>
@@ -220,12 +225,25 @@ namespace TodoAPI2.Controllers
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Update(id, model);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"แก้ไขข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"]))
{
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
model.employee_id = e.id;
var result = _repository.Update(id, model);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"แก้ไขข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
else
{
return Unauthorized();
}
}
catch (Exception ex)
{

View File

@@ -0,0 +1,403 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using TTSW.Controllers;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Net;
namespace TodoAPI2.Controllers
{
//[Authorize]
[Produces("application/json")]
[Route("api/eva_evaluation_achievement_attach")]
public class eva_evaluation_achievement_attachController : BaseController
{
#region Private Variables
private ILogger<eva_evaluation_achievement_attachController> _logger;
private Ieva_evaluation_achievement_attachService _repository;
private IConfiguration Configuration { get; set; }
#endregion
#region Properties
#endregion
/// <summary>
/// Default constructure for dependency injection
/// </summary>
/// <param name="repository"></param>
/// <param name="configuration"></param>
/// <param name="logger"></param>
public eva_evaluation_achievement_attachController(ILogger<eva_evaluation_achievement_attachController> logger, Ieva_evaluation_achievement_attachService repository, IConfiguration configuration)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
}
/// <summary>
/// Get specific item by id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return Get specific item by id</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("{id}")]
[ProducesResponseType(typeof(eva_evaluation_achievement_attachWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Get(int id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetWithSelection(id);
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult Get.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get Blank Item
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return a blank item</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetBlankItem")]
[ProducesResponseType(typeof(eva_evaluation_achievement_attachWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetBlankItem()
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetBlankItem();
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by achievement_id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("")]
[ProducesResponseType(typeof(List<eva_evaluation_achievement_attachViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetList(int? achievement_id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListByachievement_id(achievement_id));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetList.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by search
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetListBySearch")]
[ProducesResponseType(typeof(List<eva_evaluation_achievement_attachViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetListBySearch(eva_evaluation_achievement_attachSearchModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListBySearch(model));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Download Report
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("eva_evaluation_achievement_attach_report")]
[ProducesResponseType(typeof(FileStreamResult), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult eva_evaluation_achievement_attach_report(eva_evaluation_achievement_attachReportRequestModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
string url = $"{mainurl}{reportsite}/xxใส่ชื่อรายงานตรงนี้xx.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
if (model.filetype == "xlsx")
{
url += "&ignorePagination=true";
}
var data = httpclient.DownloadData(url);
var stream = new MemoryStream(data);
return File(stream, model.contentType);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while GetReport.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Create new item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPost("")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Insert([FromBody] eva_evaluation_achievement_attachInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Insert(model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"เพิ่มข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while insert.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Update item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Update(int id, [FromBody] eva_evaluation_achievement_attachInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Update(id, model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"แก้ไขข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while update {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Delete item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpDelete("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Delete(int id)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.Delete(id);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ลบข้อมูล เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while delete {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Update multiple item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("UpdateMultiple")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult UpdateMultiple([FromBody] List<eva_evaluation_achievement_attachInputModel> model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
string rowCount = _repository.UpdateMultiple(model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = "ปรับปรุงข้อมูลเรียบร้อย จำนวน "+rowCount+" รายการ";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while UpdateMultiple.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Refresh AutoField of all items
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("RefreshAutoField")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult RefreshAutoField()
{
if (ModelState.IsValid)
{
try
{
//if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.RefreshAutoFieldOfAllData();
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ปรับปรุง Auto Field ของทุก record เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while RefreshAutoField.", ex);
return StatusCode(500, $"มีปัญหาระหว่างการปรับปรุง Auto Field. {ex.Message}");
}
}
return BadRequest(ModelState);
}
}
}

View File

@@ -0,0 +1,403 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using TTSW.Controllers;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Net;
namespace TodoAPI2.Controllers
{
//[Authorize]
[Produces("application/json")]
[Route("api/eva_idp_plan_reviewer")]
public class eva_idp_plan_reviewerController : BaseController
{
#region Private Variables
private ILogger<eva_idp_plan_reviewerController> _logger;
private Ieva_idp_plan_reviewerService _repository;
private IConfiguration Configuration { get; set; }
#endregion
#region Properties
#endregion
/// <summary>
/// Default constructure for dependency injection
/// </summary>
/// <param name="repository"></param>
/// <param name="configuration"></param>
/// <param name="logger"></param>
public eva_idp_plan_reviewerController(ILogger<eva_idp_plan_reviewerController> logger, Ieva_idp_plan_reviewerService repository, IConfiguration configuration)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
}
/// <summary>
/// Get specific item by id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return Get specific item by id</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("{id}")]
[ProducesResponseType(typeof(eva_idp_plan_reviewerWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Get(int id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetWithSelection(id);
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult Get.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get Blank Item
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return a blank item</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetBlankItem")]
[ProducesResponseType(typeof(eva_idp_plan_reviewerWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetBlankItem()
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetBlankItem();
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by create_evaluation_detail_id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("")]
[ProducesResponseType(typeof(List<eva_idp_plan_reviewerViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetList(int? create_evaluation_detail_id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListBycreate_evaluation_detail_id(create_evaluation_detail_id));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetList.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by search
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetListBySearch")]
[ProducesResponseType(typeof(List<eva_idp_plan_reviewerViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetListBySearch(eva_idp_plan_reviewerSearchModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListBySearch(model));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Download Report
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("eva_idp_plan_reviewer_report")]
[ProducesResponseType(typeof(FileStreamResult), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult eva_idp_plan_reviewer_report(eva_idp_plan_reviewerReportRequestModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
string url = $"{mainurl}{reportsite}/xxใส่ชื่อรายงานตรงนี้xx.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
if (model.filetype == "xlsx")
{
url += "&ignorePagination=true";
}
var data = httpclient.DownloadData(url);
var stream = new MemoryStream(data);
return File(stream, model.contentType);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while GetReport.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Create new item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPost("")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Insert([FromBody] eva_idp_plan_reviewerInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Insert(model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"เพิ่มข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while insert.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Update item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Update(int id, [FromBody] eva_idp_plan_reviewerInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Update(id, model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"แก้ไขข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while update {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Delete item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpDelete("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Delete(int id)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.Delete(id);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ลบข้อมูล เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while delete {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Update multiple item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("UpdateMultiple")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult UpdateMultiple([FromBody] List<eva_idp_plan_reviewerInputModel> model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
string rowCount = _repository.UpdateMultiple(model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = "ปรับปรุงข้อมูลเรียบร้อย จำนวน "+rowCount+" รายการ";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while UpdateMultiple.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Refresh AutoField of all items
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("RefreshAutoField")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult RefreshAutoField()
{
if (ModelState.IsValid)
{
try
{
//if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.RefreshAutoFieldOfAllData();
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ปรับปรุง Auto Field ของทุก record เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while RefreshAutoField.", ex);
return StatusCode(500, $"มีปัญหาระหว่างการปรับปรุง Auto Field. {ex.Message}");
}
}
return BadRequest(ModelState);
}
}
}

View File

@@ -138,7 +138,13 @@ namespace TodoAPI2.Controllers
reader.Close();
var all_group = (from t in _repository.GetContext().eva_limit_frame_group
join fk_eva_evaluation_group2 in _repository.GetContext().eva_evaluation_group on t.group_guid equals fk_eva_evaluation_group2.id
into eva_evaluation_groupResult2
from fk_eva_evaluation_groupResult2 in eva_evaluation_groupResult2.DefaultIfEmpty()
where t.frame_plan_guid == model.frame_plan_guid
orderby fk_eva_evaluation_groupResult2.code
select t);
foreach(var u in all_group)
{

View File

@@ -16,6 +16,8 @@ using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Net;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace TodoAPI2.Controllers
{
@@ -96,43 +98,39 @@ namespace TodoAPI2.Controllers
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
var temp = (from x in _repository.GetContext().eva_adjust_postponement_detail
join y in _repository.GetContext().eva_adjust_postponement
on x.adjust_postponement_id equals y.id
where x.id == model.detail_id
select y).FirstOrDefault();
if(temp != null)
var stream = new MemoryStream();
Document document = new Document();
PdfCopy writer = new PdfCopy(document, stream);
document.Open();
var data1 = GetReport01(model);
PdfReader reader1 = new PdfReader(data1);
reader1.ConsolidateNamedDestinations();
for (int i = 1; i <= reader1.NumberOfPages; i++)
{
model.theround = temp.theRound.ToString();
model.theyear = temp.fiscal_year.ToString();
PdfImportedPage page = writer.GetImportedPage(reader1, i);
writer.AddPage(page);
}
reader1.Close();
var temp2 = (from x in _repository.GetContext().eva_adjust_postponement_detail
where x.id == model.detail_id
select x).FirstOrDefault();
//var data2 = GetReport02(model);
//PdfReader reader2 = new PdfReader(data2);
//reader2.ConsolidateNamedDestinations();
//for (int i = 1; i <= reader2.NumberOfPages; i++)
//{
// PdfImportedPage page = writer.GetImportedPage(reader2, i);
// writer.AddPage(page);
//}
//reader2.Close();
if(temp2 != null && temp2.promoted_percentage.HasValue)
{
model.x1 = temp2.promoted_percentage.Value > 0 ? "X" : "";
model.x2 = temp2.promoted_percentage.Value <= 0 ? "X" : "";
}
writer.Close();
document.Close();
string url = $"{mainurl}{reportsite}/rep_eva_self_review.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
var datax = stream.ToArray();
var streamx = new MemoryStream(datax);
if (model.filetype == "xlsx")
{
url += "&ignorePagination=true";
}
var data = httpclient.DownloadData(url);
var stream = new MemoryStream(data);
return File(stream, model.contentType);
return File(streamx, model.contentType);
}
catch (Exception ex)
{
@@ -141,6 +139,134 @@ namespace TodoAPI2.Controllers
}
}
private byte[] GetReport01(rep_eva_self_reviewReportRequestModel model)
{
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
var temp = (from x in _repository.GetContext().eva_adjust_postponement_detail
join fk_eva_adjust_postponement1 in _repository.GetContext().eva_adjust_postponement on x.adjust_postponement_id equals fk_eva_adjust_postponement1.id
into eva_adjust_postponementResult1
from fk_eva_adjust_postponementResult1 in eva_adjust_postponementResult1.DefaultIfEmpty()
join fk_eva_adjust_postponement2 in _repository.GetContext().eva_adjust_postponement on x.adjust_postponement_quota_id equals fk_eva_adjust_postponement2.id
into eva_adjust_postponementResult2
from fk_eva_adjust_postponementResult2 in eva_adjust_postponementResult2.DefaultIfEmpty()
where x.id == model.detail_id
select fk_eva_adjust_postponementResult1 == null? fk_eva_adjust_postponementResult1 : fk_eva_adjust_postponementResult2).FirstOrDefault();
if (temp != null)
{
model.theround = temp.theRound.ToString();
model.theyear = temp.fiscal_year.ToString();
var all_eva = (from x in _repository.GetContext().eva_performance_plan
where x.fiscal_year == temp.fiscal_year
&& x.theTime == temp.theRound
orderby x.theTime
select x).ToList();
foreach (var x2 in all_eva)
{
var start = (from n in _repository.GetContext().eva_performance_plan_detail
where n.performance_plan_id == x2.id
select n.start_date).Min();
var end = (from n in _repository.GetContext().eva_performance_plan_detail
where n.performance_plan_id == x2.id
select n.end_date).Min();
model.thedesc = "ตั้งแต่วันที่ " + MyHelper.GetDateStringForReport(start) + " ถึงวันที่ " + MyHelper.GetDateStringForReport(end);
}
}
var temp2 = (from x in _repository.GetContext().eva_adjust_postponement_detail
where x.id == model.detail_id
select x).FirstOrDefault();
if (temp2 != null && temp2.promoted_percentage.HasValue)
{
model.x1 = temp2.promoted_percentage.Value > 0 ? "/" : "";
model.x2 = temp2.promoted_percentage.Value <= 0 ? "/" : "";
}
string url = $"{mainurl}{reportsite}/rep_eva_self_review.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
if (model.filetype == "xlsx")
{
url += "&ignorePagination=true";
}
var data = httpclient.DownloadData(url);
return data;
}
private byte[] GetReport02(rep_eva_self_reviewReportRequestModel model)
{
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
var temp = (from x in _repository.GetContext().eva_adjust_postponement_detail
join fk_eva_adjust_postponement1 in _repository.GetContext().eva_adjust_postponement on x.adjust_postponement_id equals fk_eva_adjust_postponement1.id
into eva_adjust_postponementResult1
from fk_eva_adjust_postponementResult1 in eva_adjust_postponementResult1.DefaultIfEmpty()
join fk_eva_adjust_postponement2 in _repository.GetContext().eva_adjust_postponement on x.adjust_postponement_quota_id equals fk_eva_adjust_postponement2.id
into eva_adjust_postponementResult2
from fk_eva_adjust_postponementResult2 in eva_adjust_postponementResult2.DefaultIfEmpty()
where x.id == model.detail_id
select fk_eva_adjust_postponementResult1 == null ? fk_eva_adjust_postponementResult1 : fk_eva_adjust_postponementResult2).FirstOrDefault();
if (temp != null)
{
model.theround = temp.theRound.ToString();
model.theyear = temp.fiscal_year.ToString();
var all_eva = (from x in _repository.GetContext().eva_performance_plan
where x.fiscal_year == temp.fiscal_year
&& x.theTime == temp.theRound
orderby x.theTime
select x).ToList();
foreach (var x2 in all_eva)
{
var start = (from n in _repository.GetContext().eva_performance_plan_detail
where n.performance_plan_id == x2.id
select n.start_date).Min();
var end = (from n in _repository.GetContext().eva_performance_plan_detail
where n.performance_plan_id == x2.id
select n.end_date).Min();
model.thedesc = "ตั้งแต่วันที่ " + MyHelper.GetDateStringForReport(start) + " ถึงวันที่ " + MyHelper.GetDateStringForReport(end);
}
}
var temp2 = (from x in _repository.GetContext().eva_adjust_postponement_detail
where x.id == model.detail_id
select x).FirstOrDefault();
if (temp2 != null && temp2.promoted_percentage.HasValue)
{
model.x1 = temp2.promoted_percentage.Value > 0 ? "/" : "";
model.x2 = temp2.promoted_percentage.Value <= 0 ? "/" : "";
}
string url = $"{mainurl}{reportsite}/rep_eva_self_review_cover.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
if (model.filetype == "xlsx")
{
url += "&ignorePagination=true";
}
var data = httpclient.DownloadData(url);
return data;
}
}
}

View File

@@ -41,8 +41,13 @@ namespace TTSW.EF {
public DbSet<eva_limit_frame_employeeEntity> eva_limit_frame_employee { get; set; }
public DbSet<eva_limit_frame_groupEntity> eva_limit_frame_group { get; set; }
public DbSet<eva_limit_frame_planEntity> eva_limit_frame_plan { get; set; }
public DbSet<eva_idp_planEntity> eva_idp_plan { get; set; }
public DbSet<eva_create_evaluation_detail_historyEntity> eva_create_evaluation_detail_history { get; set; }
public DbSet<eva_evaluation_achievement_attachEntity> eva_evaluation_achievement_attach { get; set; }
public DbSet<activity_log_evaEntity> activity_log_eva { get; set; }
protected override void OnModelCreating (ModelBuilder modelBuilder) {
base.OnModelCreating (modelBuilder);

View File

@@ -1,15 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using System.Transactions;
using AutoMapper;
using System.Linq.Expressions;
using TTSW.Common;
using TodoAPI2.Models;
using Microsoft.AspNetCore.Http;
using IdentityModel;
using Newtonsoft.Json;
using System.Reflection;
using System.Data;
using System.ComponentModel.DataAnnotations;
using TTSW.Utils;
namespace TTSW.EF
{
@@ -18,6 +21,7 @@ namespace TTSW.EF
{
#region Private Variables
private DataContext _context;
private IMyDatabase _db;
public DataContext Context
{
get
@@ -38,11 +42,12 @@ namespace TTSW.EF
}
#endregion
public BaseRepository(DataContext context, IHttpContextAccessor contextAccessor
public BaseRepository(DataContext context, IHttpContextAccessor contextAccessor, IMyDatabase mydatabase
)
{
_context = context;
_contextAccessor = contextAccessor;
_db = mydatabase;
}
#region Private Functions
@@ -211,6 +216,26 @@ namespace TTSW.EF
entity = SetUpdatorProperties(entity);
entity = SetActiveProperty(entity);
var log = new activity_log();
log.attributes = entity;
log.old = null;
var log_message = Newtonsoft.Json.JsonConvert.SerializeObject(log);
var activity_log = new activity_log_evaEntity();
activity_log.log_name = entity.GetType().Name.Replace("Entity", "");
activity_log.description = "Add " + entity.GetType().Name.Replace("Entity", "");
activity_log.subject_id = 0;
activity_log.subject_type = entity.GetType().Name;
activity_log.causer_id = Convert.ToInt32(_contextAccessor.HttpContext.Request.Cookies["user_id"]);
activity_log.causer_type = @"App\Models\User";
activity_log.properties = log_message;
activity_log.ip_address = _contextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
activity_log.mac_address = "N/A";
activity_log.created_at = DateTime.Now;
activity_log.updated_at = activity_log.created_at;
_context.Add(activity_log);
var result = Entities.Add(entity);
if(!SaveToDB())
@@ -237,17 +262,49 @@ namespace TTSW.EF
if (!SaveToDB())
throw new NotificationException($"Unable to insert item to database.");
}
public T Update(Key id, object model)
{
var userLogin = GetLoginProfile();
var existingItem = Get(id);
object old_existingItem;
if(existingItem == null)
try
{
var x = MyHelper.GetDataRow(id, model, _db);
old_existingItem = MyHelper.GetObject(x, model.GetType().Name.Replace("Entity", ""));
}
catch(Exception ex)
{
old_existingItem = null;
}
if (existingItem == null)
throw new NotificationException($"No item in database.");
Mapper.Map(model, existingItem);
var log = new activity_log();
log.attributes = existingItem;
log.old = old_existingItem;
var log_message = Newtonsoft.Json.JsonConvert.SerializeObject(log);
var activity_log = new activity_log_evaEntity();
activity_log.log_name = existingItem.GetType().Name.Replace("Entity", ""); ;
activity_log.description = "Update " + existingItem.GetType().Name.Replace("Entity", ""); ;
activity_log.subject_id = 0;
activity_log.subject_type = existingItem.GetType().Name;
activity_log.causer_id = Convert.ToInt32(_contextAccessor.HttpContext.Request.Cookies["user_id"]);
activity_log.causer_type = @"App\Models\User";
activity_log.properties = log_message;
activity_log.ip_address = _contextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
activity_log.mac_address = "N/A";
activity_log.created_at = DateTime.Now;
activity_log.updated_at = activity_log.created_at;
_context.Add(activity_log);
existingItem = SetUpdatorProperties(existingItem);
if (!SaveToDB())
@@ -295,6 +352,25 @@ namespace TTSW.EF
var existingItem = Get(id);
var log = new activity_log();
log.attributes = existingItem;
log.old = null;
var log_message = Newtonsoft.Json.JsonConvert.SerializeObject(log);
var activity_log = new activity_log_evaEntity();
activity_log.log_name = existingItem.GetType().Name.Replace("Entity", ""); ;
activity_log.description = "Delete " + existingItem.GetType().Name.Replace("Entity", ""); ;
activity_log.subject_id = 0;
activity_log.subject_type = existingItem.GetType().Name;
activity_log.causer_id = Convert.ToInt32(_contextAccessor.HttpContext.Request.Cookies["user_id"]);
activity_log.causer_type = @"App\Models\User";
activity_log.properties = log_message;
activity_log.ip_address = _contextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
activity_log.mac_address = "N/A";
activity_log.created_at = DateTime.Now;
activity_log.updated_at = activity_log.created_at;
_context.Add(activity_log);
if (existingItem == null)
throw new NotificationException($"No item in database.");

View File

@@ -10,14 +10,24 @@ using TTSW.Common;
using TodoAPI2.Models;
using Microsoft.AspNetCore.Http;
using IdentityModel;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json;
using TTSW.Utils;
namespace TTSW.EF
{
public class activity_log
{
public object attributes { get; set; }
public object old { get; set; }
}
public class BaseRepository2<T, Key> : IBaseRepository2<T, Key>
where T : class, IBaseEntity2<Key>
{
#region Private Variables
private DataContext _context;
private IMyDatabase _db;
public DataContext Context
{
get
@@ -38,11 +48,12 @@ namespace TTSW.EF
}
#endregion
public BaseRepository2(DataContext context, IHttpContextAccessor contextAccessor
public BaseRepository2(DataContext context, IHttpContextAccessor contextAccessor, IMyDatabase mydatabase
)
{
_context = context;
_contextAccessor = contextAccessor;
_db = mydatabase;
}
#region Private Functions
@@ -213,7 +224,27 @@ namespace TTSW.EF
var result = Entities.Add(entity);
if(!SaveToDB())
var log = new activity_log();
log.attributes = entity;
log.old = null;
var log_message = Newtonsoft.Json.JsonConvert.SerializeObject(log);
var activity_log = new activity_log_evaEntity();
activity_log.log_name = entity.GetType().Name.Replace("Entity", "");
activity_log.description = "Add " + entity.GetType().Name.Replace("Entity", "");
activity_log.subject_id = 0;
activity_log.subject_type = entity.GetType().Name;
activity_log.causer_id = Convert.ToInt32(_contextAccessor.HttpContext.Request.Cookies["user_id"]);
activity_log.causer_type = @"App\Models\User";
activity_log.properties = log_message;
activity_log.ip_address = _contextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
activity_log.mac_address = "N/A";
activity_log.created_at = DateTime.Now;
activity_log.updated_at = activity_log.created_at;
_context.Add(activity_log);
if (!SaveToDB())
throw new NotificationException($"Unable to add new item to database.");
return Get(result.Entity.id);
@@ -242,12 +273,42 @@ namespace TTSW.EF
var userLogin = GetLoginProfile();
var existingItem = Get(id);
object old_existingItem;
if(existingItem == null)
try
{
var x = MyHelper.GetDataRow(id, model, _db);
old_existingItem = MyHelper.GetObject(x, model.GetType().Name.Replace("Entity", ""));
}
catch (Exception ex)
{
old_existingItem = null;
}
if (existingItem == null)
throw new NotificationException($"No item in database.");
Mapper.Map(model, existingItem);
var log = new activity_log();
log.attributes = existingItem;
log.old = old_existingItem;
var log_message = Newtonsoft.Json.JsonConvert.SerializeObject(log);
var activity_log = new activity_log_evaEntity();
activity_log.log_name = existingItem.GetType().Name.Replace("Entity", ""); ;
activity_log.description = "Update " + existingItem.GetType().Name.Replace("Entity", ""); ;
activity_log.subject_id = 0;
activity_log.subject_type = existingItem.GetType().Name;
activity_log.causer_id = Convert.ToInt32(_contextAccessor.HttpContext.Request.Cookies["user_id"]);
activity_log.causer_type = @"App\Models\User";
activity_log.properties = log_message;
activity_log.ip_address = _contextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
activity_log.mac_address = "N/A";
activity_log.created_at = DateTime.Now;
activity_log.updated_at = activity_log.created_at;
_context.Add(activity_log);
existingItem = SetUpdatorProperties(existingItem);
if (!SaveToDB())
@@ -294,6 +355,24 @@ namespace TTSW.EF
var userLogin = GetLoginProfile();
var existingItem = Get(id);
var log = new activity_log();
log.attributes = existingItem;
log.old = null;
var log_message = Newtonsoft.Json.JsonConvert.SerializeObject(log);
var activity_log = new activity_log_evaEntity();
activity_log.log_name = existingItem.GetType().Name.Replace("Entity", ""); ;
activity_log.description = "Delete " + existingItem.GetType().Name.Replace("Entity", ""); ;
activity_log.subject_id = 0;
activity_log.subject_type = existingItem.GetType().Name;
activity_log.causer_id = Convert.ToInt32(_contextAccessor.HttpContext.Request.Cookies["user_id"]);
activity_log.causer_type = @"App\Models\User";
activity_log.properties = log_message;
activity_log.ip_address = _contextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
activity_log.mac_address = "N/A";
activity_log.created_at = DateTime.Now;
activity_log.updated_at = activity_log.created_at;
_context.Add(activity_log);
if (existingItem == null)
throw new NotificationException($"No item in database.");

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,962 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TTSW.EF;
namespace tb320eva.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20210328084209_UpdatePlan")]
partial class UpdatePlan
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b =>
{
b.Property<int>("id");
b.Property<string>("command_no")
.HasMaxLength(4000);
b.Property<int?>("create_evaluation_id");
b.Property<DateTime>("created");
b.Property<int?>("fiscal_year");
b.Property<DateTime?>("imported_date");
b.Property<string>("imported_file")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<decimal?>("limit");
b.Property<decimal?>("limit_frame");
b.Property<decimal?>("limit_frame_quota");
b.Property<decimal?>("limit_quota");
b.Property<int?>("managed_by");
b.Property<decimal?>("percentage");
b.Property<string>("report_type")
.HasMaxLength(1000);
b.Property<DateTime?>("theDate");
b.Property<int?>("theRound");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("create_evaluation_id");
b.ToTable("eva_adjust_postponement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b =>
{
b.Property<int>("id");
b.Property<decimal?>("achievement_final");
b.Property<int?>("adjust_postponement_id");
b.Property<int?>("adjust_postponement_quota_id");
b.Property<decimal?>("competency_final");
b.Property<decimal?>("cost_living");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<bool>("isActive");
b.Property<string>("level_score_final")
.HasMaxLength(255);
b.Property<string>("level_this_time")
.HasMaxLength(1000);
b.Property<decimal?>("middle");
b.Property<string>("migration_eva_result")
.HasMaxLength(1000);
b.Property<decimal?>("migration_total_score");
b.Property<decimal?>("new_cost_living");
b.Property<decimal?>("new_sarary");
b.Property<decimal?>("new_sarary_with_quota");
b.Property<int?>("order_at_this_time");
b.Property<int?>("org_at_this_time");
b.Property<decimal?>("other_money_at_this_time");
b.Property<decimal?>("position_allowance_at_this_time");
b.Property<string>("position_this_time")
.HasMaxLength(1000);
b.Property<decimal?>("promoted_percentage");
b.Property<decimal?>("receive_quota");
b.Property<string>("remark")
.HasMaxLength(1000);
b.Property<decimal?>("sarary");
b.Property<decimal?>("score_final");
b.Property<decimal?>("total_promote");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("adjust_postponement_id");
b.HasIndex("adjust_postponement_quota_id");
b.ToTable("eva_adjust_postponement_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b =>
{
b.Property<int>("id");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<Guid?>("evaluation_group_id");
b.Property<bool>("isActive");
b.Property<Guid?>("performance_plan_id");
b.Property<decimal?>("score1");
b.Property<decimal?>("score2");
b.Property<int?>("supervisor1_id");
b.Property<int?>("supervisor2_id");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("evaluation_group_id");
b.HasIndex("performance_plan_id");
b.ToTable("eva_create_evaluation");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b =>
{
b.Property<int>("id");
b.Property<decimal?>("Final_summary_chief");
b.Property<decimal?>("Final_summary_competency_chief");
b.Property<decimal?>("Final_summary_competency_supervisor");
b.Property<decimal?>("Final_summary_competency_supervisor1A");
b.Property<decimal?>("Final_summary_competency_supervisor2A");
b.Property<decimal?>("Final_summary_supervisor");
b.Property<decimal?>("Final_summary_supervisor1A");
b.Property<decimal?>("Final_summary_supervisor2A");
b.Property<decimal?>("achievement_chief");
b.Property<decimal?>("achievement_supervisor");
b.Property<decimal?>("achievement_supervisor1A");
b.Property<decimal?>("achievement_supervisor2A");
b.Property<int?>("chief");
b.Property<int?>("chief_a");
b.Property<DateTime?>("chief_a_date");
b.Property<string>("chief_a_reject_reason")
.HasMaxLength(1000);
b.Property<string>("chief_a_remark")
.HasMaxLength(1000);
b.Property<string>("chief_a_result")
.HasMaxLength(1);
b.Property<decimal?>("competency_chief");
b.Property<decimal?>("competency_supervisor");
b.Property<decimal?>("competency_supervisor1A");
b.Property<decimal?>("competency_supervisor2A");
b.Property<int?>("create_evaluation_id");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<int?>("eva_employee_id");
b.Property<int?>("help_org_id");
b.Property<bool>("isActive");
b.Property<string>("level_score_chief")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor1A")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor2A")
.HasMaxLength(255);
b.Property<int?>("order_of_data");
b.Property<decimal?>("score_chief");
b.Property<decimal?>("score_supervisor");
b.Property<decimal?>("score_supervisor1A");
b.Property<decimal?>("score_supervisor2A");
b.Property<string>("status_chief")
.HasMaxLength(1);
b.Property<string>("status_chief_a")
.HasMaxLength(1);
b.Property<DateTime?>("status_chief_a_click_date");
b.Property<DateTime?>("status_chief_click_date");
b.Property<string>("status_self")
.HasMaxLength(1);
b.Property<string>("status_self_a")
.HasMaxLength(1);
b.Property<DateTime?>("status_self_a_click_date");
b.Property<DateTime?>("status_self_click_date");
b.Property<string>("status_supervisor")
.HasMaxLength(1);
b.Property<string>("status_supervisor1A")
.HasMaxLength(1);
b.Property<DateTime?>("status_supervisor1A_click_date");
b.Property<string>("status_supervisor2A")
.HasMaxLength(1);
b.Property<DateTime?>("status_supervisor2A_click_date");
b.Property<DateTime?>("status_supervisor_click_date");
b.Property<int?>("supervisor1");
b.Property<int?>("supervisor1A");
b.Property<DateTime?>("supervisor1A_date");
b.Property<string>("supervisor1A_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor1A_result")
.HasMaxLength(1);
b.Property<DateTime?>("supervisor1_date");
b.Property<int?>("supervisor1_id");
b.Property<string>("supervisor1_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor1_result")
.HasMaxLength(1);
b.Property<int?>("supervisor2");
b.Property<int?>("supervisor2A");
b.Property<DateTime?>("supervisor2A_date");
b.Property<string>("supervisor2A_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor2A_result")
.HasMaxLength(1);
b.Property<DateTime?>("supervisor2_date");
b.Property<int?>("supervisor2_id");
b.Property<string>("supervisor2_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor2_result")
.HasMaxLength(1);
b.Property<decimal?>("total_summary_chief");
b.Property<decimal?>("total_summary_competency_chief");
b.Property<decimal?>("total_summary_competency_supervisor");
b.Property<decimal?>("total_summary_competency_supervisor1A");
b.Property<decimal?>("total_summary_competency_supervisor2A");
b.Property<decimal?>("total_summary_supervisor");
b.Property<decimal?>("total_summary_supervisor1A");
b.Property<decimal?>("total_summary_supervisor2A");
b.Property<DateTime>("updated");
b.Property<decimal?>("work_period");
b.HasKey("id");
b.HasIndex("create_evaluation_id");
b.ToTable("eva_create_evaluation_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b =>
{
b.Property<int>("id");
b.Property<string>("achievement")
.HasMaxLength(8000);
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<decimal?>("score");
b.Property<decimal?>("score2");
b.Property<decimal?>("score3");
b.Property<decimal?>("score4");
b.Property<decimal?>("sumary");
b.Property<decimal?>("sumary2");
b.Property<decimal?>("sumary3");
b.Property<decimal?>("sumary4");
b.Property<string>("target_score1")
.HasMaxLength(255);
b.Property<string>("target_score2")
.HasMaxLength(255);
b.Property<string>("target_score3")
.HasMaxLength(255);
b.Property<string>("target_score4")
.HasMaxLength(255);
b.Property<string>("target_score5")
.HasMaxLength(255);
b.Property<string>("thefile")
.HasMaxLength(1000);
b.Property<DateTime>("updated");
b.Property<decimal?>("weight");
b.HasKey("id");
b.HasIndex("create_evaluation_detail_id");
b.ToTable("eva_evaluation_achievement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b =>
{
b.Property<int>("id");
b.Property<string>("behavior")
.HasMaxLength(1000);
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<decimal?>("score");
b.Property<decimal?>("score2");
b.Property<decimal?>("score3");
b.Property<decimal?>("score4");
b.Property<decimal?>("sumary");
b.Property<decimal?>("sumary2");
b.Property<decimal?>("sumary3");
b.Property<decimal?>("sumary4");
b.Property<string>("target_score1")
.HasMaxLength(255);
b.Property<string>("target_score2")
.HasMaxLength(255);
b.Property<string>("target_score3")
.HasMaxLength(255);
b.Property<string>("target_score4")
.HasMaxLength(255);
b.Property<string>("target_score5")
.HasMaxLength(255);
b.Property<DateTime>("updated");
b.Property<decimal?>("weight");
b.HasKey("id");
b.HasIndex("create_evaluation_detail_id");
b.ToTable("eva_evaluation_behavior");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_groupEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<string>("code")
.HasMaxLength(255);
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<int?>("main_dept_id");
b.Property<decimal?>("percentage");
b.Property<string>("thegroup")
.HasMaxLength(255);
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_evaluation_group");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<Guid?>("evaluation_group_id");
b.Property<bool>("isActive");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("evaluation_group_id");
b.ToTable("eva_evaluation_group_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b =>
{
b.Property<int>("id");
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<string>("indicators")
.HasMaxLength(4000);
b.Property<bool>("isActive");
b.Property<string>("mission_detail")
.HasMaxLength(4000);
b.Property<int?>("mission_no");
b.Property<string>("target")
.HasMaxLength(4000);
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("create_evaluation_detail_id");
b.ToTable("eva_evaluation_operating_agreement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_idp_planEntity", b =>
{
b.Property<int>("id");
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<string>("develop")
.HasMaxLength(1000);
b.Property<string>("development_method")
.HasMaxLength(1000);
b.Property<DateTime?>("end_date");
b.Property<bool>("isActive");
b.Property<string>("period_text")
.HasMaxLength(1000);
b.Property<DateTime?>("start_date");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_idp_plan");
});
modelBuilder.Entity("TodoAPI2.Models.eva_level_scoreEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<string>("code")
.HasMaxLength(255);
b.Property<DateTime>("created");
b.Property<string>("detail")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<decimal?>("max_score");
b.Property<decimal?>("min_score");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_level_score");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b =>
{
b.Property<Guid>("id");
b.Property<decimal?>("cost_of_living");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<Guid?>("frame_group_guid");
b.Property<int?>("help_org_id");
b.Property<bool>("isActive");
b.Property<string>("level_text")
.HasMaxLength(1000);
b.Property<decimal?>("monthly_remuneration");
b.Property<int?>("order_of_data");
b.Property<int?>("org_id");
b.Property<decimal?>("position_allowance");
b.Property<string>("position_text")
.HasMaxLength(1000);
b.Property<decimal?>("salary");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("frame_group_guid");
b.ToTable("eva_limit_frame_employee");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b =>
{
b.Property<Guid>("id");
b.Property<DateTime>("created");
b.Property<Guid?>("frame_plan_guid");
b.Property<Guid?>("group_guid");
b.Property<bool>("isActive");
b.Property<decimal?>("limit_frame_295");
b.Property<int?>("main_dept_id");
b.Property<string>("remark")
.HasMaxLength(4000);
b.Property<decimal?>("total_salary");
b.Property<decimal?>("total_salary_limit");
b.Property<decimal?>("total_salary_limit_rounded");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("frame_plan_guid");
b.HasIndex("group_guid");
b.ToTable("eva_limit_frame_group");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b =>
{
b.Property<Guid>("id");
b.Property<DateTime>("created");
b.Property<DateTime?>("executed_date");
b.Property<bool>("isActive");
b.Property<decimal?>("limit_frame_005");
b.Property<decimal?>("limit_frame_005_total");
b.Property<decimal?>("limit_frame_005_total_rounded");
b.Property<Guid?>("plan_guid");
b.Property<DateTime?>("salary_adjustment_date");
b.Property<string>("status_chief")
.HasMaxLength(1);
b.Property<string>("status_self")
.HasMaxLength(1);
b.Property<int?>("supervisor1");
b.Property<DateTime?>("supervisor1_date");
b.Property<string>("supervisor1_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor1_result")
.HasMaxLength(1);
b.Property<decimal?>("total_salary");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("plan_guid");
b.ToTable("eva_limit_frame_plan");
});
modelBuilder.Entity("TodoAPI2.Models.eva_performance_planEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("created");
b.Property<int?>("fiscal_year");
b.Property<bool>("isActive");
b.Property<decimal?>("percent");
b.Property<int?>("theTime");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_performance_plan");
});
modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("created");
b.Property<DateTime?>("end_date");
b.Property<bool>("isActive");
b.Property<int?>("list_no");
b.Property<Guid?>("performance_plan_id");
b.Property<string>("remark")
.HasMaxLength(1000);
b.Property<DateTime?>("start_date");
b.Property<string>("step")
.HasMaxLength(1000);
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("performance_plan_id");
b.ToTable("eva_performance_plan_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<string>("code")
.HasMaxLength(255);
b.Property<DateTime>("created");
b.Property<string>("detail")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<Guid?>("level_score_id");
b.Property<decimal?>("max_score");
b.Property<decimal?>("min_score");
b.Property<decimal?>("promoted_percentage");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("level_score_id");
b.ToTable("eva_promoted_percentage");
});
modelBuilder.Entity("TodoAPI2.Models.eva_salary_cylinderEntity", b =>
{
b.Property<int>("id");
b.Property<decimal?>("cost_living");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<decimal?>("middle");
b.Property<int?>("position_level");
b.Property<int?>("position_type");
b.Property<decimal?>("temporary_min");
b.Property<decimal?>("themax");
b.Property<decimal?>("themin");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_salary_cylinder");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation")
.WithMany()
.HasForeignKey("create_evaluation_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement")
.WithMany()
.HasForeignKey("adjust_postponement_id");
b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement_quota")
.WithMany()
.HasForeignKey("adjust_postponement_quota_id")
.HasConstraintName("FK_eva_adjust_postponement_detail_eva_adjust_postponement_adj~1");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group")
.WithMany()
.HasForeignKey("evaluation_group_id");
b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan")
.WithMany()
.HasForeignKey("performance_plan_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation_create_evaluation_id")
.WithMany()
.HasForeignKey("create_evaluation_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail")
.WithMany()
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail")
.WithMany()
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group")
.WithMany()
.HasForeignKey("evaluation_group_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail_create_evaluation_detail_id")
.WithMany()
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_limit_frame_groupEntity", "eva_limit_frame_group_frame_group_guid")
.WithMany()
.HasForeignKey("frame_group_guid");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_limit_frame_planEntity", "eva_limit_frame_plan_frame_plan_guid")
.WithMany()
.HasForeignKey("frame_plan_guid");
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group_group_guid")
.WithMany()
.HasForeignKey("group_guid");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan_plan_guid")
.WithMany()
.HasForeignKey("plan_guid");
});
modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan")
.WithMany()
.HasForeignKey("performance_plan_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_level_scoreEntity", "eva_level_score")
.WithMany()
.HasForeignKey("level_score_id");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class UpdatePlan : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<decimal>(
name: "percent",
table: "eva_performance_plan",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "percent",
table: "eva_performance_plan");
}
}
}

View File

@@ -0,0 +1,968 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TTSW.EF;
namespace tb320eva.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20210406042734_AddMigrationField003")]
partial class AddMigrationField003
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b =>
{
b.Property<int>("id");
b.Property<string>("command_no")
.HasMaxLength(4000);
b.Property<int?>("create_evaluation_id");
b.Property<DateTime>("created");
b.Property<int?>("fiscal_year");
b.Property<DateTime?>("imported_date");
b.Property<string>("imported_file")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<decimal?>("limit");
b.Property<decimal?>("limit_frame");
b.Property<decimal?>("limit_frame_quota");
b.Property<decimal?>("limit_quota");
b.Property<int?>("managed_by");
b.Property<decimal?>("percentage");
b.Property<string>("report_type")
.HasMaxLength(1000);
b.Property<DateTime?>("theDate");
b.Property<int?>("theRound");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("create_evaluation_id");
b.ToTable("eva_adjust_postponement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b =>
{
b.Property<int>("id");
b.Property<decimal?>("achievement_final");
b.Property<int?>("adjust_postponement_id");
b.Property<int?>("adjust_postponement_quota_id");
b.Property<decimal?>("competency_final");
b.Property<decimal?>("cost_living");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<string>("employee_no_at_this_time")
.HasMaxLength(1000);
b.Property<string>("fullname_at_this_time")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<string>("level_score_final")
.HasMaxLength(255);
b.Property<string>("level_this_time")
.HasMaxLength(1000);
b.Property<decimal?>("middle");
b.Property<string>("migration_eva_result")
.HasMaxLength(1000);
b.Property<decimal?>("migration_total_score");
b.Property<decimal?>("new_cost_living");
b.Property<decimal?>("new_sarary");
b.Property<decimal?>("new_sarary_with_quota");
b.Property<int?>("order_at_this_time");
b.Property<int?>("org_at_this_time");
b.Property<decimal?>("other_money_at_this_time");
b.Property<decimal?>("position_allowance_at_this_time");
b.Property<string>("position_this_time")
.HasMaxLength(1000);
b.Property<decimal?>("promoted_percentage");
b.Property<decimal?>("receive_quota");
b.Property<string>("remark")
.HasMaxLength(1000);
b.Property<decimal?>("sarary");
b.Property<decimal?>("score_final");
b.Property<decimal?>("total_promote");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("adjust_postponement_id");
b.HasIndex("adjust_postponement_quota_id");
b.ToTable("eva_adjust_postponement_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b =>
{
b.Property<int>("id");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<Guid?>("evaluation_group_id");
b.Property<bool>("isActive");
b.Property<Guid?>("performance_plan_id");
b.Property<decimal?>("score1");
b.Property<decimal?>("score2");
b.Property<int?>("supervisor1_id");
b.Property<int?>("supervisor2_id");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("evaluation_group_id");
b.HasIndex("performance_plan_id");
b.ToTable("eva_create_evaluation");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b =>
{
b.Property<int>("id");
b.Property<decimal?>("Final_summary_chief");
b.Property<decimal?>("Final_summary_competency_chief");
b.Property<decimal?>("Final_summary_competency_supervisor");
b.Property<decimal?>("Final_summary_competency_supervisor1A");
b.Property<decimal?>("Final_summary_competency_supervisor2A");
b.Property<decimal?>("Final_summary_supervisor");
b.Property<decimal?>("Final_summary_supervisor1A");
b.Property<decimal?>("Final_summary_supervisor2A");
b.Property<decimal?>("achievement_chief");
b.Property<decimal?>("achievement_supervisor");
b.Property<decimal?>("achievement_supervisor1A");
b.Property<decimal?>("achievement_supervisor2A");
b.Property<int?>("chief");
b.Property<int?>("chief_a");
b.Property<DateTime?>("chief_a_date");
b.Property<string>("chief_a_reject_reason")
.HasMaxLength(1000);
b.Property<string>("chief_a_remark")
.HasMaxLength(1000);
b.Property<string>("chief_a_result")
.HasMaxLength(1);
b.Property<decimal?>("competency_chief");
b.Property<decimal?>("competency_supervisor");
b.Property<decimal?>("competency_supervisor1A");
b.Property<decimal?>("competency_supervisor2A");
b.Property<int?>("create_evaluation_id");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<int?>("eva_employee_id");
b.Property<int?>("help_org_id");
b.Property<bool>("isActive");
b.Property<string>("level_score_chief")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor1A")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor2A")
.HasMaxLength(255);
b.Property<int?>("order_of_data");
b.Property<decimal?>("score_chief");
b.Property<decimal?>("score_supervisor");
b.Property<decimal?>("score_supervisor1A");
b.Property<decimal?>("score_supervisor2A");
b.Property<string>("status_chief")
.HasMaxLength(1);
b.Property<string>("status_chief_a")
.HasMaxLength(1);
b.Property<DateTime?>("status_chief_a_click_date");
b.Property<DateTime?>("status_chief_click_date");
b.Property<string>("status_self")
.HasMaxLength(1);
b.Property<string>("status_self_a")
.HasMaxLength(1);
b.Property<DateTime?>("status_self_a_click_date");
b.Property<DateTime?>("status_self_click_date");
b.Property<string>("status_supervisor")
.HasMaxLength(1);
b.Property<string>("status_supervisor1A")
.HasMaxLength(1);
b.Property<DateTime?>("status_supervisor1A_click_date");
b.Property<string>("status_supervisor2A")
.HasMaxLength(1);
b.Property<DateTime?>("status_supervisor2A_click_date");
b.Property<DateTime?>("status_supervisor_click_date");
b.Property<int?>("supervisor1");
b.Property<int?>("supervisor1A");
b.Property<DateTime?>("supervisor1A_date");
b.Property<string>("supervisor1A_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor1A_result")
.HasMaxLength(1);
b.Property<DateTime?>("supervisor1_date");
b.Property<int?>("supervisor1_id");
b.Property<string>("supervisor1_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor1_result")
.HasMaxLength(1);
b.Property<int?>("supervisor2");
b.Property<int?>("supervisor2A");
b.Property<DateTime?>("supervisor2A_date");
b.Property<string>("supervisor2A_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor2A_result")
.HasMaxLength(1);
b.Property<DateTime?>("supervisor2_date");
b.Property<int?>("supervisor2_id");
b.Property<string>("supervisor2_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor2_result")
.HasMaxLength(1);
b.Property<decimal?>("total_summary_chief");
b.Property<decimal?>("total_summary_competency_chief");
b.Property<decimal?>("total_summary_competency_supervisor");
b.Property<decimal?>("total_summary_competency_supervisor1A");
b.Property<decimal?>("total_summary_competency_supervisor2A");
b.Property<decimal?>("total_summary_supervisor");
b.Property<decimal?>("total_summary_supervisor1A");
b.Property<decimal?>("total_summary_supervisor2A");
b.Property<DateTime>("updated");
b.Property<decimal?>("work_period");
b.HasKey("id");
b.HasIndex("create_evaluation_id");
b.ToTable("eva_create_evaluation_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b =>
{
b.Property<int>("id");
b.Property<string>("achievement")
.HasMaxLength(8000);
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<decimal?>("score");
b.Property<decimal?>("score2");
b.Property<decimal?>("score3");
b.Property<decimal?>("score4");
b.Property<decimal?>("sumary");
b.Property<decimal?>("sumary2");
b.Property<decimal?>("sumary3");
b.Property<decimal?>("sumary4");
b.Property<string>("target_score1")
.HasMaxLength(255);
b.Property<string>("target_score2")
.HasMaxLength(255);
b.Property<string>("target_score3")
.HasMaxLength(255);
b.Property<string>("target_score4")
.HasMaxLength(255);
b.Property<string>("target_score5")
.HasMaxLength(255);
b.Property<string>("thefile")
.HasMaxLength(1000);
b.Property<DateTime>("updated");
b.Property<decimal?>("weight");
b.HasKey("id");
b.HasIndex("create_evaluation_detail_id");
b.ToTable("eva_evaluation_achievement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b =>
{
b.Property<int>("id");
b.Property<string>("behavior")
.HasMaxLength(1000);
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<decimal?>("score");
b.Property<decimal?>("score2");
b.Property<decimal?>("score3");
b.Property<decimal?>("score4");
b.Property<decimal?>("sumary");
b.Property<decimal?>("sumary2");
b.Property<decimal?>("sumary3");
b.Property<decimal?>("sumary4");
b.Property<string>("target_score1")
.HasMaxLength(255);
b.Property<string>("target_score2")
.HasMaxLength(255);
b.Property<string>("target_score3")
.HasMaxLength(255);
b.Property<string>("target_score4")
.HasMaxLength(255);
b.Property<string>("target_score5")
.HasMaxLength(255);
b.Property<DateTime>("updated");
b.Property<decimal?>("weight");
b.HasKey("id");
b.HasIndex("create_evaluation_detail_id");
b.ToTable("eva_evaluation_behavior");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_groupEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<string>("code")
.HasMaxLength(255);
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<int?>("main_dept_id");
b.Property<decimal?>("percentage");
b.Property<string>("thegroup")
.HasMaxLength(255);
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_evaluation_group");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<Guid?>("evaluation_group_id");
b.Property<bool>("isActive");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("evaluation_group_id");
b.ToTable("eva_evaluation_group_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b =>
{
b.Property<int>("id");
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<string>("indicators")
.HasMaxLength(4000);
b.Property<bool>("isActive");
b.Property<string>("mission_detail")
.HasMaxLength(4000);
b.Property<int?>("mission_no");
b.Property<string>("target")
.HasMaxLength(4000);
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("create_evaluation_detail_id");
b.ToTable("eva_evaluation_operating_agreement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_idp_planEntity", b =>
{
b.Property<int>("id");
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<string>("develop")
.HasMaxLength(1000);
b.Property<string>("development_method")
.HasMaxLength(1000);
b.Property<DateTime?>("end_date");
b.Property<bool>("isActive");
b.Property<string>("period_text")
.HasMaxLength(1000);
b.Property<DateTime?>("start_date");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_idp_plan");
});
modelBuilder.Entity("TodoAPI2.Models.eva_level_scoreEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<string>("code")
.HasMaxLength(255);
b.Property<DateTime>("created");
b.Property<string>("detail")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<decimal?>("max_score");
b.Property<decimal?>("min_score");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_level_score");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b =>
{
b.Property<Guid>("id");
b.Property<decimal?>("cost_of_living");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<Guid?>("frame_group_guid");
b.Property<int?>("help_org_id");
b.Property<bool>("isActive");
b.Property<string>("level_text")
.HasMaxLength(1000);
b.Property<decimal?>("monthly_remuneration");
b.Property<int?>("order_of_data");
b.Property<int?>("org_id");
b.Property<decimal?>("position_allowance");
b.Property<string>("position_text")
.HasMaxLength(1000);
b.Property<decimal?>("salary");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("frame_group_guid");
b.ToTable("eva_limit_frame_employee");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b =>
{
b.Property<Guid>("id");
b.Property<DateTime>("created");
b.Property<Guid?>("frame_plan_guid");
b.Property<Guid?>("group_guid");
b.Property<bool>("isActive");
b.Property<decimal?>("limit_frame_295");
b.Property<int?>("main_dept_id");
b.Property<string>("remark")
.HasMaxLength(4000);
b.Property<decimal?>("total_salary");
b.Property<decimal?>("total_salary_limit");
b.Property<decimal?>("total_salary_limit_rounded");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("frame_plan_guid");
b.HasIndex("group_guid");
b.ToTable("eva_limit_frame_group");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b =>
{
b.Property<Guid>("id");
b.Property<DateTime>("created");
b.Property<DateTime?>("executed_date");
b.Property<bool>("isActive");
b.Property<decimal?>("limit_frame_005");
b.Property<decimal?>("limit_frame_005_total");
b.Property<decimal?>("limit_frame_005_total_rounded");
b.Property<Guid?>("plan_guid");
b.Property<DateTime?>("salary_adjustment_date");
b.Property<string>("status_chief")
.HasMaxLength(1);
b.Property<string>("status_self")
.HasMaxLength(1);
b.Property<int?>("supervisor1");
b.Property<DateTime?>("supervisor1_date");
b.Property<string>("supervisor1_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor1_result")
.HasMaxLength(1);
b.Property<decimal?>("total_salary");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("plan_guid");
b.ToTable("eva_limit_frame_plan");
});
modelBuilder.Entity("TodoAPI2.Models.eva_performance_planEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("created");
b.Property<int?>("fiscal_year");
b.Property<bool>("isActive");
b.Property<decimal?>("percent");
b.Property<int?>("theTime");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_performance_plan");
});
modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("created");
b.Property<DateTime?>("end_date");
b.Property<bool>("isActive");
b.Property<int?>("list_no");
b.Property<Guid?>("performance_plan_id");
b.Property<string>("remark")
.HasMaxLength(1000);
b.Property<DateTime?>("start_date");
b.Property<string>("step")
.HasMaxLength(1000);
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("performance_plan_id");
b.ToTable("eva_performance_plan_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<string>("code")
.HasMaxLength(255);
b.Property<DateTime>("created");
b.Property<string>("detail")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<Guid?>("level_score_id");
b.Property<decimal?>("max_score");
b.Property<decimal?>("min_score");
b.Property<decimal?>("promoted_percentage");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("level_score_id");
b.ToTable("eva_promoted_percentage");
});
modelBuilder.Entity("TodoAPI2.Models.eva_salary_cylinderEntity", b =>
{
b.Property<int>("id");
b.Property<decimal?>("cost_living");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<decimal?>("middle");
b.Property<int?>("position_level");
b.Property<int?>("position_type");
b.Property<decimal?>("temporary_min");
b.Property<decimal?>("themax");
b.Property<decimal?>("themin");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_salary_cylinder");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation")
.WithMany()
.HasForeignKey("create_evaluation_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement")
.WithMany()
.HasForeignKey("adjust_postponement_id");
b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement_quota")
.WithMany()
.HasForeignKey("adjust_postponement_quota_id")
.HasConstraintName("FK_eva_adjust_postponement_detail_eva_adjust_postponement_adj~1");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group")
.WithMany()
.HasForeignKey("evaluation_group_id");
b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan")
.WithMany()
.HasForeignKey("performance_plan_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation_create_evaluation_id")
.WithMany()
.HasForeignKey("create_evaluation_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail")
.WithMany()
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail")
.WithMany()
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group")
.WithMany()
.HasForeignKey("evaluation_group_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail_create_evaluation_detail_id")
.WithMany()
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_limit_frame_groupEntity", "eva_limit_frame_group_frame_group_guid")
.WithMany()
.HasForeignKey("frame_group_guid");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_limit_frame_planEntity", "eva_limit_frame_plan_frame_plan_guid")
.WithMany()
.HasForeignKey("frame_plan_guid");
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group_group_guid")
.WithMany()
.HasForeignKey("group_guid");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan_plan_guid")
.WithMany()
.HasForeignKey("plan_guid");
});
modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan")
.WithMany()
.HasForeignKey("performance_plan_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_level_scoreEntity", "eva_level_score")
.WithMany()
.HasForeignKey("level_score_id");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class AddMigrationField003 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "employee_no_at_this_time",
table: "eva_adjust_postponement_detail",
maxLength: 1000,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "fullname_at_this_time",
table: "eva_adjust_postponement_detail",
maxLength: 1000,
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "employee_no_at_this_time",
table: "eva_adjust_postponement_detail");
migrationBuilder.DropColumn(
name: "fullname_at_this_time",
table: "eva_adjust_postponement_detail");
}
}
}

View File

@@ -0,0 +1,970 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TTSW.EF;
namespace tb320eva.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20210409015522_Addis_for_postponement")]
partial class Addis_for_postponement
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b =>
{
b.Property<int>("id");
b.Property<string>("command_no")
.HasMaxLength(4000);
b.Property<int?>("create_evaluation_id");
b.Property<DateTime>("created");
b.Property<int?>("fiscal_year");
b.Property<DateTime?>("imported_date");
b.Property<string>("imported_file")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<decimal?>("limit");
b.Property<decimal?>("limit_frame");
b.Property<decimal?>("limit_frame_quota");
b.Property<decimal?>("limit_quota");
b.Property<int?>("managed_by");
b.Property<decimal?>("percentage");
b.Property<string>("report_type")
.HasMaxLength(1000);
b.Property<DateTime?>("theDate");
b.Property<int?>("theRound");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("create_evaluation_id");
b.ToTable("eva_adjust_postponement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b =>
{
b.Property<int>("id");
b.Property<decimal?>("achievement_final");
b.Property<int?>("adjust_postponement_id");
b.Property<int?>("adjust_postponement_quota_id");
b.Property<decimal?>("competency_final");
b.Property<decimal?>("cost_living");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<string>("employee_no_at_this_time")
.HasMaxLength(1000);
b.Property<string>("fullname_at_this_time")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<bool?>("is_for_postponement");
b.Property<string>("level_score_final")
.HasMaxLength(255);
b.Property<string>("level_this_time")
.HasMaxLength(1000);
b.Property<decimal?>("middle");
b.Property<string>("migration_eva_result")
.HasMaxLength(1000);
b.Property<decimal?>("migration_total_score");
b.Property<decimal?>("new_cost_living");
b.Property<decimal?>("new_sarary");
b.Property<decimal?>("new_sarary_with_quota");
b.Property<int?>("order_at_this_time");
b.Property<int?>("org_at_this_time");
b.Property<decimal?>("other_money_at_this_time");
b.Property<decimal?>("position_allowance_at_this_time");
b.Property<string>("position_this_time")
.HasMaxLength(1000);
b.Property<decimal?>("promoted_percentage");
b.Property<decimal?>("receive_quota");
b.Property<string>("remark")
.HasMaxLength(1000);
b.Property<decimal?>("sarary");
b.Property<decimal?>("score_final");
b.Property<decimal?>("total_promote");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("adjust_postponement_id");
b.HasIndex("adjust_postponement_quota_id");
b.ToTable("eva_adjust_postponement_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b =>
{
b.Property<int>("id");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<Guid?>("evaluation_group_id");
b.Property<bool>("isActive");
b.Property<Guid?>("performance_plan_id");
b.Property<decimal?>("score1");
b.Property<decimal?>("score2");
b.Property<int?>("supervisor1_id");
b.Property<int?>("supervisor2_id");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("evaluation_group_id");
b.HasIndex("performance_plan_id");
b.ToTable("eva_create_evaluation");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b =>
{
b.Property<int>("id");
b.Property<decimal?>("Final_summary_chief");
b.Property<decimal?>("Final_summary_competency_chief");
b.Property<decimal?>("Final_summary_competency_supervisor");
b.Property<decimal?>("Final_summary_competency_supervisor1A");
b.Property<decimal?>("Final_summary_competency_supervisor2A");
b.Property<decimal?>("Final_summary_supervisor");
b.Property<decimal?>("Final_summary_supervisor1A");
b.Property<decimal?>("Final_summary_supervisor2A");
b.Property<decimal?>("achievement_chief");
b.Property<decimal?>("achievement_supervisor");
b.Property<decimal?>("achievement_supervisor1A");
b.Property<decimal?>("achievement_supervisor2A");
b.Property<int?>("chief");
b.Property<int?>("chief_a");
b.Property<DateTime?>("chief_a_date");
b.Property<string>("chief_a_reject_reason")
.HasMaxLength(1000);
b.Property<string>("chief_a_remark")
.HasMaxLength(1000);
b.Property<string>("chief_a_result")
.HasMaxLength(1);
b.Property<decimal?>("competency_chief");
b.Property<decimal?>("competency_supervisor");
b.Property<decimal?>("competency_supervisor1A");
b.Property<decimal?>("competency_supervisor2A");
b.Property<int?>("create_evaluation_id");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<int?>("eva_employee_id");
b.Property<int?>("help_org_id");
b.Property<bool>("isActive");
b.Property<string>("level_score_chief")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor1A")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor2A")
.HasMaxLength(255);
b.Property<int?>("order_of_data");
b.Property<decimal?>("score_chief");
b.Property<decimal?>("score_supervisor");
b.Property<decimal?>("score_supervisor1A");
b.Property<decimal?>("score_supervisor2A");
b.Property<string>("status_chief")
.HasMaxLength(1);
b.Property<string>("status_chief_a")
.HasMaxLength(1);
b.Property<DateTime?>("status_chief_a_click_date");
b.Property<DateTime?>("status_chief_click_date");
b.Property<string>("status_self")
.HasMaxLength(1);
b.Property<string>("status_self_a")
.HasMaxLength(1);
b.Property<DateTime?>("status_self_a_click_date");
b.Property<DateTime?>("status_self_click_date");
b.Property<string>("status_supervisor")
.HasMaxLength(1);
b.Property<string>("status_supervisor1A")
.HasMaxLength(1);
b.Property<DateTime?>("status_supervisor1A_click_date");
b.Property<string>("status_supervisor2A")
.HasMaxLength(1);
b.Property<DateTime?>("status_supervisor2A_click_date");
b.Property<DateTime?>("status_supervisor_click_date");
b.Property<int?>("supervisor1");
b.Property<int?>("supervisor1A");
b.Property<DateTime?>("supervisor1A_date");
b.Property<string>("supervisor1A_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor1A_result")
.HasMaxLength(1);
b.Property<DateTime?>("supervisor1_date");
b.Property<int?>("supervisor1_id");
b.Property<string>("supervisor1_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor1_result")
.HasMaxLength(1);
b.Property<int?>("supervisor2");
b.Property<int?>("supervisor2A");
b.Property<DateTime?>("supervisor2A_date");
b.Property<string>("supervisor2A_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor2A_result")
.HasMaxLength(1);
b.Property<DateTime?>("supervisor2_date");
b.Property<int?>("supervisor2_id");
b.Property<string>("supervisor2_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor2_result")
.HasMaxLength(1);
b.Property<decimal?>("total_summary_chief");
b.Property<decimal?>("total_summary_competency_chief");
b.Property<decimal?>("total_summary_competency_supervisor");
b.Property<decimal?>("total_summary_competency_supervisor1A");
b.Property<decimal?>("total_summary_competency_supervisor2A");
b.Property<decimal?>("total_summary_supervisor");
b.Property<decimal?>("total_summary_supervisor1A");
b.Property<decimal?>("total_summary_supervisor2A");
b.Property<DateTime>("updated");
b.Property<decimal?>("work_period");
b.HasKey("id");
b.HasIndex("create_evaluation_id");
b.ToTable("eva_create_evaluation_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b =>
{
b.Property<int>("id");
b.Property<string>("achievement")
.HasMaxLength(8000);
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<decimal?>("score");
b.Property<decimal?>("score2");
b.Property<decimal?>("score3");
b.Property<decimal?>("score4");
b.Property<decimal?>("sumary");
b.Property<decimal?>("sumary2");
b.Property<decimal?>("sumary3");
b.Property<decimal?>("sumary4");
b.Property<string>("target_score1")
.HasMaxLength(255);
b.Property<string>("target_score2")
.HasMaxLength(255);
b.Property<string>("target_score3")
.HasMaxLength(255);
b.Property<string>("target_score4")
.HasMaxLength(255);
b.Property<string>("target_score5")
.HasMaxLength(255);
b.Property<string>("thefile")
.HasMaxLength(1000);
b.Property<DateTime>("updated");
b.Property<decimal?>("weight");
b.HasKey("id");
b.HasIndex("create_evaluation_detail_id");
b.ToTable("eva_evaluation_achievement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b =>
{
b.Property<int>("id");
b.Property<string>("behavior")
.HasMaxLength(1000);
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<decimal?>("score");
b.Property<decimal?>("score2");
b.Property<decimal?>("score3");
b.Property<decimal?>("score4");
b.Property<decimal?>("sumary");
b.Property<decimal?>("sumary2");
b.Property<decimal?>("sumary3");
b.Property<decimal?>("sumary4");
b.Property<string>("target_score1")
.HasMaxLength(255);
b.Property<string>("target_score2")
.HasMaxLength(255);
b.Property<string>("target_score3")
.HasMaxLength(255);
b.Property<string>("target_score4")
.HasMaxLength(255);
b.Property<string>("target_score5")
.HasMaxLength(255);
b.Property<DateTime>("updated");
b.Property<decimal?>("weight");
b.HasKey("id");
b.HasIndex("create_evaluation_detail_id");
b.ToTable("eva_evaluation_behavior");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_groupEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<string>("code")
.HasMaxLength(255);
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<int?>("main_dept_id");
b.Property<decimal?>("percentage");
b.Property<string>("thegroup")
.HasMaxLength(255);
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_evaluation_group");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<Guid?>("evaluation_group_id");
b.Property<bool>("isActive");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("evaluation_group_id");
b.ToTable("eva_evaluation_group_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b =>
{
b.Property<int>("id");
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<string>("indicators")
.HasMaxLength(4000);
b.Property<bool>("isActive");
b.Property<string>("mission_detail")
.HasMaxLength(4000);
b.Property<int?>("mission_no");
b.Property<string>("target")
.HasMaxLength(4000);
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("create_evaluation_detail_id");
b.ToTable("eva_evaluation_operating_agreement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_idp_planEntity", b =>
{
b.Property<int>("id");
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<string>("develop")
.HasMaxLength(1000);
b.Property<string>("development_method")
.HasMaxLength(1000);
b.Property<DateTime?>("end_date");
b.Property<bool>("isActive");
b.Property<string>("period_text")
.HasMaxLength(1000);
b.Property<DateTime?>("start_date");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_idp_plan");
});
modelBuilder.Entity("TodoAPI2.Models.eva_level_scoreEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<string>("code")
.HasMaxLength(255);
b.Property<DateTime>("created");
b.Property<string>("detail")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<decimal?>("max_score");
b.Property<decimal?>("min_score");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_level_score");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b =>
{
b.Property<Guid>("id");
b.Property<decimal?>("cost_of_living");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<Guid?>("frame_group_guid");
b.Property<int?>("help_org_id");
b.Property<bool>("isActive");
b.Property<string>("level_text")
.HasMaxLength(1000);
b.Property<decimal?>("monthly_remuneration");
b.Property<int?>("order_of_data");
b.Property<int?>("org_id");
b.Property<decimal?>("position_allowance");
b.Property<string>("position_text")
.HasMaxLength(1000);
b.Property<decimal?>("salary");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("frame_group_guid");
b.ToTable("eva_limit_frame_employee");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b =>
{
b.Property<Guid>("id");
b.Property<DateTime>("created");
b.Property<Guid?>("frame_plan_guid");
b.Property<Guid?>("group_guid");
b.Property<bool>("isActive");
b.Property<decimal?>("limit_frame_295");
b.Property<int?>("main_dept_id");
b.Property<string>("remark")
.HasMaxLength(4000);
b.Property<decimal?>("total_salary");
b.Property<decimal?>("total_salary_limit");
b.Property<decimal?>("total_salary_limit_rounded");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("frame_plan_guid");
b.HasIndex("group_guid");
b.ToTable("eva_limit_frame_group");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b =>
{
b.Property<Guid>("id");
b.Property<DateTime>("created");
b.Property<DateTime?>("executed_date");
b.Property<bool>("isActive");
b.Property<decimal?>("limit_frame_005");
b.Property<decimal?>("limit_frame_005_total");
b.Property<decimal?>("limit_frame_005_total_rounded");
b.Property<Guid?>("plan_guid");
b.Property<DateTime?>("salary_adjustment_date");
b.Property<string>("status_chief")
.HasMaxLength(1);
b.Property<string>("status_self")
.HasMaxLength(1);
b.Property<int?>("supervisor1");
b.Property<DateTime?>("supervisor1_date");
b.Property<string>("supervisor1_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor1_result")
.HasMaxLength(1);
b.Property<decimal?>("total_salary");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("plan_guid");
b.ToTable("eva_limit_frame_plan");
});
modelBuilder.Entity("TodoAPI2.Models.eva_performance_planEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("created");
b.Property<int?>("fiscal_year");
b.Property<bool>("isActive");
b.Property<decimal?>("percent");
b.Property<int?>("theTime");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_performance_plan");
});
modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("created");
b.Property<DateTime?>("end_date");
b.Property<bool>("isActive");
b.Property<int?>("list_no");
b.Property<Guid?>("performance_plan_id");
b.Property<string>("remark")
.HasMaxLength(1000);
b.Property<DateTime?>("start_date");
b.Property<string>("step")
.HasMaxLength(1000);
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("performance_plan_id");
b.ToTable("eva_performance_plan_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<string>("code")
.HasMaxLength(255);
b.Property<DateTime>("created");
b.Property<string>("detail")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<Guid?>("level_score_id");
b.Property<decimal?>("max_score");
b.Property<decimal?>("min_score");
b.Property<decimal?>("promoted_percentage");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("level_score_id");
b.ToTable("eva_promoted_percentage");
});
modelBuilder.Entity("TodoAPI2.Models.eva_salary_cylinderEntity", b =>
{
b.Property<int>("id");
b.Property<decimal?>("cost_living");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<decimal?>("middle");
b.Property<int?>("position_level");
b.Property<int?>("position_type");
b.Property<decimal?>("temporary_min");
b.Property<decimal?>("themax");
b.Property<decimal?>("themin");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_salary_cylinder");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation")
.WithMany()
.HasForeignKey("create_evaluation_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement")
.WithMany()
.HasForeignKey("adjust_postponement_id");
b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement_quota")
.WithMany()
.HasForeignKey("adjust_postponement_quota_id")
.HasConstraintName("FK_eva_adjust_postponement_detail_eva_adjust_postponement_adj~1");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group")
.WithMany()
.HasForeignKey("evaluation_group_id");
b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan")
.WithMany()
.HasForeignKey("performance_plan_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation_create_evaluation_id")
.WithMany()
.HasForeignKey("create_evaluation_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail")
.WithMany()
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail")
.WithMany()
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group")
.WithMany()
.HasForeignKey("evaluation_group_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail_create_evaluation_detail_id")
.WithMany()
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_limit_frame_groupEntity", "eva_limit_frame_group_frame_group_guid")
.WithMany()
.HasForeignKey("frame_group_guid");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_limit_frame_planEntity", "eva_limit_frame_plan_frame_plan_guid")
.WithMany()
.HasForeignKey("frame_plan_guid");
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group_group_guid")
.WithMany()
.HasForeignKey("group_guid");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan_plan_guid")
.WithMany()
.HasForeignKey("plan_guid");
});
modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan")
.WithMany()
.HasForeignKey("performance_plan_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_level_scoreEntity", "eva_level_score")
.WithMany()
.HasForeignKey("level_score_id");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class Addis_for_postponement : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "is_for_postponement",
table: "eva_adjust_postponement_detail",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "is_for_postponement",
table: "eva_adjust_postponement_detail");
}
}
}

View File

@@ -0,0 +1,999 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TTSW.EF;
namespace tb320eva.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20210411122053_AddAttach")]
partial class AddAttach
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b =>
{
b.Property<int>("id");
b.Property<string>("command_no")
.HasMaxLength(4000);
b.Property<int?>("create_evaluation_id");
b.Property<DateTime>("created");
b.Property<int?>("fiscal_year");
b.Property<DateTime?>("imported_date");
b.Property<string>("imported_file")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<decimal?>("limit");
b.Property<decimal?>("limit_frame");
b.Property<decimal?>("limit_frame_quota");
b.Property<decimal?>("limit_quota");
b.Property<int?>("managed_by");
b.Property<decimal?>("percentage");
b.Property<string>("report_type")
.HasMaxLength(1000);
b.Property<DateTime?>("theDate");
b.Property<int?>("theRound");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("create_evaluation_id");
b.ToTable("eva_adjust_postponement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b =>
{
b.Property<int>("id");
b.Property<decimal?>("achievement_final");
b.Property<int?>("adjust_postponement_id");
b.Property<int?>("adjust_postponement_quota_id");
b.Property<decimal?>("competency_final");
b.Property<decimal?>("cost_living");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<string>("employee_no_at_this_time")
.HasMaxLength(1000);
b.Property<string>("fullname_at_this_time")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<bool?>("is_for_postponement");
b.Property<string>("level_score_final")
.HasMaxLength(255);
b.Property<string>("level_this_time")
.HasMaxLength(1000);
b.Property<decimal?>("middle");
b.Property<string>("migration_eva_result")
.HasMaxLength(1000);
b.Property<decimal?>("migration_total_score");
b.Property<decimal?>("new_cost_living");
b.Property<decimal?>("new_sarary");
b.Property<decimal?>("new_sarary_with_quota");
b.Property<int?>("order_at_this_time");
b.Property<int?>("org_at_this_time");
b.Property<decimal?>("other_money_at_this_time");
b.Property<decimal?>("position_allowance_at_this_time");
b.Property<string>("position_this_time")
.HasMaxLength(1000);
b.Property<decimal?>("promoted_percentage");
b.Property<decimal?>("receive_quota");
b.Property<string>("remark")
.HasMaxLength(1000);
b.Property<decimal?>("sarary");
b.Property<decimal?>("score_final");
b.Property<decimal?>("total_promote");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("adjust_postponement_id");
b.HasIndex("adjust_postponement_quota_id");
b.ToTable("eva_adjust_postponement_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b =>
{
b.Property<int>("id");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<Guid?>("evaluation_group_id");
b.Property<bool>("isActive");
b.Property<Guid?>("performance_plan_id");
b.Property<decimal?>("score1");
b.Property<decimal?>("score2");
b.Property<int?>("supervisor1_id");
b.Property<int?>("supervisor2_id");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("evaluation_group_id");
b.HasIndex("performance_plan_id");
b.ToTable("eva_create_evaluation");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b =>
{
b.Property<int>("id");
b.Property<decimal?>("Final_summary_chief");
b.Property<decimal?>("Final_summary_competency_chief");
b.Property<decimal?>("Final_summary_competency_supervisor");
b.Property<decimal?>("Final_summary_competency_supervisor1A");
b.Property<decimal?>("Final_summary_competency_supervisor2A");
b.Property<decimal?>("Final_summary_supervisor");
b.Property<decimal?>("Final_summary_supervisor1A");
b.Property<decimal?>("Final_summary_supervisor2A");
b.Property<decimal?>("achievement_chief");
b.Property<decimal?>("achievement_supervisor");
b.Property<decimal?>("achievement_supervisor1A");
b.Property<decimal?>("achievement_supervisor2A");
b.Property<int?>("chief");
b.Property<int?>("chief_a");
b.Property<DateTime?>("chief_a_date");
b.Property<string>("chief_a_reject_reason")
.HasMaxLength(1000);
b.Property<string>("chief_a_remark")
.HasMaxLength(1000);
b.Property<string>("chief_a_result")
.HasMaxLength(1);
b.Property<decimal?>("competency_chief");
b.Property<decimal?>("competency_supervisor");
b.Property<decimal?>("competency_supervisor1A");
b.Property<decimal?>("competency_supervisor2A");
b.Property<int?>("create_evaluation_id");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<int?>("eva_employee_id");
b.Property<int?>("help_org_id");
b.Property<bool>("isActive");
b.Property<string>("level_score_chief")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor1A")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor2A")
.HasMaxLength(255);
b.Property<int?>("order_of_data");
b.Property<decimal?>("score_chief");
b.Property<decimal?>("score_supervisor");
b.Property<decimal?>("score_supervisor1A");
b.Property<decimal?>("score_supervisor2A");
b.Property<string>("status_chief")
.HasMaxLength(1);
b.Property<string>("status_chief_a")
.HasMaxLength(1);
b.Property<DateTime?>("status_chief_a_click_date");
b.Property<DateTime?>("status_chief_click_date");
b.Property<string>("status_self")
.HasMaxLength(1);
b.Property<string>("status_self_a")
.HasMaxLength(1);
b.Property<DateTime?>("status_self_a_click_date");
b.Property<DateTime?>("status_self_click_date");
b.Property<string>("status_supervisor")
.HasMaxLength(1);
b.Property<string>("status_supervisor1A")
.HasMaxLength(1);
b.Property<DateTime?>("status_supervisor1A_click_date");
b.Property<string>("status_supervisor2A")
.HasMaxLength(1);
b.Property<DateTime?>("status_supervisor2A_click_date");
b.Property<DateTime?>("status_supervisor_click_date");
b.Property<int?>("supervisor1");
b.Property<int?>("supervisor1A");
b.Property<DateTime?>("supervisor1A_date");
b.Property<string>("supervisor1A_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor1A_result")
.HasMaxLength(1);
b.Property<DateTime?>("supervisor1_date");
b.Property<int?>("supervisor1_id");
b.Property<string>("supervisor1_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor1_result")
.HasMaxLength(1);
b.Property<int?>("supervisor2");
b.Property<int?>("supervisor2A");
b.Property<DateTime?>("supervisor2A_date");
b.Property<string>("supervisor2A_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor2A_result")
.HasMaxLength(1);
b.Property<DateTime?>("supervisor2_date");
b.Property<int?>("supervisor2_id");
b.Property<string>("supervisor2_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor2_result")
.HasMaxLength(1);
b.Property<decimal?>("total_summary_chief");
b.Property<decimal?>("total_summary_competency_chief");
b.Property<decimal?>("total_summary_competency_supervisor");
b.Property<decimal?>("total_summary_competency_supervisor1A");
b.Property<decimal?>("total_summary_competency_supervisor2A");
b.Property<decimal?>("total_summary_supervisor");
b.Property<decimal?>("total_summary_supervisor1A");
b.Property<decimal?>("total_summary_supervisor2A");
b.Property<DateTime>("updated");
b.Property<decimal?>("work_period");
b.HasKey("id");
b.HasIndex("create_evaluation_id");
b.ToTable("eva_create_evaluation_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b =>
{
b.Property<int>("id");
b.Property<string>("achievement")
.HasMaxLength(8000);
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<decimal?>("score");
b.Property<decimal?>("score2");
b.Property<decimal?>("score3");
b.Property<decimal?>("score4");
b.Property<decimal?>("sumary");
b.Property<decimal?>("sumary2");
b.Property<decimal?>("sumary3");
b.Property<decimal?>("sumary4");
b.Property<string>("target_score1")
.HasMaxLength(255);
b.Property<string>("target_score2")
.HasMaxLength(255);
b.Property<string>("target_score3")
.HasMaxLength(255);
b.Property<string>("target_score4")
.HasMaxLength(255);
b.Property<string>("target_score5")
.HasMaxLength(255);
b.Property<string>("thefile")
.HasMaxLength(1000);
b.Property<DateTime>("updated");
b.Property<decimal?>("weight");
b.HasKey("id");
b.HasIndex("create_evaluation_detail_id");
b.ToTable("eva_evaluation_achievement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievement_attachEntity", b =>
{
b.Property<int>("id");
b.Property<int?>("achievement_id");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<string>("the_file")
.HasMaxLength(1000);
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("achievement_id");
b.ToTable("eva_evaluation_achievement_attach");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b =>
{
b.Property<int>("id");
b.Property<string>("behavior")
.HasMaxLength(1000);
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<decimal?>("score");
b.Property<decimal?>("score2");
b.Property<decimal?>("score3");
b.Property<decimal?>("score4");
b.Property<decimal?>("sumary");
b.Property<decimal?>("sumary2");
b.Property<decimal?>("sumary3");
b.Property<decimal?>("sumary4");
b.Property<string>("target_score1")
.HasMaxLength(255);
b.Property<string>("target_score2")
.HasMaxLength(255);
b.Property<string>("target_score3")
.HasMaxLength(255);
b.Property<string>("target_score4")
.HasMaxLength(255);
b.Property<string>("target_score5")
.HasMaxLength(255);
b.Property<DateTime>("updated");
b.Property<decimal?>("weight");
b.HasKey("id");
b.HasIndex("create_evaluation_detail_id");
b.ToTable("eva_evaluation_behavior");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_groupEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<string>("code")
.HasMaxLength(255);
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<int?>("main_dept_id");
b.Property<decimal?>("percentage");
b.Property<string>("thegroup")
.HasMaxLength(255);
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_evaluation_group");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<Guid?>("evaluation_group_id");
b.Property<bool>("isActive");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("evaluation_group_id");
b.ToTable("eva_evaluation_group_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b =>
{
b.Property<int>("id");
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<string>("indicators")
.HasMaxLength(4000);
b.Property<bool>("isActive");
b.Property<string>("mission_detail")
.HasMaxLength(4000);
b.Property<int?>("mission_no");
b.Property<string>("target")
.HasMaxLength(4000);
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("create_evaluation_detail_id");
b.ToTable("eva_evaluation_operating_agreement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_idp_planEntity", b =>
{
b.Property<int>("id");
b.Property<int?>("create_evaluation_detail_id");
b.Property<DateTime>("created");
b.Property<string>("develop")
.HasMaxLength(1000);
b.Property<string>("development_method")
.HasMaxLength(1000);
b.Property<DateTime?>("end_date");
b.Property<bool>("isActive");
b.Property<string>("period_text")
.HasMaxLength(1000);
b.Property<DateTime?>("start_date");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_idp_plan");
});
modelBuilder.Entity("TodoAPI2.Models.eva_level_scoreEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<string>("code")
.HasMaxLength(255);
b.Property<DateTime>("created");
b.Property<string>("detail")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<decimal?>("max_score");
b.Property<decimal?>("min_score");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_level_score");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b =>
{
b.Property<Guid>("id");
b.Property<decimal?>("cost_of_living");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<Guid?>("frame_group_guid");
b.Property<int?>("help_org_id");
b.Property<bool>("isActive");
b.Property<string>("level_text")
.HasMaxLength(1000);
b.Property<decimal?>("monthly_remuneration");
b.Property<int?>("order_of_data");
b.Property<int?>("org_id");
b.Property<decimal?>("position_allowance");
b.Property<string>("position_text")
.HasMaxLength(1000);
b.Property<decimal?>("salary");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("frame_group_guid");
b.ToTable("eva_limit_frame_employee");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b =>
{
b.Property<Guid>("id");
b.Property<DateTime>("created");
b.Property<Guid?>("frame_plan_guid");
b.Property<Guid?>("group_guid");
b.Property<bool>("isActive");
b.Property<decimal?>("limit_frame_295");
b.Property<int?>("main_dept_id");
b.Property<string>("remark")
.HasMaxLength(4000);
b.Property<decimal?>("total_salary");
b.Property<decimal?>("total_salary_limit");
b.Property<decimal?>("total_salary_limit_rounded");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("frame_plan_guid");
b.HasIndex("group_guid");
b.ToTable("eva_limit_frame_group");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b =>
{
b.Property<Guid>("id");
b.Property<DateTime>("created");
b.Property<DateTime?>("executed_date");
b.Property<bool>("isActive");
b.Property<decimal?>("limit_frame_005");
b.Property<decimal?>("limit_frame_005_total");
b.Property<decimal?>("limit_frame_005_total_rounded");
b.Property<Guid?>("plan_guid");
b.Property<DateTime?>("salary_adjustment_date");
b.Property<string>("status_chief")
.HasMaxLength(1);
b.Property<string>("status_self")
.HasMaxLength(1);
b.Property<int?>("supervisor1");
b.Property<DateTime?>("supervisor1_date");
b.Property<string>("supervisor1_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor1_result")
.HasMaxLength(1);
b.Property<decimal?>("total_salary");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("plan_guid");
b.ToTable("eva_limit_frame_plan");
});
modelBuilder.Entity("TodoAPI2.Models.eva_performance_planEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("created");
b.Property<int?>("fiscal_year");
b.Property<bool>("isActive");
b.Property<decimal?>("percent");
b.Property<int?>("theTime");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_performance_plan");
});
modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("created");
b.Property<DateTime?>("end_date");
b.Property<bool>("isActive");
b.Property<int?>("list_no");
b.Property<Guid?>("performance_plan_id");
b.Property<string>("remark")
.HasMaxLength(1000);
b.Property<DateTime?>("start_date");
b.Property<string>("step")
.HasMaxLength(1000);
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("performance_plan_id");
b.ToTable("eva_performance_plan_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b =>
{
b.Property<Guid>("id")
.ValueGeneratedOnAdd();
b.Property<string>("code")
.HasMaxLength(255);
b.Property<DateTime>("created");
b.Property<string>("detail")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<Guid?>("level_score_id");
b.Property<decimal?>("max_score");
b.Property<decimal?>("min_score");
b.Property<decimal?>("promoted_percentage");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("level_score_id");
b.ToTable("eva_promoted_percentage");
});
modelBuilder.Entity("TodoAPI2.Models.eva_salary_cylinderEntity", b =>
{
b.Property<int>("id");
b.Property<decimal?>("cost_living");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<decimal?>("middle");
b.Property<int?>("position_level");
b.Property<int?>("position_type");
b.Property<decimal?>("temporary_min");
b.Property<decimal?>("themax");
b.Property<decimal?>("themin");
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_salary_cylinder");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation")
.WithMany()
.HasForeignKey("create_evaluation_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement")
.WithMany()
.HasForeignKey("adjust_postponement_id");
b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement_quota")
.WithMany()
.HasForeignKey("adjust_postponement_quota_id")
.HasConstraintName("FK_eva_adjust_postponement_detail_eva_adjust_postponement_adj~1");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group")
.WithMany()
.HasForeignKey("evaluation_group_id");
b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan")
.WithMany()
.HasForeignKey("performance_plan_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation_create_evaluation_id")
.WithMany()
.HasForeignKey("create_evaluation_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail")
.WithMany()
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievement_attachEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_evaluation_achievementEntity", "eva_evaluation_achievement_achievement_id")
.WithMany()
.HasForeignKey("achievement_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail")
.WithMany()
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group")
.WithMany()
.HasForeignKey("evaluation_group_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail_create_evaluation_detail_id")
.WithMany()
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_limit_frame_groupEntity", "eva_limit_frame_group_frame_group_guid")
.WithMany()
.HasForeignKey("frame_group_guid");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_limit_frame_planEntity", "eva_limit_frame_plan_frame_plan_guid")
.WithMany()
.HasForeignKey("frame_plan_guid");
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group_group_guid")
.WithMany()
.HasForeignKey("group_guid");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan_plan_guid")
.WithMany()
.HasForeignKey("plan_guid");
});
modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan")
.WithMany()
.HasForeignKey("performance_plan_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_level_scoreEntity", "eva_level_score")
.WithMany()
.HasForeignKey("level_score_id");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,44 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class AddAttach : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "eva_evaluation_achievement_attach",
columns: table => new
{
id = table.Column<int>(nullable: false),
created = table.Column<DateTime>(nullable: false),
updated = table.Column<DateTime>(nullable: false),
isActive = table.Column<bool>(nullable: false),
achievement_id = table.Column<int>(nullable: true),
the_file = table.Column<string>(maxLength: 1000, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_eva_evaluation_achievement_attach", x => x.id);
table.ForeignKey(
name: "FK_eva_evaluation_achievement_attach_eva_evaluation_achievemen~",
column: x => x.achievement_id,
principalTable: "eva_evaluation_achievement",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_eva_evaluation_achievement_attach_achievement_id",
table: "eva_evaluation_achievement_attach",
column: "achievement_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "eva_evaluation_achievement_attach");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,46 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class AddEvaLog : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "eva_create_evaluation_detail_history",
columns: table => new
{
id = table.Column<int>(nullable: false),
created = table.Column<DateTime>(nullable: false),
updated = table.Column<DateTime>(nullable: false),
isActive = table.Column<bool>(nullable: false),
evaluation_detail_id = table.Column<int>(nullable: true),
action_dt = table.Column<DateTime>(nullable: true),
action_detail = table.Column<string>(maxLength: 4000, nullable: true),
action_emp_id = table.Column<int>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_eva_create_evaluation_detail_history", x => x.id);
table.ForeignKey(
name: "FK_eva_create_evaluation_detail_history_eva_create_evaluation_~",
column: x => x.evaluation_detail_id,
principalTable: "eva_create_evaluation_detail",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_eva_create_evaluation_detail_history_evaluation_detail_id",
table: "eva_create_evaluation_detail_history",
column: "evaluation_detail_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "eva_create_evaluation_detail_history");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,41 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace tb320eva.Migrations
{
public partial class AddLog : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "activity_log_eva",
columns: table => new
{
id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
log_name = table.Column<string>(maxLength: 191, nullable: true),
description = table.Column<string>(maxLength: 4000, nullable: true),
subject_id = table.Column<int>(nullable: true),
subject_type = table.Column<string>(maxLength: 191, nullable: true),
causer_id = table.Column<int>(nullable: true),
causer_type = table.Column<string>(maxLength: 191, nullable: true),
properties = table.Column<string>(maxLength: 8000, nullable: true),
ip_address = table.Column<string>(maxLength: 191, nullable: true),
mac_address = table.Column<string>(maxLength: 191, nullable: true),
created_at = table.Column<DateTime>(nullable: true),
updated_at = table.Column<DateTime>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_activity_log_eva", x => x.id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "activity_log_eva");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class Updatesalary_cylinder : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<decimal>(
name: "monthly_compensation",
table: "eva_salary_cylinder",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "position_allowance",
table: "eva_salary_cylinder",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "monthly_compensation",
table: "eva_salary_cylinder");
migrationBuilder.DropColumn(
name: "position_allowance",
table: "eva_salary_cylinder");
}
}
}

View File

@@ -19,6 +19,45 @@ namespace tb320eva.Migrations
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("TodoAPI2.Models.activity_log_evaEntity", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd();
b.Property<int?>("causer_id");
b.Property<string>("causer_type")
.HasMaxLength(191);
b.Property<DateTime?>("created_at");
b.Property<string>("description")
.HasMaxLength(4000);
b.Property<string>("ip_address")
.HasMaxLength(191);
b.Property<string>("log_name")
.HasMaxLength(191);
b.Property<string>("mac_address")
.HasMaxLength(191);
b.Property<string>("properties")
.HasMaxLength(8000);
b.Property<int?>("subject_id");
b.Property<string>("subject_type")
.HasMaxLength(191);
b.Property<DateTime?>("updated_at");
b.HasKey("id");
b.ToTable("activity_log_eva");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b =>
{
b.Property<int>("id");
@@ -85,8 +124,16 @@ namespace tb320eva.Migrations
b.Property<int?>("employee_id");
b.Property<string>("employee_no_at_this_time")
.HasMaxLength(1000);
b.Property<string>("fullname_at_this_time")
.HasMaxLength(1000);
b.Property<bool>("isActive");
b.Property<bool?>("is_for_postponement");
b.Property<string>("level_score_final")
.HasMaxLength(255);
@@ -365,6 +412,32 @@ namespace tb320eva.Migrations
b.ToTable("eva_create_evaluation_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detail_historyEntity", b =>
{
b.Property<int>("id");
b.Property<string>("action_detail")
.HasMaxLength(4000);
b.Property<DateTime?>("action_dt");
b.Property<int?>("action_emp_id");
b.Property<DateTime>("created");
b.Property<int?>("evaluation_detail_id");
b.Property<bool>("isActive");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("evaluation_detail_id");
b.ToTable("eva_create_evaluation_detail_history");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b =>
{
b.Property<int>("id");
@@ -423,6 +496,28 @@ namespace tb320eva.Migrations
b.ToTable("eva_evaluation_achievement");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievement_attachEntity", b =>
{
b.Property<int>("id");
b.Property<int?>("achievement_id");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<string>("the_file")
.HasMaxLength(1000);
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("achievement_id");
b.ToTable("eva_evaluation_achievement_attach");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b =>
{
b.Property<int>("id");
@@ -747,6 +842,8 @@ namespace tb320eva.Migrations
b.Property<bool>("isActive");
b.Property<decimal?>("percent");
b.Property<int?>("theTime");
b.Property<DateTime>("updated");
@@ -832,6 +929,10 @@ namespace tb320eva.Migrations
b.Property<decimal?>("middle");
b.Property<decimal?>("monthly_compensation");
b.Property<decimal?>("position_allowance");
b.Property<int?>("position_level");
b.Property<int?>("position_type");
@@ -886,6 +987,13 @@ namespace tb320eva.Migrations
.HasForeignKey("create_evaluation_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detail_historyEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail_evaluation_detail_id")
.WithMany()
.HasForeignKey("evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail")
@@ -893,6 +1001,13 @@ namespace tb320eva.Migrations
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievement_attachEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_evaluation_achievementEntity", "eva_evaluation_achievement_achievement_id")
.WithMany()
.HasForeignKey("achievement_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail")

View File

@@ -0,0 +1,49 @@
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;
using System.IO;
namespace TodoAPI2.Models
{
public class activity_log_evaEntity
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int id { get; set; }
[MaxLength(191)]
public string log_name { get; set; }
[MaxLength(4000)]
public string description { get; set; }
public int? subject_id { get; set; }
[MaxLength(191)]
public string subject_type { get; set; }
public int? causer_id { get; set; }
[MaxLength(191)]
public string causer_type { get; set; }
[MaxLength(8000)]
public string properties { get; set; }
[MaxLength(191)]
public string ip_address { get; set; }
[MaxLength(191)]
public string mac_address { get; set; }
public DateTime? created_at { get; set; }
public DateTime? updated_at { get; set; }
}
}

View File

@@ -74,6 +74,13 @@ namespace TodoAPI2.Models
[MaxLength(255)]
public string level_score_final { get; set; }
[MaxLength(1000)]
public string fullname_at_this_time { get; set; }
[MaxLength(1000)]
public string employee_no_at_this_time { get; set; }
public bool? is_for_postponement { get; set; }
}
}

View File

@@ -58,8 +58,13 @@ namespace TodoAPI2.Models
public int? order_at_this_time { get; set; }
public string active_mode { get; set; }
public string fullname_at_this_time { get; set; }
public string employee_no_at_this_time { get; set; }
public bool? is_for_postponement { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -158,6 +158,12 @@ namespace TodoAPI2.Models
adjust_postponement_quota_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult2.fiscal_year,
employee_id_external_linkage_external_name = fk_external_linkageResult3.fullname,
fullname_at_this_time = m_eva_adjust_postponement_detail_migration.fullname_at_this_time,
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
@@ -204,8 +210,8 @@ namespace TodoAPI2.Models
var existingEntity = _repository.Get(id);
if (existingEntity != null)
{
existingEntity.adjust_postponement_id = model.adjust_postponement_id;
existingEntity.adjust_postponement_quota_id = model.adjust_postponement_quota_id;
//existingEntity.adjust_postponement_id = model.adjust_postponement_id;
//existingEntity.adjust_postponement_quota_id = model.adjust_postponement_quota_id;
existingEntity.employee_id = model.employee_id;
existingEntity.sarary = model.sarary;
existingEntity.cost_living = model.cost_living;
@@ -227,6 +233,10 @@ namespace TodoAPI2.Models
existingEntity.org_at_this_time = model.org_at_this_time;
existingEntity.order_at_this_time = model.order_at_this_time;
existingEntity.fullname_at_this_time = model.fullname_at_this_time;
existingEntity.employee_no_at_this_time = model.employee_no_at_this_time;
existingEntity.is_for_postponement = model.is_for_postponement;
var updated = _repository.Update(id, existingEntity);
return Get(updated.id);
}
@@ -243,8 +253,8 @@ namespace TodoAPI2.Models
var existingEntity = _repository.Get(i.id.Value);
if (existingEntity != null)
{
existingEntity.adjust_postponement_id = i.adjust_postponement_id;
existingEntity.adjust_postponement_quota_id = i.adjust_postponement_quota_id;
//existingEntity.adjust_postponement_id = i.adjust_postponement_id;
//existingEntity.adjust_postponement_quota_id = i.adjust_postponement_quota_id;
existingEntity.employee_id = i.employee_id;
existingEntity.sarary = i.sarary;
existingEntity.cost_living = i.cost_living;
@@ -266,6 +276,10 @@ namespace TodoAPI2.Models
existingEntity.org_at_this_time = i.org_at_this_time;
existingEntity.order_at_this_time = i.order_at_this_time;
existingEntity.fullname_at_this_time = i.fullname_at_this_time;
existingEntity.employee_no_at_this_time = i.employee_no_at_this_time;
existingEntity.is_for_postponement = i.is_for_postponement;
//existingEntity.SetAutoField(_repository.Context);
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}
@@ -325,7 +339,6 @@ namespace TodoAPI2.Models
{
var i = new Dictionary<string, string>();
i.Add("adjust_postponement_id", "รหัสอ้างอิงตาราง eva_adjust_postponement");
i.Add("adjust_postponement_id_eva_adjust_postponement_fiscal_year", "รหัสอ้างอิงตาราง eva_adjust_postponement");
i.Add("adjust_postponement_quota_id", "รหัสอ้างอิงตาราง eva_adjust_postponement");
@@ -344,6 +357,9 @@ namespace TodoAPI2.Models
i.Add("new_sarary_with_quota", "เงินเดือนใหม่ (รวมโควต้า)");
i.Add("position_this_time", "ตำแหน่ง (ณ วันปรับเลื่อน)");
i.Add("level_this_time", "ระดับ (ณ วันปรับเลื่อน)");
i.Add("fullname_at_this_time", "ชื่อ-ชื่อสกุล (ณ วันปรับเลื่อน)");
i.Add("employee_no_at_this_time", "เลขที่พนักงาน (ณ วันปรับเลื่อน)");
i.Add("is_for_postponement", "ใช้สำหรับ ปรับเลื่อนเงินเดือน/โควตา");
return i;
}

View File

@@ -51,13 +51,25 @@ namespace TodoAPI2.Models
public decimal? migration_total_score { get; set; }
public string migration_eva_result { get; set; }
public int? org_at_this_time { get; set; }
public int? order_at_this_time { get; set; }
public string fullname_at_this_time { get; set; }
public string employee_no_at_this_time { get; set; }
public bool? is_for_postponement { get; set; }
public int? adjust_postponement_id_eva_adjust_postponement_fiscal_year { get; set; }
public int? adjust_postponement_quota_id_eva_adjust_postponement_fiscal_year { get; set; }
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

@@ -9,5 +9,6 @@ namespace TodoAPI2.Models
{
public List<external_employeeViewModel> item_employee_id { get; set; }
public List<external_linkageViewModel> item_org_at_this_time { get; set; }
}
}

View File

@@ -322,6 +322,9 @@ namespace TodoAPI2.Models
n.level_score_final = qq;
}
//n.migration_total_score = n.score_final;
//n.migration_eva_result = n.level_score_final;
_repository.Context.eva_adjust_postponement_detail.Add(n);
}
@@ -366,15 +369,10 @@ namespace TodoAPI2.Models
if (theemp == null) continue;
if (theemp.fullname.Contains("อุบลวรรณ"))
{
string zz = "1";
}
var n = (from t in _repository.Context.eva_adjust_postponement_detail
where t.adjust_postponement_id == entity.id
&& t.employee_id == m.employee_id
select t).FirstOrDefault();
select t).FirstOrDefault();
n.updated = DateTime.Now;
n.isActive = true;
@@ -399,7 +397,8 @@ namespace TodoAPI2.Models
select s.detail).FirstOrDefault();
n.level_score_final = qq;
}
//n.migration_total_score = n.score_final;
//n.migration_eva_result = n.level_score_final;
}
entity.limit = sum_salary;

View File

@@ -108,10 +108,10 @@ namespace TodoAPI2.Models
into eva_adjust_postponementResult1
from fk_eva_adjust_postponementResult1 in eva_adjust_postponementResult1.DefaultIfEmpty()
join create_detail in _repository.Context.eva_create_evaluation_detail
on fk_eva_adjust_postponementResult1.create_evaluation_id equals create_detail.create_evaluation_id
into create_detailResult
from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
// on fk_eva_adjust_postponementResult1.create_evaluation_id equals create_detail.create_evaluation_id
// into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
join create_data in _repository.Context.eva_create_evaluation
on fk_eva_adjust_postponementResult1.create_evaluation_id equals create_data.id
@@ -136,10 +136,14 @@ namespace TodoAPI2.Models
into external_linkageResult2
from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty()
join sort_dep in ext.GetSortingDep() on fk_external_linkageResult2.department_id equals sort_dep.id
join sort_dep in ext.GetSortingDep() on m_eva_adjust_postponement_detail_normal_02.org_at_this_time.HasValue ? m_eva_adjust_postponement_detail_normal_02.org_at_this_time : fk_external_linkageResult2.department_id equals sort_dep.id
into sort_depResult2
from fk_sort_depResult2 in sort_depResult2.DefaultIfEmpty()
join sort_dep2 in ext.GetSortingDep() on m_eva_adjust_postponement_detail_normal_02.org_at_this_time equals sort_dep2.id
into external_linkageResult11
from fk_external_linkageResult11 in sort_depResult2.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
//on fk_eva_adjust_postponementResult1.create_evaluation_id equals create_detail.create_evaluation_id
//into create_detailResult
@@ -149,9 +153,14 @@ namespace TodoAPI2.Models
//&& (m_eva_adjust_postponement_detail_normal_02.id == model.id || !model.id.HasValue)
&& (m_eva_adjust_postponement_detail_normal_02.adjust_postponement_id == model.adjust_postponement_id || !model.adjust_postponement_id.HasValue)
//&& fk_create_detailResult.employee_id == m_eva_adjust_postponement_detail_normal_02.employee_id
//&& (m_eva_adjust_postponement_detail_normal_02.is_for_postponement == null?true: m_eva_adjust_postponement_detail_normal_02.is_for_postponement.Value)
&& fk_external_linkageResult2.workingstatus == "สถานะปฏิบัติงาน"
orderby
fk_sort_depResult2.external_code,
m_eva_adjust_postponement_detail_normal_02.org_at_this_time.HasValue ? 1 : 0,
//fk_external_linkageResult2.department_degree_id,
//fk_external_linkageResult2.department_code,
fk_external_linkageResult2.hpt_position_type_id,
@@ -178,10 +187,11 @@ namespace TodoAPI2.Models
achievement = m_eva_adjust_postponement_detail_normal_02.achievement_final,
competency = m_eva_adjust_postponement_detail_normal_02.competency_final,
total_score = m_eva_adjust_postponement_detail_normal_02.score_final,
eva_result = m_eva_adjust_postponement_detail_normal_02.level_score_final,
emp_department_name = fk_external_linkageResult2.department_name,
total_score = m_eva_adjust_postponement_detail_normal_02.migration_total_score.HasValue ? m_eva_adjust_postponement_detail_normal_02.migration_total_score : m_eva_adjust_postponement_detail_normal_02.score_final,
eva_result = !string.IsNullOrEmpty(m_eva_adjust_postponement_detail_normal_02.migration_eva_result) ? m_eva_adjust_postponement_detail_normal_02.migration_eva_result : m_eva_adjust_postponement_detail_normal_02.level_score_final,
emp_department_name = !string.IsNullOrEmpty(fk_external_linkageResult11.external_name) ? fk_external_linkageResult11.external_name : fk_sort_depResult2.external_name,
adjust_postponement_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult1.fiscal_year,
position_allowance = fk_external_linkageResult2.position_allowance,

View File

@@ -112,10 +112,10 @@ namespace TodoAPI2.Models
into eva_adjust_postponementResult1A
from fk_eva_adjust_postponementResult1A in eva_adjust_postponementResult1A.DefaultIfEmpty()
join create_detail in _repository.Context.eva_create_evaluation_detail
on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
into create_detailResult
from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
// on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
// into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
join create_data in _repository.Context.eva_create_evaluation
on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_data.id
@@ -142,29 +142,39 @@ namespace TodoAPI2.Models
join fk_external_linkage2 in all_emp on m_eva_adjust_postponement_detail_quota_02.employee_id equals fk_external_linkage2.id
into external_linkageResult2
from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty()
from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty()
join sort_dep in ext.GetSortingDep() on fk_external_linkageResult2.department_id equals sort_dep.id
//join create_detail in _repository.Context.eva_create_evaluation_detail
//on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
//into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
join sort_dep in ext.GetSortingDep() on m_eva_adjust_postponement_detail_quota_02.org_at_this_time.HasValue ? m_eva_adjust_postponement_detail_quota_02.org_at_this_time : fk_external_linkageResult2.department_id equals sort_dep.id
into sort_depResult2
from fk_sort_depResult2 in sort_depResult2.DefaultIfEmpty()
join create_detail in _repository.Context.eva_create_evaluation_detail
on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
into create_detailResult
from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
join create_data in _repository.Context.eva_create_evaluation
on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_data.id
into create_dataResult
from fk_create_dataResult in create_dataResult.DefaultIfEmpty()
join sort_dep2 in ext.GetSortingDep() on m_eva_adjust_postponement_detail_quota_02.org_at_this_time equals sort_dep2.id
into external_linkageResult11
from fk_external_linkageResult11 in sort_depResult2.DefaultIfEmpty()
where 1==1
//&& (m_eva_adjust_postponement_detail_quota_02.id == model.id || !model.id.HasValue)
&& (m_eva_adjust_postponement_detail_quota_02.adjust_postponement_quota_id == model.adjust_postponement_quota_id || !model.adjust_postponement_quota_id.HasValue)
&& (fk_create_detailResult.employee_id == m_eva_adjust_postponement_detail_quota_02.employee_id || fk_create_detailResult == null)
//&& (fk_create_detailResult.employee_id == m_eva_adjust_postponement_detail_quota_02.employee_id || fk_create_detailResult == null)
//&& (m_eva_adjust_postponement_detail_quota_02.is_for_postponement == null ? true : m_eva_adjust_postponement_detail_quota_02.is_for_postponement.Value)
&& fk_external_linkageResult2.workingstatus == "สถานะปฏิบัติงาน"
orderby
fk_sort_depResult2.external_code,
m_eva_adjust_postponement_detail_quota_02.org_at_this_time.HasValue ? 1 : 0,
//fk_external_linkageResult2.department_degree_id,
//fk_external_linkageResult2.department_code,
fk_external_linkageResult2.hpt_position_type_id,
@@ -190,9 +200,11 @@ namespace TodoAPI2.Models
emp_fullname = fk_external_linkageResult2.fullname,
emp_position = fk_external_linkageResult2.position_name,
emp_level = fk_external_linkageResult2.position_level_text,
emp_department_name = fk_sort_depResult2.external_name,
total_score = fk_create_detailResult.score_supervisor,
eva_result = fk_create_detailResult.level_score_supervisor,
emp_department_name = !string.IsNullOrEmpty(fk_external_linkageResult11.external_name) ? fk_external_linkageResult11.external_name : fk_sort_depResult2.external_name,
total_score = m_eva_adjust_postponement_detail_quota_02.migration_total_score.HasValue? m_eva_adjust_postponement_detail_quota_02.migration_total_score : m_eva_adjust_postponement_detail_quota_02.score_final,
eva_result = !string.IsNullOrEmpty(m_eva_adjust_postponement_detail_quota_02.migration_eva_result) ? m_eva_adjust_postponement_detail_quota_02.migration_eva_result : m_eva_adjust_postponement_detail_quota_02.level_score_final,
adjust_postponement_quota_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult1.fiscal_year,
position_allowance = fk_external_linkageResult2.position_allowance,

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

@@ -87,6 +87,26 @@ namespace TodoAPI2.Models
i.item_managed_by = all_emp.ToList();
i.item_org_id = (from x in ext.GetDepartmentData() select x).ToList();
var data_fiscal_year = (from f_y in _repository.Context.eva_adjust_postponement
group f_y by f_y.fiscal_year into new_group
orderby new_group.Key descending
select new
{
fiscal_year = new_group.Key
}
).ToList();
var result = new List<external_linkageViewModel>();
foreach (var x in data_fiscal_year)
{
result.Add(new external_linkageViewModel
{
external_id = x.fiscal_year,
external_code = x.fiscal_year.ToString(),
external_name = x.fiscal_year.ToString()
});
}
i.item_fiscal_year = result;
return i;
}
@@ -96,6 +116,24 @@ namespace TodoAPI2.Models
where j.employee_id == emp_id
select j.id).ToList();
var data_fiscal_year = (from f_y in _repository.Context.eva_adjust_postponement
group f_y by f_y.fiscal_year into new_group
orderby new_group.Key descending
select new
{
fiscal_year = new_group.Key
}
).ToList();
var result = new List<external_linkageViewModel>();
foreach(var x in data_fiscal_year)
{
result.Add(new external_linkageViewModel {
external_id = x.fiscal_year,
external_code = x.fiscal_year.ToString(),
external_name = x.fiscal_year.ToString()
});
}
var i = new eva_adjust_postponement_normalWithSelectionViewModel();
var temp = create.GetListBySearch(new eva_create_evaluationSearchModel());
i.item_create_evaluation_id = (from x in temp where avaliable_eva.Contains(x.id) select x).ToList();
@@ -103,6 +141,7 @@ namespace TodoAPI2.Models
i.item_managed_by = all_emp.ToList();
i.item_org_id = (from x in ext.GetDepartmentData() select x).ToList();
i.item_fiscal_year = result;
return i;
}
@@ -301,7 +340,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);

View File

@@ -7,6 +7,7 @@ namespace TodoAPI2.Models
{
public class eva_adjust_postponement_normalWithSelectionViewModel: eva_adjust_postponement_normalViewModel
{
public List<external_linkageViewModel> item_fiscal_year { get; set; }
public List<eva_create_evaluationViewModel> item_create_evaluation_id { get; set; }
public List<external_employeeViewModel> item_managed_by { get; set; }
public List<external_linkageViewModel> item_org_id { get; set; }

View File

@@ -20,18 +20,18 @@ namespace TodoAPI2.Models
public class eva_adjust_postponement_quotaService : Ieva_adjust_postponement_quotaService
{
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_quota_02Service quota02;
public eva_adjust_postponement_quotaService(IBaseRepository2<eva_adjust_postponementEntity, int> repository, IMyDatabase mydb,
public eva_adjust_postponement_quotaService(IBaseRepository2<eva_adjust_postponementEntity, int> repository, IMyDatabase mydb,
Iexternal_linkageService inext, Iexternal_employeeService inemp,
Ieva_adjust_postponement_detail_quota_02Service inquota02)
{
_repository = repository;
db = mydb;
ext = inext;
db = mydb;
ext = inext;
emp = inemp;
quota02 = inquota02;
}
@@ -53,7 +53,7 @@ namespace TodoAPI2.Models
{
return Mapper.Map<List<eva_adjust_postponement_quotaViewModel>>(entities);
}
#endregion
#region Public Functions
@@ -85,12 +85,12 @@ namespace TodoAPI2.Models
public List<eva_adjust_postponement_quotaViewModel> GetListByfiscal_year(int? fiscal_year)
{
var model = new eva_adjust_postponement_quotaSearchModel();
var model = new eva_adjust_postponement_quotaSearchModel();
model.fiscal_year = fiscal_year;
return GetListBySearch(model);
}
public List<eva_adjust_postponement_quotaViewModel> GetListBySearch(eva_adjust_postponement_quotaSearchModel model)
public List<eva_adjust_postponement_quotaViewModel> GetListBySearch(eva_adjust_postponement_quotaSearchModel model)
{
var all_emp = emp.GetListByemployee_type(null, null);
@@ -100,8 +100,8 @@ namespace TodoAPI2.Models
join fk_external_linkage7 in all_emp on m_eva_adjust_postponement_quota.managed_by equals fk_external_linkage7.id
into external_linkageResult7
from fk_external_linkageResult7 in external_linkageResult7.DefaultIfEmpty()
where 1==1
where 1 == 1
//&& (m_eva_adjust_postponement_quota.id == model.id || !model.id.HasValue)
&& (m_eva_adjust_postponement_quota.fiscal_year == model.fiscal_year || !model.fiscal_year.HasValue)
&& (m_eva_adjust_postponement_quota.theRound == model.theRound || !model.theRound.HasValue)
@@ -140,10 +140,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;
}
@@ -179,7 +179,7 @@ namespace TodoAPI2.Models
entity.limit = AddMultipleDetail(entity.id, all_emp_id_list, entity.fiscal_year, entity.theRound, all_emp);
var inserted = _repository.Insert(entity);
return Get(inserted.id);
}
@@ -203,7 +203,7 @@ namespace TodoAPI2.Models
where x.adjust_postponement_quota_id == adjust_postponement_quota_id
select x.employee_id).ToList();
foreach (var i in model)
{
@@ -215,7 +215,7 @@ namespace TodoAPI2.Models
if (theemp.salary.HasValue)
{
sum_salary += theemp.salary.Value;
}
}
var q = (from p in _repository.Context.eva_adjust_postponement_detail
where p.employee_id == i
@@ -326,31 +326,129 @@ namespace TodoAPI2.Models
existingEntity.managed_by = model.managed_by;
// limit
UpdatePostponementDetailQuota(existingEntity);
quota02.UpdateMultiple(model.adjust_postponement_detail_quota_02_model);
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_adjust_postponement_quotaInputModel> model)
public string UpdatePostponementDetailQuota(eva_adjust_postponementEntity entity)
{
foreach(var i in model)
int? adjust_postponement_id = entity.id;
var cylinder = (from z in _repository.Context.eva_salary_cylinder
select z).ToList();
var all_emp = emp.GetListByemployee_type(null, null);
var adjust_postponement = entity;
var evaluation_group_id = (from m in _repository.Context.eva_create_evaluation
where m.id == adjust_postponement.create_evaluation_id
select m.evaluation_group_id).FirstOrDefault();
var current_eva_evaluation_group_detail = from k in _repository.Context.eva_evaluation_group_detail
where k.evaluation_group_id == evaluation_group_id
select k;
var current_eva_create_evaluation_detail = from k in _repository.Context.eva_create_evaluation_detail
where k.create_evaluation_id == adjust_postponement.create_evaluation_id
select k;
var current_level_score = (from e in _repository.Context.eva_level_score
select e).ToList();
decimal sum_salary = 0;
foreach (var m in current_eva_evaluation_group_detail)
{
var theemp = (from i in all_emp where i.id == m.employee_id select i).FirstOrDefault();
if (theemp == null) continue;
var n = (from t in _repository.Context.eva_adjust_postponement_detail
where t.adjust_postponement_quota_id == entity.id
&& t.employee_id == m.employee_id
select t).FirstOrDefault();
n.updated = DateTime.Now;
n.isActive = true;
var temp = (from z in current_eva_create_evaluation_detail
where z.employee_id == n.employee_id
select new
{
achievement_final = getData(z).Item1.HasValue ? getData(z).Item1 : 0,
competency_final = getData(z).Item2.HasValue ? getData(z).Item2 : 0,
score_final = getData(z).Item3.HasValue ? getData(z).Item3 : 0,
work_period = getData(z).Item4.HasValue ? getData(z).Item4 : 6,
});
n.achievement_final = temp.Sum(w => w.achievement_final * w.work_period / 6);
n.competency_final = temp.Sum(w => w.competency_final * w.work_period / 6);
n.score_final = temp.Sum(w => w.score_final * w.work_period / 6);
if (n.score_final.HasValue)
{
var qq = (from s in current_level_score
where s.min_score <= n.score_final && s.max_score >= n.score_final
select s.detail).FirstOrDefault();
n.level_score_final = qq;
}
//n.migration_total_score = n.score_final;
//n.migration_eva_result = n.level_score_final;
}
entity.limit = sum_salary;
//_repository.Context.SaveChanges();
return current_eva_evaluation_group_detail.Count().ToString();
}
private (decimal?, decimal?, decimal?, decimal?) getData(eva_create_evaluation_detailEntity detail)
{
if (detail.status_supervisor2A == "Y")
{
return (detail.achievement_supervisor2A, detail.competency_supervisor2A, detail.score_supervisor2A, detail.work_period);
}
else if (detail.status_supervisor1A == "Y")
{
return (detail.achievement_supervisor1A, detail.competency_supervisor1A, detail.score_supervisor1A, detail.work_period);
}
else if (detail.status_supervisor == "Y")
{
return (detail.achievement_supervisor, detail.competency_supervisor, detail.score_supervisor, detail.work_period);
}
else if (detail.status_chief == "Y")
{
return (detail.achievement_chief, detail.competency_chief, detail.score_chief, detail.work_period);
}
else
{
return (0, 0, 0, detail.work_period);
}
}
public string UpdateMultiple(List<eva_adjust_postponement_quotaInputModel> 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.limit_quota = i.limit_quota;
existingEntity.limit_frame_quota = i.limit_frame_quota;
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.limit_quota = i.limit_quota;
existingEntity.limit_frame_quota = i.limit_frame_quota;
existingEntity.command_no = i.command_no;
existingEntity.managed_by = i.managed_by;
// limit
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
@@ -363,15 +461,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();
}
@@ -396,10 +494,10 @@ namespace TodoAPI2.Models
_repository.Context.RemoveRange(data);
var data2 = from i in _repository.Context.eva_adjust_postponement_detail
where i.adjust_postponement_quota_id == id && i.adjust_postponement_id != null
select i;
where i.adjust_postponement_quota_id == id && i.adjust_postponement_id != null
select i;
foreach(var i in data2)
foreach (var i in data2)
{
i.adjust_postponement_quota_id = null;
}

View File

@@ -130,7 +130,8 @@ namespace TodoAPI2.Models
into external_linkageResult25
from fk_external_linkageResult25 in external_linkageResult25.DefaultIfEmpty()
join sort_dep in ext.GetSortingDep() on fk_external_linkageResult2.department_id equals sort_dep.id
join sort_dep in ext.GetSortingDep() on
(m_eva_create_evaluation_detail.help_org_id.HasValue ? m_eva_create_evaluation_detail.help_org_id : fk_external_linkageResult2.department_id) equals sort_dep.id
into sort_depResult2
from fk_sort_depResult2 in sort_depResult2.DefaultIfEmpty()
@@ -138,11 +139,16 @@ namespace TodoAPI2.Models
into external_linkageResult46
from fk_external_linkageResult46 in external_linkageResult46.DefaultIfEmpty()
join fk_external_linkage99 in ext.GetDepartmentData() on (m_eva_create_evaluation_detail.help_org_id.HasValue ? m_eva_create_evaluation_detail.help_org_id : fk_external_linkageResult2.department_id) equals fk_external_linkage99.id
into external_linkageResult99
from fk_external_linkageResult99 in external_linkageResult99.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,
(m_eva_create_evaluation_detail.help_org_id.HasValue ? 1 : 0),
//fk_external_linkageResult2.department_degree_id,
//fk_external_linkageResult2.department_code,
fk_external_linkageResult2.hpt_position_type_id,
@@ -211,7 +217,7 @@ namespace TodoAPI2.Models
status_supervisor1A_click_date = m_eva_create_evaluation_detail.status_supervisor1A_click_date,
status_supervisor2A_click_date = m_eva_create_evaluation_detail.status_supervisor2A_click_date,
department_name = fk_external_linkageResult2.department_name,
department_name = fk_external_linkageResult99.external_name,
help_org_id_external_linkage_external_name = fk_external_linkageResult46.external_name,
isActive = m_eva_create_evaluation_detail.isActive,

View File

@@ -60,9 +60,9 @@ namespace TodoAPI2.Models
public decimal? score2 { 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_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_click_date) + getHistoryLink(status_self); } }
public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_click_date) + getHistoryLink(status_chief); } }
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor_click_date) + getHistoryLink(status_supervisor); } }
private string getStatusText(string s)
{
@@ -80,5 +80,15 @@ namespace TodoAPI2.Models
return " ";
}
private string getHistoryLink(string s)
{
if (!string.IsNullOrEmpty(s))
{
return ("<br/><a href='javascript:window_open({0}../eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history?id=" + id.ToString() + "{0});'>ดูประวัติ</a>").Replace("{0}", '"'.ToString());
}
return "";
}
}
}
}

View File

@@ -143,9 +143,9 @@ namespace TodoAPI2.Models
role_code = getRoleCode(emp_id,
m_eva_create_evaluation_detail_agreement.chief,
m_eva_create_evaluation_detail_agreement.chief,
fk_eva_create_evaluationResult10.employee_id,
fk_eva_create_evaluationResult10.supervisor1_id,
fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_agreement.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_agreement.eva_employee_id : fk_eva_create_evaluationResult10.employee_id,
m_eva_create_evaluation_detail_agreement.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_agreement.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
m_eva_create_evaluation_detail_agreement.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_agreement.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_agreement.employee_id,
m_eva_create_evaluation_detail_agreement.status_self_a,
m_eva_create_evaluation_detail_agreement.status_chief_a
@@ -254,6 +254,10 @@ namespace TodoAPI2.Models
into external_employeeResult
from fk_external_employee in external_employeeResult.DefaultIfEmpty()
join sort_dep in ext.GetSortingDep() on m_eva_create_evaluation_detail_agreement.help_org_id.HasValue? m_eva_create_evaluation_detail_agreement.help_org_id : fk_external_employee.department_id equals sort_dep.id
into sort_depResult2
from fk_sort_depResult2 in sort_depResult2.DefaultIfEmpty()
join fk_external_chief in allemp on m_eva_create_evaluation_detail_agreement.chief equals fk_external_chief.id
into external_chiefResult
from fk_external_chief in external_chiefResult.DefaultIfEmpty()
@@ -266,6 +270,10 @@ namespace TodoAPI2.Models
into planResult
from fk_planResult in planResult.DefaultIfEmpty()
join fk_external_linkage11 in ext.GetDepartmentData() on m_eva_create_evaluation_detail_agreement.help_org_id equals fk_external_linkage11.id
into external_linkageResult11
from fk_external_linkageResult11 in external_linkageResult11.DefaultIfEmpty()
where 1 == 1
&& (m_eva_create_evaluation_detail_agreement.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue)
&& (fk_external_employee.department_id == model.org_id || !model.org_id.HasValue)
@@ -273,7 +281,16 @@ namespace TodoAPI2.Models
&& (fk_external_employee.fullname.Contains(model.search_employee_fullname) || string.IsNullOrEmpty(model.search_employee_fullname))
&& (m_eva_create_evaluation_detail_agreement.employee_id == emp_id || m_eva_create_evaluation_detail_agreement.chief == emp_id)
orderby m_eva_create_evaluation_detail_agreement.created descending
orderby
fk_sort_depResult2.external_code,
//fk_external_employee.department_degree_id,
//fk_external_employee.department_code,
(!string.IsNullOrEmpty(fk_external_linkageResult11.external_name) ? 1 : 0),
fk_external_employee.hpt_position_type_id,
fk_external_employee.hpl_position_level_id,
fk_external_employee.employee_no
select new eva_create_evaluation_detail_firstdocViewModel()
{
id = m_eva_create_evaluation_detail_agreement.id,
@@ -296,7 +313,7 @@ namespace TodoAPI2.Models
status_chief_a = m_eva_create_evaluation_detail_agreement.status_chief_a,
status_supervisor = m_eva_create_evaluation_detail_agreement.status_supervisor,
org_id_external_linkage_external_name = fk_external_employee.department_name,
org_id_external_linkage_external_name = !string.IsNullOrEmpty(fk_external_linkageResult11.external_name) ? fk_external_linkageResult11.external_name : fk_external_employee.department_name,
status_self_click_date = m_eva_create_evaluation_detail_agreement.status_self_click_date,
status_chief_click_date = m_eva_create_evaluation_detail_agreement.status_chief_click_date,
@@ -309,9 +326,9 @@ namespace TodoAPI2.Models
role_code = getRoleCode(emp_id,
m_eva_create_evaluation_detail_agreement.chief,
m_eva_create_evaluation_detail_agreement.chief,
fk_eva_create_evaluationResult10.employee_id,
fk_eva_create_evaluationResult10.supervisor1_id,
fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_agreement.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_agreement.eva_employee_id : fk_eva_create_evaluationResult10.employee_id,
m_eva_create_evaluation_detail_agreement.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_agreement.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
m_eva_create_evaluation_detail_agreement.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_agreement.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_agreement.employee_id,
m_eva_create_evaluation_detail_agreement.status_self_a,
m_eva_create_evaluation_detail_agreement.status_chief_a),
@@ -319,9 +336,9 @@ namespace TodoAPI2.Models
role_desc = getRoleName(emp_id,
m_eva_create_evaluation_detail_agreement.chief,
m_eva_create_evaluation_detail_agreement.chief,
fk_eva_create_evaluationResult10.employee_id,
fk_eva_create_evaluationResult10.supervisor1_id,
fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_agreement.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_agreement.eva_employee_id : fk_eva_create_evaluationResult10.employee_id,
m_eva_create_evaluation_detail_agreement.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_agreement.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
m_eva_create_evaluation_detail_agreement.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_agreement.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_agreement.employee_id,
m_eva_create_evaluation_detail_agreement.status_self_a,
m_eva_create_evaluation_detail_agreement.status_chief_a),

View File

@@ -68,19 +68,28 @@ namespace TodoAPI2.Models
public decimal? score2 { get; set; }
public string txt_status_self_a { get { return getStatusText2(status_self_a) + MyHelper.GetDateStringForReport(status_self_a_click_date); } }
public string txt_status_self_a { get { return getStatusText2(status_self_a) + MyHelper.GetDateStringForReport(status_self_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_a_click_date) + getHistoryLink(status_self_a); } }
public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date); } }
public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_click_date) + getHistoryLink(status_self); } }
public string txt_status_chief_a { get { return getStatusText2(status_chief_a) + MyHelper.GetDateStringForReport(status_chief_a_click_date); } }
public string txt_status_chief_a { get { return getStatusText2(status_chief_a) + MyHelper.GetDateStringForReport(status_chief_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_a_click_date) + getHistoryLink(status_chief_a); } }
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_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_click_date) + getHistoryLink(status_chief); } }
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor_click_date) + getHistoryLink(status_supervisor); } }
public string role_desc { get; set; }
public string role_code { get; set; }
private string getHistoryLink(string s)
{
if (!string.IsNullOrEmpty(s))
{
return ("<br/><a href='javascript:window_open({0}../eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history?id=" + id.ToString() + "{0});'>ดูประวัติ</a>").Replace("{0}", '"'.ToString());
}
return "";
}
private string getStatusText(string s)
{
if (!string.IsNullOrEmpty(s))

View File

@@ -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_historyService : IBaseService2<int, eva_create_evaluation_detail_historyInputModel, eva_create_evaluation_detail_historyViewModel>
{
new eva_create_evaluation_detail_historyViewModel Insert(eva_create_evaluation_detail_historyInputModel model, bool is_force_save);
new eva_create_evaluation_detail_historyViewModel Update(int id, eva_create_evaluation_detail_historyInputModel model, bool is_force_save);
List<eva_create_evaluation_detail_historyViewModel> GetListByevaluation_detail_id(int? evaluation_detail_id);
List<eva_create_evaluation_detail_historyViewModel> GetListBySearch(eva_create_evaluation_detail_historySearchModel model);
string UpdateMultiple(List<eva_create_evaluation_detail_historyInputModel> model, bool is_force_save);
eva_create_evaluation_detail_historyWithSelectionViewModel GetWithSelection(int id);
eva_create_evaluation_detail_historyWithSelectionViewModel GetBlankItem();
void RefreshAutoFieldOfAllData();
eva_create_evaluation_detail_historyEntity GetEntity(int id);
DataContext GetContext();
}
}

View File

@@ -0,0 +1,42 @@
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;
using System.IO;
namespace TodoAPI2.Models
{
public class eva_create_evaluation_detail_historyEntity : BaseEntity2<int>
{
[ForeignKey("evaluation_detail_id")]
public eva_create_evaluation_detailEntity eva_create_evaluation_detail_evaluation_detail_id { get; set; }
public int? evaluation_detail_id { get; set; }
public DateTime? action_dt { get; set; }
[MaxLength(4000)]
public string action_detail { get; set; }
public int? action_emp_id { get; set; }
public void SetAutoField(DataContext context)
{
}
public void DoAfterInsertUpdate(DataContext context)
{
}
}
}

View File

@@ -0,0 +1,30 @@
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_historyInputModel
{
public int? id { get; set; }
public int? evaluation_detail_id { get; set; }
public DateTime? action_dt { get; set; }
public string action_detail { get; set; }
public int? action_emp_id { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -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_historyReportRequestModel : eva_create_evaluation_detail_historySearchModel
{
public string filetype { get; set; }
public string contentType { get { return MyHelper.GetContentType(filetype); } }
}
}

View File

@@ -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_historySearchModel
{
public int id { get; set; }
public int? evaluation_detail_id { get; set; }
}
}

View File

@@ -0,0 +1,310 @@
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_historyService : Ieva_create_evaluation_detail_historyService
{
private IBaseRepository2<eva_create_evaluation_detail_historyEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private Iexternal_employeeService emp;
public eva_create_evaluation_detail_historyService(IBaseRepository2<eva_create_evaluation_detail_historyEntity, int> repository, IMyDatabase mydb,
Iexternal_linkageService inext, Iexternal_employeeService inemp)
{
_repository = repository;
db = mydb;
ext = inext;
emp = inemp;
}
#region Private Functions
private eva_create_evaluation_detail_historyEntity GetEntity(eva_create_evaluation_detail_historyInputModel model)
{
return Mapper.Map<eva_create_evaluation_detail_historyEntity>(model);
}
private List<eva_create_evaluation_detail_historyEntity> GetEntityList(List<eva_create_evaluation_detail_historyInputModel> models)
{
return Mapper.Map<List<eva_create_evaluation_detail_historyEntity>>(models);
}
private eva_create_evaluation_detail_historyViewModel GetDto(eva_create_evaluation_detail_historyEntity entity)
{
return Mapper.Map<eva_create_evaluation_detail_historyViewModel>(entity);
}
private List<eva_create_evaluation_detail_historyViewModel> GetDtoList(List<eva_create_evaluation_detail_historyEntity> entities)
{
return Mapper.Map<List<eva_create_evaluation_detail_historyViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public eva_create_evaluation_detail_historyViewModel Get(int id)
{
var entity = _repository.Get(id);
return GetDto(entity);
}
public eva_create_evaluation_detail_historyEntity GetEntity(int id)
{
var entity = _repository.Get(id);
return entity;
}
public DataContext GetContext()
{
return _repository.Context;
}
public eva_create_evaluation_detail_historyWithSelectionViewModel GetWithSelection(int id)
{
var entity = _repository.Get(id);
var i = Mapper.Map<eva_create_evaluation_detail_historyWithSelectionViewModel>(entity);
i.item_action_emp_id = emp.GetAllEmployee();
return i;
}
public eva_create_evaluation_detail_historyWithSelectionViewModel GetBlankItem()
{
var i = new eva_create_evaluation_detail_historyWithSelectionViewModel();
i.item_action_emp_id = emp.GetAllEmployee();
return i;
}
public List<eva_create_evaluation_detail_historyViewModel> GetListByevaluation_detail_id(int? evaluation_detail_id)
{
var model = new eva_create_evaluation_detail_historySearchModel();
model.evaluation_detail_id = evaluation_detail_id;
return GetListBySearch(model);
}
public List<eva_create_evaluation_detail_historyViewModel> GetListBySearch(eva_create_evaluation_detail_historySearchModel model)
{
var data = (
from m_eva_create_evaluation_detail_history in _repository.Context.eva_create_evaluation_detail_history
join fk_eva_create_evaluation_detail1 in _repository.Context.eva_create_evaluation_detail on m_eva_create_evaluation_detail_history.evaluation_detail_id equals fk_eva_create_evaluation_detail1.id
into eva_create_evaluation_detailResult1
from fk_eva_create_evaluation_detailResult1 in eva_create_evaluation_detailResult1.DefaultIfEmpty()
join fk_external_employee4 in emp.GetAllEmployee() on m_eva_create_evaluation_detail_history.action_emp_id equals fk_external_employee4.id
into external_employeeResult4
from fk_external_employeeResult4 in external_employeeResult4.DefaultIfEmpty()
where
1 == 1
&& (!model.evaluation_detail_id.HasValue || m_eva_create_evaluation_detail_history.evaluation_detail_id == model.evaluation_detail_id)
orderby m_eva_create_evaluation_detail_history.action_dt
select new eva_create_evaluation_detail_historyViewModel()
{
id = m_eva_create_evaluation_detail_history.id,
evaluation_detail_id = m_eva_create_evaluation_detail_history.evaluation_detail_id,
action_dt = m_eva_create_evaluation_detail_history.action_dt,
action_detail = m_eva_create_evaluation_detail_history.action_detail,
action_emp_id = m_eva_create_evaluation_detail_history.action_emp_id,
evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id = fk_eva_create_evaluation_detailResult1.create_evaluation_id,
action_emp_id_external_employee_fullname = fk_external_employeeResult4.fullname,
isActive = m_eva_create_evaluation_detail_history.isActive,
Created = m_eva_create_evaluation_detail_history.created,
Updated = m_eva_create_evaluation_detail_history.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_history
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_historyViewModel Insert(eva_create_evaluation_detail_historyInputModel 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_historyViewModel>(entity);
}
}
public eva_create_evaluation_detail_historyViewModel Update(int id, eva_create_evaluation_detail_historyInputModel model, bool is_force_save)
{
var existingEntity = _repository.Get(id);
if (existingEntity != null)
{
existingEntity.evaluation_detail_id = model.evaluation_detail_id;
existingEntity.action_dt = model.action_dt;
existingEntity.action_detail = model.action_detail;
existingEntity.action_emp_id = model.action_emp_id;
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_historyViewModel>(existingEntity);
}
}
else
throw new NotificationException("No data to update");
}
public string UpdateMultiple(List<eva_create_evaluation_detail_historyInputModel> 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.evaluation_detail_id = i.evaluation_detail_id;
existingEntity.action_dt = i.action_dt;
existingEntity.action_detail = i.action_detail;
existingEntity.action_emp_id = i.action_emp_id;
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_historyViewModel SetAsActive(int id)
{
var updated = _repository.SetAsActive(id);
return Get(updated.id);
}
public eva_create_evaluation_detail_historyViewModel 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_history
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("evaluation_detail_id", "การประเมิน");
i.Add("evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id", "การประเมิน");
i.Add("action_dt", "วันที่/เวลา");
i.Add("txt_action_dt", "วันที่/เวลา");
i.Add("action_detail", "รายละเอียด");
i.Add("action_emp_id", "ผู้ดำเนินการ");
i.Add("action_emp_id_external_employee_employee_type", "ผู้ดำเนินการ");
return i;
}
#endregion
#region Match Item
#endregion
#endregion
}
}

View File

@@ -0,0 +1,31 @@
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_historyViewModel : BaseViewModel2<int>
{
public int? evaluation_detail_id { get; set; }
public DateTime? action_dt { get; set; }
public string txt_action_dt { get { return MyHelper.GetDateStringForReport(this.action_dt); } }
public string action_detail { get; set; }
public int? action_emp_id { get; set; }
public int? evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id { get; set; }
public string action_emp_id_external_employee_fullname { get; set; }
}
}

View File

@@ -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_historyWithSelectionViewModel: eva_create_evaluation_detail_historyViewModel
{
public List<external_employeeViewModel> item_action_emp_id { get; set; }
}
}

View File

@@ -164,15 +164,17 @@ namespace TodoAPI2.Models
role_code = getRoleCode(emp_id, m_eva_create_evaluation_detail_process.chief,
m_eva_create_evaluation_detail_process.chief,
fk_eva_create_evaluationResult10.employee_id,
fk_eva_create_evaluationResult10.supervisor1_id,
fk_eva_create_evaluationResult10.supervisor2_id, path),
m_eva_create_evaluation_detail_process.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_process.eva_employee_id : fk_eva_create_evaluationResult10.employee_id,
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),
role_desc = getRoleName(emp_id, m_eva_create_evaluation_detail_process.chief,
m_eva_create_evaluation_detail_process.chief,
fk_eva_create_evaluationResult10.employee_id,
fk_eva_create_evaluationResult10.supervisor1_id,
fk_eva_create_evaluationResult10.supervisor2_id, path),
m_eva_create_evaluation_detail_process.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_process.eva_employee_id : fk_eva_create_evaluationResult10.employee_id,
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),
remark_hrm_work_record = fk_external_employee.remark_hrm_work_record
+ GetWorkTimeText(fk_external_employee.packing_date, end_date),
@@ -198,7 +200,7 @@ namespace TodoAPI2.Models
item.item_level_score = (from i in _repository.Context.eva_level_score
orderby i.min_score
select Mapper.Map<eva_level_scoreViewModel>(i)).ToList();
item.item_employee_id = (from x in emp.GetListByemployee_type(null,null) select x).ToList();
item.item_employee_id = (from x in emp.GetAllEmployee() where x.count_resigns == 0 select x).ToList();
return item;
}
@@ -206,7 +208,7 @@ namespace TodoAPI2.Models
{
var i = new eva_create_evaluation_detail_processWithSelectionViewModel();
i.item_org_id = ext.GetDepartmentData();
i.item_employee_id = (from x in emp.GetListByemployee_type(null, null) select x).ToList();
i.item_employee_id = (from x in emp.GetAllEmployee() where x.count_resigns == 0 select x).ToList();
//i.item_level_score = (from j in _repository.Context.eva_level_score
// orderby j.min_score
// select Mapper.Map<eva_level_scoreViewModel>(i)).ToList();
@@ -246,7 +248,7 @@ namespace TodoAPI2.Models
into external_employeeResult
from fk_external_employee in external_employeeResult.DefaultIfEmpty()
join sort_dep in ext.GetSortingDep() on fk_external_employee.department_id equals sort_dep.id
join sort_dep in ext.GetSortingDep() on m_eva_create_evaluation_detail_process.help_org_id.HasValue ? m_eva_create_evaluation_detail_process.help_org_id : fk_external_employee.department_id equals sort_dep.id
into sort_depResult2
from fk_sort_depResult2 in sort_depResult2.DefaultIfEmpty()
@@ -262,6 +264,10 @@ namespace TodoAPI2.Models
into planResult
from fk_planResult in planResult.DefaultIfEmpty()
join fk_external_linkage11 in ext.GetDepartmentData() on m_eva_create_evaluation_detail_process.help_org_id equals fk_external_linkage11.id
into external_linkageResult11
from fk_external_linkageResult11 in external_linkageResult11.DefaultIfEmpty()
where 1 == 1
&& (m_eva_create_evaluation_detail_process.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue)
&& (all_org_id.Contains(fk_external_employee.department_id) || !model.org_id.HasValue)
@@ -270,9 +276,9 @@ namespace TodoAPI2.Models
&& emp_id.HasValue
&& (
(m_eva_create_evaluation_detail_process.chief.HasValue && emp_id == m_eva_create_evaluation_detail_process.chief)
|| (fk_eva_create_evaluationResult10.employee_id.HasValue && emp_id == fk_eva_create_evaluationResult10.employee_id)
|| (fk_eva_create_evaluationResult10.supervisor1_id.HasValue && emp_id == fk_eva_create_evaluationResult10.supervisor1_id)
|| (fk_eva_create_evaluationResult10.supervisor2_id.HasValue && emp_id == fk_eva_create_evaluationResult10.supervisor2_id)
|| (((m_eva_create_evaluation_detail_process.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_process.eva_employee_id : fk_eva_create_evaluationResult10.employee_id)).HasValue && emp_id == (m_eva_create_evaluation_detail_process.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_process.eva_employee_id : fk_eva_create_evaluationResult10.employee_id))
|| ((m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id).HasValue && emp_id == (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).HasValue && emp_id == (m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id))
)
&& (!model.employee_id.HasValue || m_eva_create_evaluation_detail_process.employee_id == model.employee_id)
@@ -301,7 +307,7 @@ namespace TodoAPI2.Models
search_employee_code = fk_external_employee.employee_no,
search_employee_fullname = fk_external_employee.fullname,
org_id_external_linkage_external_name = fk_sort_depResult2.external_name,
org_id_external_linkage_external_name = !string.IsNullOrEmpty(fk_external_linkageResult11.external_name) ? fk_external_linkageResult11.external_name : fk_external_employee.department_name,
status_self = m_eva_create_evaluation_detail_process.status_self,
status_chief = m_eva_create_evaluation_detail_process.status_chief,
@@ -312,17 +318,18 @@ namespace TodoAPI2.Models
role_code = getRoleCodeSearch(emp_id, m_eva_create_evaluation_detail_process.chief,
m_eva_create_evaluation_detail_process.chief,
fk_eva_create_evaluationResult10.employee_id,
fk_eva_create_evaluationResult10.supervisor1_id,
fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_process.eva_employee_id.HasValue? m_eva_create_evaluation_detail_process.eva_employee_id : fk_eva_create_evaluationResult10.employee_id,
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
),
role_desc = getRoleName(emp_id, m_eva_create_evaluation_detail_process.chief,
m_eva_create_evaluation_detail_process.chief,
fk_eva_create_evaluationResult10.employee_id,
fk_eva_create_evaluationResult10.supervisor1_id,
fk_eva_create_evaluationResult10.supervisor2_id, path),
m_eva_create_evaluation_detail_process.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_process.eva_employee_id : fk_eva_create_evaluationResult10.employee_id,
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),
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,

View File

@@ -88,11 +88,20 @@ namespace TodoAPI2.Models
public DateTime? status_supervisor1A_click_date { get; set; }
public DateTime? status_supervisor2A_click_date { 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 txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_click_date) + getHistoryLink(status_self); } }
public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_click_date) + getHistoryLink(status_chief); } }
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor_click_date) + getHistoryLink(status_supervisor); } }
public string txt_status_supervisor1A { get { return getStatusText(status_supervisor1A) + MyHelper.GetDateStringForReport(status_supervisor1A_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor1A_click_date) + getHistoryLink(status_supervisor1A); } }
public string txt_status_supervisor2A { get { return getStatusText(status_supervisor2A) + MyHelper.GetDateStringForReport(status_supervisor2A_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor2A_click_date) + getHistoryLink(status_supervisor2A); } }
private string getHistoryLink(string s)
{
if (!string.IsNullOrEmpty(s))
{
return ("<br/><a href='javascript:window_open({0}../eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history?id=" + id.ToString() + "{0});'>ดูประวัติ</a>").Replace("{0}", '"'.ToString());
}
return "";
}
private string getStatusText(string s)
{
@@ -110,8 +119,8 @@ namespace TodoAPI2.Models
return " ";
}
public string txt_status_self_a_click_date { get { return MyHelper.GetDateStringForReport(status_self_a_click_date); } }
public string txt_status_chief_a_click_date { get { return MyHelper.GetDateStringForReport(status_chief_a_click_date); } }
public string txt_status_self_a_click_date { get { return MyHelper.GetDateStringForReport(status_self_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_a_click_date); } }
public string txt_status_chief_a_click_date { get { return MyHelper.GetDateStringForReport(status_chief_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_a_click_date); } }
}
}

View File

@@ -34,6 +34,8 @@ namespace TodoAPI2.Models
public string status_mode { get; set; }
public int? employee_id { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -28,16 +28,18 @@ namespace TodoAPI2.Models
private IMyDatabase db;
private Iexternal_linkageService ext;
private Iexternal_employeeService emp;
private Ieva_create_evaluation_detail_historyService his;
private IConfiguration Configuration { get; set; }
public eva_create_evaluation_detail_statusService(IBaseRepository2<eva_create_evaluation_detailEntity, int> repository,
IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp, IConfiguration configuration)
IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp, IConfiguration configuration, Ieva_create_evaluation_detail_historyService inhis)
{
_repository = repository;
db = mydb;
ext = inext;
emp = inemp;
Configuration = configuration;
his = inhis;
}
#region Private Functions
@@ -155,13 +157,33 @@ namespace TodoAPI2.Models
var entity = GetEntity(model);
entity.id = GetNewPrimaryKey();
var inserted = _repository.Insert(entity);
return Get(inserted.id);
}
private void add_history(DateTime? dt, string action, int? action_user_id, int? detail_id)
{
int? newkey = 0;
var x = (from i in _repository.Context.eva_create_evaluation_detail_history
orderby i.id descending
select i).Take(1).ToList();
if (x.Count > 0)
{
newkey = x[0].id + 1;
}
var n = new eva_create_evaluation_detail_historyEntity();
n.id = newkey.Value;
n.action_detail = action;
n.action_dt = dt;
n.action_emp_id = action_user_id;
n.evaluation_detail_id = detail_id;
_repository.Context.Add(n);
}
public eva_create_evaluation_detail_statusViewModel Update(int id, eva_create_evaluation_detail_statusInputModel model)
{
var existingEntity = _repository.Get(id);
@@ -192,25 +214,31 @@ namespace TodoAPI2.Models
string noti_url = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2?id=" + existingEntity.id.ToString();
bool need_noti = true;
string noti_message2 = "";
string noti_url2 = "";
int? noti_to_employee_id2 = null;
if (model.status_mode == "nextA")
{
existingEntity.status_self_a_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
existingEntity.status_self_a_click_date = DateTime.Now;
existingEntity.status_chief_a_click_date = null;
noti_to_employee_id = existingEntity.chief;
noti_message = "กรุณาตรวจสอบ ข้อตกลงการประเมิน ของ {0}";
noti_url = "/eva/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "ส่งข้อตกลงการประเมิน", model.employee_id, existingEntity.id);
}
else if (model.status_mode == "backB")
{
existingEntity.status_chief_a_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
existingEntity.status_chief_a_click_date = DateTime.Now;
existingEntity.status_self_a_click_date = null;
noti_to_employee_id = existingEntity.employee_id;
noti_message = "ข้อตกลงการประเมินของคุณ ({0}) ถูกตีกลับ";
noti_url = "/eva/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "ข้อตกลงการประเมิน ถูกตีกลับ", model.employee_id, existingEntity.id);
}
else if (model.status_mode == "nextB")
{
existingEntity.status_chief_a_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
existingEntity.status_chief_a_click_date = DateTime.Now;
if (current_eva.employee_id == existingEntity.chief) // หัวหน้าและผู้ประเมินสูงสุด เป็นคนคนเดียวกัน
{
noti_to_employee_id = current_eva.supervisor1_id;
@@ -220,17 +248,23 @@ namespace TodoAPI2.Models
noti_to_employee_id = current_eva.employee_id;
}
need_noti = false;
add_history(DateTime.Now, "อนุมัติ ข้อตกลงการประเมิน", existingEntity.chief, existingEntity.id);
}
else if (model.status_mode == "next0")
{
existingEntity.status_self_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
existingEntity.status_self_click_date = DateTime.Now;
noti_to_employee_id = existingEntity.chief;
noti_message = "กรุณาตรวจสอบแบบประเมินของ {0}";
noti_url = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString();
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);
}
else if (model.status_mode == "next1")
{
existingEntity.status_chief_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
existingEntity.status_chief_click_date = DateTime.Now;
if (current_eva.employee_id == existingEntity.chief) // หัวหน้าและผู้ประเมินสูงสุด เป็นคนคนเดียวกัน
{
noti_to_employee_id = current_eva.supervisor1_id;
@@ -242,55 +276,78 @@ namespace TodoAPI2.Models
}
else if (model.status_mode == "back1")
{
existingEntity.status_chief_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
existingEntity.status_chief_click_date = DateTime.Now;
existingEntity.status_self_click_date = null;
noti_to_employee_id = existingEntity.employee_id;
noti_message = "ข้อตกลงการประเมินของคุณ ({0}) ถูกตีกลับ";
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "ข้อตกลงการประเมิน ถูกตีกลับ โดยผู้ประเมิน", model.employee_id, existingEntity.id);
}
else if (model.status_mode == "next2")
{
existingEntity.status_supervisor_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
existingEntity.status_supervisor_click_date = DateTime.Now;
noti_to_employee_id = current_eva.supervisor1_id;
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);
}
else if (model.status_mode == "back2")
{
existingEntity.status_supervisor_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
existingEntity.status_supervisor_click_date = DateTime.Now;
existingEntity.status_chief_click_date = null;
noti_to_employee_id = existingEntity.chief;
noti_message = "แบบประเมินของ {0} ถูกตีกลับ";
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "แบบประเมิน ถูกตีกลับ โดยผู้ประเมินสูงสุด", model.employee_id, existingEntity.id);
}
else if (model.status_mode == "next3")
{
existingEntity.status_supervisor1A_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
existingEntity.status_supervisor1A_click_date = DateTime.Now;
noti_to_employee_id = current_eva.supervisor2_id;
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);
}
else if (model.status_mode == "back3")
{
existingEntity.status_supervisor1A_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
existingEntity.status_supervisor1A_click_date = DateTime.Now;
existingEntity.status_supervisor_click_date = null;
noti_to_employee_id = current_eva.employee_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);
}
else if (model.status_mode == "next4")
{
existingEntity.status_supervisor2A_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
existingEntity.status_supervisor2A_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);
}
else if (model.status_mode == "back4")
{
existingEntity.status_supervisor2A_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
existingEntity.status_supervisor2A_click_date = DateTime.Now;
existingEntity.status_supervisor1A_click_date = null;
noti_to_employee_id = current_eva.supervisor1_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);
}
if (need_noti)
{
SendNotification(noti_to_employee_id, owner_eva_employee_id, existingEntity.id, noti_message, noti_url);
}
if (noti_to_employee_id2.HasValue)
{
SendNotification(noti_to_employee_id2, owner_eva_employee_id, existingEntity.id, noti_message2, noti_url2);
}
var updated = _repository.Update(id, existingEntity);
return Get(updated.id);
@@ -320,7 +377,7 @@ values('{Guid.NewGuid().ToString()}','App\Notifications\WorkflowNotification','A
d.url = noti_url;
NpgsqlParameter data = new NpgsqlParameter();
data.DbType = DbType.String;
data.NpgsqlDbType = NpgsqlDbType.Json;
data.Direction = ParameterDirection.Input;
data.ParameterName = "data";
data.Value = JsonConvert.SerializeObject(d);

View File

@@ -266,15 +266,16 @@ namespace TodoAPI2.Models
var newid = GetNewPrimaryKey();
var enter = "\n";
var start_id = newid;
foreach (var i in opt)
{
var n = new eva_evaluation_achievementEntity();
n.id = newid;
n.create_evaluation_detail_id = id;
n.achievement = "รายละเอียดภารกิจ" + enter + enter + i.mission_detail + enter + enter + "เป้าหมาย" + enter + enter + i.target + enter + enter + "ตัวชี้วัด" + enter + enter + i.indicators;
n.achievement = "รายละเอียดภารกิจ" + enter + i.mission_detail + enter + enter + "เป้าหมาย" + enter + i.target + enter + enter + "ตัวชี้วัด" + enter + i.indicators;
n.weight = 0;
n.created = DateTime.Now.AddMinutes(-1 * newid);
n.created = DateTime.Now.AddMinutes(newid - start_id).AddMinutes(opt.Count * -1);
newid++;
_repository.Context.Add(n);
}

View File

@@ -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_evaluation_achievement_attachService : IBaseService2<int, eva_evaluation_achievement_attachInputModel, eva_evaluation_achievement_attachViewModel>
{
new eva_evaluation_achievement_attachViewModel Insert(eva_evaluation_achievement_attachInputModel model, bool is_force_save);
new eva_evaluation_achievement_attachViewModel Update(int id, eva_evaluation_achievement_attachInputModel model, bool is_force_save);
List<eva_evaluation_achievement_attachViewModel> GetListByachievement_id(int? achievement_id);
List<eva_evaluation_achievement_attachViewModel> GetListBySearch(eva_evaluation_achievement_attachSearchModel model);
string UpdateMultiple(List<eva_evaluation_achievement_attachInputModel> model, bool is_force_save);
eva_evaluation_achievement_attachWithSelectionViewModel GetWithSelection(int id);
eva_evaluation_achievement_attachWithSelectionViewModel GetBlankItem();
void RefreshAutoFieldOfAllData();
eva_evaluation_achievement_attachEntity GetEntity(int id);
DataContext GetContext();
}
}

View File

@@ -0,0 +1,48 @@
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;
using System.IO;
namespace TodoAPI2.Models
{
public class eva_evaluation_achievement_attachEntity : BaseEntity2<int>
{
[ForeignKey("achievement_id")]
public eva_evaluation_achievementEntity eva_evaluation_achievement_achievement_id { get; set; }
public int? achievement_id { get; set; }
[MaxLength(1000)]
public string the_file { get; set; }
[NotMapped]
public string the_fileDisplay
{
get
{
return (string.IsNullOrEmpty(the_file) ? "" :
FileUtil.GetFileInfo(TTSW.Constant.FilePathConstant.DirType.FilesTestUpload, id, the_file).RelativePath).Replace(@"\", "/");
}
}
public void SetAutoField(DataContext context)
{
}
public void DoAfterInsertUpdate(DataContext context)
{
}
}
}

View File

@@ -0,0 +1,26 @@
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_evaluation_achievement_attachInputModel
{
public int? id { get; set; }
public int? achievement_id { get; set; }
public string the_file { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -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_evaluation_achievement_attachReportRequestModel : eva_evaluation_achievement_attachSearchModel
{
public string filetype { get; set; }
public string contentType { get { return MyHelper.GetContentType(filetype); } }
}
}

View File

@@ -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_evaluation_achievement_attachSearchModel
{
public int id { get; set; }
public int? achievement_id { get; set; }
}
}

View File

@@ -0,0 +1,332 @@
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_evaluation_achievement_attachService : Ieva_evaluation_achievement_attachService
{
private IBaseRepository2<eva_evaluation_achievement_attachEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
public eva_evaluation_achievement_attachService(IBaseRepository2<eva_evaluation_achievement_attachEntity, int> repository, IMyDatabase mydb, Iexternal_linkageService inext)
{
_repository = repository;
db = mydb;
ext = inext;
}
#region Private Functions
private eva_evaluation_achievement_attachEntity GetEntity(eva_evaluation_achievement_attachInputModel model)
{
return Mapper.Map<eva_evaluation_achievement_attachEntity>(model);
}
private List<eva_evaluation_achievement_attachEntity> GetEntityList(List<eva_evaluation_achievement_attachInputModel> models)
{
return Mapper.Map<List<eva_evaluation_achievement_attachEntity>>(models);
}
private eva_evaluation_achievement_attachViewModel GetDto(eva_evaluation_achievement_attachEntity entity)
{
return Mapper.Map<eva_evaluation_achievement_attachViewModel>(entity);
}
private List<eva_evaluation_achievement_attachViewModel> GetDtoList(List<eva_evaluation_achievement_attachEntity> entities)
{
return Mapper.Map<List<eva_evaluation_achievement_attachViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public eva_evaluation_achievement_attachViewModel Get(int id)
{
var entity = _repository.Get(id);
return GetDto(entity);
}
public eva_evaluation_achievement_attachEntity GetEntity(int id)
{
var entity = _repository.Get(id);
return entity;
}
public DataContext GetContext()
{
return _repository.Context;
}
public eva_evaluation_achievement_attachWithSelectionViewModel GetWithSelection(int id)
{
var entity = _repository.Get(id);
var i = Mapper.Map<eva_evaluation_achievement_attachWithSelectionViewModel>(entity);
return i;
}
public eva_evaluation_achievement_attachWithSelectionViewModel GetBlankItem()
{
var i = new eva_evaluation_achievement_attachWithSelectionViewModel();
return i;
}
public List<eva_evaluation_achievement_attachViewModel> GetListByachievement_id(int? achievement_id)
{
var model = new eva_evaluation_achievement_attachSearchModel();
model.achievement_id = achievement_id;
return GetListBySearch(model);
}
public List<eva_evaluation_achievement_attachViewModel> GetListBySearch(eva_evaluation_achievement_attachSearchModel model)
{
var data = (
from m_eva_evaluation_achievement_attach in _repository.Context.eva_evaluation_achievement_attach
join fk_eva_evaluation_achievement1 in _repository.Context.eva_evaluation_achievement on m_eva_evaluation_achievement_attach.achievement_id equals fk_eva_evaluation_achievement1.id
into eva_evaluation_achievementResult1
from fk_eva_evaluation_achievementResult1 in eva_evaluation_achievementResult1.DefaultIfEmpty()
where
1 == 1
&& (!model.achievement_id.HasValue || m_eva_evaluation_achievement_attach.achievement_id == model.achievement_id)
orderby m_eva_evaluation_achievement_attach.created descending
select new eva_evaluation_achievement_attachViewModel()
{
id = m_eva_evaluation_achievement_attach.id,
achievement_id = m_eva_evaluation_achievement_attach.achievement_id,
the_file = m_eva_evaluation_achievement_attach.the_file,
the_fileDisplay = m_eva_evaluation_achievement_attach.the_fileDisplay,
achievement_id_eva_evaluation_achievement_create_evaluation_detail_id = fk_eva_evaluation_achievementResult1.create_evaluation_detail_id,
isActive = m_eva_evaluation_achievement_attach.isActive,
Created = m_eva_evaluation_achievement_attach.created,
Updated = m_eva_evaluation_achievement_attach.updated
}
).Take(1000).ToList();
return data;
}
#endregion
#region Manipulation Functions
public int GetNewPrimaryKey()
{
int? newkey = 0;
var x = (from i in _repository.Context.eva_evaluation_achievement_attach
orderby i.id descending
select i).Take(1).ToList();
if(x.Count > 0)
{
newkey = x[0].id + 1;
}
return newkey.Value;
}
public eva_evaluation_achievement_attachViewModel Insert(eva_evaluation_achievement_attachInputModel model, bool is_force_save)
{
var entity = GetEntity(model);
entity.id = GetNewPrimaryKey();
if (!string.IsNullOrEmpty(model.the_file))
{
//Move file from temp to physical
string the_fileFileName = FileUtil.MoveTempUploadFileToActualPath(
model.the_file, FilePathConstant.DirType.FilesTestUpload, entity.id);
entity.the_file = the_fileFileName;
}
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_evaluation_achievement_attachViewModel>(entity);
}
}
public eva_evaluation_achievement_attachViewModel Update(int id, eva_evaluation_achievement_attachInputModel model, bool is_force_save)
{
var existingEntity = _repository.Get(id);
if (existingEntity != null)
{
existingEntity.achievement_id = model.achievement_id;
if (!string.IsNullOrEmpty(model.the_file))
{
if (model.the_file.StartsWith("Uploads"))
{
var the_fileFileName = FileUtil.MoveTempUploadFileToActualPath(
model.the_file, FilePathConstant.DirType.FilesTestUpload, existingEntity.id, existingEntity.the_file);
existingEntity.the_file = the_fileFileName;
}
else
{
existingEntity.the_file = model.the_file;
}
}
else
{
existingEntity.the_file = null;
}
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_evaluation_achievement_attachViewModel>(existingEntity);
}
}
else
throw new NotificationException("No data to update");
}
public string UpdateMultiple(List<eva_evaluation_achievement_attachInputModel> 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.achievement_id = i.achievement_id;
if (!string.IsNullOrEmpty(i.the_file))
{
if (i.the_file.StartsWith("Uploads"))
{
var the_fileFileName = FileUtil.MoveTempUploadFileToActualPath(
i.the_file, FilePathConstant.DirType.FilesTestUpload, existingEntity.id, existingEntity.the_file);
existingEntity.the_file = the_fileFileName;
}
else
{
existingEntity.the_file = i.the_file;
}
}
else
{
existingEntity.the_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
}
}
if (is_force_save)
{
_repository.Context.SaveChanges();
}
return model.Count().ToString();
}
public eva_evaluation_achievement_attachViewModel SetAsActive(int id)
{
var updated = _repository.SetAsActive(id);
return Get(updated.id);
}
public eva_evaluation_achievement_attachViewModel 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_evaluation_achievement_attach
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("achievement_id", "อ้างอิงตาราง eva_create_evaluation_detail");
i.Add("achievement_id_eva_evaluation_achievement_create_evaluation_detail_id", "อ้างอิงตาราง eva_create_evaluation_detail");
return i;
}
#endregion
#region Match Item
#endregion
#endregion
}
}

View File

@@ -0,0 +1,34 @@
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_evaluation_achievement_attachViewModel : BaseViewModel2<int>
{
public int? achievement_id { get; set; }
public string the_file { get; set; }
public string the_fileDisplay { get; set; }
public string txt_the_file
{
get
{
return (string.IsNullOrEmpty(the_file) ? "" :
$"<a href='../{the_fileDisplay}' target='_blank'>{the_file}</a>");
}
}
public int? achievement_id_eva_evaluation_achievement_create_evaluation_detail_id { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TodoAPI2.Models
{
public class eva_evaluation_achievement_attachWithSelectionViewModel: eva_evaluation_achievement_attachViewModel
{
}
}

View File

@@ -239,14 +239,15 @@ namespace TodoAPI2.Models
throw new Exception("ผู้รับการประเมิน ส่งแบบประเมินไปแล้ว บันทึกไม่ได้");
}
existingEntity.create_evaluation_detail_id = i.create_evaluation_detail_id;
existingEntity.behavior = i.behavior;
existingEntity.weight = i.weight;
existingEntity.target_score1 = i.target_score1;
existingEntity.target_score2 = i.target_score2;
existingEntity.target_score3 = i.target_score3;
existingEntity.target_score4 = i.target_score4;
existingEntity.target_score5 = i.target_score5;
//existingEntity.create_evaluation_detail_id = i.create_evaluation_detail_id;
//existingEntity.behavior = i.behavior;
//existingEntity.target_score1 = i.target_score1;
//existingEntity.target_score2 = i.target_score2;
//existingEntity.target_score3 = i.target_score3;
//existingEntity.target_score4 = i.target_score4;
//existingEntity.target_score5 = i.target_score5;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}

View File

@@ -157,6 +157,20 @@ namespace TodoAPI2.Models
var entity = GetEntity(model);
entity.id = GetNewPrimaryKey();
if (!model.mission_no.HasValue)
{
var max_mission = (from i in _repository.Context.eva_evaluation_operating_agreement
where i.create_evaluation_detail_id == model.create_evaluation_detail_id
select i.mission_no).Max();
if (max_mission.HasValue)
{
entity.mission_no = max_mission + 1;
}
else
{
entity.mission_no = 1;
}
}
entity.SetAutoField(_repository.Context);

View File

@@ -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_idp_plan_reviewerService : IBaseService2<int, eva_idp_plan_reviewerInputModel, eva_idp_plan_reviewerViewModel>
{
new eva_idp_plan_reviewerViewModel Insert(eva_idp_plan_reviewerInputModel model, bool is_force_save);
new eva_idp_plan_reviewerViewModel Update(int id, eva_idp_plan_reviewerInputModel model, bool is_force_save);
List<eva_idp_plan_reviewerViewModel> GetListBycreate_evaluation_detail_id(int? create_evaluation_detail_id);
List<eva_idp_plan_reviewerViewModel> GetListBySearch(eva_idp_plan_reviewerSearchModel model);
string UpdateMultiple(List<eva_idp_plan_reviewerInputModel> model, bool is_force_save);
eva_idp_plan_reviewerWithSelectionViewModel GetWithSelection(int id);
eva_idp_plan_reviewerWithSelectionViewModel GetBlankItem();
void RefreshAutoFieldOfAllData();
eva_idp_planEntity GetEntity(int id);
DataContext GetContext();
}
}

View File

@@ -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_idp_plan_reviewerInputModel
{
public int? id { get; set; }
public int? create_evaluation_detail_id { get; set; }
public string develop { get; set; }
public string development_method { get; set; }
public DateTime? start_date { get; set; }
public DateTime? end_date { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -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_idp_plan_reviewerReportRequestModel : eva_idp_plan_reviewerSearchModel
{
public string filetype { get; set; }
public string contentType { get { return MyHelper.GetContentType(filetype); } }
}
}

View File

@@ -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_idp_plan_reviewerSearchModel
{
public int id { get; set; }
public int? create_evaluation_detail_id { get; set; }
}
}

View File

@@ -0,0 +1,300 @@
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_idp_plan_reviewerService : Ieva_idp_plan_reviewerService
{
private IBaseRepository2<eva_idp_planEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
public eva_idp_plan_reviewerService(IBaseRepository2<eva_idp_planEntity, int> repository, IMyDatabase mydb, Iexternal_linkageService inext)
{
_repository = repository;
db = mydb;
ext = inext;
}
#region Private Functions
private eva_idp_planEntity GetEntity(eva_idp_plan_reviewerInputModel model)
{
return Mapper.Map<eva_idp_planEntity>(model);
}
private List<eva_idp_planEntity> GetEntityList(List<eva_idp_plan_reviewerInputModel> models)
{
return Mapper.Map<List<eva_idp_planEntity>>(models);
}
private eva_idp_plan_reviewerViewModel GetDto(eva_idp_planEntity entity)
{
return Mapper.Map<eva_idp_plan_reviewerViewModel>(entity);
}
private List<eva_idp_plan_reviewerViewModel> GetDtoList(List<eva_idp_planEntity> entities)
{
return Mapper.Map<List<eva_idp_plan_reviewerViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public eva_idp_plan_reviewerViewModel Get(int id)
{
var entity = _repository.Get(id);
return GetDto(entity);
}
public eva_idp_planEntity GetEntity(int id)
{
var entity = _repository.Get(id);
return entity;
}
public DataContext GetContext()
{
return _repository.Context;
}
public eva_idp_plan_reviewerWithSelectionViewModel GetWithSelection(int id)
{
var entity = _repository.Get(id);
var i = Mapper.Map<eva_idp_plan_reviewerWithSelectionViewModel>(entity);
return i;
}
public eva_idp_plan_reviewerWithSelectionViewModel GetBlankItem()
{
var i = new eva_idp_plan_reviewerWithSelectionViewModel();
return i;
}
public List<eva_idp_plan_reviewerViewModel> GetListBycreate_evaluation_detail_id(int? create_evaluation_detail_id)
{
var model = new eva_idp_plan_reviewerSearchModel();
model.create_evaluation_detail_id = create_evaluation_detail_id;
return GetListBySearch(model);
}
public List<eva_idp_plan_reviewerViewModel> GetListBySearch(eva_idp_plan_reviewerSearchModel model)
{
var data = (
from m_eva_idp_plan_reviewer in _repository.Context.eva_idp_plan
where
1 == 1
&& (!model.create_evaluation_detail_id.HasValue || m_eva_idp_plan_reviewer.create_evaluation_detail_id == model.create_evaluation_detail_id)
orderby m_eva_idp_plan_reviewer.created descending
select new eva_idp_plan_reviewerViewModel()
{
id = m_eva_idp_plan_reviewer.id,
create_evaluation_detail_id = m_eva_idp_plan_reviewer.create_evaluation_detail_id,
develop = m_eva_idp_plan_reviewer.develop,
development_method = m_eva_idp_plan_reviewer.development_method,
start_date = m_eva_idp_plan_reviewer.start_date,
end_date = m_eva_idp_plan_reviewer.end_date,
isActive = m_eva_idp_plan_reviewer.isActive,
Created = m_eva_idp_plan_reviewer.created,
Updated = m_eva_idp_plan_reviewer.updated
}
).Take(1000).ToList();
return data;
}
#endregion
#region Manipulation Functions
public int GetNewPrimaryKey()
{
int? newkey = 0;
var x = (from i in _repository.Context.eva_idp_plan
orderby i.id descending
select i).Take(1).ToList();
if(x.Count > 0)
{
newkey = x[0].id + 1;
}
return newkey.Value;
}
public eva_idp_plan_reviewerViewModel Insert(eva_idp_plan_reviewerInputModel 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_idp_plan_reviewerViewModel>(entity);
}
}
public eva_idp_plan_reviewerViewModel Update(int id, eva_idp_plan_reviewerInputModel model, bool is_force_save)
{
var existingEntity = _repository.Get(id);
if (existingEntity != null)
{
existingEntity.create_evaluation_detail_id = model.create_evaluation_detail_id;
existingEntity.develop = model.develop;
existingEntity.development_method = model.development_method;
existingEntity.start_date = model.start_date;
existingEntity.end_date = model.end_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_idp_plan_reviewerViewModel>(existingEntity);
}
}
else
throw new NotificationException("No data to update");
}
public string UpdateMultiple(List<eva_idp_plan_reviewerInputModel> 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_detail_id = i.create_evaluation_detail_id;
existingEntity.develop = i.develop;
existingEntity.development_method = i.development_method;
existingEntity.start_date = i.start_date;
existingEntity.end_date = i.end_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_idp_plan_reviewerViewModel SetAsActive(int id)
{
var updated = _repository.SetAsActive(id);
return Get(updated.id);
}
public eva_idp_plan_reviewerViewModel 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_idp_plan
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_detail_id", "create_evaluation_detail_id");
i.Add("develop", "ความรู้/ทักษะ/สมรรถนะที่ต้องได้รับการพัฒนา");
i.Add("development_method", "วิธีการพัฒนา");
i.Add("start_date", "ช่วงเวลาเริ่มต้นพัฒนา");
i.Add("txt_start_date", "ช่วงเวลาเริ่มต้นพัฒนา");
i.Add("end_date", "ช่วงเวลาสิ้นสุดพัฒนา");
i.Add("txt_end_date", "ช่วงเวลาสิ้นสุดพัฒนา");
return i;
}
#endregion
#region Match Item
#endregion
#endregion
}
}

View File

@@ -0,0 +1,33 @@
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_idp_plan_reviewerViewModel : BaseViewModel2<int>
{
public int? create_evaluation_detail_id { get; set; }
public string develop { get; set; }
public string development_method { get; set; }
public DateTime? start_date { get; set; }
public string txt_start_date { get { return MyHelper.GetDateStringForReport(this.start_date); } }
public DateTime? end_date { get; set; }
public string txt_end_date { get { return MyHelper.GetDateStringForReport(this.end_date); } }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TodoAPI2.Models
{
public class eva_idp_plan_reviewerWithSelectionViewModel: eva_idp_plan_reviewerViewModel
{
}
}

View File

@@ -132,6 +132,11 @@ namespace TodoAPI2.Models
into external_linkageResult11
from fk_external_linkageResult11 in external_linkageResult11.DefaultIfEmpty()
join sort_dep in ext.GetSortingDep() on
(m_eva_limit_frame_employee.help_org_id.HasValue ? m_eva_limit_frame_employee.help_org_id : fk_external_linkageResult2.department_id) equals sort_dep.id
into sort_depResult2
from fk_sort_depResult2 in sort_depResult2.DefaultIfEmpty()
where
1 == 1
&& (!model.frame_group_guid.HasValue || m_eva_limit_frame_employee.frame_group_guid == model.frame_group_guid)
@@ -156,7 +161,7 @@ namespace TodoAPI2.Models
frame_group_guid_eva_limit_frame_group_group_guid = fk_eva_limit_frame_groupResult1.group_guid,
employee_id_external_linkage_external_name = fk_external_linkageResult2.fullname,
org_id_external_linkage_external_name = fk_external_linkageResult3.external_name,
org_id_external_linkage_external_name = !string.IsNullOrEmpty(fk_external_linkageResult11.external_name) ? fk_external_linkageResult11.external_name : fk_external_linkageResult3.external_name,
help_org_id_external_linkage_external_name = fk_external_linkageResult11.external_name,
isActive = m_eva_limit_frame_employee.isActive,

View File

@@ -22,12 +22,15 @@ namespace TodoAPI2.Models
private IBaseRepository2<eva_limit_frame_groupEntity, Guid> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private Iexternal_employeeService emp;
public eva_limit_frame_groupService(IBaseRepository2<eva_limit_frame_groupEntity, Guid> repository, IMyDatabase mydb, Iexternal_linkageService inext)
public eva_limit_frame_groupService(IBaseRepository2<eva_limit_frame_groupEntity, Guid> repository,
IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp)
{
_repository = repository;
db = mydb;
ext = inext;
emp = inemp;
}
#region Private Functions
@@ -172,6 +175,18 @@ namespace TodoAPI2.Models
public eva_limit_frame_groupViewModel Update(Guid id, eva_limit_frame_groupInputModel model, bool is_force_save)
{
var existingEntity = _repository.Get(id);
var plan = (from i in _repository.Context.eva_limit_frame_plan where i.plan_guid == existingEntity.frame_plan_guid select i).FirstOrDefault();
var all_all_emp = emp.GetAllEmployee();
var mapping_dept = emp.GetDeptMapping();
var working_record = from i in emp.GetWorkingRecord()
// where
//plan.executed_date.HasValue
//&& i.start_date <= plan.executed_date
//&& i.end_date >= plan.executed_date
select i;
if (existingEntity != null)
{
existingEntity.frame_plan_guid = model.frame_plan_guid;
@@ -182,7 +197,24 @@ namespace TodoAPI2.Models
existingEntity.total_salary_limit_rounded = model.total_salary_limit_rounded;
existingEntity.remark = model.remark;
existingEntity.SetAutoField(_repository.Context);
int j = 1;
foreach (var y in from z in _repository.Context.eva_limit_frame_employee where z.frame_group_guid == model.id orderby z.order_of_data select z)
{
if (y.help_org_id.HasValue)
{
var theemp = (from q in all_all_emp where q.id == y.employee_id select q).FirstOrDefault();
var thedetail = (from r in working_record where r.employee_id == y.employee_id select r).FirstOrDefault();
var help_at = (from s in mapping_dept where s.id == thedetail.place select s).FirstOrDefault();
if (theemp != null && thedetail != null && help_at != null)
{
if (existingEntity.remark != "") existingEntity.remark += "\n";
existingEntity.remark += $"{j}.ในลำดับที่ {y.order_of_data} {theemp.fullname} ตำแหน่ง{theemp.position_name} {theemp.department_name} \nมาช่วยปฏิบัติงานที่{help_at.department_name} ตั้งแต่วันที่ {MyHelper.GetDateStringForReport(thedetail.start_date)} - {MyHelper.GetDateStringForReport(thedetail.end_date)} \nตาม{thedetail.subject}";
}
j++;
}
}
existingEntity.SetAutoField(_repository.Context);
if (is_force_save)
{

View File

@@ -57,9 +57,10 @@ namespace TodoAPI2.Models
public void DoAfterInsertUpdate(DataContext context)
{
total_salary = (from i in context.eva_limit_frame_employee
join j in context.eva_limit_frame_group
on i.frame_group_guid equals j.id
select i.salary).Sum();
join j in context.eva_limit_frame_group
on i.frame_group_guid equals j.id
where j.frame_plan_guid == this.id
select i.salary).Sum();
limit_frame_005_total = total_salary * limit_frame_005 / 100;
limit_frame_005_total_rounded = MyHelper.RoundOff(limit_frame_005_total.Value, 10);
}

View File

@@ -19,6 +19,8 @@ namespace TodoAPI2.Models
public int? theTime { get; set; }
public decimal? percent { get; set; }
[NotMapped]
public string display_text
{

View File

@@ -20,6 +20,8 @@ namespace TodoAPI2.Models
public int? theTime { get; set; }
public decimal? percent { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -20,14 +20,14 @@ namespace TodoAPI2.Models
public class eva_performance_planService : Ieva_performance_planService
{
private IBaseRepository<eva_performance_planEntity, Guid> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private IMyDatabase db;
private Iexternal_linkageService ext;
public eva_performance_planService(IBaseRepository<eva_performance_planEntity, Guid> 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_performance_planViewModel>>(entities);
}
private List<eva_performance_planEntity> GetListWithoutBase64Fields(IQueryable<eva_performance_planEntity> listQuery)
{
return listQuery.Select(c => new eva_performance_planEntity()
@@ -98,7 +98,7 @@ namespace TodoAPI2.Models
id = m_eva_performance_plan.id,
fiscal_year = m_eva_performance_plan.fiscal_year,
theTime = m_eva_performance_plan.theTime,
percent = m_eva_performance_plan.percent,
isActive = m_eva_performance_plan.isActive,
Created = m_eva_performance_plan.created,
@@ -115,7 +115,7 @@ namespace TodoAPI2.Models
from m_eva_performance_plan in _repository.Context.eva_performance_plan
where m_eva_performance_plan.fiscal_year == fiscal_year || !fiscal_year.HasValue
where m_eva_performance_plan.fiscal_year == fiscal_year || !fiscal_year.HasValue
orderby m_eva_performance_plan.created descending
select new eva_performance_planViewModel()
@@ -123,7 +123,7 @@ namespace TodoAPI2.Models
id = m_eva_performance_plan.id,
fiscal_year = m_eva_performance_plan.fiscal_year,
theTime = m_eva_performance_plan.theTime,
percent = m_eva_performance_plan.percent,
isActive = m_eva_performance_plan.isActive,
Created = m_eva_performance_plan.created,
@@ -134,13 +134,13 @@ namespace TodoAPI2.Models
return data;
}
public List<eva_performance_planViewModel> GetListBySearch(eva_performance_planSearchModel model)
public List<eva_performance_planViewModel> GetListBySearch(eva_performance_planSearchModel model)
{
var data = (
from m_eva_performance_plan in _repository.Context.eva_performance_plan
where 1==1
where 1 == 1
&& (m_eva_performance_plan.fiscal_year == model.fiscal_year || !model.fiscal_year.HasValue)
&& (m_eva_performance_plan.theTime == model.theTime || !model.theTime.HasValue)
@@ -151,7 +151,7 @@ namespace TodoAPI2.Models
id = m_eva_performance_plan.id,
fiscal_year = m_eva_performance_plan.fiscal_year,
theTime = m_eva_performance_plan.theTime,
percent = m_eva_performance_plan.percent,
isActive = m_eva_performance_plan.isActive,
Created = m_eva_performance_plan.created,
@@ -173,7 +173,7 @@ namespace TodoAPI2.Models
var inserted = _repository.Insert(entity);
return Get(inserted.id);
}
@@ -184,27 +184,27 @@ namespace TodoAPI2.Models
{
existingEntity.fiscal_year = model.fiscal_year;
existingEntity.theTime = model.theTime;
existingEntity.percent = model.percent;
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_performance_planInputModel> model)
public string UpdateMultiple(List<eva_performance_planInputModel> 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.theTime = i.theTime;
existingEntity.fiscal_year = i.fiscal_year;
existingEntity.theTime = i.theTime;
existingEntity.percent = i.percent;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}
@@ -216,15 +216,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();
}

View File

@@ -18,6 +18,6 @@ namespace TodoAPI2.Models
public int? theTime { get; set; }
public decimal? percent { get; set; }
}
}

View File

@@ -30,6 +30,8 @@ namespace TodoAPI2.Models
public decimal? cost_living { get; set; }
public decimal? position_allowance { get; set; }
public decimal? monthly_compensation { get; set; }
}
}

View File

@@ -30,6 +30,10 @@ namespace TodoAPI2.Models
public decimal? cost_living { get; set; }
public decimal? position_allowance { get; set; }
public decimal? monthly_compensation { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -20,14 +20,14 @@ namespace TodoAPI2.Models
public class eva_salary_cylinderService : Ieva_salary_cylinderService
{
private IBaseRepository2<eva_salary_cylinderEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private IMyDatabase db;
private Iexternal_linkageService ext;
public eva_salary_cylinderService(IBaseRepository2<eva_salary_cylinderEntity, 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_salary_cylinderViewModel>>(entities);
}
#endregion
#region Public Functions
@@ -93,7 +93,7 @@ namespace TodoAPI2.Models
from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty()
where m_eva_salary_cylinder.position_type == position_type || !position_type.HasValue
where m_eva_salary_cylinder.position_type == position_type || !position_type.HasValue
orderby m_eva_salary_cylinder.created descending
select new eva_salary_cylinderViewModel()
@@ -105,7 +105,9 @@ namespace TodoAPI2.Models
themin = m_eva_salary_cylinder.themin,
themax = m_eva_salary_cylinder.themax,
middle = m_eva_salary_cylinder.middle,
cost_living = m_eva_salary_cylinder.cost_living ,
cost_living = m_eva_salary_cylinder.cost_living,
position_allowance = m_eva_salary_cylinder.position_allowance,
monthly_compensation = m_eva_salary_cylinder.monthly_compensation,
position_type_external_linkage_external_name = fk_external_linkageResult1.external_name,
position_level_external_linkage_external_name = fk_external_linkageResult2.external_name,
@@ -119,7 +121,7 @@ namespace TodoAPI2.Models
return data;
}
public List<eva_salary_cylinderViewModel> GetListBySearch(eva_salary_cylinderSearchModel model)
public List<eva_salary_cylinderViewModel> GetListBySearch(eva_salary_cylinderSearchModel model)
{
var data = (
from m_eva_salary_cylinder in _repository.Context.eva_salary_cylinder
@@ -133,7 +135,7 @@ namespace TodoAPI2.Models
from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty()
where 1==1
where 1 == 1
&& (m_eva_salary_cylinder.position_type == model.position_type || !model.position_type.HasValue)
@@ -147,7 +149,9 @@ namespace TodoAPI2.Models
themin = m_eva_salary_cylinder.themin,
themax = m_eva_salary_cylinder.themax,
middle = m_eva_salary_cylinder.middle,
cost_living = m_eva_salary_cylinder.cost_living ,
cost_living = m_eva_salary_cylinder.cost_living,
position_allowance = m_eva_salary_cylinder.position_allowance,
monthly_compensation = m_eva_salary_cylinder.monthly_compensation,
position_type_external_linkage_external_name = fk_external_linkageResult1.external_name,
position_level_external_linkage_external_name = fk_external_linkageResult2.external_name,
@@ -161,6 +165,7 @@ namespace TodoAPI2.Models
return data;
}
#endregion
#region Manipulation Functions
@@ -170,10 +175,10 @@ namespace TodoAPI2.Models
int? newkey = 0;
var x = (from i in _repository.Context.eva_salary_cylinder
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;
}
@@ -189,7 +194,7 @@ namespace TodoAPI2.Models
var inserted = _repository.Insert(entity);
return Get(inserted.id);
}
@@ -204,33 +209,35 @@ namespace TodoAPI2.Models
existingEntity.themin = model.themin;
existingEntity.themax = model.themax;
existingEntity.middle = model.middle;
existingEntity.cost_living = model.cost_living ;
existingEntity.cost_living = model.cost_living;
existingEntity.position_allowance = model.position_allowance;
existingEntity.monthly_compensation = model.monthly_compensation;
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_salary_cylinderInputModel> model)
public string UpdateMultiple(List<eva_salary_cylinderInputModel> 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.position_type = i.position_type;
existingEntity.position_level = i.position_level;
existingEntity.temporary_min = i.temporary_min;
existingEntity.themin = i.themin;
existingEntity.themax = i.themax;
existingEntity.middle = i.middle;
existingEntity.cost_living = i.cost_living ;
existingEntity.position_type = i.position_type;
existingEntity.position_level = i.position_level;
existingEntity.temporary_min = i.temporary_min;
existingEntity.themin = i.themin;
existingEntity.themax = i.themax;
existingEntity.middle = i.middle;
existingEntity.cost_living = i.cost_living;
existingEntity.position_allowance = i.position_allowance;
existingEntity.monthly_compensation = i.monthly_compensation;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}
@@ -242,15 +249,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();
}

View File

@@ -28,6 +28,10 @@ namespace TodoAPI2.Models
public decimal? cost_living { get; set; }
public decimal? position_allowance { get; set; }
public decimal? monthly_compensation { get; set; }
public string position_type_external_linkage_external_name { get; set; }
public string position_level_external_linkage_external_name { get; set; }

View File

@@ -94,9 +94,9 @@ namespace TodoAPI2.Models
select x.fiscal_year).Distinct().OrderBy(x => x.Value).ToList();
i.item_eva_year = fill_list_number((from x in _repository.Context.eva_adjust_postponement
select x.fiscal_year).Distinct().OrderBy(x => x.Value).ToList());
select x.fiscal_year).Distinct().OrderByDescending(x => x.Value).ToList());
i.item_eva_no = fill_list_number((from x in _repository.Context.eva_adjust_postponement
select x.theRound).Distinct().OrderBy(x => x.Value).ToList());
select x.theRound).Distinct().OrderByDescending(x => x.Value).ToList());
return i;
}
@@ -104,9 +104,9 @@ namespace TodoAPI2.Models
{
var i = new eva_self_reviewWithSelectionViewModel();
i.item_eva_year = fill_list_number((from x in _repository.Context.eva_adjust_postponement
select x.fiscal_year).Distinct().OrderBy(x => x.Value).ToList());
select x.fiscal_year).Distinct().OrderByDescending(x => x.Value).ToList());
i.item_eva_no = fill_list_number((from x in _repository.Context.eva_adjust_postponement
select x.theRound).Distinct().OrderBy(x => x.Value).ToList());
select x.theRound).Distinct().OrderByDescending(x => x.Value).ToList());
return i;
@@ -145,28 +145,30 @@ namespace TodoAPI2.Models
(model.employee_id.HasValue && m_eva_self_review.employee_id == model.employee_id)
&& (!model.eva_year.HasValue || fk_eva_adjust_postponementResult1.fiscal_year == model.eva_year)
&& (!model.eva_no.HasValue || fk_eva_adjust_postponementResult1.theRound == model.eva_no)
&& fk_eva_adjust_postponementResult1.fiscal_year.HasValue
orderby m_eva_self_review.created descending
orderby
(fk_eva_adjust_postponementResult1.fiscal_year.HasValue ? fk_eva_adjust_postponementResult1.fiscal_year : fk_eva_adjust_postponementResult2.fiscal_year) descending,
(fk_eva_adjust_postponementResult1.theRound.HasValue ? fk_eva_adjust_postponementResult1.theRound : fk_eva_adjust_postponementResult2.theRound) descending
select new eva_self_reviewViewModel()
{
id = m_eva_self_review.id,
adjust_postponement_id = m_eva_self_review.adjust_postponement_id,
adjust_postponement_quota_id = m_eva_self_review.adjust_postponement_quota_id,
employee_id = m_eva_self_review.employee_id,
eva_year = fk_eva_adjust_postponementResult1.fiscal_year,
eva_no = fk_eva_adjust_postponementResult1.theRound,
eva_year = (fk_eva_adjust_postponementResult1.fiscal_year.HasValue? fk_eva_adjust_postponementResult1.fiscal_year : fk_eva_adjust_postponementResult2.fiscal_year),
eva_no = fk_eva_adjust_postponementResult1.theRound.HasValue? fk_eva_adjust_postponementResult1.theRound : fk_eva_adjust_postponementResult2.theRound,
adjust_postponement_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult1.fiscal_year,
adjust_postponement_quota_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult2.fiscal_year,
eva_year_external_linkage_external_name = fk_eva_adjust_postponementResult1.fiscal_year.ToString(),
eva_no_external_linkage_external_name = fk_eva_adjust_postponementResult1.theRound.ToString(),
adjust_postponement_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult1.fiscal_year.HasValue ? fk_eva_adjust_postponementResult1.fiscal_year : fk_eva_adjust_postponementResult2.fiscal_year,
adjust_postponement_quota_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult1.theRound.HasValue ? fk_eva_adjust_postponementResult1.theRound : fk_eva_adjust_postponementResult2.theRound,
eva_year_external_linkage_external_name = (fk_eva_adjust_postponementResult1.fiscal_year.HasValue ? fk_eva_adjust_postponementResult1.fiscal_year : fk_eva_adjust_postponementResult2.fiscal_year).ToString(),
eva_no_external_linkage_external_name = (fk_eva_adjust_postponementResult1.theRound.HasValue ? fk_eva_adjust_postponementResult1.theRound : fk_eva_adjust_postponementResult2.theRound).ToString(),
isActive = m_eva_self_review.isActive,
Created = m_eva_self_review.created,
Updated = m_eva_self_review.updated
}
).OrderBy(x => x.eva_year * 10 + x.eva_no).ToList();
).ToList();
return data;
}

View File

@@ -241,7 +241,7 @@ namespace TodoAPI2.Models
public string RecieveFingerScanFromLocal(List<fingerscanDataModel> model)
{
var all_emp = emp.GetListByemployee_type(null, null);
var all_emp = emp.GetAllEmployee();
//var result = (from i in model
// join e in all_emp on ClearName(i.fullname) equals ClearName(e.halfname)

View File

@@ -95,7 +95,9 @@ hpt.position_type_name,he.packing_date,he.cost_of_living,
LIMIT 1) IS NOT null THEN 'ช่วยปฎิบัติหน้าที่'
ELSE null END) as remark_hrm_work_record,
org_type_depart.department_degree_id, he.timerecorder_id
org_type_depart.department_degree_id, he.timerecorder_id,
(select count(*) from hrm_resigns where hrm_resigns.employee_id = he.employee_id) as count_resigns,
he.workingstatus
from public.hrm_employees as he
left join public.hrm_position_types as hpt on he.position_type_id=hpt.id
@@ -108,6 +110,30 @@ left join public.hrm_employee_types as het on het.id = he.employee_type_id
left join public.users as u on u.employee_id = he.employee_id
left join public.org_type_departments as org_type_depart on orgdata.department_type_id = org_type_depart.id
left join public.org_type_department_colors as org_depart_color on org_type_depart.department_degree_id = org_depart_color.id
left join (select orgdata.id,orgdata2.id as id2,
case when orgdata2.department_name is not null then
concat(orgdata2.department_name,' - ',orgdata.department_name)
else orgdata.department_name end as full_dep,
orgdata.department_name,
orgdata.department_code,detail.parent_department_id,
case
when org_type_depart.department_degree_id = 1 then orgdata.department_code::int*1000
when detail.parent_department_id is not null and detail.parent_department_id>0
then orgdata2.department_code::int*1000+orgdata.department_code::int
else orgdata.department_code::int*100000 end as sort_order,org_type_depart.department_degree_id
from public.{0}DepartmentData{0} orgdata
left join org_organization_chart_details detail on orgdata.id = detail.department_id
left join public.{0}DepartmentData{0} orgdata2 on orgdata2.id = detail.parent_department_id
left join public.org_type_departments as org_type_depart on orgdata.department_type_id = org_type_depart.id
left join public.org_type_department_colors as org_depart_color
on org_type_depart.department_degree_id = org_depart_color.id
where orgdata.department_name is not null
order by case
when org_type_depart.department_degree_id = 1 then orgdata.department_code::int*1000
when detail.parent_department_id is not null and detail.parent_department_id>0
then orgdata2.department_code::int*1000+orgdata.department_code::int
else orgdata.department_code::int*100000 end) as sorting_dep
on sorting_dep.id = he.department_id
where he.deleted_at is null
and hpt.deleted_at is null
and hpl.deleted_at is null
@@ -119,7 +145,7 @@ and het.deleted_at is null
and u.deleted_at is null
and org_type_depart.deleted_at is null
and org_depart_color.deleted_at is null
order by he.firstname, he.lastname;
order by sorting_dep.sort_order, hpt.position_type_id, hpl.position_level_id, employee_no desc;
", '"'.ToString());
var para = db.GetParameterListNpgsql();
DataTable dt = db.ExecuteDataTableNpgsql(sql, para);
@@ -210,6 +236,15 @@ order by he.firstname, he.lastname;
{
i.timerecorder_id = "";
}
if (dr["count_resigns"] != DBNull.Value)
{
i.count_resigns = Convert.ToInt32(dr["count_resigns"]);
}
else
{
i.count_resigns = 0;
}
i.workingstatus = dr["workingstatus"].ToString();
result.Add(i);
}
@@ -227,7 +262,7 @@ left join public.mpp_position_numbers as mpn on he.position_no = mpn.id
left join public.org_position_datas as opd on opd.position_id = mpn.position_id
left join public.hrm_title_masters as htm on htm.id = he.prefix_card_name
left join public.users as u on u.employee_id = he.employee_id
where he.workingstatus = 'สถานะปฏิบัติงาน' and he.deleted_at is null and mpn.deleted_at is null
where he.deleted_at is null and mpn.deleted_at is null
and opd.deleted_at is null --and htm.deleted_at is null
and u.id=@user_id;
";

View File

@@ -69,6 +69,9 @@ namespace TodoAPI2.Models
public string profile_picture { get; set; }
public string timerecorder_id { get; set; }
public int count_resigns { get; set; }
public string workingstatus { get; set; }
public int? worked_month // ทำงานมาแล้วกี่เดือน
{

View File

@@ -72,7 +72,7 @@ namespace TodoAPI2.Models
var i = new external_linkageViewModel();
i.external_id = Convert.ToInt32(dr["id"]);
i.external_code = dr["position_type_id"].ToString();
i.external_name = dr["position_type_id"].ToString() + " " + dr["position_type_name"].ToString();
i.external_name = dr["position_type_name"].ToString();
result.Add(i);
}
return result;
@@ -89,7 +89,7 @@ namespace TodoAPI2.Models
var i = new external_linkageViewModel();
i.external_id = Convert.ToInt32(dr["id"]);
i.external_code = dr["position_level_id"].ToString();
i.external_name = dr["position_level_id"].ToString() + " " + dr["position_level_name"].ToString();
i.external_name = dr["position_level_name"].ToString();
result.Add(i);
}
return result;
@@ -286,21 +286,125 @@ namespace TodoAPI2.Models
public List<external_linkageViewModel> GetDepartmentData()
{
var sql = string.Format("select * from public.{0}DepartmentData{0} where department_name != '' and deleted_at is null order by department_name; ", '"'.ToString());
var para = db.GetParameterListNpgsql();
DataTable dt = db.ExecuteDataTableNpgsql(sql, para);
var sql_parent = string.Format("select" +
" org_chart_detail.department_id," +
" org_depart.department_code," +
" (case when org_chart_detail.department_id is not null then" +
" (select org_short.department_name" +
" from public.org_department_version_names as org_short" +
" where org_short.deleted_at is null" +
" and org_short.department_id = org_chart_detail.department_id" +
" and org_short.effective_date <= now()" +
" order by org_short.effective_date desc limit 1) else null end) as department_name," +
" (case when cast(org_chart_detail.parent_department_id AS int) < 0 then" +
" (select org.organization_name from public.org_organization_datas as org" +
" where org.deleted_at is null" +
" and org.organization_id = ABS(org_chart_detail.parent_department_id))" +
" else (select org_department_version.department_name from public.org_department_version_names as org_department_version" +
" where org_department_version.deleted_at is null" +
" and org_department_version.department_id = ABS(org_chart_detail.parent_department_id)" +
" and org_department_version.effective_date <= now()" +
" order by org_department_version.effective_date desc limit 1)" +
" end) as parent_name," +
" cast(org_chart_detail.parent_department_id as int) as parent_department_id" +
" from public.org_organization_chart_details as org_chart_detail" +
" left join public.org_organization_charts as org_chart on org_chart_detail.organization_chart_id = org_chart.id" +
" left join public.org_department_datas as org_depart on org_chart_detail.department_id = org_depart.id" +
" left join public.org_type_departments as org_type_depart on org_depart.department_type_id = org_type_depart.id" +
" where org_chart_detail.deleted_at is null" +
" and org_chart.deleted_at is null" +
" and org_depart.deleted_at is null" +
" and org_type_depart.deleted_at is null" +
" and org_chart.version = (select max(max_org_chart.version) from public.org_organization_charts as max_org_chart where max_org_chart.deleted_at is null and max_org_chart.effective_date <= now())" +
" and org_chart_detail.parent_department_id <= 0" +
" order by cast(org_depart.department_code as int) asc;", '"'.ToString());
var sql_childs = string.Format("select" +
" org_chart_detail.department_id," +
" org_depart.department_code," +
" (case when org_chart_detail.department_id is not null then" +
" (select org_short.department_name" +
" from public.org_department_version_names as org_short" +
" where org_short.deleted_at is null" +
" and org_short.department_id = org_chart_detail.department_id" +
" and org_short.effective_date <= now()" +
" order by org_short.effective_date desc limit 1) else null end) as department_name," +
" (case when cast(org_chart_detail.parent_department_id AS int) < 0 then" +
" (select org.organization_name from public.org_organization_datas as org" +
" where org.deleted_at is null" +
" and org.organization_id = ABS(org_chart_detail.parent_department_id))" +
" else (select org_department_version.department_name from public.org_department_version_names as org_department_version" +
" where org_department_version.deleted_at is null" +
" and org_department_version.department_id = ABS(org_chart_detail.parent_department_id)" +
" and org_department_version.effective_date <= now()" +
" order by org_department_version.effective_date desc limit 1)" +
" end) as parent_name," +
" cast(org_chart_detail.parent_department_id as int) as parent_department_id" +
" from public.org_organization_chart_details as org_chart_detail" +
" left join public.org_organization_charts as org_chart on org_chart_detail.organization_chart_id = org_chart.id" +
" left join public.org_department_datas as org_depart on org_chart_detail.department_id = org_depart.id" +
" left join public.org_type_departments as org_type_depart on org_depart.department_type_id = org_type_depart.id" +
" where org_chart_detail.deleted_at is null" +
" and org_chart.deleted_at is null" +
" and org_depart.deleted_at is null" +
" and org_type_depart.deleted_at is null" +
" and org_chart.version = (select max(max_org_chart.version) from public.org_organization_charts as max_org_chart where max_org_chart.deleted_at is null and max_org_chart.effective_date <= now())" +
" and org_chart_detail.parent_department_id > 0" +
" order by cast(org_depart.department_code as int) asc;", '"'.ToString());
var p_para = db.GetParameterListNpgsql();
DataTable data_parent = db.ExecuteDataTableNpgsql(sql_parent, p_para);
var c_para = db.GetParameterListNpgsql();
DataTable data_childs = db.ExecuteDataTableNpgsql(sql_childs, c_para);
var result = new List<external_linkageViewModel>();
foreach (DataRow dr in dt.Rows)
foreach (DataRow parent_depart in data_parent.Rows)
{
var i = new external_linkageViewModel();
i.external_id = Convert.ToInt32(dr["id"]);
i.external_code = dr["department_code"].ToString();
i.external_name = dr["department_name"].ToString();
i.external_id = Convert.ToInt32(parent_depart["department_id"]);
i.external_code = parent_depart["department_code"].ToString();
i.external_name = parent_depart["department_name"].ToString();
result.Add(i);
var val_department_id = Convert.ToInt32(parent_depart["department_id"]);
var val_department_name = parent_depart["department_name"].ToString();
RecursiveLoopDepartmentParentToChilds(result, val_department_id, val_department_name, data_childs);
}
return result;
}
public void RecursiveLoopDepartmentParentToChilds(List<external_linkageViewModel> result, int param_department_id, string param_department_name, DataTable data_childs)
{
foreach(DataRow childs_parent in data_childs.Rows)
{
var val_parent_department_id = Convert.ToInt32(childs_parent["parent_department_id"]);
if (val_parent_department_id == param_department_id)
{
var i = new external_linkageViewModel();
i.external_id = Convert.ToInt32(childs_parent["department_id"]);
i.external_code = childs_parent["department_code"].ToString();
i.external_name = param_department_name + " - " + childs_parent["department_name"].ToString();
result.Add(i);
var val_child_department_id = Convert.ToInt32(childs_parent["department_id"]);
var val_child_department_name = childs_parent["department_name"].ToString();
RecursiveLoopDepartmentParentToChilds(result, val_child_department_id, val_child_department_name, data_childs);
}
}
return;
}
// FOR REPORT
public List<external_linkageViewModel> GetDepartmentDataForReport()
@@ -440,7 +544,7 @@ namespace TodoAPI2.Models
var i = new external_linkageViewModel();
i.external_id = Convert.ToInt32(dr["id"]);
//i.id_guid = Guid.Parse(dr["id"].ToString());
i.external_code = dr["theRound"].ToString();
i.external_code = dr["fiscal_year"].ToString() + dr["theRound"].ToString();
i.external_name = dr["theRound"].ToString() + "/" + dr["fiscal_year"].ToString();
result.Add(i);
}

View File

@@ -58,7 +58,7 @@ namespace TodoAPI2.Models
var entity = _repository.Get(id);
var i = Mapper.Map<rep_eva01WithSelectionViewModel>(entity);
i.item_org_id = (from x in ext.GetSortingDep() select x).ToList();
i.item_round_id = (from x in ext.GetEvaRound() select x).ToList();
i.item_round_id = (from x in ext.GetEvaRound() orderby x.external_code descending select x).ToList();
return i;
@@ -67,7 +67,7 @@ namespace TodoAPI2.Models
{
var i = new rep_eva01WithSelectionViewModel();
i.item_org_id = (from x in ext.GetSortingDep() select x).ToList();
i.item_round_id = (from x in ext.GetEvaRound() select x).ToList();
i.item_round_id = (from x in ext.GetEvaRound() orderby x.external_code descending select x).ToList();
return i;

View File

@@ -58,7 +58,7 @@ namespace TodoAPI2.Models
var entity = _repository.Get(id);
var i = Mapper.Map<rep_eva02WithSelectionViewModel>(entity);
i.item_org_id = (from x in ext.GetSortingDep() select x).ToList();
i.item_round_id = (from x in ext.GetEvaRound() select x).ToList();
i.item_round_id = (from x in ext.GetEvaRound() orderby x.external_code descending select x).ToList();
return i;
@@ -67,7 +67,7 @@ namespace TodoAPI2.Models
{
var i = new rep_eva02WithSelectionViewModel();
i.item_org_id = (from x in ext.GetSortingDep() select x).ToList();
i.item_round_id = (from x in ext.GetEvaRound() select x).ToList();
i.item_round_id = (from x in ext.GetEvaRound() orderby x.external_code descending select x).ToList();
return i;

Some files were not shown because too many files have changed in this diff Show More