From 1ca6d4955d70eed553ac69b1e1b928dd2b0c9a90 Mon Sep 17 00:00:00 2001 From: Nakorn Rientrakrunchai Date: Fri, 28 Feb 2020 13:09:50 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=AB=E0=B8=99=E0=B9=89=E0=B8=B2=20=E0=B8=9B=E0=B8=A3?= =?UTF-8?q?=E0=B8=B1=E0=B8=9A=E0=B9=80=E0=B8=A5=E0=B8=B7=E0=B9=88=E0=B8=AD?= =?UTF-8?q?=E0=B8=99=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80=E0=B8=94?= =?UTF-8?q?=E0=B8=B7=E0=B8=AD=E0=B8=99=20=E0=B9=81=E0=B8=A5=E0=B8=B0?= =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B9=82=E0=B8=84=E0=B8=A7?= =?UTF-8?q?=E0=B8=95=E0=B9=89=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...t_postponement_detail_normalControllers.cs | 42 +-- ...ostponement_detail_normal_02Controllers.cs | 355 ++++++++++++++++++ ...postponement_detail_quota_02Controllers.cs | 355 ++++++++++++++++++ ..._adjust_postponement_detail_normal_02.xlsx | Bin 0 -> 11061 bytes ...a_adjust_postponement_detail_quota_02.xlsx | Bin 0 -> 11202 bytes .../eva_adjust_postponementService.cs | 11 +- ...djust_postponement_detail_normalService.cs | 2 +- ...djust_postponement_detail_normalService.cs | 39 +- ...st_postponement_detail_normal_02Service.cs | 28 ++ ...postponement_detail_normal_02InputModel.cs | 56 +++ ...ment_detail_normal_02ReportRequestModel.cs | 21 ++ ...ostponement_detail_normal_02SearchModel.cs | 23 ++ ...st_postponement_detail_normal_02Service.cs | 284 ++++++++++++++ ..._postponement_detail_normal_02ViewModel.cs | 52 +++ ..._detail_normal_02WithSelectionViewModel.cs | 12 + ...ust_postponement_detail_quota_02Service.cs | 28 ++ ..._postponement_detail_quota_02InputModel.cs | 58 +++ ...ement_detail_quota_02ReportRequestModel.cs | 21 ++ ...postponement_detail_quota_02SearchModel.cs | 23 ++ ...ust_postponement_detail_quota_02Service.cs | 290 ++++++++++++++ ...t_postponement_detail_quota_02ViewModel.cs | 56 +++ ...t_detail_quota_02WithSelectionViewModel.cs | 12 + ...va_adjust_postponement_normalInputModel.cs | 2 + .../eva_adjust_postponement_normalService.cs | 18 +- ...eva_adjust_postponement_quotaInputModel.cs | 2 + .../eva_adjust_postponement_quotaService.cs | 154 +++++++- .../external_employeeService.cs | 5 + Startup.cs | 12 +- ...ostponement_detail_normal_02_inline.cshtml | 83 ++++ ...postponement_detail_quota_02_inline.cshtml | 85 +++++ .../eva_adjust_postponement_normal.cshtml | 25 +- .../eva_adjust_postponement_normal_d.cshtml | 180 +++------ .../eva_adjust_postponement_quota.cshtml | 13 +- .../eva_adjust_postponement_quota_d.cshtml | 143 ++----- appsettings.Development.json | 4 +- appsettings.Production.json | 4 +- appsettings.Staging.json | 4 +- tb320eva.xml | 226 ++++++++++- .../eva_adjust_postponement_detail_normal.js | 2 +- ...st_postponement_detail_normal_02_inline.js | 200 ++++++++++ ...ust_postponement_detail_quota_02_inline.js | 208 ++++++++++ .../eva_adjust_postponement_normal_d.js | 64 +++- .../eva_adjust_postponement_quota_d.js | 24 +- 43 files changed, 2854 insertions(+), 372 deletions(-) create mode 100644 ApiControllers/eva_adjust_postponement_detail_normal_02Controllers.cs create mode 100644 ApiControllers/eva_adjust_postponement_detail_quota_02Controllers.cs create mode 100644 EXCEL/eva_adjust_postponement_detail@eva_adjust_postponement_detail_normal_02.xlsx create mode 100644 EXCEL/eva_adjust_postponement_detail@eva_adjust_postponement_detail_quota_02.xlsx create mode 100644 Models/eva_adjust_postponement_detail_normal_02/Ieva_adjust_postponement_detail_normal_02Service.cs create mode 100644 Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02InputModel.cs create mode 100644 Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02ReportRequestModel.cs create mode 100644 Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02SearchModel.cs create mode 100644 Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02Service.cs create mode 100644 Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02ViewModel.cs create mode 100644 Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02WithSelectionViewModel.cs create mode 100644 Models/eva_adjust_postponement_detail_quota_02/Ieva_adjust_postponement_detail_quota_02Service.cs create mode 100644 Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02InputModel.cs create mode 100644 Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02ReportRequestModel.cs create mode 100644 Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02SearchModel.cs create mode 100644 Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02Service.cs create mode 100644 Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02ViewModel.cs create mode 100644 Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02WithSelectionViewModel.cs create mode 100644 Views/eva_adjust_postponement_detail_normal_02View/eva_adjust_postponement_detail_normal_02_inline.cshtml create mode 100644 Views/eva_adjust_postponement_detail_quota_02View/eva_adjust_postponement_detail_quota_02_inline.cshtml create mode 100644 wwwroot/js/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02_inline.js create mode 100644 wwwroot/js/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02_inline.js diff --git a/ApiControllers/eva_adjust_postponement_detail_normalControllers.cs b/ApiControllers/eva_adjust_postponement_detail_normalControllers.cs index c303a81..54e1aea 100644 --- a/ApiControllers/eva_adjust_postponement_detail_normalControllers.cs +++ b/ApiControllers/eva_adjust_postponement_detail_normalControllers.cs @@ -271,47 +271,7 @@ namespace TodoAPI2.Controllers return BadRequest(ModelState); } - - /// - /// ReCreatePostponementDetailNormal - /// - /// - /// - /// - /// Response Result Message - /// Response Result Message - /// If the model is invalid - /// Error Occurred - [HttpPut("ReCreatePostponementDetailNormal")] - [ProducesResponseType(typeof(CommonResponseMessage), 200)] - [ProducesResponseType(400)] - [ProducesResponseType(500)] - //[ValidateAntiForgeryToken] - public IActionResult ReCreatePostponementDetailNormal(int? adjust_postponement_id) - { - if (ModelState.IsValid) - { - try - { - if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); - var result = _repository.ReCreatePostponementDetailNormal(adjust_postponement_id); - string rowCount = _repository.ReCreatePostponementDetailNormal(adjust_postponement_id); - var message = new CommonResponseMessage(); - message.code = "200"; - message.message = "ปรับปรุงข้อมูลเรียบร้อย จำนวน " + rowCount + " รายการ"; - message.data = null; - return Ok(message); - } - catch (Exception ex) - { - _logger.LogCritical($"Exception while ReCreatePostponementDetailNormal.", ex); - return StatusCode(500, $"Exception while ReCreatePostponementDetailNormal. {ex.Message}"); - } - } - - return BadRequest(ModelState); - } - + /// /// Delete item /// diff --git a/ApiControllers/eva_adjust_postponement_detail_normal_02Controllers.cs b/ApiControllers/eva_adjust_postponement_detail_normal_02Controllers.cs new file mode 100644 index 0000000..cbc6a29 --- /dev/null +++ b/ApiControllers/eva_adjust_postponement_detail_normal_02Controllers.cs @@ -0,0 +1,355 @@ +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; + +namespace TodoAPI2.Controllers +{ + //[Authorize] + [Produces("application/json")] + [Route("api/eva_adjust_postponement_detail_normal_02")] + public class eva_adjust_postponement_detail_normal_02Controller : BaseController + { + #region Private Variables + private ILogger _logger; + private Ieva_adjust_postponement_detail_normal_02Service _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_adjust_postponement_detail_normal_02Controller(ILogger logger, Ieva_adjust_postponement_detail_normal_02Service repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + /// + /// Get specific item by id + /// + /// + /// + /// Return Get specific item by id + /// Returns the item + /// Error Occurred + [HttpGet("{id}")] + [ProducesResponseType(typeof(eva_adjust_postponement_detail_normal_02WithSelectionViewModel), 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, $"Exception in IActionResult Get. {ex.Message}"); + } + } + + /// + /// Get Blank Item + /// + /// + /// + /// Return a blank item + /// Returns the item + /// Error Occurred + [HttpGet("GetBlankItem")] + [ProducesResponseType(typeof(eva_adjust_postponement_detail_normal_02WithSelectionViewModel), 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, $"Exception in IActionResult GetBlankItem. {ex.Message}"); + } + } + + /// + /// Get list items by adjust_postponement_id + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetList(int? adjust_postponement_id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListByadjust_postponement_id(adjust_postponement_id)); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetList.", ex); + return StatusCode(500, $"Exception in IActionResult GetList. {ex.Message}"); + } + } + + /// + /// Get list items by search + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("GetListBySearch")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetListBySearch(eva_adjust_postponement_detail_normal_02SearchModel 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, $"Exception in IActionResult GetListBySearch. {ex.Message}"); + } + } + + /// + /// Download Report + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("eva_adjust_postponement_detail_normal_02_report")] + [ProducesResponseType(typeof(FileStreamResult), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult eva_adjust_postponement_detail_normal_02_report(eva_adjust_postponement_detail_normal_02ReportRequestModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var httpclient = MyHelper.getHttpClient(Configuration); + string mainurl = Configuration["JasperReportServer:MainURL"]; + + string url = $"{mainurl}/ro519eva/eva_adjust_postponement_detail_normal_02_report.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}"; + + 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, $"Exception while GetReport. {ex.Message}"); + } + } + + /// + /// Create new item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPost("")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Insert([FromBody] eva_adjust_postponement_detail_normal_02InputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.Insert(model); + 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, $"Exception while insert. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Update item + /// + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("{id}")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Update(int id, [FromBody] eva_adjust_postponement_detail_normal_02InputModel model) + { + if (ModelState.IsValid) + { + 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); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while update {id.ToString()}.", ex); + return StatusCode(500, $"Exception while update {id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Delete item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [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, $"Exception while delete {id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Update multiple item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("UpdateMultiple")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult UpdateMultiple([FromBody] List model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + string rowCount = _repository.UpdateMultiple(model); + 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, $"Exception while UpdateMultiple. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + + } +} diff --git a/ApiControllers/eva_adjust_postponement_detail_quota_02Controllers.cs b/ApiControllers/eva_adjust_postponement_detail_quota_02Controllers.cs new file mode 100644 index 0000000..77753ec --- /dev/null +++ b/ApiControllers/eva_adjust_postponement_detail_quota_02Controllers.cs @@ -0,0 +1,355 @@ +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; + +namespace TodoAPI2.Controllers +{ + //[Authorize] + [Produces("application/json")] + [Route("api/eva_adjust_postponement_detail_quota_02")] + public class eva_adjust_postponement_detail_quota_02Controller : BaseController + { + #region Private Variables + private ILogger _logger; + private Ieva_adjust_postponement_detail_quota_02Service _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_adjust_postponement_detail_quota_02Controller(ILogger logger, Ieva_adjust_postponement_detail_quota_02Service repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + /// + /// Get specific item by id + /// + /// + /// + /// Return Get specific item by id + /// Returns the item + /// Error Occurred + [HttpGet("{id}")] + [ProducesResponseType(typeof(eva_adjust_postponement_detail_quota_02WithSelectionViewModel), 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, $"Exception in IActionResult Get. {ex.Message}"); + } + } + + /// + /// Get Blank Item + /// + /// + /// + /// Return a blank item + /// Returns the item + /// Error Occurred + [HttpGet("GetBlankItem")] + [ProducesResponseType(typeof(eva_adjust_postponement_detail_quota_02WithSelectionViewModel), 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, $"Exception in IActionResult GetBlankItem. {ex.Message}"); + } + } + + /// + /// Get list items by adjust_postponement_quota_id + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetList(int? adjust_postponement_quota_id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListByadjust_postponement_quota_id(adjust_postponement_quota_id)); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetList.", ex); + return StatusCode(500, $"Exception in IActionResult GetList. {ex.Message}"); + } + } + + /// + /// Get list items by search + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("GetListBySearch")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetListBySearch(eva_adjust_postponement_detail_quota_02SearchModel 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, $"Exception in IActionResult GetListBySearch. {ex.Message}"); + } + } + + /// + /// Download Report + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("eva_adjust_postponement_detail_quota_02_report")] + [ProducesResponseType(typeof(FileStreamResult), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult eva_adjust_postponement_detail_quota_02_report(eva_adjust_postponement_detail_quota_02ReportRequestModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var httpclient = MyHelper.getHttpClient(Configuration); + string mainurl = Configuration["JasperReportServer:MainURL"]; + + string url = $"{mainurl}/ro519eva/eva_adjust_postponement_detail_quota_02_report.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}"; + + 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, $"Exception while GetReport. {ex.Message}"); + } + } + + /// + /// Create new item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPost("")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Insert([FromBody] eva_adjust_postponement_detail_quota_02InputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.Insert(model); + 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, $"Exception while insert. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Update item + /// + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("{id}")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Update(int id, [FromBody] eva_adjust_postponement_detail_quota_02InputModel model) + { + if (ModelState.IsValid) + { + 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); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while update {id.ToString()}.", ex); + return StatusCode(500, $"Exception while update {id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Delete item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [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, $"Exception while delete {id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Update multiple item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("UpdateMultiple")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult UpdateMultiple([FromBody] List model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + string rowCount = _repository.UpdateMultiple(model); + 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, $"Exception while UpdateMultiple. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + + } +} diff --git a/EXCEL/eva_adjust_postponement_detail@eva_adjust_postponement_detail_normal_02.xlsx b/EXCEL/eva_adjust_postponement_detail@eva_adjust_postponement_detail_normal_02.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..02c8e2f957b75c4bd75c284a8b521dfd0dee6953 GIT binary patch literal 11061 zcmeHt1y>zev-ZIb5Zv9}JvhPL-GaNj1b5fqF2Ny4aEIWo!5soYf;)kGGBfX;naq6O zAGmLywYpcY?s`u5?s|6BuBQ}bARy5JKmZH?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_S9O-tdLBLTpk#5rqPS2Ujk!goRExA&hPutycubtQ(9PRMIDUmTJP~2nrHml8ySvy49v(Vz;(N2Ru5!@BC z?R)Pe-+$0pI$ESai>1#h&t>G>_F3-76FF<2xXfQ}q!bxva?rlD%(L@+zl20`^d*>o zZZfB-_v{X77HMI$LhQb5*FAeY$@_lvfe7>^erGfoI0HyB{P)(s|9r3i9RH;eP*LXZ z0Do^v`j6qyV+n{9e`!(r)$s3)8hR|Lq}u2{Qj0 pbbbZ>`%L{OBmlro@t0@%W8PMjfdcs;000mAQG(p~{%5!Y{13L?QZN7j literal 0 HcmV?d00001 diff --git a/EXCEL/eva_adjust_postponement_detail@eva_adjust_postponement_detail_quota_02.xlsx b/EXCEL/eva_adjust_postponement_detail@eva_adjust_postponement_detail_quota_02.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..5371ed7f2bcabbb52f87c40bfba2c6f49b6c566a GIT binary patch literal 11202 zcmeHtWmFx@w)Mu{0>RxOxVyVUaJP*I*Wel~xI?hu9)gG9?(Xiv-R0Xy?#nqj_j}|0 zzqj`o-J?hKn!Brd&04E!E+ttANDKfp02TlMkN|`^14eDZ002lR0012T3$7z-XX^~K zbv97-um?KnF}T08AfZKqJS8P%b@;KMFopwto(+O%P~*HR=mL@4}N?s&%k zB$Xu|kXNSu@oP*3dp0)G$qDpiEsR{lf-!>?=?f_ZCVLG$>u&qG!Vi(sP(e|O@3cE5 z;CFKe{QVtT;IcF>*v4G$fhzR4GAkO*&B`pS>g1K_P6TQU2{#{UFuo`?*4z_G?+;91 zWb1vgz~K=k60$4cB#&Zb&B3Uh5ykaL4V#tZqE#$y5m`53sc$5zK7P_mD77CyljAM7 zQsJYj;s!!U`hNF$99UfD`?%jna=pP;7V!#$m#ogMJS6$v!3Bnv(lJTGp=`Yi&2{=} z`Z`ro#)I1Rdo*onLs5=w|0Atf`1wW7kL%HP+CsJScIT@SJS9tZ=kX+s2s=c+~wyZMFbmSrRFfg@g zyAVrnMSt?5SIFp7A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w^G=4E(R1No;B8WV#DfF!!0d5Il9%RiJuHUSa;7GEcl}kx%PIo zX?x4|^IC`66`y1bqnU_y-vmNcZt1GZ)k8fb5D>T&Z#ApwSo4)}YjXCGQQxsB)fGa6v;kUU{>ZWGH~xU6g>xyO4}b|$(7`E z((Iab<;Z65V2ckeqN-cjWEcn&B+1O6)R{0i{vrqfS=9jrh4^gmlrzncEK repository, IMyDatabase mydb, Iexternal_linkageService inext, - Iexternal_employeeService inemp) + Iexternal_employeeService inemp, + Ieva_adjust_postponement_detail_normalService indetail) { _repository = repository; db = mydb; ext = inext; emp = inemp; + detail = indetail; } #region Private Functions @@ -166,9 +169,9 @@ namespace TodoAPI2.Models var entity = GetEntity(model); entity.id = GetNewPrimaryKey(); - - var inserted = _repository.Insert(entity); + + detail.ReCreatePostponementDetailNormal(entity); return Get(inserted.id); } @@ -257,6 +260,8 @@ namespace TodoAPI2.Models } public void Delete(int id) { + + _repository.Delete(id); return; diff --git a/Models/eva_adjust_postponement_detail_normal/Ieva_adjust_postponement_detail_normalService.cs b/Models/eva_adjust_postponement_detail_normal/Ieva_adjust_postponement_detail_normalService.cs index 71966d9..eae7570 100644 --- a/Models/eva_adjust_postponement_detail_normal/Ieva_adjust_postponement_detail_normalService.cs +++ b/Models/eva_adjust_postponement_detail_normal/Ieva_adjust_postponement_detail_normalService.cs @@ -21,7 +21,7 @@ namespace TodoAPI2.Models eva_adjust_postponement_detail_normalWithSelectionViewModel GetWithSelection(int id); eva_adjust_postponement_detail_normalWithSelectionViewModel GetBlankItem(); - string ReCreatePostponementDetailNormal(int? adjust_postponement_id); + string ReCreatePostponementDetailNormal(eva_adjust_postponementEntity entity); } } diff --git a/Models/eva_adjust_postponement_detail_normal/eva_adjust_postponement_detail_normalService.cs b/Models/eva_adjust_postponement_detail_normal/eva_adjust_postponement_detail_normalService.cs index f16dc3b..6f6ef85 100644 --- a/Models/eva_adjust_postponement_detail_normal/eva_adjust_postponement_detail_normalService.cs +++ b/Models/eva_adjust_postponement_detail_normal/eva_adjust_postponement_detail_normalService.cs @@ -209,8 +209,10 @@ namespace TodoAPI2.Models throw new NotificationException("No data to update"); } - public string ReCreatePostponementDetailNormal(int? adjust_postponement_id) + public string ReCreatePostponementDetailNormal(eva_adjust_postponementEntity entity) { + int? adjust_postponement_id = entity.id; + var cylinder = (from z in _repository.Context.eva_salary_cylinder select z).ToList(); @@ -221,17 +223,24 @@ namespace TodoAPI2.Models select i; _repository.Context.RemoveRange(olddata); - var adjust_postponement = (from j in _repository.Context.eva_adjust_postponement - where j.id == adjust_postponement_id - select j).FirstOrDefault(); + var adjust_postponement = entity; - 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 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; int newkey = GetNewPrimaryKey(); + decimal sum_salary = 0; - foreach (var m in current_eva_create_evaluation_detail) + 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(); @@ -245,6 +254,7 @@ namespace TodoAPI2.Models if (theemp.salary.HasValue) { n.sarary = theemp.salary; + sum_salary += n.sarary.Value; } else { @@ -272,14 +282,16 @@ namespace TodoAPI2.Models n.created = DateTime.Now; n.updated = DateTime.Now; - n.isActive = true; + n.isActive = true; _repository.Context.eva_adjust_postponement_detail.Add(n); } - _repository.Context.SaveChanges(); + entity.limit = sum_salary; - return current_eva_create_evaluation_detail.Count().ToString(); + //_repository.Context.SaveChanges(); + + return current_eva_evaluation_group_detail.Count().ToString(); } private eva_salary_cylinderEntity getCylinderForEmployee(external_employeeViewModel theemp, @@ -356,6 +368,11 @@ namespace TodoAPI2.Models } public void Delete(int id) { + var data = from i in _repository.Context.eva_adjust_postponement_detail + where i.adjust_postponement_quota_id == null && i.adjust_postponement_id == id + select i; + _repository.Context.RemoveRange(data); + _repository.Delete(id); return; diff --git a/Models/eva_adjust_postponement_detail_normal_02/Ieva_adjust_postponement_detail_normal_02Service.cs b/Models/eva_adjust_postponement_detail_normal_02/Ieva_adjust_postponement_detail_normal_02Service.cs new file mode 100644 index 0000000..303d951 --- /dev/null +++ b/Models/eva_adjust_postponement_detail_normal_02/Ieva_adjust_postponement_detail_normal_02Service.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using TodoAPI2.Models; + +namespace TodoAPI2.Models +{ + public interface Ieva_adjust_postponement_detail_normal_02Service : IBaseService + { + new eva_adjust_postponement_detail_normal_02ViewModel Insert(eva_adjust_postponement_detail_normal_02InputModel model); + new eva_adjust_postponement_detail_normal_02ViewModel Update(int id, eva_adjust_postponement_detail_normal_02InputModel model); + List GetListByadjust_postponement_id(int? adjust_postponement_id); + List GetListBySearch(eva_adjust_postponement_detail_normal_02SearchModel model); + + string UpdateMultiple(List model); + eva_adjust_postponement_detail_normal_02WithSelectionViewModel GetWithSelection(int id); + eva_adjust_postponement_detail_normal_02WithSelectionViewModel GetBlankItem(); + + + + } +} + diff --git a/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02InputModel.cs b/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02InputModel.cs new file mode 100644 index 0000000..7500920 --- /dev/null +++ b/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02InputModel.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_adjust_postponement_detail_normal_02InputModel + { + + public int? id { get; set; } + + public int? adjust_postponement_id { get; set; } + + public int? employee_id { get; set; } + + public decimal? sarary { get; set; } + + public decimal? cost_living { get; set; } + + public decimal? middle { get; set; } + + public decimal? promoted_percentage { get; set; } + + public decimal? total_promote { get; set; } + + public decimal? new_sarary { get; set; } + + public decimal? new_cost_living { get; set; } + + public string remark { get; set; } + + public string emp_code { get; set; } + + public string emp_fullname { get; set; } + + public string emp_position { get; set; } + + public string emp_level { get; set; } + + public decimal? total_score { get; set; } + + public string eva_result { get; set; } + + public string active_mode { get; set; } + + + } +} + diff --git a/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02ReportRequestModel.cs b/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02ReportRequestModel.cs new file mode 100644 index 0000000..41b0265 --- /dev/null +++ b/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02ReportRequestModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_adjust_postponement_detail_normal_02ReportRequestModel : eva_adjust_postponement_detail_normal_02SearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02SearchModel.cs b/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02SearchModel.cs new file mode 100644 index 0000000..a9c378e --- /dev/null +++ b/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02SearchModel.cs @@ -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_adjust_postponement_detail_normal_02SearchModel + { + + public int id { get; set; } + + public int? adjust_postponement_id { get; set; } + + } +} + diff --git a/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02Service.cs b/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02Service.cs new file mode 100644 index 0000000..dfbc7a1 --- /dev/null +++ b/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02Service.cs @@ -0,0 +1,284 @@ +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_adjust_postponement_detail_normal_02Service : Ieva_adjust_postponement_detail_normal_02Service + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + private Iexternal_employeeService emp; + + public eva_adjust_postponement_detail_normal_02Service(IBaseRepository2 repository, + IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp) + { + _repository = repository; + db = mydb; + ext = inext; + emp = inemp; + } + + #region Private Functions + private eva_adjust_postponement_detailEntity GetEntity(eva_adjust_postponement_detail_normal_02InputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_adjust_postponement_detail_normal_02ViewModel GetDto(eva_adjust_postponement_detailEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public eva_adjust_postponement_detail_normal_02ViewModel Get(int id) + { + var entity = _repository.Get(id); + + return GetDto(entity); + } + public eva_adjust_postponement_detail_normal_02WithSelectionViewModel GetWithSelection(int id) + { + var entity = _repository.Get(id); + var i = Mapper.Map(entity); + + + return i; + } + public eva_adjust_postponement_detail_normal_02WithSelectionViewModel GetBlankItem() + { + var i = new eva_adjust_postponement_detail_normal_02WithSelectionViewModel(); + + + return i; + } + + public List GetListByadjust_postponement_id(int? adjust_postponement_id) + { + var model = new eva_adjust_postponement_detail_normal_02SearchModel(); + model.adjust_postponement_id = adjust_postponement_id; + return GetListBySearch(model); + } + + public List GetListBySearch(eva_adjust_postponement_detail_normal_02SearchModel model) + { + var all_emp = emp.GetListByemployee_type(null, null); + + var data = ( + from m_eva_adjust_postponement_detail_normal_02 in _repository.Context.eva_adjust_postponement_detail + + join fk_eva_adjust_postponement1 in _repository.Context.eva_adjust_postponement on m_eva_adjust_postponement_detail_normal_02.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_external_linkage2 in all_emp on m_eva_adjust_postponement_detail_normal_02.employee_id equals fk_external_linkage2.id + into external_linkageResult2 + from fk_external_linkageResult2 in external_linkageResult2.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() + + where 1==1 + //&& (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 + + orderby m_eva_adjust_postponement_detail_normal_02.created descending + select new eva_adjust_postponement_detail_normal_02ViewModel() + { + id = m_eva_adjust_postponement_detail_normal_02.id, + adjust_postponement_id = m_eva_adjust_postponement_detail_normal_02.adjust_postponement_id, + employee_id = m_eva_adjust_postponement_detail_normal_02.employee_id, + sarary = m_eva_adjust_postponement_detail_normal_02.sarary, + cost_living = m_eva_adjust_postponement_detail_normal_02.cost_living, + middle = m_eva_adjust_postponement_detail_normal_02.middle, + promoted_percentage = m_eva_adjust_postponement_detail_normal_02.promoted_percentage, + total_promote = m_eva_adjust_postponement_detail_normal_02.total_promote, + new_sarary = m_eva_adjust_postponement_detail_normal_02.new_sarary, + new_cost_living = m_eva_adjust_postponement_detail_normal_02.new_cost_living, + remark = m_eva_adjust_postponement_detail_normal_02.remark, + emp_code = fk_external_linkageResult2.employee_no, + emp_fullname = fk_external_linkageResult2.fullname, + emp_position = fk_external_linkageResult2.position_name, + emp_level = fk_external_linkageResult2.position_level_text, + total_score = fk_create_detailResult.score_supervisor, + eva_result = fk_create_detailResult.level_score_supervisor, + + adjust_postponement_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult1.fiscal_year, + + isActive = m_eva_adjust_postponement_detail_normal_02.isActive, + Created = m_eva_adjust_postponement_detail_normal_02.created, + Updated = m_eva_adjust_postponement_detail_normal_02.updated + } + ).Take(100).ToList(); + + return data; + } + + #endregion + + #region Manipulation Functions + + public int GetNewPrimaryKey() + { + int? newkey = 0; + + var x = (from i in _repository.Context.eva_adjust_postponement_detail + orderby i.id descending + select i).Take(1).ToList(); + + if(x.Count > 0) + { + newkey = x[0].id + 1; + } + + return newkey.Value; + } + + public eva_adjust_postponement_detail_normal_02ViewModel Insert(eva_adjust_postponement_detail_normal_02InputModel model) + { + var entity = GetEntity(model); + entity.id = GetNewPrimaryKey(); + + + + var inserted = _repository.Insert(entity); + + return Get(inserted.id); + } + + public eva_adjust_postponement_detail_normal_02ViewModel Update(int id, eva_adjust_postponement_detail_normal_02InputModel model) + { + var existingEntity = _repository.Get(id); + if (existingEntity != null) + { + //existingEntity.adjust_postponement_id = model.adjust_postponement_id; + //existingEntity.employee_id = model.employee_id; + existingEntity.sarary = model.sarary; + existingEntity.cost_living = model.cost_living; + existingEntity.middle = model.middle; + existingEntity.promoted_percentage = model.promoted_percentage; + existingEntity.total_promote = model.total_promote; + existingEntity.new_sarary = model.new_sarary; + existingEntity.new_cost_living = model.new_cost_living; + existingEntity.remark = model.remark; + //existingEntity.emp_code = model.emp_code; + //existingEntity.emp_fullname = model.emp_fullname; + //existingEntity.emp_position = model.emp_position; + //existingEntity.emp_level = model.emp_level; + //existingEntity.total_score = model.total_score; + //existingEntity.eva_result = model.eva_result; + + + var updated = _repository.Update(id, existingEntity); + return Get(updated.id); + } + else + throw new NotificationException("No data to update"); + } + + public string UpdateMultiple(List 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.adjust_postponement_id = i.adjust_postponement_id; + //existingEntity.employee_id = i.employee_id; + existingEntity.sarary = i.sarary; + existingEntity.cost_living = i.cost_living; + existingEntity.middle = i.middle; + existingEntity.promoted_percentage = i.promoted_percentage; + existingEntity.total_promote = i.total_promote; + existingEntity.new_sarary = i.new_sarary; + existingEntity.new_cost_living = i.new_cost_living; + existingEntity.remark = i.remark; + //existingEntity.emp_code = i.emp_code; + //existingEntity.emp_fullname = i.emp_fullname; + //existingEntity.emp_position = i.emp_position; + //existingEntity.emp_level = i.emp_level; + //existingEntity.total_score = i.total_score; + //existingEntity.eva_result = i.eva_result; + + + _repository.UpdateWithoutCommit(i.id.Value, existingEntity); + } + } + else if (i.active_mode == "1" && !i.id.HasValue) // add + { + var entity = GetEntity(i); + entity.id = GetNewPrimaryKey(); + _repository.InsertWithoutCommit(entity); + } + else if (i.active_mode == "0" && i.id.HasValue) // remove + { + _repository.DeleteWithoutCommit(i.id.Value); + } + else if (i.active_mode == "0" && !i.id.HasValue) + { + // nothing to do + } + } + //_repository.Context.SaveChanges(); + + return model.Count().ToString(); + } + + public eva_adjust_postponement_detail_normal_02ViewModel SetAsActive(int id) + { + var updated = _repository.SetAsActive(id); + + return Get(updated.id); + } + public eva_adjust_postponement_detail_normal_02ViewModel SetAsInactive(int id) + { + var updated = _repository.SetAsInActive(id); + + return Get(updated.id); + } + public void Delete(int id) + { + _repository.Delete(id); + + return; + } + #endregion + + #region Match Item + + #endregion + + #endregion + } +} + diff --git a/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02ViewModel.cs b/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02ViewModel.cs new file mode 100644 index 0000000..9a7632d --- /dev/null +++ b/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02ViewModel.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_adjust_postponement_detail_normal_02ViewModel : BaseViewModel2 + { + + public int? adjust_postponement_id { get; set; } + + public int? employee_id { get; set; } + + public decimal? sarary { get; set; } + + public decimal? cost_living { get; set; } + + public decimal? middle { get; set; } + + public decimal? promoted_percentage { get; set; } + + public decimal? total_promote { get; set; } + + public decimal? new_sarary { get; set; } + + public decimal? new_cost_living { get; set; } + + public string remark { get; set; } + + public string emp_code { get; set; } + + public string emp_fullname { get; set; } + + public string emp_position { get; set; } + + public string emp_level { get; set; } + + public decimal? total_score { get; set; } + + public string eva_result { get; set; } + + public int? adjust_postponement_id_eva_adjust_postponement_fiscal_year { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02WithSelectionViewModel.cs b/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02WithSelectionViewModel.cs new file mode 100644 index 0000000..2d61391 --- /dev/null +++ b/Models/eva_adjust_postponement_detail_normal_02/eva_adjust_postponement_detail_normal_02WithSelectionViewModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TodoAPI2.Models +{ + public class eva_adjust_postponement_detail_normal_02WithSelectionViewModel: eva_adjust_postponement_detail_normal_02ViewModel + { + + } +} \ No newline at end of file diff --git a/Models/eva_adjust_postponement_detail_quota_02/Ieva_adjust_postponement_detail_quota_02Service.cs b/Models/eva_adjust_postponement_detail_quota_02/Ieva_adjust_postponement_detail_quota_02Service.cs new file mode 100644 index 0000000..6862b47 --- /dev/null +++ b/Models/eva_adjust_postponement_detail_quota_02/Ieva_adjust_postponement_detail_quota_02Service.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using TodoAPI2.Models; + +namespace TodoAPI2.Models +{ + public interface Ieva_adjust_postponement_detail_quota_02Service : IBaseService + { + new eva_adjust_postponement_detail_quota_02ViewModel Insert(eva_adjust_postponement_detail_quota_02InputModel model); + new eva_adjust_postponement_detail_quota_02ViewModel Update(int id, eva_adjust_postponement_detail_quota_02InputModel model); + List GetListByadjust_postponement_quota_id(int? adjust_postponement_quota_id); + List GetListBySearch(eva_adjust_postponement_detail_quota_02SearchModel model); + + string UpdateMultiple(List model); + eva_adjust_postponement_detail_quota_02WithSelectionViewModel GetWithSelection(int id); + eva_adjust_postponement_detail_quota_02WithSelectionViewModel GetBlankItem(); + + + + } +} + diff --git a/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02InputModel.cs b/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02InputModel.cs new file mode 100644 index 0000000..586aec2 --- /dev/null +++ b/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02InputModel.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_adjust_postponement_detail_quota_02InputModel + { + + public int? id { get; set; } + + public int? adjust_postponement_quota_id { get; set; } + + public int? employee_id { get; set; } + + public decimal? sarary { get; set; } + + public decimal? cost_living { get; set; } + + public decimal? middle { get; set; } + + public decimal? promoted_percentage { get; set; } + + public decimal? total_promote { get; set; } + + public decimal? new_sarary { get; set; } + + public decimal? new_cost_living { get; set; } + + public string remark { get; set; } + + public decimal? receive_quota { get; set; } + + public decimal? new_sarary_with_quota { get; set; } + + public string emp_code { get; set; } + + public string emp_fullname { get; set; } + + public string emp_position { get; set; } + + public string emp_level { get; set; } + + public decimal? total_score { get; set; } + + public string eva_result { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02ReportRequestModel.cs b/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02ReportRequestModel.cs new file mode 100644 index 0000000..99aa242 --- /dev/null +++ b/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02ReportRequestModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_adjust_postponement_detail_quota_02ReportRequestModel : eva_adjust_postponement_detail_quota_02SearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02SearchModel.cs b/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02SearchModel.cs new file mode 100644 index 0000000..bf9e1a2 --- /dev/null +++ b/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02SearchModel.cs @@ -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_adjust_postponement_detail_quota_02SearchModel + { + + public int id { get; set; } + + public int? adjust_postponement_quota_id { get; set; } + + } +} + diff --git a/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02Service.cs b/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02Service.cs new file mode 100644 index 0000000..03ad045 --- /dev/null +++ b/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02Service.cs @@ -0,0 +1,290 @@ +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_adjust_postponement_detail_quota_02Service : Ieva_adjust_postponement_detail_quota_02Service + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + private Iexternal_employeeService emp; + + public eva_adjust_postponement_detail_quota_02Service(IBaseRepository2 repository, + IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp) + { + _repository = repository; + db = mydb; + ext = inext; + emp = inemp; + } + + #region Private Functions + private eva_adjust_postponement_detailEntity GetEntity(eva_adjust_postponement_detail_quota_02InputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_adjust_postponement_detail_quota_02ViewModel GetDto(eva_adjust_postponement_detailEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public eva_adjust_postponement_detail_quota_02ViewModel Get(int id) + { + var entity = _repository.Get(id); + + return GetDto(entity); + } + public eva_adjust_postponement_detail_quota_02WithSelectionViewModel GetWithSelection(int id) + { + var entity = _repository.Get(id); + var i = Mapper.Map(entity); + + + return i; + } + public eva_adjust_postponement_detail_quota_02WithSelectionViewModel GetBlankItem() + { + var i = new eva_adjust_postponement_detail_quota_02WithSelectionViewModel(); + + + return i; + } + + public List GetListByadjust_postponement_quota_id(int? adjust_postponement_quota_id) + { + var model = new eva_adjust_postponement_detail_quota_02SearchModel(); + model.adjust_postponement_quota_id = adjust_postponement_quota_id; + return GetListBySearch(model); + } + + public List GetListBySearch(eva_adjust_postponement_detail_quota_02SearchModel model) + { + var all_emp = emp.GetListByemployee_type(null, null); + + var data = ( + from m_eva_adjust_postponement_detail_quota_02 in _repository.Context.eva_adjust_postponement_detail + + join fk_eva_adjust_postponement1 in _repository.Context.eva_adjust_postponement on m_eva_adjust_postponement_detail_quota_02.adjust_postponement_quota_id equals fk_eva_adjust_postponement1.id + into eva_adjust_postponementResult1 + from fk_eva_adjust_postponementResult1 in eva_adjust_postponementResult1.DefaultIfEmpty() + + 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() + + 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() + + 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) + + + orderby m_eva_adjust_postponement_detail_quota_02.created descending + select new eva_adjust_postponement_detail_quota_02ViewModel() + { + id = m_eva_adjust_postponement_detail_quota_02.id, + adjust_postponement_quota_id = m_eva_adjust_postponement_detail_quota_02.adjust_postponement_quota_id, + employee_id = m_eva_adjust_postponement_detail_quota_02.employee_id, + sarary = m_eva_adjust_postponement_detail_quota_02.sarary, + cost_living = m_eva_adjust_postponement_detail_quota_02.cost_living, + middle = m_eva_adjust_postponement_detail_quota_02.middle, + promoted_percentage = m_eva_adjust_postponement_detail_quota_02.promoted_percentage, + total_promote = m_eva_adjust_postponement_detail_quota_02.total_promote, + new_sarary = m_eva_adjust_postponement_detail_quota_02.new_sarary, + new_cost_living = m_eva_adjust_postponement_detail_quota_02.new_cost_living, + remark = m_eva_adjust_postponement_detail_quota_02.remark, + receive_quota = m_eva_adjust_postponement_detail_quota_02.receive_quota, + new_sarary_with_quota = m_eva_adjust_postponement_detail_quota_02.new_sarary_with_quota, + emp_code = fk_external_linkageResult2.employee_no, + emp_fullname = fk_external_linkageResult2.fullname, + emp_position = fk_external_linkageResult2.position_name, + emp_level = fk_external_linkageResult2.position_level_text, + total_score = fk_create_detailResult.score_supervisor, + eva_result = fk_create_detailResult.level_score_supervisor, + + adjust_postponement_quota_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult1.fiscal_year, + + isActive = m_eva_adjust_postponement_detail_quota_02.isActive, + Created = m_eva_adjust_postponement_detail_quota_02.created, + Updated = m_eva_adjust_postponement_detail_quota_02.updated + } + ).Take(100).ToList(); + + return data; + } + + #endregion + + #region Manipulation Functions + + public int GetNewPrimaryKey() + { + int? newkey = 0; + + var x = (from i in _repository.Context.eva_adjust_postponement_detail + orderby i.id descending + select i).Take(1).ToList(); + + if(x.Count > 0) + { + newkey = x[0].id + 1; + } + + return newkey.Value; + } + + public eva_adjust_postponement_detail_quota_02ViewModel Insert(eva_adjust_postponement_detail_quota_02InputModel model) + { + var entity = GetEntity(model); + entity.id = GetNewPrimaryKey(); + + + + var inserted = _repository.Insert(entity); + + return Get(inserted.id); + } + + public eva_adjust_postponement_detail_quota_02ViewModel Update(int id, eva_adjust_postponement_detail_quota_02InputModel model) + { + var existingEntity = _repository.Get(id); + if (existingEntity != null) + { + //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; + //existingEntity.middle = model.middle; + //existingEntity.promoted_percentage = model.promoted_percentage; + //existingEntity.total_promote = model.total_promote; + //existingEntity.new_sarary = model.new_sarary; + //existingEntity.new_cost_living = model.new_cost_living; + existingEntity.remark = model.remark; + existingEntity.receive_quota = model.receive_quota; + existingEntity.new_sarary_with_quota = model.new_sarary_with_quota; + //existingEntity.emp_code = model.emp_code; + //existingEntity.emp_fullname = model.emp_fullname; + //existingEntity.emp_position = model.emp_position; + //existingEntity.emp_level = model.emp_level; + //existingEntity.total_score = model.total_score; + //existingEntity.eva_result = model.eva_result; + + + var updated = _repository.Update(id, existingEntity); + return Get(updated.id); + } + else + throw new NotificationException("No data to update"); + } + + + public string UpdateMultiple(List 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.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; + //existingEntity.middle = i.middle; + //existingEntity.promoted_percentage = i.promoted_percentage; + //existingEntity.total_promote = i.total_promote; + //existingEntity.new_sarary = i.new_sarary; + //existingEntity.new_cost_living = i.new_cost_living; + existingEntity.remark = i.remark; + existingEntity.receive_quota = i.receive_quota; + existingEntity.new_sarary_with_quota = i.new_sarary_with_quota; + //existingEntity.emp_code = i.emp_code; + //existingEntity.emp_fullname = i.emp_fullname; + //existingEntity.emp_position = i.emp_position; + //existingEntity.emp_level = i.emp_level; + //existingEntity.total_score = i.total_score; + //existingEntity.eva_result = i.eva_result; + + + _repository.UpdateWithoutCommit(i.id.Value, existingEntity); + } + } + else if (i.active_mode == "1" && !i.id.HasValue) // add + { + var entity = GetEntity(i); + entity.id = GetNewPrimaryKey(); + _repository.InsertWithoutCommit(entity); + } + else if (i.active_mode == "0" && i.id.HasValue) // remove + { + _repository.DeleteWithoutCommit(i.id.Value); + } + else if (i.active_mode == "0" && !i.id.HasValue) + { + // nothing to do + } + } + //_repository.Context.SaveChanges(); + + return model.Count().ToString(); + } + + public eva_adjust_postponement_detail_quota_02ViewModel SetAsActive(int id) + { + var updated = _repository.SetAsActive(id); + + return Get(updated.id); + } + public eva_adjust_postponement_detail_quota_02ViewModel SetAsInactive(int id) + { + var updated = _repository.SetAsInActive(id); + + return Get(updated.id); + } + public void Delete(int id) + { + _repository.Delete(id); + + return; + } + #endregion + + #region Match Item + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02ViewModel.cs b/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02ViewModel.cs new file mode 100644 index 0000000..2fb3873 --- /dev/null +++ b/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02ViewModel.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_adjust_postponement_detail_quota_02ViewModel : BaseViewModel2 + { + + public int? adjust_postponement_quota_id { get; set; } + + public int? employee_id { get; set; } + + public decimal? sarary { get; set; } + + public decimal? cost_living { get; set; } + + public decimal? middle { get; set; } + + public decimal? promoted_percentage { get; set; } + + public decimal? total_promote { get; set; } + + public decimal? new_sarary { get; set; } + + public decimal? new_cost_living { get; set; } + + public string remark { get; set; } + + public decimal? receive_quota { get; set; } + + public decimal? new_sarary_with_quota { get; set; } + + public string emp_code { get; set; } + + public string emp_fullname { get; set; } + + public string emp_position { get; set; } + + public string emp_level { get; set; } + + public decimal? total_score { get; set; } + + public string eva_result { get; set; } + + public int? adjust_postponement_quota_id_eva_adjust_postponement_fiscal_year { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02WithSelectionViewModel.cs b/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02WithSelectionViewModel.cs new file mode 100644 index 0000000..ae25b93 --- /dev/null +++ b/Models/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02WithSelectionViewModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TodoAPI2.Models +{ + public class eva_adjust_postponement_detail_quota_02WithSelectionViewModel: eva_adjust_postponement_detail_quota_02ViewModel + { + + } +} \ No newline at end of file diff --git a/Models/eva_adjust_postponement_normal/eva_adjust_postponement_normalInputModel.cs b/Models/eva_adjust_postponement_normal/eva_adjust_postponement_normalInputModel.cs index cf1eb80..003a7ec 100644 --- a/Models/eva_adjust_postponement_normal/eva_adjust_postponement_normalInputModel.cs +++ b/Models/eva_adjust_postponement_normal/eva_adjust_postponement_normalInputModel.cs @@ -37,6 +37,8 @@ namespace TodoAPI2.Models //public int? org_id { get; set; } public string active_mode { get; set; } + + public List eva_adjust_postponement_detail_normal_02_model; } } diff --git a/Models/eva_adjust_postponement_normal/eva_adjust_postponement_normalService.cs b/Models/eva_adjust_postponement_normal/eva_adjust_postponement_normalService.cs index e6b1cde..ade0beb 100644 --- a/Models/eva_adjust_postponement_normal/eva_adjust_postponement_normalService.cs +++ b/Models/eva_adjust_postponement_normal/eva_adjust_postponement_normalService.cs @@ -24,17 +24,23 @@ namespace TodoAPI2.Models private Iexternal_linkageService ext; private Iexternal_employeeService emp; private Ieva_create_evaluationService create; + private Ieva_adjust_postponement_detail_normalService detail; + private Ieva_adjust_postponement_detail_normal_02Service normal02; public eva_adjust_postponement_normalService(IBaseRepository2 repository, IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp, - Ieva_create_evaluationService increate) + Ieva_create_evaluationService increate, + Ieva_adjust_postponement_detail_normalService indetail, + Ieva_adjust_postponement_detail_normal_02Service innormal02) { _repository = repository; db = mydb; ext = inext; emp = inemp; create = increate; + detail = indetail; + normal02 = innormal02; } #region Private Functions @@ -186,10 +192,10 @@ namespace TodoAPI2.Models var entity = GetEntity(model); entity.id = GetNewPrimaryKey(); + detail.ReCreatePostponementDetailNormal(entity); + var inserted = _repository.Insert(entity); - var inserted = _repository.Insert(entity); - return Get(inserted.id); } @@ -209,6 +215,7 @@ namespace TodoAPI2.Models existingEntity.managed_by = model.managed_by; //existingEntity.org_id = model.org_id; + normal02.UpdateMultiple(model.eva_adjust_postponement_detail_normal_02_model); var updated = _repository.Update(id, existingEntity); return Get(updated.id); @@ -275,6 +282,11 @@ 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 + select i; + _repository.Context.eva_adjust_postponement_detail.RemoveRange(details); + _repository.Delete(id); return; diff --git a/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaInputModel.cs b/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaInputModel.cs index 889e033..4659e92 100644 --- a/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaInputModel.cs +++ b/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaInputModel.cs @@ -31,6 +31,8 @@ namespace TodoAPI2.Models public int? managed_by { get; set; } public string active_mode { get; set; } + + public List adjust_postponement_detail_quota_02_model; } } diff --git a/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaService.cs b/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaService.cs index 57fde30..54d9aa9 100644 --- a/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaService.cs +++ b/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaService.cs @@ -23,14 +23,17 @@ namespace TodoAPI2.Models 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 repository, IMyDatabase mydb, - Iexternal_linkageService inext, Iexternal_employeeService inemp) + Iexternal_linkageService inext, Iexternal_employeeService inemp, + Ieva_adjust_postponement_detail_quota_02Service inquota02) { _repository = repository; db = mydb; ext = inext; emp = inemp; + quota02 = inquota02; } #region Private Functions @@ -147,18 +150,159 @@ namespace TodoAPI2.Models return newkey.Value; } + public int GetNewPrimaryKeyDetail() + { + int? newkey = 0; + + var x = (from i in _repository.Context.eva_adjust_postponement_detail + orderby i.id descending + select i).Take(1).ToList(); + + if (x.Count > 0) + { + newkey = x[0].id + 1; + } + + return newkey.Value; + } + public eva_adjust_postponement_quotaViewModel Insert(eva_adjust_postponement_quotaInputModel model) { var entity = GetEntity(model); entity.id = GetNewPrimaryKey(); - + var all_emp = (from i in emp.GetListByemployee_type(null, null) select i.id).ToList(); + AddMultipleDetail(entity.id, all_emp, entity.fiscal_year, entity.theRound); var inserted = _repository.Insert(entity); return Get(inserted.id); } + public string AddMultipleDetail(int? adjust_postponement_quota_id, List model, int? fiscal_year, int? theRound) + { + if (!adjust_postponement_quota_id.HasValue) + { + return "0"; + } + else + { + int k = 0; + var all_emp = emp.GetListByemployee_type(null, null); + var cylinder = (from z in _repository.Context.eva_salary_cylinder + select z).ToList(); + int newkey = GetNewPrimaryKeyDetail(); + + var ex = (from x in _repository.Context.eva_adjust_postponement_detail + where x.adjust_postponement_quota_id == adjust_postponement_quota_id + select x.employee_id).ToList(); + + decimal sum_salary = 0; + + foreach (var i in model) + { + if (checkExistEmployeeInExternal(i, all_emp)) + { + if (!checkExistEmployeeInInternal(i, ex)) + { + var q = (from p in _repository.Context.eva_adjust_postponement_detail + where p.employee_id == i + && p.eva_adjust_postponement.fiscal_year == fiscal_year + && p.eva_adjust_postponement.theRound == theRound + select p).FirstOrDefault(); + + if (q != null) + { + q.adjust_postponement_quota_id = adjust_postponement_quota_id; + q.updated = DateTime.Now; + q.isActive = true; + k++; + } + else + { + var theemp = (from x in all_emp where x.id == i select x).FirstOrDefault(); + + var r = new eva_adjust_postponement_detailEntity(); + r.id = newkey; + r.adjust_postponement_id = null; + r.adjust_postponement_quota_id = adjust_postponement_quota_id; + + r.employee_id = i; + + if (theemp.salary.HasValue) + { + r.sarary = theemp.salary; + sum_salary += r.sarary.Value; + } + else + { + r.sarary = 0; + } + + var c = getCylinderForEmployee(theemp, cylinder); + + r.cost_living = 0; + r.middle = 0; + + if (c != null) + { + r.middle = c.middle; + r.cost_living = c.cost_living; + } + + r.promoted_percentage = 0; + r.total_promote = 0; + r.new_sarary = r.sarary; + r.new_cost_living = r.cost_living; + r.remark = null; + r.receive_quota = 0; + r.new_sarary_with_quota = r.sarary; + + r.created = DateTime.Now; + r.updated = DateTime.Now; + r.isActive = true; + + _repository.Context.Add(r); + + newkey++; + } + } + } + } + + //_repository.Context.SaveChanges(); + return k.ToString(); + } + } + + private eva_salary_cylinderEntity getCylinderForEmployee(external_employeeViewModel theemp, + List all_cylinder) + { + var c = (from i in all_cylinder + where i.position_level == theemp.position_level_id + && i.position_type == theemp.position_type_id + select i).FirstOrDefault(); + return c; + } + + private bool checkExistEmployeeInExternal(int emp_id, List emp) + { + foreach (var i in emp) + { + if (i.id == emp_id) return true; + } + return false; + } + + private bool checkExistEmployeeInInternal(int emp_id, List ex) + { + foreach (var i in ex) + { + if (i.Value == emp_id) return true; + } + return false; + } + public eva_adjust_postponement_quotaViewModel Update(int id, eva_adjust_postponement_quotaInputModel model) { var existingEntity = _repository.Get(id); @@ -172,6 +316,7 @@ namespace TodoAPI2.Models existingEntity.command_no = model.command_no; existingEntity.managed_by = model.managed_by; + quota02.UpdateMultiple(model.adjust_postponement_detail_quota_02_model); var updated = _repository.Update(id, existingEntity); return Get(updated.id); @@ -235,6 +380,11 @@ namespace TodoAPI2.Models } public void Delete(int id) { + var data = from i in _repository.Context.eva_adjust_postponement_detail + where i.adjust_postponement_quota_id == id && i.adjust_postponement_id == null + select i; + _repository.Context.RemoveRange(data); + _repository.Delete(id); return; diff --git a/Models/external_employee/external_employeeService.cs b/Models/external_employee/external_employeeService.cs index 2cc7eb7..91160bf 100644 --- a/Models/external_employee/external_employeeService.cs +++ b/Models/external_employee/external_employeeService.cs @@ -118,6 +118,11 @@ and opd.deleted_at is null and htm.deleted_at is null; i.position_level_id = Convert.ToInt32(dr["department_id"]); i.position_level_text = dr["position_level_name"].ToString(); } + i.salary = 0; + if (dr["salary"] != DBNull.Value) + { + i.salary = Convert.ToDecimal(dr["salary"]); + } result.Add(i); } diff --git a/Startup.cs b/Startup.cs index e59eaed..4e1cc97 100644 --- a/Startup.cs +++ b/Startup.cs @@ -264,6 +264,10 @@ namespace Test01 services.AddScoped(); + services.AddScoped(); + + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -447,7 +451,13 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); - + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); }); #endregion diff --git a/Views/eva_adjust_postponement_detail_normal_02View/eva_adjust_postponement_detail_normal_02_inline.cshtml b/Views/eva_adjust_postponement_detail_normal_02View/eva_adjust_postponement_detail_normal_02_inline.cshtml new file mode 100644 index 0000000..3e9dae6 --- /dev/null +++ b/Views/eva_adjust_postponement_detail_normal_02View/eva_adjust_postponement_detail_normal_02_inline.cshtml @@ -0,0 +1,83 @@ +@{ + Layout = "~/Views/Shared/_Layout.cshtml"; + ViewData["Title"] = "eva_adjust_postponement_detail_normal_02"; +} + +
+ +
+
+
+
+ จัดการ eva_adjust_postponement_detail_normal_02 + + + +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
ลำดับกิจกรรม
+ +
+ +
+ + + +
+
+ +
+
+
+ +@section FooterPlaceHolder{ + + +} diff --git a/Views/eva_adjust_postponement_detail_quota_02View/eva_adjust_postponement_detail_quota_02_inline.cshtml b/Views/eva_adjust_postponement_detail_quota_02View/eva_adjust_postponement_detail_quota_02_inline.cshtml new file mode 100644 index 0000000..9c90c4f --- /dev/null +++ b/Views/eva_adjust_postponement_detail_quota_02View/eva_adjust_postponement_detail_quota_02_inline.cshtml @@ -0,0 +1,85 @@ +@{ + Layout = "~/Views/Shared/_Layout.cshtml"; + ViewData["Title"] = "eva_adjust_postponement_detail_quota_02"; +} + +
+ +
+
+
+
+ จัดการ eva_adjust_postponement_detail_quota_02 + + + +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ลำดับกิจกรรม
+ +
+ +
+ + + +
+
+ +
+
+
+ +@section FooterPlaceHolder{ + + +} diff --git a/Views/eva_adjust_postponement_normalView/eva_adjust_postponement_normal.cshtml b/Views/eva_adjust_postponement_normalView/eva_adjust_postponement_normal.cshtml index 2c0e52a..9b8b5ad 100644 --- a/Views/eva_adjust_postponement_normalView/eva_adjust_postponement_normal.cshtml +++ b/Views/eva_adjust_postponement_normalView/eva_adjust_postponement_normal.cshtml @@ -46,29 +46,12 @@ -
- - -
- -
-
- - -
+ + + + -
- - -
-
-
- - -
-
- diff --git a/Views/eva_adjust_postponement_normalView/eva_adjust_postponement_normal_d.cshtml b/Views/eva_adjust_postponement_normalView/eva_adjust_postponement_normal_d.cshtml index 9e12a67..02ff9e8 100644 --- a/Views/eva_adjust_postponement_normalView/eva_adjust_postponement_normal_d.cshtml +++ b/Views/eva_adjust_postponement_normalView/eva_adjust_postponement_normal_d.cshtml @@ -5,81 +5,6 @@ Layout = "_LayoutDirect"; } - -
@@ -125,35 +50,39 @@
- +
- +
- +
- +
- +
- + +
+
+ +
@@ -163,6 +92,49 @@
+ + + + +
+ +
+
รายชื่อบุคคลากร
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ลำดับ
+ +
+ +
+ +
+
@@ -172,59 +144,19 @@
-
- -
-
รายชื่อบุคคลากร
-
-
- -
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - -
เครื่องมือ
-
- @section FooterPlaceHolder{ - + } diff --git a/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota.cshtml b/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota.cshtml index df3a1ca..488316b 100644 --- a/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota.cshtml +++ b/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota.cshtml @@ -18,6 +18,8 @@
+ +
@@ -41,17 +43,6 @@
-
-
- - -
- -
- - -
-
diff --git a/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml b/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml index cbc62ef..467195f 100644 --- a/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml +++ b/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml @@ -6,93 +6,6 @@ } - - -
@@ -177,50 +90,48 @@
รายชื่อบุคลลากร
-
-
-
- -
-
-
- +
- - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - +
เครื่องมือลำดับ
+
@section FooterPlaceHolder{ - +