diff --git a/ApiControllers/eva_create_evaluation_detail_review03Controllers.cs b/ApiControllers/eva_create_evaluation_detail_review03Controllers.cs new file mode 100644 index 0000000..6e86f8e --- /dev/null +++ b/ApiControllers/eva_create_evaluation_detail_review03Controllers.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_create_evaluation_detail_review03")] + public class eva_create_evaluation_detail_review03Controller : BaseController + { + #region Private Variables + private ILogger _logger; + private Ieva_create_evaluation_detail_review03Service _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_create_evaluation_detail_review03Controller(ILogger logger, Ieva_create_evaluation_detail_review03Service 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_create_evaluation_detail_review03WithSelectionViewModel), 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_create_evaluation_detail_review03WithSelectionViewModel), 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 create_evaluation_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? create_evaluation_id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListBycreate_evaluation_id(create_evaluation_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_create_evaluation_detail_review03SearchModel 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_create_evaluation_detail_review03_report")] + [ProducesResponseType(typeof(FileStreamResult), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult eva_create_evaluation_detail_review03_report(eva_create_evaluation_detail_review03ReportRequestModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var httpclient = MyHelper.getHttpClient(Configuration); + string mainurl = Configuration["JasperReportServer:MainURL"]; + + string url = $"{mainurl}/ro519eva/eva_create_evaluation_detail_review03_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_create_evaluation_detail_review03InputModel 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_create_evaluation_detail_review03InputModel 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_create_evaluation_detail_review04Controllers.cs b/ApiControllers/eva_create_evaluation_detail_review04Controllers.cs new file mode 100644 index 0000000..b712a7f --- /dev/null +++ b/ApiControllers/eva_create_evaluation_detail_review04Controllers.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_create_evaluation_detail_review04")] + public class eva_create_evaluation_detail_review04Controller : BaseController + { + #region Private Variables + private ILogger _logger; + private Ieva_create_evaluation_detail_review04Service _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_create_evaluation_detail_review04Controller(ILogger logger, Ieva_create_evaluation_detail_review04Service 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_create_evaluation_detail_review04WithSelectionViewModel), 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_create_evaluation_detail_review04WithSelectionViewModel), 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 create_evaluation_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? create_evaluation_id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListBycreate_evaluation_id(create_evaluation_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_create_evaluation_detail_review04SearchModel 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_create_evaluation_detail_review04_report")] + [ProducesResponseType(typeof(FileStreamResult), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult eva_create_evaluation_detail_review04_report(eva_create_evaluation_detail_review04ReportRequestModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var httpclient = MyHelper.getHttpClient(Configuration); + string mainurl = Configuration["JasperReportServer:MainURL"]; + + string url = $"{mainurl}/ro519eva/eva_create_evaluation_detail_review04_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_create_evaluation_detail_review04InputModel 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_create_evaluation_detail_review04InputModel 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_level_score_basicControllers.cs b/ApiControllers/eva_level_score_basicControllers.cs new file mode 100644 index 0000000..133cada --- /dev/null +++ b/ApiControllers/eva_level_score_basicControllers.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_level_score_basic")] + public class eva_level_score_basicController : BaseController + { + #region Private Variables + private ILogger _logger; + private Ieva_level_score_basicService _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_level_score_basicController(ILogger logger, Ieva_level_score_basicService 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_level_score_basicWithSelectionViewModel), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Get(Guid 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_level_score_basicWithSelectionViewModel), 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 code + /// + /// + /// + /// 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(string code) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListBycode(code)); + } + 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_level_score_basicSearchModel 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_level_score_basic_report")] + [ProducesResponseType(typeof(FileStreamResult), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult eva_level_score_basic_report(eva_level_score_basicReportRequestModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var httpclient = MyHelper.getHttpClient(Configuration); + string mainurl = Configuration["JasperReportServer:MainURL"]; + + string url = $"{mainurl}/ro519eva/eva_level_score_basic_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_level_score_basicInputModel 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(Guid id, [FromBody] eva_level_score_basicInputModel 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(Guid 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_create_evaluation.xlsx b/EXCEL/eva_create_evaluation.xlsx index 94ee8d4..743267e 100644 Binary files a/EXCEL/eva_create_evaluation.xlsx and b/EXCEL/eva_create_evaluation.xlsx differ diff --git a/EXCEL/eva_create_evaluation_detail.xlsx b/EXCEL/eva_create_evaluation_detail.xlsx index 048d4c5..a302de2 100644 Binary files a/EXCEL/eva_create_evaluation_detail.xlsx and b/EXCEL/eva_create_evaluation_detail.xlsx differ diff --git a/EXCEL/eva_create_evaluation_detail@eva_create_evaluation_detail_review03.xlsx b/EXCEL/eva_create_evaluation_detail@eva_create_evaluation_detail_review03.xlsx new file mode 100644 index 0000000..ba9187f Binary files /dev/null and b/EXCEL/eva_create_evaluation_detail@eva_create_evaluation_detail_review03.xlsx differ diff --git a/EXCEL/eva_create_evaluation_detail@eva_create_evaluation_detail_review04.xlsx b/EXCEL/eva_create_evaluation_detail@eva_create_evaluation_detail_review04.xlsx new file mode 100644 index 0000000..2524a08 Binary files /dev/null and b/EXCEL/eva_create_evaluation_detail@eva_create_evaluation_detail_review04.xlsx differ diff --git a/EXCEL/eva_evaluation_achievement.xlsx b/EXCEL/eva_evaluation_achievement.xlsx index b0604bf..6cd95ef 100644 Binary files a/EXCEL/eva_evaluation_achievement.xlsx and b/EXCEL/eva_evaluation_achievement.xlsx differ diff --git a/EXCEL/eva_level_score@eva_level_score_basic.xlsx b/EXCEL/eva_level_score@eva_level_score_basic.xlsx new file mode 100644 index 0000000..6445484 Binary files /dev/null and b/EXCEL/eva_level_score@eva_level_score_basic.xlsx differ diff --git a/Migrations/25630229053829_NewSuperVisor.Designer.cs b/Migrations/25630229053829_NewSuperVisor.Designer.cs new file mode 100644 index 0000000..01c33df --- /dev/null +++ b/Migrations/25630229053829_NewSuperVisor.Designer.cs @@ -0,0 +1,574 @@ +// +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("25630229053829_NewSuperVisor")] + partial class NewSuperVisor + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn) + .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b => + { + b.Property("id"); + + b.Property("command_no") + .HasMaxLength(100); + + b.Property("create_evaluation_id"); + + b.Property("created"); + + b.Property("fiscal_year"); + + b.Property("isActive"); + + b.Property("limit"); + + b.Property("limit_frame"); + + b.Property("limit_frame_quota"); + + b.Property("limit_quota"); + + b.Property("managed_by"); + + b.Property("percentage"); + + b.Property("theDate"); + + b.Property("theRound"); + + b.Property("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("id"); + + b.Property("adjust_postponement_id"); + + b.Property("adjust_postponement_quota_id"); + + b.Property("cost_living"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("isActive"); + + b.Property("middle"); + + b.Property("new_cost_living"); + + b.Property("new_sarary"); + + b.Property("new_sarary_with_quota"); + + b.Property("promoted_percentage"); + + b.Property("receive_quota"); + + b.Property("remark") + .HasMaxLength(1000); + + b.Property("sarary"); + + b.Property("total_promote"); + + b.Property("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("id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("evaluation_group_id"); + + b.Property("isActive"); + + b.Property("performance_plan_id"); + + b.Property("score1"); + + b.Property("score2"); + + b.Property("supervisor1_id"); + + b.Property("supervisor2_id"); + + b.Property("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("id"); + + b.Property("Final_summary_chief"); + + b.Property("Final_summary_competency_chief"); + + b.Property("Final_summary_competency_supervisor"); + + b.Property("Final_summary_supervisor"); + + b.Property("achievement_chief"); + + b.Property("achievement_supervisor"); + + b.Property("chief"); + + b.Property("competency_chief"); + + b.Property("competency_supervisor"); + + b.Property("create_evaluation_id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("isActive"); + + b.Property("level_score_chief") + .HasMaxLength(255); + + b.Property("level_score_supervisor") + .HasMaxLength(255); + + b.Property("score_chief"); + + b.Property("score_supervisor"); + + b.Property("status_chief") + .HasMaxLength(1); + + b.Property("status_self") + .HasMaxLength(1); + + b.Property("status_supervisor") + .HasMaxLength(1); + + b.Property("supervisor1"); + + b.Property("supervisor1_date"); + + b.Property("supervisor1_remark") + .HasMaxLength(1000); + + b.Property("supervisor1_result") + .HasMaxLength(1); + + b.Property("supervisor2"); + + b.Property("supervisor2_date"); + + b.Property("supervisor2_remark") + .HasMaxLength(1000); + + b.Property("supervisor2_result") + .HasMaxLength(1); + + b.Property("total_summary_chief"); + + b.Property("total_summary_competency_chief"); + + b.Property("total_summary_competency_supervisor"); + + b.Property("total_summary_supervisor"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_create_evaluation_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b => + { + b.Property("id"); + + b.Property("achievement") + .HasMaxLength(1000); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("score"); + + b.Property("score2"); + + b.Property("sumary"); + + b.Property("sumary2"); + + b.Property("target_score1") + .HasMaxLength(255); + + b.Property("target_score2") + .HasMaxLength(255); + + b.Property("target_score3") + .HasMaxLength(255); + + b.Property("target_score4") + .HasMaxLength(255); + + b.Property("target_score5") + .HasMaxLength(255); + + b.Property("thefile") + .HasMaxLength(1000); + + b.Property("updated"); + + b.Property("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("id"); + + b.Property("behavior") + .HasMaxLength(1000); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("score"); + + b.Property("score2"); + + b.Property("sumary"); + + b.Property("sumary2"); + + b.Property("target_score1") + .HasMaxLength(255); + + b.Property("target_score2") + .HasMaxLength(255); + + b.Property("target_score3") + .HasMaxLength(255); + + b.Property("target_score4") + .HasMaxLength(255); + + b.Property("target_score5") + .HasMaxLength(255); + + b.Property("updated"); + + b.Property("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("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("thegroup") + .HasMaxLength(255); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_evaluation_group"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("evaluation_group_id"); + + b.Property("isActive"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("evaluation_group_id"); + + b.ToTable("eva_evaluation_group_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_level_scoreEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("detail") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("max_score"); + + b.Property("min_score"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_level_score"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_planEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("fiscal_year"); + + b.Property("isActive"); + + b.Property("theTime"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_performance_plan"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("end_date"); + + b.Property("isActive"); + + b.Property("list_no"); + + b.Property("performance_plan_id"); + + b.Property("remark") + .HasMaxLength(1000); + + b.Property("start_date"); + + b.Property("step") + .HasMaxLength(1000); + + b.Property("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("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("detail") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("level_score_id"); + + b.Property("max_score"); + + b.Property("min_score"); + + b.Property("promoted_percentage"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("level_score_id"); + + b.ToTable("eva_promoted_percentage"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_salary_cylinderEntity", b => + { + b.Property("id"); + + b.Property("cost_living"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("middle"); + + b.Property("position_level"); + + b.Property("position_type"); + + b.Property("temporary_min"); + + b.Property("themax"); + + b.Property("themin"); + + b.Property("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_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_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 + } + } +} diff --git a/Migrations/25630229053829_NewSuperVisor.cs b/Migrations/25630229053829_NewSuperVisor.cs new file mode 100644 index 0000000..1983893 --- /dev/null +++ b/Migrations/25630229053829_NewSuperVisor.cs @@ -0,0 +1,31 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace tb320eva.Migrations +{ + public partial class NewSuperVisor : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "supervisor1_id", + table: "eva_create_evaluation", + nullable: true); + + migrationBuilder.AddColumn( + name: "supervisor2_id", + table: "eva_create_evaluation", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "supervisor1_id", + table: "eva_create_evaluation"); + + migrationBuilder.DropColumn( + name: "supervisor2_id", + table: "eva_create_evaluation"); + } + } +} diff --git a/Migrations/25630229074424_AddSuperVisorAB.Designer.cs b/Migrations/25630229074424_AddSuperVisorAB.Designer.cs new file mode 100644 index 0000000..d67b56b --- /dev/null +++ b/Migrations/25630229074424_AddSuperVisorAB.Designer.cs @@ -0,0 +1,594 @@ +// +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("25630229074424_AddSuperVisorAB")] + partial class AddSuperVisorAB + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn) + .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b => + { + b.Property("id"); + + b.Property("command_no") + .HasMaxLength(100); + + b.Property("create_evaluation_id"); + + b.Property("created"); + + b.Property("fiscal_year"); + + b.Property("isActive"); + + b.Property("limit"); + + b.Property("limit_frame"); + + b.Property("limit_frame_quota"); + + b.Property("limit_quota"); + + b.Property("managed_by"); + + b.Property("percentage"); + + b.Property("theDate"); + + b.Property("theRound"); + + b.Property("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("id"); + + b.Property("adjust_postponement_id"); + + b.Property("adjust_postponement_quota_id"); + + b.Property("cost_living"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("isActive"); + + b.Property("middle"); + + b.Property("new_cost_living"); + + b.Property("new_sarary"); + + b.Property("new_sarary_with_quota"); + + b.Property("promoted_percentage"); + + b.Property("receive_quota"); + + b.Property("remark") + .HasMaxLength(1000); + + b.Property("sarary"); + + b.Property("total_promote"); + + b.Property("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("id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("evaluation_group_id"); + + b.Property("isActive"); + + b.Property("performance_plan_id"); + + b.Property("score1"); + + b.Property("score2"); + + b.Property("supervisor1_id"); + + b.Property("supervisor2_id"); + + b.Property("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("id"); + + b.Property("Final_summary_chief"); + + b.Property("Final_summary_competency_chief"); + + b.Property("Final_summary_competency_supervisor"); + + b.Property("Final_summary_supervisor"); + + b.Property("achievement_chief"); + + b.Property("achievement_supervisor"); + + b.Property("chief"); + + b.Property("competency_chief"); + + b.Property("competency_supervisor"); + + b.Property("create_evaluation_id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("isActive"); + + b.Property("level_score_chief") + .HasMaxLength(255); + + b.Property("level_score_supervisor") + .HasMaxLength(255); + + b.Property("score_chief"); + + b.Property("score_supervisor"); + + b.Property("status_chief") + .HasMaxLength(1); + + b.Property("status_self") + .HasMaxLength(1); + + b.Property("status_supervisor") + .HasMaxLength(1); + + b.Property("supervisor1"); + + b.Property("supervisor1A"); + + b.Property("supervisor1A_date"); + + b.Property("supervisor1A_remark") + .HasMaxLength(1000); + + b.Property("supervisor1A_result") + .HasMaxLength(1); + + b.Property("supervisor1_date"); + + b.Property("supervisor1_remark") + .HasMaxLength(1000); + + b.Property("supervisor1_result") + .HasMaxLength(1); + + b.Property("supervisor2"); + + b.Property("supervisor2A"); + + b.Property("supervisor2A_date"); + + b.Property("supervisor2A_remark") + .HasMaxLength(1000); + + b.Property("supervisor2A_result") + .HasMaxLength(1); + + b.Property("supervisor2_date"); + + b.Property("supervisor2_remark") + .HasMaxLength(1000); + + b.Property("supervisor2_result") + .HasMaxLength(1); + + b.Property("total_summary_chief"); + + b.Property("total_summary_competency_chief"); + + b.Property("total_summary_competency_supervisor"); + + b.Property("total_summary_supervisor"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_create_evaluation_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b => + { + b.Property("id"); + + b.Property("achievement") + .HasMaxLength(1000); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("score"); + + b.Property("score2"); + + b.Property("sumary"); + + b.Property("sumary2"); + + b.Property("target_score1") + .HasMaxLength(255); + + b.Property("target_score2") + .HasMaxLength(255); + + b.Property("target_score3") + .HasMaxLength(255); + + b.Property("target_score4") + .HasMaxLength(255); + + b.Property("target_score5") + .HasMaxLength(255); + + b.Property("thefile") + .HasMaxLength(1000); + + b.Property("updated"); + + b.Property("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("id"); + + b.Property("behavior") + .HasMaxLength(1000); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("score"); + + b.Property("score2"); + + b.Property("sumary"); + + b.Property("sumary2"); + + b.Property("target_score1") + .HasMaxLength(255); + + b.Property("target_score2") + .HasMaxLength(255); + + b.Property("target_score3") + .HasMaxLength(255); + + b.Property("target_score4") + .HasMaxLength(255); + + b.Property("target_score5") + .HasMaxLength(255); + + b.Property("updated"); + + b.Property("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("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("thegroup") + .HasMaxLength(255); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_evaluation_group"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("evaluation_group_id"); + + b.Property("isActive"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("evaluation_group_id"); + + b.ToTable("eva_evaluation_group_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_level_scoreEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("detail") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("max_score"); + + b.Property("min_score"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_level_score"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_planEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("fiscal_year"); + + b.Property("isActive"); + + b.Property("theTime"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_performance_plan"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("end_date"); + + b.Property("isActive"); + + b.Property("list_no"); + + b.Property("performance_plan_id"); + + b.Property("remark") + .HasMaxLength(1000); + + b.Property("start_date"); + + b.Property("step") + .HasMaxLength(1000); + + b.Property("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("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("detail") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("level_score_id"); + + b.Property("max_score"); + + b.Property("min_score"); + + b.Property("promoted_percentage"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("level_score_id"); + + b.ToTable("eva_promoted_percentage"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_salary_cylinderEntity", b => + { + b.Property("id"); + + b.Property("cost_living"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("middle"); + + b.Property("position_level"); + + b.Property("position_type"); + + b.Property("temporary_min"); + + b.Property("themax"); + + b.Property("themin"); + + b.Property("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_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_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 + } + } +} diff --git a/Migrations/25630229074424_AddSuperVisorAB.cs b/Migrations/25630229074424_AddSuperVisorAB.cs new file mode 100644 index 0000000..9b133e7 --- /dev/null +++ b/Migrations/25630229074424_AddSuperVisorAB.cs @@ -0,0 +1,90 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace tb320eva.Migrations +{ + public partial class AddSuperVisorAB : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "supervisor1A", + table: "eva_create_evaluation_detail", + nullable: true); + + migrationBuilder.AddColumn( + name: "supervisor1A_date", + table: "eva_create_evaluation_detail", + nullable: true); + + migrationBuilder.AddColumn( + name: "supervisor1A_remark", + table: "eva_create_evaluation_detail", + maxLength: 1000, + nullable: true); + + migrationBuilder.AddColumn( + name: "supervisor1A_result", + table: "eva_create_evaluation_detail", + maxLength: 1, + nullable: true); + + migrationBuilder.AddColumn( + name: "supervisor2A", + table: "eva_create_evaluation_detail", + nullable: true); + + migrationBuilder.AddColumn( + name: "supervisor2A_date", + table: "eva_create_evaluation_detail", + nullable: true); + + migrationBuilder.AddColumn( + name: "supervisor2A_remark", + table: "eva_create_evaluation_detail", + maxLength: 1000, + nullable: true); + + migrationBuilder.AddColumn( + name: "supervisor2A_result", + table: "eva_create_evaluation_detail", + maxLength: 1, + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "supervisor1A", + table: "eva_create_evaluation_detail"); + + migrationBuilder.DropColumn( + name: "supervisor1A_date", + table: "eva_create_evaluation_detail"); + + migrationBuilder.DropColumn( + name: "supervisor1A_remark", + table: "eva_create_evaluation_detail"); + + migrationBuilder.DropColumn( + name: "supervisor1A_result", + table: "eva_create_evaluation_detail"); + + migrationBuilder.DropColumn( + name: "supervisor2A", + table: "eva_create_evaluation_detail"); + + migrationBuilder.DropColumn( + name: "supervisor2A_date", + table: "eva_create_evaluation_detail"); + + migrationBuilder.DropColumn( + name: "supervisor2A_remark", + table: "eva_create_evaluation_detail"); + + migrationBuilder.DropColumn( + name: "supervisor2A_result", + table: "eva_create_evaluation_detail"); + } + } +} diff --git a/Migrations/DataContextModelSnapshot.cs b/Migrations/DataContextModelSnapshot.cs index b86dcfb..e6d02db 100644 --- a/Migrations/DataContextModelSnapshot.cs +++ b/Migrations/DataContextModelSnapshot.cs @@ -123,6 +123,10 @@ namespace tb320eva.Migrations b.Property("score2"); + b.Property("supervisor1_id"); + + b.Property("supervisor2_id"); + b.Property("updated"); b.HasKey("id"); @@ -185,6 +189,16 @@ namespace tb320eva.Migrations b.Property("supervisor1"); + b.Property("supervisor1A"); + + b.Property("supervisor1A_date"); + + b.Property("supervisor1A_remark") + .HasMaxLength(1000); + + b.Property("supervisor1A_result") + .HasMaxLength(1); + b.Property("supervisor1_date"); b.Property("supervisor1_remark") @@ -195,6 +209,16 @@ namespace tb320eva.Migrations b.Property("supervisor2"); + b.Property("supervisor2A"); + + b.Property("supervisor2A_date"); + + b.Property("supervisor2A_remark") + .HasMaxLength(1000); + + b.Property("supervisor2A_result") + .HasMaxLength(1); + b.Property("supervisor2_date"); b.Property("supervisor2_remark") diff --git a/Models/eva_create_evaluation/eva_create_evaluationEntity.cs b/Models/eva_create_evaluation/eva_create_evaluationEntity.cs index b27f0d4..7c7f903 100644 --- a/Models/eva_create_evaluation/eva_create_evaluationEntity.cs +++ b/Models/eva_create_evaluation/eva_create_evaluationEntity.cs @@ -14,6 +14,8 @@ namespace TodoAPI2.Models { public class eva_create_evaluationEntity : BaseEntity2 { + + [ForeignKey("performance_plan_id")] public eva_performance_planEntity eva_performance_plan { get; set; } public Guid? performance_plan_id { get; set; } @@ -27,7 +29,11 @@ namespace TodoAPI2.Models [ForeignKey("evaluation_group_id")] public eva_evaluation_groupEntity eva_evaluation_group { get; set; } public Guid? evaluation_group_id { get; set; } + + public int? supervisor1_id { get; set; } + + public int? supervisor2_id { get; set; } + + } } - - diff --git a/Models/eva_create_evaluation/eva_create_evaluationInputModel.cs b/Models/eva_create_evaluation/eva_create_evaluationInputModel.cs index 9d6f714..2ecb2cb 100644 --- a/Models/eva_create_evaluation/eva_create_evaluationInputModel.cs +++ b/Models/eva_create_evaluation/eva_create_evaluationInputModel.cs @@ -26,6 +26,10 @@ namespace TodoAPI2.Models public Guid? evaluation_group_id { get; set; } + public int? supervisor1_id { get; set; } + + public int? supervisor2_id { get; set; } + public string active_mode { get; set; } } } diff --git a/Models/eva_create_evaluation/eva_create_evaluationService.cs b/Models/eva_create_evaluation/eva_create_evaluationService.cs index ade2c9d..b6dc3df 100644 --- a/Models/eva_create_evaluation/eva_create_evaluationService.cs +++ b/Models/eva_create_evaluation/eva_create_evaluationService.cs @@ -64,22 +64,28 @@ namespace TodoAPI2.Models } public eva_create_evaluationWithSelectionViewModel GetWithSelection(int id) { + var all_emp = emp.GetListByemployee_type(null, null); + var entity = _repository.Get(id); var i = Mapper.Map(entity); i.item_performance_plan_id = (from x in _repository.Context.eva_performance_plan select x).ToList(); - i.item_employee_id = emp.GetListByemployee_type(null, null); + i.item_employee_id = all_emp; i.item_evaluation_group_id = (from x in _repository.Context.eva_evaluation_group select x).ToList(); - + i.item_supervisor1_id = all_emp; + i.item_supervisor2_id = all_emp; return i; } public eva_create_evaluationWithSelectionViewModel GetBlankItem() { + var all_emp = emp.GetListByemployee_type(null, null); + var i = new eva_create_evaluationWithSelectionViewModel(); i.item_performance_plan_id = (from x in _repository.Context.eva_performance_plan select x).ToList(); - i.item_employee_id = emp.GetListByemployee_type(null, null); + i.item_employee_id = all_emp; i.item_evaluation_group_id = (from x in _repository.Context.eva_evaluation_group select x).ToList(); - + i.item_supervisor1_id = all_emp; + i.item_supervisor2_id = all_emp; return i; } @@ -93,6 +99,8 @@ namespace TodoAPI2.Models public List GetListBySearch(eva_create_evaluationSearchModel model) { + var all_emp = emp.GetListByemployee_type(null, null); + var data = ( from m_eva_create_evaluation in _repository.Context.eva_create_evaluation @@ -100,7 +108,7 @@ namespace TodoAPI2.Models into eva_performance_planResult1 from fk_eva_performance_planResult1 in eva_performance_planResult1.DefaultIfEmpty() - join fk_external_linkage2 in emp.GetListByemployee_type(null,null) on m_eva_create_evaluation.employee_id equals fk_external_linkage2.id + join fk_external_linkage2 in all_emp on m_eva_create_evaluation.employee_id equals fk_external_linkage2.id into external_linkageResult2 from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty() @@ -108,8 +116,15 @@ namespace TodoAPI2.Models into eva_evaluation_groupResult5 from fk_eva_evaluation_groupResult5 in eva_evaluation_groupResult5.DefaultIfEmpty() + join fk_external_linkage6 in all_emp on m_eva_create_evaluation.supervisor1_id equals fk_external_linkage6.id + into external_linkageResult6 + from fk_external_linkageResult6 in external_linkageResult6.DefaultIfEmpty() - where 1==1 + join fk_external_linkage7 in all_emp on m_eva_create_evaluation.supervisor2_id equals fk_external_linkage7.id + into external_linkageResult7 + from fk_external_linkageResult7 in external_linkageResult7.DefaultIfEmpty() + + where 1==1 && (m_eva_create_evaluation.performance_plan_id == model.performance_plan_id || !model.performance_plan_id.HasValue) && (m_eva_create_evaluation.evaluation_group_id == model.evaluation_group_id || !model.evaluation_group_id.HasValue) @@ -123,10 +138,14 @@ namespace TodoAPI2.Models score1 = m_eva_create_evaluation.score1, score2 = m_eva_create_evaluation.score2, evaluation_group_id = m_eva_create_evaluation.evaluation_group_id, + supervisor1_id = m_eva_create_evaluation.supervisor1_id, + supervisor2_id = m_eva_create_evaluation.supervisor2_id, performance_plan_id_eva_performance_plan_fiscal_year = fk_eva_performance_planResult1.fiscal_year, employee_id_external_linkage_external_name = fk_external_linkageResult2.fullname, - evaluation_group_id_eva_evaluation_group_code = fk_eva_evaluation_groupResult5.thegroup, + evaluation_group_id_eva_evaluation_group_code = fk_eva_evaluation_groupResult5.code, + supervisor1_id_external_linkage_external_name = fk_external_linkageResult6.fullname, + supervisor2_id_external_linkage_external_name = fk_external_linkageResult7.fullname, isActive = m_eva_create_evaluation.isActive, Created = m_eva_create_evaluation.created, @@ -180,6 +199,8 @@ namespace TodoAPI2.Models existingEntity.score1 = model.score1; existingEntity.score2 = model.score2; existingEntity.evaluation_group_id = model.evaluation_group_id; + existingEntity.supervisor1_id = model.supervisor1_id; + existingEntity.supervisor2_id = model.supervisor2_id; var updated = _repository.Update(id, existingEntity); @@ -198,11 +219,13 @@ namespace TodoAPI2.Models var existingEntity = _repository.Get(i.id.Value); if (existingEntity != null) { - existingEntity.performance_plan_id = i.performance_plan_id; - existingEntity.employee_id = i.employee_id; - existingEntity.score1 = i.score1; - existingEntity.score2 = i.score2; - existingEntity.evaluation_group_id = i.evaluation_group_id; + existingEntity.performance_plan_id = i.performance_plan_id; + existingEntity.employee_id = i.employee_id; + existingEntity.score1 = i.score1; + existingEntity.score2 = i.score2; + existingEntity.evaluation_group_id = i.evaluation_group_id; + existingEntity.supervisor1_id = i.supervisor1_id; + existingEntity.supervisor2_id = i.supervisor2_id; _repository.UpdateWithoutCommit(i.id.Value, existingEntity); diff --git a/Models/eva_create_evaluation/eva_create_evaluationViewModel.cs b/Models/eva_create_evaluation/eva_create_evaluationViewModel.cs index e8629f7..14a0bcf 100644 --- a/Models/eva_create_evaluation/eva_create_evaluationViewModel.cs +++ b/Models/eva_create_evaluation/eva_create_evaluationViewModel.cs @@ -24,9 +24,15 @@ namespace TodoAPI2.Models public Guid? evaluation_group_id { get; set; } + public int? supervisor1_id { get; set; } + + public int? supervisor2_id { get; set; } + public int? performance_plan_id_eva_performance_plan_fiscal_year { get; set; } public string employee_id_external_linkage_external_name { get; set; } public string evaluation_group_id_eva_evaluation_group_code { get; set; } + public string supervisor1_id_external_linkage_external_name { get; set; } + public string supervisor2_id_external_linkage_external_name { get; set; } public string description { diff --git a/Models/eva_create_evaluation/eva_create_evaluationWithSelectionViewModel.cs b/Models/eva_create_evaluation/eva_create_evaluationWithSelectionViewModel.cs index 6521bd1..c79f2b4 100644 --- a/Models/eva_create_evaluation/eva_create_evaluationWithSelectionViewModel.cs +++ b/Models/eva_create_evaluation/eva_create_evaluationWithSelectionViewModel.cs @@ -10,6 +10,8 @@ namespace TodoAPI2.Models public List item_performance_plan_id { get; set; } public List item_employee_id { get; set; } public List item_evaluation_group_id { get; set; } + public List item_supervisor1_id { get; set; } + public List item_supervisor2_id { get; set; } } } \ No newline at end of file diff --git a/Models/eva_create_evaluation_detail/eva_create_evaluation_detailEntity.cs b/Models/eva_create_evaluation_detail/eva_create_evaluation_detailEntity.cs index f816e0a..4e37325 100644 --- a/Models/eva_create_evaluation_detail/eva_create_evaluation_detailEntity.cs +++ b/Models/eva_create_evaluation_detail/eva_create_evaluation_detailEntity.cs @@ -85,6 +85,24 @@ namespace TodoAPI2.Models [MaxLength(1)] public string status_supervisor { get; set; } + public int? supervisor1A { get; set; } + [MaxLength(1)] + public string supervisor1A_result { get; set; } + + [MaxLength(1000)] + public string supervisor1A_remark { get; set; } + + public DateTime? supervisor1A_date { get; set; } + + public int? supervisor2A { get; set; } + + [MaxLength(1)] + public string supervisor2A_result { get; set; } + + [MaxLength(1000)] + public string supervisor2A_remark { get; set; } + + public DateTime? supervisor2A_date { get; set; } } } diff --git a/Models/eva_create_evaluation_detail_review03/Ieva_create_evaluation_detail_review03Service.cs b/Models/eva_create_evaluation_detail_review03/Ieva_create_evaluation_detail_review03Service.cs new file mode 100644 index 0000000..2b908f5 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review03/Ieva_create_evaluation_detail_review03Service.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_create_evaluation_detail_review03Service : IBaseService + { + new eva_create_evaluation_detail_review03ViewModel Insert(eva_create_evaluation_detail_review03InputModel model); + new eva_create_evaluation_detail_review03ViewModel Update(int id, eva_create_evaluation_detail_review03InputModel model); + List GetListBycreate_evaluation_id(int? create_evaluation_id); + List GetListBySearch(eva_create_evaluation_detail_review03SearchModel model); + + string UpdateMultiple(List model); + eva_create_evaluation_detail_review03WithSelectionViewModel GetWithSelection(int id); + eva_create_evaluation_detail_review03WithSelectionViewModel GetBlankItem(); + + + + } +} + diff --git a/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03InputModel.cs b/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03InputModel.cs new file mode 100644 index 0000000..cb5dd26 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03InputModel.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_create_evaluation_detail_review03InputModel + { + + public int? id { get; set; } + + public int? create_evaluation_id { get; set; } + + public int? supervisor1A { get; set; } + + public string supervisor1A_result { get; set; } + + public string supervisor1A_remark { get; set; } + + public DateTime? supervisor1A_date { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03ReportRequestModel.cs b/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03ReportRequestModel.cs new file mode 100644 index 0000000..8e32112 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03ReportRequestModel.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_create_evaluation_detail_review03ReportRequestModel : eva_create_evaluation_detail_review03SearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03SearchModel.cs b/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03SearchModel.cs new file mode 100644 index 0000000..d44b86e --- /dev/null +++ b/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03SearchModel.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_create_evaluation_detail_review03SearchModel + { + + public int id { get; set; } + + public int? create_evaluation_id { get; set; } + + } +} + diff --git a/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03Service.cs b/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03Service.cs new file mode 100644 index 0000000..e2c9013 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03Service.cs @@ -0,0 +1,239 @@ +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_review03Service : Ieva_create_evaluation_detail_review03Service + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + + public eva_create_evaluation_detail_review03Service(IBaseRepository2 repository, IMyDatabase mydb, Iexternal_linkageService inext) + { + _repository = repository; + db = mydb; + ext = inext; + } + + #region Private Functions + private eva_create_evaluation_detailEntity GetEntity(eva_create_evaluation_detail_review03InputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_create_evaluation_detail_review03ViewModel GetDto(eva_create_evaluation_detailEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public eva_create_evaluation_detail_review03ViewModel Get(int id) + { + var entity = _repository.Get(id); + + return GetDto(entity); + } + public eva_create_evaluation_detail_review03WithSelectionViewModel GetWithSelection(int id) + { + var entity = _repository.Get(id); + var i = Mapper.Map(entity); + i.item_supervisor1A_result = (from x in ext.GetAgreeDisagree() select x).ToList(); + + + return i; + } + public eva_create_evaluation_detail_review03WithSelectionViewModel GetBlankItem() + { + var i = new eva_create_evaluation_detail_review03WithSelectionViewModel(); + i.item_supervisor1A_result = (from x in ext.GetAgreeDisagree() select x).ToList(); + + + return i; + } + + public List GetListBycreate_evaluation_id(int? create_evaluation_id) + { + var model = new eva_create_evaluation_detail_review03SearchModel(); + model.create_evaluation_id = create_evaluation_id; + return GetListBySearch(model); + } + + public List GetListBySearch(eva_create_evaluation_detail_review03SearchModel model) + { + var data = ( + from m_eva_create_evaluation_detail_review03 in _repository.Context.eva_create_evaluation_detail + + join fk_external_linkage3 in ext.GetAgreeDisagree() on m_eva_create_evaluation_detail_review03.supervisor1A_result equals fk_external_linkage3.external_code + into external_linkageResult3 + from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty() + + + where 1==1 + //&& (m_eva_create_evaluation_detail_review03.id == model.id || !model.id.HasValue) + && (m_eva_create_evaluation_detail_review03.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue) + + + orderby m_eva_create_evaluation_detail_review03.created descending + select new eva_create_evaluation_detail_review03ViewModel() + { + id = m_eva_create_evaluation_detail_review03.id, + create_evaluation_id = m_eva_create_evaluation_detail_review03.create_evaluation_id, + supervisor1A = m_eva_create_evaluation_detail_review03.supervisor1A, + supervisor1A_result = m_eva_create_evaluation_detail_review03.supervisor1A_result, + supervisor1A_remark = m_eva_create_evaluation_detail_review03.supervisor1A_remark, + supervisor1A_date = m_eva_create_evaluation_detail_review03.supervisor1A_date, + + supervisor1A_result_external_linkage_external_name = fk_external_linkageResult3.external_name, + + isActive = m_eva_create_evaluation_detail_review03.isActive, + Created = m_eva_create_evaluation_detail_review03.created, + Updated = m_eva_create_evaluation_detail_review03.updated + } + ).Take(100).ToList(); + + return data; + } + + #endregion + + #region Manipulation Functions + + public int GetNewPrimaryKey() + { + int? newkey = 0; + + var x = (from i in _repository.Context.eva_create_evaluation_detail + orderby i.id descending + select i).Take(1).ToList(); + + if(x.Count > 0) + { + newkey = x[0].id + 1; + } + + return newkey.Value; + } + + public eva_create_evaluation_detail_review03ViewModel Insert(eva_create_evaluation_detail_review03InputModel model) + { + var entity = GetEntity(model); + entity.id = GetNewPrimaryKey(); + + + + var inserted = _repository.Insert(entity); + + return Get(inserted.id); + } + + public eva_create_evaluation_detail_review03ViewModel Update(int id, eva_create_evaluation_detail_review03InputModel model) + { + var existingEntity = _repository.Get(id); + if (existingEntity != null) + { + existingEntity.create_evaluation_id = model.create_evaluation_id; + existingEntity.supervisor1A = model.supervisor1A; + existingEntity.supervisor1A_result = model.supervisor1A_result; + existingEntity.supervisor1A_remark = model.supervisor1A_remark; + existingEntity.supervisor1A_date = model.supervisor1A_date; + + + 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.create_evaluation_id = i.create_evaluation_id; + existingEntity.supervisor1A = i.supervisor1A; + existingEntity.supervisor1A_result = i.supervisor1A_result; + existingEntity.supervisor1A_remark = i.supervisor1A_remark; + existingEntity.supervisor1A_date = i.supervisor1A_date; + + + _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_create_evaluation_detail_review03ViewModel SetAsActive(int id) + { + var updated = _repository.SetAsActive(id); + + return Get(updated.id); + } + public eva_create_evaluation_detail_review03ViewModel 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_create_evaluation_detail_review03/eva_create_evaluation_detail_review03ViewModel.cs b/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03ViewModel.cs new file mode 100644 index 0000000..2d68d2f --- /dev/null +++ b/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03ViewModel.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_create_evaluation_detail_review03ViewModel : BaseViewModel2 + { + + public int? create_evaluation_id { get; set; } + + public int? supervisor1A { get; set; } + + public string supervisor1A_result { get; set; } + + public string supervisor1A_remark { get; set; } + + public DateTime? supervisor1A_date { get; set; } + + public string txt_supervisor1A_date { get { return MyHelper.GetDateStringForReport(this.supervisor1A_date); } } + + public string supervisor1A_result_external_linkage_external_name { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03WithSelectionViewModel.cs b/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03WithSelectionViewModel.cs new file mode 100644 index 0000000..1aa5885 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03WithSelectionViewModel.cs @@ -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_review03WithSelectionViewModel: eva_create_evaluation_detail_review03ViewModel + { + public List item_supervisor1A_result { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_create_evaluation_detail_review04/Ieva_create_evaluation_detail_review04Service.cs b/Models/eva_create_evaluation_detail_review04/Ieva_create_evaluation_detail_review04Service.cs new file mode 100644 index 0000000..2c5b757 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review04/Ieva_create_evaluation_detail_review04Service.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_create_evaluation_detail_review04Service : IBaseService + { + new eva_create_evaluation_detail_review04ViewModel Insert(eva_create_evaluation_detail_review04InputModel model); + new eva_create_evaluation_detail_review04ViewModel Update(int id, eva_create_evaluation_detail_review04InputModel model); + List GetListBycreate_evaluation_id(int? create_evaluation_id); + List GetListBySearch(eva_create_evaluation_detail_review04SearchModel model); + + string UpdateMultiple(List model); + eva_create_evaluation_detail_review04WithSelectionViewModel GetWithSelection(int id); + eva_create_evaluation_detail_review04WithSelectionViewModel GetBlankItem(); + + + + } +} + diff --git a/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04InputModel.cs b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04InputModel.cs new file mode 100644 index 0000000..cee6b25 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04InputModel.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_create_evaluation_detail_review04InputModel + { + + public int? id { get; set; } + + public int? create_evaluation_id { get; set; } + + public int? supervisor2A { get; set; } + + public string supervisor2A_result { get; set; } + + public string supervisor2A_remark { get; set; } + + public DateTime? supervisor2A_date { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04ReportRequestModel.cs b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04ReportRequestModel.cs new file mode 100644 index 0000000..9b2600d --- /dev/null +++ b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04ReportRequestModel.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_create_evaluation_detail_review04ReportRequestModel : eva_create_evaluation_detail_review04SearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04SearchModel.cs b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04SearchModel.cs new file mode 100644 index 0000000..c04f758 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04SearchModel.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_create_evaluation_detail_review04SearchModel + { + + public int id { get; set; } + + public int? create_evaluation_id { get; set; } + + } +} + diff --git a/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04Service.cs b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04Service.cs new file mode 100644 index 0000000..a588292 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04Service.cs @@ -0,0 +1,239 @@ +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_review04Service : Ieva_create_evaluation_detail_review04Service + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + + public eva_create_evaluation_detail_review04Service(IBaseRepository2 repository, IMyDatabase mydb, Iexternal_linkageService inext) + { + _repository = repository; + db = mydb; + ext = inext; + } + + #region Private Functions + private eva_create_evaluation_detailEntity GetEntity(eva_create_evaluation_detail_review04InputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_create_evaluation_detail_review04ViewModel GetDto(eva_create_evaluation_detailEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public eva_create_evaluation_detail_review04ViewModel Get(int id) + { + var entity = _repository.Get(id); + + return GetDto(entity); + } + public eva_create_evaluation_detail_review04WithSelectionViewModel GetWithSelection(int id) + { + var entity = _repository.Get(id); + var i = Mapper.Map(entity); + i.item_supervisor2A_result = (from x in ext.GetAgreeDisagree() select x).ToList(); + + + return i; + } + public eva_create_evaluation_detail_review04WithSelectionViewModel GetBlankItem() + { + var i = new eva_create_evaluation_detail_review04WithSelectionViewModel(); + i.item_supervisor2A_result = (from x in ext.GetAgreeDisagree() select x).ToList(); + + + return i; + } + + public List GetListBycreate_evaluation_id(int? create_evaluation_id) + { + var model = new eva_create_evaluation_detail_review04SearchModel(); + model.create_evaluation_id = create_evaluation_id; + return GetListBySearch(model); + } + + public List GetListBySearch(eva_create_evaluation_detail_review04SearchModel model) + { + var data = ( + from m_eva_create_evaluation_detail_review04 in _repository.Context.eva_create_evaluation_detail + + join fk_external_linkage3 in ext.GetAgreeDisagree() on m_eva_create_evaluation_detail_review04.supervisor2A_result equals fk_external_linkage3.external_code + into external_linkageResult3 + from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty() + + + where 1==1 + //&& (m_eva_create_evaluation_detail_review04.id == model.id || !model.id.HasValue) + && (m_eva_create_evaluation_detail_review04.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue) + + + orderby m_eva_create_evaluation_detail_review04.created descending + select new eva_create_evaluation_detail_review04ViewModel() + { + id = m_eva_create_evaluation_detail_review04.id, + create_evaluation_id = m_eva_create_evaluation_detail_review04.create_evaluation_id, + supervisor2A = m_eva_create_evaluation_detail_review04.supervisor2A, + supervisor2A_result = m_eva_create_evaluation_detail_review04.supervisor2A_result, + supervisor2A_remark = m_eva_create_evaluation_detail_review04.supervisor2A_remark, + supervisor2A_date = m_eva_create_evaluation_detail_review04.supervisor2A_date, + + supervisor2A_result_external_linkage_external_name = fk_external_linkageResult3.external_name, + + isActive = m_eva_create_evaluation_detail_review04.isActive, + Created = m_eva_create_evaluation_detail_review04.created, + Updated = m_eva_create_evaluation_detail_review04.updated + } + ).Take(100).ToList(); + + return data; + } + + #endregion + + #region Manipulation Functions + + public int GetNewPrimaryKey() + { + int? newkey = 0; + + var x = (from i in _repository.Context.eva_create_evaluation_detail + orderby i.id descending + select i).Take(1).ToList(); + + if(x.Count > 0) + { + newkey = x[0].id + 1; + } + + return newkey.Value; + } + + public eva_create_evaluation_detail_review04ViewModel Insert(eva_create_evaluation_detail_review04InputModel model) + { + var entity = GetEntity(model); + entity.id = GetNewPrimaryKey(); + + + + var inserted = _repository.Insert(entity); + + return Get(inserted.id); + } + + public eva_create_evaluation_detail_review04ViewModel Update(int id, eva_create_evaluation_detail_review04InputModel model) + { + var existingEntity = _repository.Get(id); + if (existingEntity != null) + { + existingEntity.create_evaluation_id = model.create_evaluation_id; + existingEntity.supervisor2A = model.supervisor2A; + existingEntity.supervisor2A_result = model.supervisor2A_result; + existingEntity.supervisor2A_remark = model.supervisor2A_remark; + existingEntity.supervisor2A_date = model.supervisor2A_date; + + + 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.create_evaluation_id = i.create_evaluation_id; + existingEntity.supervisor2A = i.supervisor2A; + existingEntity.supervisor2A_result = i.supervisor2A_result; + existingEntity.supervisor2A_remark = i.supervisor2A_remark; + existingEntity.supervisor2A_date = i.supervisor2A_date; + + + _repository.UpdateWithoutCommit(i.id.Value, existingEntity); + } + } + 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_create_evaluation_detail_review04ViewModel SetAsActive(int id) + { + var updated = _repository.SetAsActive(id); + + return Get(updated.id); + } + public eva_create_evaluation_detail_review04ViewModel 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_create_evaluation_detail_review04/eva_create_evaluation_detail_review04ViewModel.cs b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04ViewModel.cs new file mode 100644 index 0000000..5f200df --- /dev/null +++ b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04ViewModel.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_create_evaluation_detail_review04ViewModel : BaseViewModel2 + { + + public int? create_evaluation_id { get; set; } + + public int? supervisor2A { get; set; } + + public string supervisor2A_result { get; set; } + + public string supervisor2A_remark { get; set; } + + public DateTime? supervisor2A_date { get; set; } + + public string txt_supervisor2A_date { get { return MyHelper.GetDateStringForReport(this.supervisor2A_date); } } + + public string supervisor2A_result_external_linkage_external_name { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04WithSelectionViewModel.cs b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04WithSelectionViewModel.cs new file mode 100644 index 0000000..9cefd9f --- /dev/null +++ b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04WithSelectionViewModel.cs @@ -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_review04WithSelectionViewModel: eva_create_evaluation_detail_review04ViewModel + { + public List item_supervisor2A_result { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_evaluation_achievement/eva_evaluation_achievementInputModel.cs b/Models/eva_evaluation_achievement/eva_evaluation_achievementInputModel.cs index d63ed5d..5f70f66 100644 --- a/Models/eva_evaluation_achievement/eva_evaluation_achievementInputModel.cs +++ b/Models/eva_evaluation_achievement/eva_evaluation_achievementInputModel.cs @@ -24,6 +24,16 @@ namespace TodoAPI2.Models public string thefile { get; set; } + public string target_score1 { get; set; } + + public string target_score2 { get; set; } + + public string target_score3 { get; set; } + + public string target_score4 { get; set; } + + public string target_score5 { get; set; } + public string active_mode { get; set; } } } diff --git a/Models/eva_evaluation_achievement/eva_evaluation_achievementService.cs b/Models/eva_evaluation_achievement/eva_evaluation_achievementService.cs index 6977732..d70712b 100644 --- a/Models/eva_evaluation_achievement/eva_evaluation_achievementService.cs +++ b/Models/eva_evaluation_achievement/eva_evaluation_achievementService.cs @@ -20,14 +20,14 @@ namespace TodoAPI2.Models public class eva_evaluation_achievementService : Ieva_evaluation_achievementService { private IBaseRepository2 _repository; - private IMyDatabase db; - private Iexternal_linkageService ext; + private IMyDatabase db; + private Iexternal_linkageService ext; public eva_evaluation_achievementService(IBaseRepository2 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>(entities); } - + #endregion #region Public Functions @@ -77,12 +77,12 @@ namespace TodoAPI2.Models public List GetListBycreate_evaluation_detail_id(int? create_evaluation_detail_id) { - var model = new eva_evaluation_achievementSearchModel(); + var model = new eva_evaluation_achievementSearchModel(); model.create_evaluation_detail_id = create_evaluation_detail_id; return GetListBySearch(model); } - public List GetListBySearch(eva_evaluation_achievementSearchModel model) + public List GetListBySearch(eva_evaluation_achievementSearchModel model) { var data = ( from m_eva_evaluation_achievement in _repository.Context.eva_evaluation_achievement @@ -92,11 +92,11 @@ namespace TodoAPI2.Models from fk_eva_create_evaluation_detailResult1 in eva_create_evaluation_detailResult1.DefaultIfEmpty() - where 1==1 + where 1 == 1 && (m_eva_evaluation_achievement.create_evaluation_detail_id == model.create_evaluation_detail_id || !model.create_evaluation_detail_id.HasValue) - orderby m_eva_evaluation_achievement.achievement + orderby m_eva_evaluation_achievement.achievement select new eva_evaluation_achievementViewModel() { id = m_eva_evaluation_achievement.id, @@ -108,6 +108,12 @@ namespace TodoAPI2.Models create_evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id = fk_eva_create_evaluation_detailResult1.create_evaluation_id, + target_score1 = m_eva_evaluation_achievement.target_score1, + target_score2 = m_eva_evaluation_achievement.target_score2, + target_score3 = m_eva_evaluation_achievement.target_score3, + target_score4 = m_eva_evaluation_achievement.target_score4, + target_score5 = m_eva_evaluation_achievement.target_score5, + isActive = m_eva_evaluation_achievement.isActive, Created = m_eva_evaluation_achievement.created, Updated = m_eva_evaluation_achievement.updated @@ -126,10 +132,10 @@ namespace TodoAPI2.Models int? newkey = 0; var x = (from i in _repository.Context.eva_evaluation_achievement - 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; } @@ -143,6 +149,7 @@ namespace TodoAPI2.Models entity.id = GetNewPrimaryKey(); var current_sum = (from i in _repository.Context.eva_evaluation_achievement + where i.create_evaluation_detail_id == model.create_evaluation_detail_id select i.weight).Sum(); if (current_sum + model.weight > 100) @@ -159,17 +166,18 @@ namespace TodoAPI2.Models } var inserted = _repository.Insert(entity); - + return Get(inserted.id); } public eva_evaluation_achievementViewModel Update(int id, eva_evaluation_achievementInputModel model) { var current_sum = (from i in _repository.Context.eva_evaluation_achievement + where i.create_evaluation_detail_id == model.create_evaluation_detail_id select i.weight).Sum(); var current_item_weight = (from i in _repository.Context.eva_evaluation_achievement - where i.id==id + where i.id == id select i.weight).Sum(); if (current_sum - current_item_weight + model.weight > 100) @@ -185,61 +193,69 @@ namespace TodoAPI2.Models existingEntity.weight = model.weight; if (!string.IsNullOrEmpty(model.thefile)) { - if (model.thefile.StartsWith("Uploads")) - { - var thefileFileName = FileUtil.MoveTempUploadFileToActualPath( + if (model.thefile.StartsWith("Uploads")) + { + var thefileFileName = FileUtil.MoveTempUploadFileToActualPath( model.thefile, FilePathConstant.DirType.FilesTestUpload, existingEntity.id, existingEntity.thefile); - existingEntity.thefile = thefileFileName; - } - else - { - existingEntity.thefile = model.thefile; - } + existingEntity.thefile = thefileFileName; + } + else + { + existingEntity.thefile = model.thefile; + } } - else - { - existingEntity.thefile = null; - } - + else + { + existingEntity.thefile = null; + } + existingEntity.target_score1 = model.target_score1; + existingEntity.target_score2 = model.target_score2; + existingEntity.target_score3 = model.target_score3; + existingEntity.target_score4 = model.target_score4; + existingEntity.target_score5 = model.target_score5; 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 model) + public string UpdateMultiple(List model) { - foreach(var i in model) + foreach (var i in model) { if (i.active_mode == "1" && i.id.HasValue) // update - { + { var existingEntity = _repository.Get(i.id.Value); if (existingEntity != null) { - existingEntity.create_evaluation_detail_id = i.create_evaluation_detail_id; - existingEntity.achievement = i.achievement; - existingEntity.weight = i.weight; - if (!string.IsNullOrEmpty(i.thefile)) - { - if (i.thefile.StartsWith("Uploads")) - { - var thefileFileName = FileUtil.MoveTempUploadFileToActualPath( - i.thefile, FilePathConstant.DirType.FilesTestUpload, existingEntity.id, existingEntity.thefile); - existingEntity.thefile = thefileFileName; - } - else - { - existingEntity.thefile = i.thefile; - } - } - else - { - existingEntity.thefile = null; - } - + existingEntity.create_evaluation_detail_id = i.create_evaluation_detail_id; + existingEntity.achievement = i.achievement; + existingEntity.weight = i.weight; + if (!string.IsNullOrEmpty(i.thefile)) + { + if (i.thefile.StartsWith("Uploads")) + { + var thefileFileName = FileUtil.MoveTempUploadFileToActualPath( + i.thefile, FilePathConstant.DirType.FilesTestUpload, existingEntity.id, existingEntity.thefile); + existingEntity.thefile = thefileFileName; + } + else + { + existingEntity.thefile = i.thefile; + } + } + else + { + existingEntity.thefile = null; + } + 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); @@ -252,15 +268,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(); } @@ -291,4 +307,6 @@ namespace TodoAPI2.Models #endregion } -} \ No newline at end of file +} + + diff --git a/Models/eva_evaluation_achievement/eva_evaluation_achievementViewModel.cs b/Models/eva_evaluation_achievement/eva_evaluation_achievementViewModel.cs index cf667eb..404f124 100644 --- a/Models/eva_evaluation_achievement/eva_evaluation_achievementViewModel.cs +++ b/Models/eva_evaluation_achievement/eva_evaluation_achievementViewModel.cs @@ -30,9 +30,19 @@ namespace TodoAPI2.Models return (string.IsNullOrEmpty(thefile) ? "" : $"{thefile}"); } - } + } + public string target_score1 { get; set; } + + public string target_score2 { get; set; } + + public string target_score3 { get; set; } + + public string target_score4 { get; set; } + + public string target_score5 { get; set; } public int? create_evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id { get; set; } } -} \ No newline at end of file +} + diff --git a/Models/eva_evaluation_behavior/eva_evaluation_behaviorService.cs b/Models/eva_evaluation_behavior/eva_evaluation_behaviorService.cs index f7f4d94..5f38c3b 100644 --- a/Models/eva_evaluation_behavior/eva_evaluation_behaviorService.cs +++ b/Models/eva_evaluation_behavior/eva_evaluation_behaviorService.cs @@ -141,6 +141,7 @@ namespace TodoAPI2.Models entity.id = GetNewPrimaryKey(); var current_sum = (from i in _repository.Context.eva_evaluation_behavior + where i.create_evaluation_detail_id == model.create_evaluation_detail_id select i.weight).Sum(); if (current_sum + model.weight > 100) @@ -156,6 +157,7 @@ namespace TodoAPI2.Models public eva_evaluation_behaviorViewModel Update(int id, eva_evaluation_behaviorInputModel model) { var current_sum = (from i in _repository.Context.eva_evaluation_behavior + where i.create_evaluation_detail_id == model.create_evaluation_detail_id select i.weight).Sum(); var current_item_weight = (from i in _repository.Context.eva_evaluation_behavior diff --git a/Models/eva_level_score_basic/Ieva_level_score_basicService.cs b/Models/eva_level_score_basic/Ieva_level_score_basicService.cs new file mode 100644 index 0000000..9e2a334 --- /dev/null +++ b/Models/eva_level_score_basic/Ieva_level_score_basicService.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_level_score_basicService : IBaseService + { + new eva_level_score_basicViewModel Insert(eva_level_score_basicInputModel model); + new eva_level_score_basicViewModel Update(Guid id, eva_level_score_basicInputModel model); + List GetListBycode(string code); + List GetListBySearch(eva_level_score_basicSearchModel model); + + string UpdateMultiple(List model); + eva_level_score_basicWithSelectionViewModel GetWithSelection(Guid id); + eva_level_score_basicWithSelectionViewModel GetBlankItem(); + + + + } +} + diff --git a/Models/eva_level_score_basic/eva_level_score_basicInputModel.cs b/Models/eva_level_score_basic/eva_level_score_basicInputModel.cs new file mode 100644 index 0000000..d53b6ec --- /dev/null +++ b/Models/eva_level_score_basic/eva_level_score_basicInputModel.cs @@ -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_level_score_basicInputModel + { + + public Guid? id { get; set; } + + public string code { get; set; } + + public string detail { get; set; } + + public decimal? max_score { get; set; } + + public decimal? min_score { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/eva_level_score_basic/eva_level_score_basicReportRequestModel.cs b/Models/eva_level_score_basic/eva_level_score_basicReportRequestModel.cs new file mode 100644 index 0000000..e9c55d4 --- /dev/null +++ b/Models/eva_level_score_basic/eva_level_score_basicReportRequestModel.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_level_score_basicReportRequestModel : eva_level_score_basicSearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_level_score_basic/eva_level_score_basicSearchModel.cs b/Models/eva_level_score_basic/eva_level_score_basicSearchModel.cs new file mode 100644 index 0000000..02372e5 --- /dev/null +++ b/Models/eva_level_score_basic/eva_level_score_basicSearchModel.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_level_score_basicSearchModel + { + + public Guid id { get; set; } + + public string code { get; set; } + + } +} + diff --git a/Models/eva_level_score_basic/eva_level_score_basicService.cs b/Models/eva_level_score_basic/eva_level_score_basicService.cs new file mode 100644 index 0000000..8a49069 --- /dev/null +++ b/Models/eva_level_score_basic/eva_level_score_basicService.cs @@ -0,0 +1,213 @@ +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_level_score_basicService : Ieva_level_score_basicService + { + private IBaseRepository _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + + public eva_level_score_basicService(IBaseRepository repository, IMyDatabase mydb, Iexternal_linkageService inext) + { + _repository = repository; + db = mydb; + ext = inext; + } + + #region Private Functions + private eva_level_scoreEntity GetEntity(eva_level_score_basicInputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_level_score_basicViewModel GetDto(eva_level_scoreEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public eva_level_score_basicViewModel Get(Guid id) + { + var entity = _repository.Get(id); + + return GetDto(entity); + } + public eva_level_score_basicWithSelectionViewModel GetWithSelection(Guid id) + { + var entity = _repository.Get(id); + var i = Mapper.Map(entity); + + + return i; + } + public eva_level_score_basicWithSelectionViewModel GetBlankItem() + { + var i = new eva_level_score_basicWithSelectionViewModel(); + + + return i; + } + + public List GetListBycode(string code) + { + var model = new eva_level_score_basicSearchModel(); + model.code = code; + return GetListBySearch(model); + } + + public List GetListBySearch(eva_level_score_basicSearchModel model) + { + var data = ( + from m_eva_level_score_basic in _repository.Context.eva_level_score + + + where 1==1 + //&& (m_eva_level_score_basic.id == model.id || !model.id.HasValue) + && (m_eva_level_score_basic.code == model.code || string.IsNullOrEmpty(model.code)) + + + orderby m_eva_level_score_basic.created descending + select new eva_level_score_basicViewModel() + { + id = m_eva_level_score_basic.id, + code = m_eva_level_score_basic.code, + detail = m_eva_level_score_basic.detail, + max_score = m_eva_level_score_basic.max_score, + min_score = m_eva_level_score_basic.min_score, + + + isActive = m_eva_level_score_basic.isActive, + Created = m_eva_level_score_basic.created, + Updated = m_eva_level_score_basic.updated + } + ).Take(100).ToList(); + + return data; + } + + #endregion + + #region Manipulation Functions + + public eva_level_score_basicViewModel Insert(eva_level_score_basicInputModel model) + { + var entity = GetEntity(model); + entity.id = Guid.NewGuid(); + + + + var inserted = _repository.Insert(entity); + + return Get(inserted.id); + } + + public eva_level_score_basicViewModel Update(Guid id, eva_level_score_basicInputModel model) + { + var existingEntity = _repository.Get(id); + if (existingEntity != null) + { + existingEntity.code = model.code; + existingEntity.detail = model.detail; + existingEntity.max_score = model.max_score; + existingEntity.min_score = model.min_score; + + + 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.code = i.code; + existingEntity.detail = i.detail; + existingEntity.max_score = i.max_score; + existingEntity.min_score = i.min_score; + + + _repository.UpdateWithoutCommit(i.id.Value, existingEntity); + } + } + else if (i.active_mode == "1" && !i.id.HasValue) // add + { + var entity = GetEntity(i); + entity.id = Guid.NewGuid(); + _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_level_score_basicViewModel SetAsActive(Guid id) + { + var updated = _repository.SetAsActive(id); + + return Get(updated.id); + } + public eva_level_score_basicViewModel SetAsInactive(Guid id) + { + var updated = _repository.SetAsInActive(id); + + return Get(updated.id); + } + public void Delete(Guid id) + { + _repository.Delete(id); + + return; + } + #endregion + + #region Match Item + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/Models/eva_level_score_basic/eva_level_score_basicViewModel.cs b/Models/eva_level_score_basic/eva_level_score_basicViewModel.cs new file mode 100644 index 0000000..d090269 --- /dev/null +++ b/Models/eva_level_score_basic/eva_level_score_basicViewModel.cs @@ -0,0 +1,27 @@ +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_level_score_basicViewModel : BaseViewModel2 + { + + public string code { get; set; } + + public string detail { get; set; } + + public decimal? max_score { get; set; } + + public decimal? min_score { get; set; } + + + } +} \ No newline at end of file diff --git a/Models/eva_level_score_basic/eva_level_score_basicWithSelectionViewModel.cs b/Models/eva_level_score_basic/eva_level_score_basicWithSelectionViewModel.cs new file mode 100644 index 0000000..03a19de --- /dev/null +++ b/Models/eva_level_score_basic/eva_level_score_basicWithSelectionViewModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TodoAPI2.Models +{ + public class eva_level_score_basicWithSelectionViewModel: eva_level_score_basicViewModel + { + + } +} \ No newline at end of file diff --git a/Startup.cs b/Startup.cs index 4e1cc97..9643872 100644 --- a/Startup.cs +++ b/Startup.cs @@ -268,6 +268,12 @@ namespace Test01 services.AddScoped(); + services.AddScoped(); + + services.AddScoped(); + + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -459,6 +465,17 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); }); #endregion diff --git a/ViewControllers/eva_level_score_basicViewControllers.cs b/ViewControllers/eva_level_score_basicViewControllers.cs new file mode 100644 index 0000000..11929b4 --- /dev/null +++ b/ViewControllers/eva_level_score_basicViewControllers.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using TodoAPI2.Models; +using STAFF_API.Models; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Configuration; +using TodoAPI2.Controllers; + +namespace TodoAPI2.Controllers +{ + public class eva_level_score_basicViewController : Controller + { + private ILogger _logger; + private Ieva_level_score_basicService _repository; + private IConfiguration Configuration { get; set; } + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_level_score_basicViewController(ILogger logger, Ieva_level_score_basicService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + public IActionResult eva_level_score_basic() + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + return View(); + } + + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} + + diff --git a/Views/eva_create_evaluationView/eva_create_evaluation.cshtml b/Views/eva_create_evaluationView/eva_create_evaluation.cshtml index 47d07b0..13cb989 100644 --- a/Views/eva_create_evaluationView/eva_create_evaluation.cshtml +++ b/Views/eva_create_evaluationView/eva_create_evaluation.cshtml @@ -34,15 +34,28 @@ + +
+
+ + +
+ +
+ + +
+
+
- +
- +
diff --git a/Views/eva_create_evaluationView/eva_create_evaluation_d.cshtml b/Views/eva_create_evaluationView/eva_create_evaluation_d.cshtml index 682d20d..80c330d 100644 --- a/Views/eva_create_evaluationView/eva_create_evaluation_d.cshtml +++ b/Views/eva_create_evaluationView/eva_create_evaluation_d.cshtml @@ -91,8 +91,6 @@
- -
@@ -109,19 +107,31 @@
+ +
+
+ + +
+ +
+ + +
+
+
- +
- +
-
diff --git a/Views/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d.cshtml b/Views/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d.cshtml index 1049447..e7fb0f6 100644 --- a/Views/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d.cshtml +++ b/Views/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d.cshtml @@ -84,8 +84,33 @@ +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+ +
+ + +
+
@@ -208,6 +233,11 @@ เครื่องมือ + + + + + @@ -219,17 +249,6 @@
พฤติกรรมการปฏิบัติงาน
-
-
- - - -
- -
- -
-
diff --git a/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2.cshtml b/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2.cshtml index 48de5d5..43b1aea 100644 --- a/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2.cshtml +++ b/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2.cshtml @@ -297,9 +297,6 @@
ความเห็นผู้ประเมินสูงสุด
-
- กรุณากรอกข้อมูลลงในแบบฟอร์ม -
@@ -350,6 +347,99 @@
+
+ +
+
ความเห็น ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง
+ +
+
+ +
+
+ + + + + +
+
+ + +
+ +
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ +
+
+ +
+
+
+ +
+ +
+
ความเห็น ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)
+
+
+ +
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ +
+
+ +
+
+ +
+ + + @section FooterPlaceHolder{ @@ -357,6 +447,8 @@ + + } diff --git a/Views/eva_create_evaluation_detail_review03View/eva_create_evaluation_detail_review03_d.cshtml b/Views/eva_create_evaluation_detail_review03View/eva_create_evaluation_detail_review03_d.cshtml new file mode 100644 index 0000000..014605d --- /dev/null +++ b/Views/eva_create_evaluation_detail_review03View/eva_create_evaluation_detail_review03_d.cshtml @@ -0,0 +1,99 @@ +@using Microsoft.Extensions.Configuration +@inject IConfiguration Configuration +@{ + ViewData["Title"] = "eva_create_evaluation_detail_review03"; + Layout = "_LayoutDirect"; +} + +
+
+
+ @Configuration["SiteInformation:modulename"] +
+
+
+ +
+
+ +
+
บันทึกข้อมูล eva_create_evaluation_detail_review03
+ +
+
+ กรุณากรอกข้อมูลลงในแบบฟอร์ม +
+
+ +
+
+ +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
+ + +
+ +
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ +
+
+ + +
+
+ +
+ +@section FooterPlaceHolder{ + + +} + diff --git a/Views/eva_create_evaluation_detail_review04View/eva_create_evaluation_detail_review04_d.cshtml b/Views/eva_create_evaluation_detail_review04View/eva_create_evaluation_detail_review04_d.cshtml new file mode 100644 index 0000000..a796e5d --- /dev/null +++ b/Views/eva_create_evaluation_detail_review04View/eva_create_evaluation_detail_review04_d.cshtml @@ -0,0 +1,99 @@ +@using Microsoft.Extensions.Configuration +@inject IConfiguration Configuration +@{ + ViewData["Title"] = "eva_create_evaluation_detail_review04"; + Layout = "_LayoutDirect"; +} + +
+
+
+ @Configuration["SiteInformation:modulename"] +
+
+
+ +
+
+ +
+
บันทึกข้อมูล eva_create_evaluation_detail_review04
+ +
+
+ กรุณากรอกข้อมูลลงในแบบฟอร์ม +
+
+ +
+
+ +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
+ + +
+ +
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ +
+
+ + +
+
+ +
+ +@section FooterPlaceHolder{ + + +} + diff --git a/Views/eva_level_scoreView/eva_level_score.cshtml b/Views/eva_level_scoreView/eva_level_score.cshtml index a0c0f8c..7e1159e 100644 --- a/Views/eva_level_scoreView/eva_level_score.cshtml +++ b/Views/eva_level_scoreView/eva_level_score.cshtml @@ -31,18 +31,15 @@
-
- - -
-
+
+ + +
- - @@ -64,13 +61,13 @@
-
กำหนดระดับผลการประเมิน
+
กำหนดร้อยละที่ได้เลื่อน
@@ -81,7 +78,7 @@
- +
@@ -93,9 +90,8 @@
- - + diff --git a/Views/eva_level_scoreView/eva_level_score_d.cshtml b/Views/eva_level_scoreView/eva_level_score_d.cshtml index 442e42b..07d66d5 100644 --- a/Views/eva_level_scoreView/eva_level_score_d.cshtml +++ b/Views/eva_level_scoreView/eva_level_score_d.cshtml @@ -71,18 +71,15 @@
-
กำหนดระดับผลการประเมิน
+
กำหนดร้อยละที่ได้เลื่อน
-
- กรุณากรอกข้อมูลลงในแบบฟอร์ม -
@@ -93,45 +90,35 @@
- +
- +
- - + +
- - + +
- -
-
-
- - -
-
-

-
กำหนดร้อยละที่ได้เลื่อน
diff --git a/Views/eva_level_score_basicView/eva_level_score_basic.cshtml b/Views/eva_level_score_basicView/eva_level_score_basic.cshtml new file mode 100644 index 0000000..07da8ce --- /dev/null +++ b/Views/eva_level_score_basicView/eva_level_score_basic.cshtml @@ -0,0 +1,113 @@ +@using Microsoft.Extensions.Configuration +@inject IConfiguration Configuration +@{ + ViewData["Title"] = "eva_level_score_basic"; +} + + + +
+
+
+ @Configuration["SiteInformation:modulename"] +
+
+
+ +
+
+ +
+
ค้นหา ระดับการประเมิน
+
+
+ +
+ + +
+ +
+ + +
+ +
+
+ +
เครื่องมือ
+ + + + + + + + + + +
เครื่องมือ
+
+ +@section FooterPlaceHolder{ + + +} + diff --git a/Views/home/index.cshtml b/Views/home/index.cshtml index cfbafd6..db61f1d 100644 --- a/Views/home/index.cshtml +++ b/Views/home/index.cshtml @@ -31,7 +31,10 @@
  • ·กำหนดแผนการประเมินเพื่อปรับเลื่อนเงินเดือน
    +
    • ·กำหนดกลุ่มการประเมิน
      diff --git a/tb320eva.xml b/tb320eva.xml index 82f03e0..9ada29a 100644 --- a/tb320eva.xml +++ b/tb320eva.xml @@ -1228,6 +1228,220 @@ If the model is invalid Error Occurred + + + Default constructure for dependency injection + + + + + + + + Get specific item by id + + + + Return Get specific item by id + Returns the item + Error Occurred + + + + Get Blank Item + + + + Return a blank item + Returns the item + Error Occurred + + + + Get list items by create_evaluation_id + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Get list items by search + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Download Report + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Create new item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Update item + + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Delete item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Update multiple item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Default constructure for dependency injection + + + + + + + + Get specific item by id + + + + Return Get specific item by id + Returns the item + Error Occurred + + + + Get Blank Item + + + + Return a blank item + Returns the item + Error Occurred + + + + Get list items by create_evaluation_id + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Get list items by search + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Download Report + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Create new item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Update item + + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Delete item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Update multiple item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + Default constructure for dependency injection @@ -2525,6 +2739,113 @@ If the model is invalid Error Occurred + + + Default constructure for dependency injection + + + + + + + + Get specific item by id + + + + Return Get specific item by id + Returns the item + Error Occurred + + + + Get Blank Item + + + + Return a blank item + Returns the item + Error Occurred + + + + Get list items by code + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Get list items by search + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Download Report + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Create new item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Update item + + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Delete item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Update multiple item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + Default constructure for dependency injection @@ -3363,6 +3684,14 @@ + + + Default constructure for dependency injection + + + + + Default constructure for dependency injection diff --git a/wwwroot/js/eva_create_evaluation/eva_create_evaluation.js b/wwwroot/js/eva_create_evaluation/eva_create_evaluation.js index 8ac03ca..ba7feee 100644 --- a/wwwroot/js/eva_create_evaluation/eva_create_evaluation.js +++ b/wwwroot/js/eva_create_evaluation/eva_create_evaluation.js @@ -26,6 +26,8 @@ DropDownClearFormAndFeedWithData($("#eva_create_evaluation_employee_id"), data, $("#eva_create_evaluation_score1").val(data.score1); $("#eva_create_evaluation_score2").val(data.score2); DropDownClearFormAndFeedWithData($("#eva_create_evaluation_evaluation_group_id"), data, "id", "thegroup", "item_evaluation_group_id", data.evaluation_group_id); +DropDownClearFormAndFeedWithData($("#eva_create_evaluation_supervisor1_id"), data, "id", "fullname", "item_supervisor1_id", data.supervisor1_id); +DropDownClearFormAndFeedWithData($("#eva_create_evaluation_supervisor2_id"), data, "id", "fullname", "item_supervisor2_id", data.supervisor2_id); } @@ -37,7 +39,8 @@ eva_create_evaluationObject.employee_id = $("#eva_create_evaluation_employee_id" eva_create_evaluationObject.score1 = $("#eva_create_evaluation_score1").val(); eva_create_evaluationObject.score2 = $("#eva_create_evaluation_score2").val(); eva_create_evaluationObject.evaluation_group_id = $("#eva_create_evaluation_evaluation_group_id").val(); - +eva_create_evaluationObject.supervisor1_id = $("#eva_create_evaluation_supervisor1_id").val(); +eva_create_evaluationObject.supervisor2_id = $("#eva_create_evaluation_supervisor2_id").val(); return eva_create_evaluationObject; } @@ -214,7 +217,18 @@ function eva_create_evaluation_GetSelect(f) { -//================= Multi-Selection Function ========================================= - +//================= Control Function ========================================= +function Oneva_create_evaluation_score1Change() +{ + var s1 = $("#eva_create_evaluation_score1").val(); + var s2 = $("#eva_create_evaluation_score2").val(); + $("#eva_create_evaluation_score2").val(100 - s1); +} +function Oneva_create_evaluation_score2Change() +{ + var s1 = $("#eva_create_evaluation_score1").val(); + var s2 = $("#eva_create_evaluation_score2").val(); + $("#eva_create_evaluation_score1").val(100 - s2); +} \ No newline at end of file diff --git a/wwwroot/js/eva_create_evaluation/eva_create_evaluation_d.js b/wwwroot/js/eva_create_evaluation/eva_create_evaluation_d.js index d35413f..70af89c 100644 --- a/wwwroot/js/eva_create_evaluation/eva_create_evaluation_d.js +++ b/wwwroot/js/eva_create_evaluation/eva_create_evaluation_d.js @@ -10,6 +10,8 @@ DropDownClearFormAndFeedWithData($("#eva_create_evaluation_employee_id"), data, $("#eva_create_evaluation_score1").val(data.score1); $("#eva_create_evaluation_score2").val(data.score2); DropDownClearFormAndFeedWithData($("#eva_create_evaluation_evaluation_group_id"), data, "id", "thegroup", "item_evaluation_group_id", data.evaluation_group_id); +DropDownClearFormAndFeedWithData($("#eva_create_evaluation_supervisor1_id"), data, "id", "fullname", "item_supervisor1_id", data.supervisor1_id); +DropDownClearFormAndFeedWithData($("#eva_create_evaluation_supervisor2_id"), data, "id", "fullname", "item_supervisor2_id", data.supervisor2_id); } @@ -21,7 +23,8 @@ eva_create_evaluationObject.employee_id = $("#eva_create_evaluation_employee_id" eva_create_evaluationObject.score1 = $("#eva_create_evaluation_score1").val(); eva_create_evaluationObject.score2 = $("#eva_create_evaluation_score2").val(); eva_create_evaluationObject.evaluation_group_id = $("#eva_create_evaluation_evaluation_group_id").val(); - +eva_create_evaluationObject.supervisor1_id = $("#eva_create_evaluation_supervisor1_id").val(); +eva_create_evaluationObject.supervisor2_id = $("#eva_create_evaluation_supervisor2_id").val(); return eva_create_evaluationObject; } @@ -101,6 +104,19 @@ function eva_create_evaluation_GoDelete(a) { -//================= Multi-Selection Function ========================================= +//================= Control Function ========================================= +function Oneva_create_evaluation_score1Change() +{ + var s1 = $("#eva_create_evaluation_score1").val(); + var s2 = $("#eva_create_evaluation_score2").val(); + $("#eva_create_evaluation_score2").val(100 - s1); +} + +function Oneva_create_evaluation_score2Change() +{ + var s1 = $("#eva_create_evaluation_score1").val(); + var s2 = $("#eva_create_evaluation_score2").val(); + $("#eva_create_evaluation_score1").val(100 - s2); +} diff --git a/wwwroot/js/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03_d.js b/wwwroot/js/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03_d.js new file mode 100644 index 0000000..56e0386 --- /dev/null +++ b/wwwroot/js/eva_create_evaluation_detail_review03/eva_create_evaluation_detail_review03_d.js @@ -0,0 +1,106 @@ +var eva_create_evaluation_detail_review03_editMode = "CREATE"; +var eva_create_evaluation_detail_review03_API = "/api/eva_create_evaluation_detail_review03/"; + +//================= Form Data Customizaiton ========================================= + +function eva_create_evaluation_detail_review03_FeedDataToForm(data) { +$("#eva_create_evaluation_detail_review03_id").val(data.id); +$("#eva_create_evaluation_detail_review03_create_evaluation_id").val(data.create_evaluation_id); +$("#eva_create_evaluation_detail_review03_supervisor1A").val(data.supervisor1A); +DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_review03_supervisor1A_result"), data, "id", "external_name", "item_supervisor1A_result", data.supervisor1A_result); +$("#eva_create_evaluation_detail_review03_supervisor1A_remark").val(data.supervisor1A_remark); +$("#eva_create_evaluation_detail_review03_supervisor1A_date").val(formatDate(data.supervisor1A_date)); + +} + +function eva_create_evaluation_detail_review03_GetFromForm() { + var eva_create_evaluation_detail_review03Object = new Object(); +eva_create_evaluation_detail_review03Object.id = $("#eva_create_evaluation_detail_review03_id").val(); +eva_create_evaluation_detail_review03Object.create_evaluation_id = $("#eva_create_evaluation_detail_review03_create_evaluation_id").val(); +eva_create_evaluation_detail_review03Object.supervisor1A = $("#eva_create_evaluation_detail_review03_supervisor1A").val(); +eva_create_evaluation_detail_review03Object.supervisor1A_result = $("#eva_create_evaluation_detail_review03_supervisor1A_result").val(); +eva_create_evaluation_detail_review03Object.supervisor1A_remark = $("#eva_create_evaluation_detail_review03_supervisor1A_remark").val(); +eva_create_evaluation_detail_review03Object.supervisor1A_date = getDate($("#eva_create_evaluation_detail_review03_supervisor1A_date").val()); + + + return eva_create_evaluation_detail_review03Object; +} + +function eva_create_evaluation_detail_review03_InitialForm() { + var successFunc = function (result) { + eva_create_evaluation_detail_review03_FeedDataToForm(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_create_evaluation_detail_review03_API + "GetBlankItem", successFunc, AlertDanger); +} + +//================= Form Mode Setup and Flow ========================================= + +function eva_create_evaluation_detail_review03_SetEditForm(a) { + var successFunc = function (result) { + eva_create_evaluation_detail_review03_editMode = "UPDATE"; + eva_create_evaluation_detail_review03_FeedDataToForm(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_create_evaluation_detail_review03_API + a, successFunc, AlertDanger); +} + +function eva_create_evaluation_detail_review03_SetCreateForm() { + eva_create_evaluation_detail_review03_editMode = "CREATE"; + eva_create_evaluation_detail_review03_InitialForm(); +} + +//================= Update and Delete ========================================= + +var eva_create_evaluation_detail_review03_customValidation = function (group) { + return ""; +}; + +function eva_create_evaluation_detail_review03_PutUpdate() { + if (!ValidateForm('eva_create_evaluation_detail_review03', eva_create_evaluation_detail_review03_customValidation)) + { + return; + } + var data = eva_create_evaluation_detail_review03_GetFromForm(); + + //Update Mode + if (eva_create_evaluation_detail_review03_editMode === "UPDATE") { + var successFunc1 = function (result) { + AlertSuccess(result.code+" "+result.message); + endLoad(); + }; + startLoad(); + AjaxPutRequest(apisite + eva_create_evaluation_detail_review03_API + data.id, data, successFunc1, AlertDanger); + } + // Create mode + else { + var successFunc2 = function (result) { + AlertSuccess(result.code+" "+result.message); + endLoad(); + }; + startLoad(); + AjaxPostRequest(apisite + eva_create_evaluation_detail_review03_API, data, successFunc2, AlertDanger); + } +} + +function eva_create_evaluation_detail_review03_GoDelete(a) { + if (confirm('คุณต้องการลบ ' + a + ' ใช่หรือไม่?')) { + var successFunc = function (result) { + AlertSuccess(result.code+" "+result.message); + eva_create_evaluation_detail_review03_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxDeleteRequest(apisite + eva_create_evaluation_detail_review03_API + a, null, successFunc, AlertDanger); + } +} + +//================= File Upload ========================================= + + + +//================= Multi-Selection Function ========================================= + + diff --git a/wwwroot/js/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04_d.js b/wwwroot/js/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04_d.js new file mode 100644 index 0000000..d3ff2c5 --- /dev/null +++ b/wwwroot/js/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04_d.js @@ -0,0 +1,106 @@ +var eva_create_evaluation_detail_review04_editMode = "CREATE"; +var eva_create_evaluation_detail_review04_API = "/api/eva_create_evaluation_detail_review04/"; + +//================= Form Data Customizaiton ========================================= + +function eva_create_evaluation_detail_review04_FeedDataToForm(data) { +$("#eva_create_evaluation_detail_review04_id").val(data.id); +$("#eva_create_evaluation_detail_review04_create_evaluation_id").val(data.create_evaluation_id); +$("#eva_create_evaluation_detail_review04_supervisor2A").val(data.supervisor2A); +DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_review04_supervisor2A_result"), data, "id", "external_name", "item_supervisor2A_result", data.supervisor2A_result); +$("#eva_create_evaluation_detail_review04_supervisor2A_remark").val(data.supervisor2A_remark); +$("#eva_create_evaluation_detail_review04_supervisor2A_date").val(formatDate(data.supervisor2A_date)); + +} + +function eva_create_evaluation_detail_review04_GetFromForm() { + var eva_create_evaluation_detail_review04Object = new Object(); +eva_create_evaluation_detail_review04Object.id = $("#eva_create_evaluation_detail_review04_id").val(); +eva_create_evaluation_detail_review04Object.create_evaluation_id = $("#eva_create_evaluation_detail_review04_create_evaluation_id").val(); +eva_create_evaluation_detail_review04Object.supervisor2A = $("#eva_create_evaluation_detail_review04_supervisor2A").val(); +eva_create_evaluation_detail_review04Object.supervisor2A_result = $("#eva_create_evaluation_detail_review04_supervisor2A_result").val(); +eva_create_evaluation_detail_review04Object.supervisor2A_remark = $("#eva_create_evaluation_detail_review04_supervisor2A_remark").val(); +eva_create_evaluation_detail_review04Object.supervisor2A_date = getDate($("#eva_create_evaluation_detail_review04_supervisor2A_date").val()); + + + return eva_create_evaluation_detail_review04Object; +} + +function eva_create_evaluation_detail_review04_InitialForm() { + var successFunc = function (result) { + eva_create_evaluation_detail_review04_FeedDataToForm(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_create_evaluation_detail_review04_API + "GetBlankItem", successFunc, AlertDanger); +} + +//================= Form Mode Setup and Flow ========================================= + +function eva_create_evaluation_detail_review04_SetEditForm(a) { + var successFunc = function (result) { + eva_create_evaluation_detail_review04_editMode = "UPDATE"; + eva_create_evaluation_detail_review04_FeedDataToForm(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_create_evaluation_detail_review04_API + a, successFunc, AlertDanger); +} + +function eva_create_evaluation_detail_review04_SetCreateForm() { + eva_create_evaluation_detail_review04_editMode = "CREATE"; + eva_create_evaluation_detail_review04_InitialForm(); +} + +//================= Update and Delete ========================================= + +var eva_create_evaluation_detail_review04_customValidation = function (group) { + return ""; +}; + +function eva_create_evaluation_detail_review04_PutUpdate() { + if (!ValidateForm('eva_create_evaluation_detail_review04', eva_create_evaluation_detail_review04_customValidation)) + { + return; + } + var data = eva_create_evaluation_detail_review04_GetFromForm(); + + //Update Mode + if (eva_create_evaluation_detail_review04_editMode === "UPDATE") { + var successFunc1 = function (result) { + AlertSuccess(result.code+" "+result.message); + endLoad(); + }; + startLoad(); + AjaxPutRequest(apisite + eva_create_evaluation_detail_review04_API + data.id, data, successFunc1, AlertDanger); + } + // Create mode + else { + var successFunc2 = function (result) { + AlertSuccess(result.code+" "+result.message); + endLoad(); + }; + startLoad(); + AjaxPostRequest(apisite + eva_create_evaluation_detail_review04_API, data, successFunc2, AlertDanger); + } +} + +function eva_create_evaluation_detail_review04_GoDelete(a) { + if (confirm('คุณต้องการลบ ' + a + ' ใช่หรือไม่?')) { + var successFunc = function (result) { + AlertSuccess(result.code+" "+result.message); + eva_create_evaluation_detail_review04_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxDeleteRequest(apisite + eva_create_evaluation_detail_review04_API + a, null, successFunc, AlertDanger); + } +} + +//================= File Upload ========================================= + + + +//================= Multi-Selection Function ========================================= + + diff --git a/wwwroot/js/eva_evaluation_achievement/eva_evaluation_achievement.js b/wwwroot/js/eva_evaluation_achievement/eva_evaluation_achievement.js index 28eda35..2b6a0f8 100644 --- a/wwwroot/js/eva_evaluation_achievement/eva_evaluation_achievement.js +++ b/wwwroot/js/eva_evaluation_achievement/eva_evaluation_achievement.js @@ -23,7 +23,11 @@ $("#eva_evaluation_achievement_create_evaluation_detail_id").val(data.create_eva $("#eva_evaluation_achievement_achievement").val(data.achievement); $("#eva_evaluation_achievement_weight").val(data.weight); feedFileToControl(data.thefile, data.thefileDisplay, "eva_evaluation_achievement_thefile", "file"); - +$("#eva_evaluation_achievement_target_score1").val(data.target_score1); +$("#eva_evaluation_achievement_target_score2").val(data.target_score2); +$("#eva_evaluation_achievement_target_score3").val(data.target_score3); +$("#eva_evaluation_achievement_target_score4").val(data.target_score4); +$("#eva_evaluation_achievement_target_score5").val(data.target_score5); } function eva_evaluation_achievement_GetFromForm() { @@ -37,7 +41,11 @@ if ($("#eva_evaluation_achievement_thefile_hidURL").val() !== null) { }else { eva_evaluation_achievementObject.thefile = ""; } - +eva_evaluation_achievementObject.target_score1 = $("#eva_evaluation_achievement_target_score1").val(); +eva_evaluation_achievementObject.target_score2 = $("#eva_evaluation_achievement_target_score2").val(); +eva_evaluation_achievementObject.target_score3 = $("#eva_evaluation_achievement_target_score3").val(); +eva_evaluation_achievementObject.target_score4 = $("#eva_evaluation_achievement_target_score4").val(); +eva_evaluation_achievementObject.target_score5 = $("#eva_evaluation_achievement_target_score5").val(); return eva_evaluation_achievementObject; } @@ -164,6 +172,11 @@ var eva_evaluation_achievement_setupTable = function (result) { { "data": "id" }, { "data": "achievement" }, { "data": "weight" }, + { "data": "target_score1" }, + { "data": "target_score2" }, + { "data": "target_score3" }, + { "data": "target_score4" }, + { "data": "target_score5" }, { "data": "txt_thefile" }, ], "columnDefs": [ diff --git a/wwwroot/js/eva_level_score/eva_level_score.js b/wwwroot/js/eva_level_score/eva_level_score.js index 9f2bd3f..d65a009 100644 --- a/wwwroot/js/eva_level_score/eva_level_score.js +++ b/wwwroot/js/eva_level_score/eva_level_score.js @@ -160,8 +160,9 @@ var eva_level_score_setupTable = function (result) { { "data": "id" }, { "data": "code" }, { "data": "detail" }, +{ "data": "min_score" }, { "data": "max_score" }, - { "data": "min_score" }, + ], "columnDefs": [ { diff --git a/wwwroot/js/eva_level_score_basic/eva_level_score_basic.js b/wwwroot/js/eva_level_score_basic/eva_level_score_basic.js new file mode 100644 index 0000000..f9811f2 --- /dev/null +++ b/wwwroot/js/eva_level_score_basic/eva_level_score_basic.js @@ -0,0 +1,216 @@ +var eva_level_score_basic_editMode = "CREATE"; +var eva_level_score_basic_API = "/api/eva_level_score_basic/"; + +//================= Search Customizaiton ========================================= + +function eva_level_score_basic_GetSearchParameter() { + var eva_level_score_basicSearchObject = new Object(); +eva_level_score_basicSearchObject.code = $("#s_eva_level_score_basic_code").val(); + + return eva_level_score_basicSearchObject; +} + +function eva_level_score_basic_FeedDataToSearchForm(data) { +$("#s_eva_level_score_basic_code").val(data.code); + +} + +//================= Form Data Customizaiton ========================================= + +function eva_level_score_basic_FeedDataToForm(data) { +$("#eva_level_score_basic_id").val(data.id); +$("#eva_level_score_basic_code").val(data.code); +$("#eva_level_score_basic_detail").val(data.detail); +$("#eva_level_score_basic_max_score").val(data.max_score); +$("#eva_level_score_basic_min_score").val(data.min_score); + +} + +function eva_level_score_basic_GetFromForm() { + var eva_level_score_basicObject = new Object(); +eva_level_score_basicObject.id = $("#eva_level_score_basic_id").val(); +eva_level_score_basicObject.code = $("#eva_level_score_basic_code").val(); +eva_level_score_basicObject.detail = $("#eva_level_score_basic_detail").val(); +eva_level_score_basicObject.max_score = $("#eva_level_score_basic_max_score").val(); +eva_level_score_basicObject.min_score = $("#eva_level_score_basic_min_score").val(); + + + return eva_level_score_basicObject; +} + +function eva_level_score_basic_InitialForm(s) { + var successFunc = function (result) { + eva_level_score_basic_FeedDataToForm(result); + eva_level_score_basic_FeedDataToSearchForm(result); + if (s) { + // Incase model popup + $("#eva_level_score_basicModel").modal("show"); + } + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_level_score_basic_API + "GetBlankItem", successFunc, AlertDanger); +} + +//================= Form Mode Setup and Flow ========================================= + +function eva_level_score_basic_GoCreate() { + // Incase model popup + eva_level_score_basic_SetCreateForm(true); + + // Incase open new page + //window_open(appsite + "/eva_level_score_basicView/eva_level_score_basic_d"); +} + +function eva_level_score_basic_GoEdit(a) { + // Incase model popup + eva_level_score_basic_SetEditForm(a); + + // Incase open new page + //window_open(appsite + "/eva_level_score_basicView/eva_level_score_basic_d?id=" + a); +} + +function eva_level_score_basic_SetEditForm(a) { + var successFunc = function (result) { + eva_level_score_basic_editMode = "UPDATE"; + eva_level_score_basic_FeedDataToForm(result); + $("#eva_level_score_basicModel").modal("show"); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_level_score_basic_API + a, successFunc, AlertDanger); +} + +function eva_level_score_basic_SetCreateForm(s) { + eva_level_score_basic_editMode = "CREATE"; + eva_level_score_basic_InitialForm(s); +} + +function eva_level_score_basic_RefreshTable() { + // Incase model popup + eva_level_score_basic_DoSearch(); + + // Incase open new page + //window.parent.eva_level_score_basic_DoSearch(); +} + +//================= Update and Delete ========================================= + +var eva_level_score_basic_customValidation = function (group) { + return ""; +}; + +function eva_level_score_basic_PutUpdate() { + if (!ValidateForm('eva_level_score_basic', eva_level_score_basic_customValidation)) + { + return; + } + + var data = eva_level_score_basic_GetFromForm(); + + //Update Mode + if (eva_level_score_basic_editMode === "UPDATE") { + var successFunc1 = function (result) { + $("#eva_level_score_basicModel").modal("hide"); + AlertSuccess(result.code+" "+result.message); + eva_level_score_basic_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxPutRequest(apisite + eva_level_score_basic_API + data.id, data, successFunc1, AlertDanger); + } + // Create mode + else { + var successFunc2 = function (result) { + $("#eva_level_score_basicModel").modal("hide"); + AlertSuccess(result.code+" "+result.message); + eva_level_score_basic_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxPostRequest(apisite + eva_level_score_basic_API, data, successFunc2, AlertDanger); + } +} + +function eva_level_score_basic_GoDelete(a) { + if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) { + var successFunc = function (result) { + $("#eva_level_score_basicModel").modal("hide"); + AlertSuccess(result.code+" "+result.message); + eva_level_score_basic_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxDeleteRequest(apisite + eva_level_score_basic_API + a, null, successFunc, AlertDanger); + } +} + +//================= Data Table ========================================= + +var eva_level_score_basicTableV; + +var eva_level_score_basic_setupTable = function (result) { + tmp = '"'; + eva_level_score_basicTableV = $('#eva_level_score_basicTable').DataTable({ + "processing": true, + "serverSide": false, + "data": result, + "select": false, + "columns": [ + { "data": "id" }, + { "data": "code" }, + { "data": "detail" }, +{ "data": "min_score" }, + { "data": "max_score" }, + + ], + "columnDefs": [ + { + "targets": 0, + "data": "id", + "render": function (data, type, row, meta) { + return " "; + } + }], + "language": { + "url": appsite + "/DataTables-1.10.16/thai.json" + }, + "paging": true, + "searching": false + }); + endLoad(); +}; + +function eva_level_score_basic_InitiateDataTable() { + startLoad(); + var p = $.param(eva_level_score_basic_GetSearchParameter()); + AjaxGetRequest(apisite + "/api/eva_level_score_basic/GetListBySearch?"+p, eva_level_score_basic_setupTable, AlertDanger); +} + +function eva_level_score_basic_DoSearch() { + var p = $.param(eva_level_score_basic_GetSearchParameter()); + var eva_level_score_basic_reload = function (result) { + eva_level_score_basicTableV.destroy(); + eva_level_score_basic_setupTable(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + "/api/eva_level_score_basic/GetListBySearch?"+p, eva_level_score_basic_reload, AlertDanger); +} + +function eva_level_score_basic_GetSelect(f) { + var eva_level_score_basic_selectitem = []; + $.each(eva_level_score_basicTableV.rows('.selected').data(), function (key, value) { + eva_level_score_basic_selectitem.push(value[f]); + }); + alert(eva_level_score_basic_selectitem); +} + +//================= File Upload ========================================= + + + +//================= Multi-Selection Function ========================================= + + +