33 Commits

Author SHA1 Message Date
Sudkhet Authairat
8a799f9725 แก้ bug supervisor1_remark ไม่มีข้อมูล 2022-10-03 17:38:19 +07:00
Sudkhet Authairat
d345d579a1 เพิ่ม (supervisor1_remark) parameter jasperReport 2022-10-03 16:11:12 +07:00
Mart Sudkhet Authairat
eae11f4765 เพิ่ม orderby drowdrop แผนการประเมิน 2022-09-26 16:45:37 +07:00
nakorn
8f2e0af11b Last commit 2022-08-27 11:22:12 +07:00
nakorn
804bb7d9f2 Update source code 2022-05-09 14:47:12 +07:00
nakorn
ccef30e588 เสร็จงานอนุมัติ ปรับเลื่อนเงินเดือน และ โควต้า 2022-05-06 07:54:55 +07:00
nakorn
bfb9c80fac ปรับปรุง ลำดับการอนุมัติ 2022-05-03 15:27:30 +07:00
nakorn
086f101d0f ทำเรื่องอนุมัติวงเงิน 2022-05-02 10:53:45 +07:00
nakorn
42e1878aa8 อนุมัติและส่งต่อ การปรับเลื่อน ค่าตอบแทน 2022-05-01 12:20:21 +07:00
nakorn
32280778e6 keep source 2022-04-19 14:32:50 +07:00
nakorn
94bf0709d1 ปลด lock การกรอกคะแนน ให้กรอกได้อิสระ 2022-04-08 11:55:20 +07:00
nakorn
71f1906d79 ปิดให้ ผอ และ แผนกบุคคล เห็นคะแนน และ เรื่องอื่นๆ 2022-03-29 18:27:31 +07:00
nakorn
f5ebda01bf ปรับปรุงวันที่ 2022-03-22 15:04:57 +07:00
nakorn
ba57633ab8 แก้ไขหลายอย่าง 2022-03-21 17:19:56 +07:00
nakorn
9774fb0a9c แจ้งพนักงานแซดดีทราบ
ที่ประชุมทรัพย์เมื่อวันศุกร์ที่ 4 มี.ค. 65 ได้มีมติให้ พนักงานทั่วไปเงินเดือนตันที่ 25020 บาท ถ้าเลยนี้ให้รับเป็นค่าตอบแทนพิเศษ และพนักงานในระดับชำนาญงาน ให้ตันที่ 49480 บาท ถ้าเลยนี้ให้ได้ค่าตอบแทนพิเศษ จึงขอให้ทาง บ. ไปปรับแก้ใน text box เดิมในระบบ และเพิ่มช่องค่าตอบแทนพิเศษในเมนูที่ ผอ. ใช้หยอดเงินในระบบด้วยค่ะ
2022-03-19 12:48:21 +07:00
nakorn
c6d107e179 ปรับปรุงหลายอย่าง 2022-03-19 11:32:56 +07:00
nakorn
61f067f150 ปรับปรุง การอนุมัติแบบข้อตกลง ของ ผอ 2022-03-17 16:12:32 +07:00
nakorn
f6afc23b45 Update report signature 2022-03-13 12:04:14 +07:00
nakorn
67a4c35f8e ปรับปรุงการ default 2021-11-21 21:47:22 +07:00
nakorn
aae66b1d97 ปรับปรุงจากหลายข้อ 2021-11-18 14:00:11 +07:00
nakorn
b6e27e9f12 ปรับปรุงรายงาน 2021-11-17 15:20:33 +07:00
nakorn
afc4429e63 แก้ให้ ผู้ประเมินสูงสุด พิเศษ ประเมินได้แล้ว 2021-11-16 18:07:33 +07:00
nakorn
4b98790d2e ปรับปรุงหลายส่วน 2021-11-15 13:53:13 +07:00
nakorn
6d0a2ace7d แก้ไขหน้าจอ โควต้า 2021-11-07 12:05:09 +07:00
nakorn
260c542b10 ปรับปรุงการตัดหน้าบรรทัด 2021-11-03 15:38:17 +07:00
nakorn
0d0e309589 ปรับรายงานให้ ไม่ตกบรรทัด 2021-10-31 21:48:44 +07:00
nakorn
7baab53365 ปรับปรุงส่วน ตารางกำหนดช่วงร้อยละที่ได้เลื่อน 2021-10-30 11:53:07 +07:00
nakorn
8e8596116f แก้ไข ความยาว ตัวอักษรที่เก็บได้ 2021-10-28 10:42:03 +07:00
nakorn
4d7f6186d5 Fix Bug save data 2021-10-26 16:57:06 +07:00
nakorn
40d91d2ad2 แก้ไข ให้บันทึก เพื่อพิมพ์ได้ก่อน 2021-10-26 16:38:42 +07:00
nakorn
26f416ec46 เก็บ source code 2021-10-25 17:23:40 +07:00
nakorn
544d1224de ปรับการคำนวณคะแนน ขั้นสุดท้าย 2021-10-23 17:17:05 +07:00
nakorn
f6b58c8406 ปรับปรุงการแจ้งเตือน 2021-10-23 16:08:43 +07:00
173 changed files with 21486 additions and 600 deletions

View File

@@ -0,0 +1,230 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using TTSW.Controllers;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Net;
namespace TodoAPI2.Controllers
{
//[Authorize]
[Produces("application/json")]
[Route("api/eva_adjust_postponement_update_status")]
public class eva_adjust_postponement_update_statusController : BaseController
{
#region Private Variables
private ILogger<eva_adjust_postponement_update_statusController> _logger;
private Ieva_adjust_postponement_update_statusService _repository;
private Iexternal_employeeService emp;
private IConfiguration Configuration { get; set; }
#endregion
#region Properties
#endregion
/// <summary>
/// Default constructure for dependency injection
/// </summary>
/// <param name="repository"></param>
/// <param name="configuration"></param>
/// <param name="logger"></param>
public eva_adjust_postponement_update_statusController(ILogger<eva_adjust_postponement_update_statusController> logger,
Ieva_adjust_postponement_update_statusService repository, IConfiguration configuration,
Iexternal_employeeService inemp)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
emp = inemp;
}
/// <summary>
/// Get specific item by id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return Get specific item by id</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("{id}")]
[ProducesResponseType(typeof(eva_adjust_postponement_update_statusWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Get(int id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetWithSelection(id);
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult Get.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get Blank Item
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return a blank item</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetBlankItem")]
[ProducesResponseType(typeof(eva_adjust_postponement_update_statusWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetBlankItem()
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetBlankItem();
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by postponement_status_note
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("")]
[ProducesResponseType(typeof(List<eva_adjust_postponement_update_statusViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetList(string postponement_status_note)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListBypostponement_status_note(postponement_status_note));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetList.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by search
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetListBySearch")]
[ProducesResponseType(typeof(List<eva_adjust_postponement_update_statusViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetListBySearch(eva_adjust_postponement_update_statusSearchModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListBySearch(model));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Update item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Update(int id, [FromBody] eva_adjust_postponement_update_statusInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
int? e = null;
if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"]))
{
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
var theEmp = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
if(theEmp != null)
{
e = theEmp.id;
}
else
{
return Unauthorized();
}
}
else
{
return Unauthorized();
}
var result = _repository.Update(id, model, true, e);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"บันทึกการอนุมัติและส่งต่อ เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while update {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
}
}

View File

@@ -0,0 +1,275 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using TTSW.Controllers;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Net;
namespace TodoAPI2.Controllers
{
//[Authorize]
[Produces("application/json")]
[Route("api/eva_adjust_quota_update_final_status")]
public class eva_adjust_quota_update_final_statusController : BaseController
{
#region Private Variables
private ILogger<eva_adjust_quota_update_final_statusController> _logger;
private Ieva_adjust_quota_update_final_statusService _repository;
private Iexternal_employeeService emp;
private IConfiguration Configuration { get; set; }
#endregion
#region Properties
#endregion
/// <summary>
/// Default constructure for dependency injection
/// </summary>
/// <param name="repository"></param>
/// <param name="configuration"></param>
/// <param name="inemp"></param>
/// <param name="logger"></param>
public eva_adjust_quota_update_final_statusController(ILogger<eva_adjust_quota_update_final_statusController> logger,
Ieva_adjust_quota_update_final_statusService repository, IConfiguration configuration,
Iexternal_employeeService inemp)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
emp = inemp;
}
/// <summary>
/// Get specific item by id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return Get specific item by id</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("{id}")]
[ProducesResponseType(typeof(eva_adjust_quota_update_final_statusWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Get(int id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetWithSelection(id);
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult Get.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get Blank Item
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return a blank item</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetBlankItem")]
[ProducesResponseType(typeof(eva_adjust_quota_update_final_statusWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetBlankItem()
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetBlankItem();
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by quota_final_status_note
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("")]
[ProducesResponseType(typeof(List<eva_adjust_quota_update_final_statusViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetList(string quota_final_status_note)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListByquota_final_status_note(quota_final_status_note));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetList.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by search
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetListBySearch")]
[ProducesResponseType(typeof(List<eva_adjust_quota_update_final_statusViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetListBySearch(eva_adjust_quota_update_final_statusSearchModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListBySearch(model));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Download Report
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("eva_adjust_quota_update_final_status_report")]
[ProducesResponseType(typeof(FileStreamResult), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult eva_adjust_quota_update_final_status_report(eva_adjust_quota_update_final_statusReportRequestModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
string url = $"{mainurl}{reportsite}/xxใส่ชื่อรายงานตรงนี้xx.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
if (model.filetype == "xlsx")
{
url += "&ignorePagination=true";
}
var data = httpclient.DownloadData(url);
var stream = new MemoryStream(data);
return File(stream, model.contentType);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while GetReport.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Update item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Update(int id, [FromBody] eva_adjust_quota_update_final_statusInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
int? e = null;
if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"]))
{
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
var theEmp = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
if (theEmp != null)
{
e = theEmp.id;
}
else
{
return Unauthorized();
}
}
else
{
return Unauthorized();
}
var result = _repository.Update(id, model, true, e);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"แก้ไขข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while update {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
}
}

View File

@@ -0,0 +1,230 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using TTSW.Controllers;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Net;
namespace TodoAPI2.Controllers
{
//[Authorize]
[Produces("application/json")]
[Route("api/eva_adjust_quota_update_status")]
public class eva_adjust_quota_update_statusController : BaseController
{
#region Private Variables
private ILogger<eva_adjust_quota_update_statusController> _logger;
private Ieva_adjust_quota_update_statusService _repository;
private Iexternal_employeeService emp;
private IConfiguration Configuration { get; set; }
#endregion
#region Properties
#endregion
/// <summary>
/// Default constructure for dependency injection
/// </summary>
/// <param name="repository"></param>
/// <param name="configuration"></param>
/// <param name="logger"></param>
/// <param name="inemp"></param>
public eva_adjust_quota_update_statusController(ILogger<eva_adjust_quota_update_statusController> logger, Ieva_adjust_quota_update_statusService repository,
IConfiguration configuration,
Iexternal_employeeService inemp)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
emp = inemp;
}
/// <summary>
/// Get specific item by id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return Get specific item by id</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("{id}")]
[ProducesResponseType(typeof(eva_adjust_quota_update_statusWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Get(int id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetWithSelection(id);
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult Get.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get Blank Item
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return a blank item</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetBlankItem")]
[ProducesResponseType(typeof(eva_adjust_quota_update_statusWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetBlankItem()
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetBlankItem();
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by quota_status_note
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("")]
[ProducesResponseType(typeof(List<eva_adjust_quota_update_statusViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetList(string quota_status_note)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListByquota_status_note(quota_status_note));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetList.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by search
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetListBySearch")]
[ProducesResponseType(typeof(List<eva_adjust_quota_update_statusViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetListBySearch(eva_adjust_quota_update_statusSearchModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListBySearch(model));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Update item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Update(int id, [FromBody] eva_adjust_quota_update_statusInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
int? e = null;
if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"]))
{
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
var theEmp = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
if (theEmp != null)
{
e = theEmp.id;
}
else
{
return Unauthorized();
}
}
else
{
return Unauthorized();
}
var result = _repository.Update(id, model, true, e);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"แก้ไขข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while update {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
}
}

View File

@@ -0,0 +1,361 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using TTSW.Controllers;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Net;
namespace TodoAPI2.Controllers
{
//[Authorize]
[Produces("application/json")]
[Route("api/eva_create_evaluation_detail_review05")]
public class eva_create_evaluation_detail_review05Controller : BaseController
{
#region Private Variables
private ILogger<eva_create_evaluation_detail_review05Controller> _logger;
private Ieva_create_evaluation_detail_review05Service _repository;
private IConfiguration Configuration { get; set; }
#endregion
#region Properties
#endregion
/// <summary>
/// Default constructure for dependency injection
/// </summary>
/// <param name="repository"></param>
/// <param name="configuration"></param>
/// <param name="logger"></param>
public eva_create_evaluation_detail_review05Controller(ILogger<eva_create_evaluation_detail_review05Controller> logger, Ieva_create_evaluation_detail_review05Service repository, IConfiguration configuration)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
}
/// <summary>
/// Get specific item by id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return Get specific item by id</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("{id}")]
[ProducesResponseType(typeof(eva_create_evaluation_detail_review05WithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Get(int id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetWithSelection(id);
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult Get.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get Blank Item
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return a blank item</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetBlankItem")]
[ProducesResponseType(typeof(eva_create_evaluation_detail_review05WithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetBlankItem()
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetBlankItem();
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by create_evaluation_id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("")]
[ProducesResponseType(typeof(List<eva_create_evaluation_detail_review05ViewModel>), 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, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by search
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetListBySearch")]
[ProducesResponseType(typeof(List<eva_create_evaluation_detail_review05ViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetListBySearch(eva_create_evaluation_detail_review05SearchModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListBySearch(model));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Create new item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPost("")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Insert([FromBody] eva_create_evaluation_detail_review05InputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Insert(model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"เพิ่มข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while insert.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Update item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Update(int id, [FromBody] eva_create_evaluation_detail_review05InputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Update(id, model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"แก้ไขข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while update {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Delete item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpDelete("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Delete(int id)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.Delete(id);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ลบข้อมูล เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while delete {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Update multiple item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("UpdateMultiple")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult UpdateMultiple([FromBody] List<eva_create_evaluation_detail_review05InputModel> model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
string rowCount = _repository.UpdateMultiple(model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = "ปรับปรุงข้อมูลเรียบร้อย จำนวน "+rowCount+" รายการ";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while UpdateMultiple.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Refresh AutoField of all items
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("RefreshAutoField")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult RefreshAutoField()
{
if (ModelState.IsValid)
{
try
{
//if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.RefreshAutoFieldOfAllData();
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ปรับปรุง Auto Field ของทุก record เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while RefreshAutoField.", ex);
return StatusCode(500, $"มีปัญหาระหว่างการปรับปรุง Auto Field. {ex.Message}");
}
}
return BadRequest(ModelState);
}
}
}

View File

@@ -94,7 +94,9 @@ namespace TodoAPI2.Controllers
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now);
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
//var httpclient = MyHelper.getHttpClient(Configuration);
var httpclient = new WebClient();

View File

@@ -94,7 +94,9 @@ namespace TodoAPI2.Controllers
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now);
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
//var httpclient = MyHelper.getHttpClient(Configuration);
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");

View File

@@ -93,7 +93,9 @@ namespace TodoAPI2.Controllers
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now);
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
//var httpclient = MyHelper.getHttpClient(Configuration);
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");

View File

@@ -95,7 +95,9 @@ namespace TodoAPI2.Controllers
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now);
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");

View File

@@ -96,23 +96,25 @@ namespace TodoAPI2.Controllers
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now);
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
var stream = new MemoryStream();
Document document = new Document();
PdfCopy writer = new PdfCopy(document, stream);
document.Open();
//var stream = new MemoryStream();
//Document document = new Document();
//PdfCopy writer = new PdfCopy(document, stream);
//document.Open();
var data1 = GetReport01(model);
PdfReader reader1 = new PdfReader(data1);
reader1.ConsolidateNamedDestinations();
for (int i = 1; i <= reader1.NumberOfPages; i++)
{
PdfImportedPage page = writer.GetImportedPage(reader1, i);
writer.AddPage(page);
}
reader1.Close();
//PdfReader reader1 = new PdfReader(data1);
//reader1.ConsolidateNamedDestinations();
//for (int i = 1; i <= reader1.NumberOfPages; i++)
//{
// PdfImportedPage page = writer.GetImportedPage(reader1, i);
// writer.AddPage(page);
//}
//reader1.Close();
//var data2 = GetReport02(model);
//PdfReader reader2 = new PdfReader(data2);
@@ -124,13 +126,15 @@ namespace TodoAPI2.Controllers
//}
//reader2.Close();
writer.Close();
document.Close();
//writer.Close();
//document.Close();
var datax = stream.ToArray();
var streamx = new MemoryStream(datax);
//var datax = stream.ToArray();
//var streamx = new MemoryStream(datax);
return File(streamx, model.contentType);
var stream = new MemoryStream(data1);
return File(stream, model.contentType);
}
catch (Exception ex)
{

View File

@@ -94,7 +94,9 @@ namespace TodoAPI2.Controllers
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now);
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");

View File

@@ -271,13 +271,63 @@ namespace TodoAPI2.Controllers
var rep_type = new int[] { 1, 2, 3, 4, 5 };
var loginPositionName = (from i in emp.GetAllEmployee()
where i.id.ToString() == Request.Cookies["emp_id"]
select i.position_name).FirstOrDefault();
foreach (var k in rep_type)
{
//if (!string.IsNullOrEmpty(loginPositionName))
//{
// if (!(loginPositionName == "นักทรัพยากรบุคคล" || loginPositionName.Contains("ผู้อำนวยการ"))
// && (k == 2 || k == 3 || k == 4 || k == 5)
// )
// {
// continue;
// }
//}
string url = $"{mainurl}{reportsite}/rep_eva_x{k}.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
if(p1.chief_fullname == p1.supervisor2_fullname && k == 3)
if(k == 3)
{
url = $"{mainurl}{reportsite}/rep_eva_x{k}A.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
if (p1.chief_fullname == p1.supervisor2_fullname)
{
url = $"{mainurl}{reportsite}/rep_eva_x{k}A.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
if (!string.IsNullOrEmpty(p1.supervisor3A_fullname))
{
url = $"{mainurl}{reportsite}/rep_eva_x{k}AC.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
}
if (string.IsNullOrEmpty(p1.supervisor2A_fullname))
{
url = $"{mainurl}{reportsite}/rep_eva_x{k}A2.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
}
}
else
{
if (!string.IsNullOrEmpty(p1.supervisor2A_fullname) && string.IsNullOrEmpty(p1.supervisor1A_fullname))
{
url = $"{mainurl}{reportsite}/rep_eva_x{k}B.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
}
else if (string.IsNullOrEmpty(p1.supervisor2A_fullname) && string.IsNullOrEmpty(p1.supervisor1A_fullname))
{
url = $"{mainurl}{reportsite}/rep_eva_x{k}B2.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
}
else if (string.IsNullOrEmpty(p1.supervisor3A_fullname))
{
url = $"{mainurl}{reportsite}/rep_eva_x{k}C.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
if (p1.supervisor1A_fullname == p1.supervisor2A_fullname || string.IsNullOrEmpty(p1.supervisor2A_fullname))
{
url = $"{mainurl}{reportsite}/rep_eva_x{k}C2.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
}
}
}
}
if (p1.employee_position_type == "อำนวยการ" && k == 1)
{
url = $"{mainurl}{reportsite}/rep_eva_x{k}a.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
}
var data = httpclient.DownloadData(url);
@@ -350,12 +400,15 @@ namespace TodoAPI2.Controllers
i.chief_fullname = p.chief_fullname;
i.chief_position = p.chief_position + checkLevel(p.chief_position_type_id, p.chief_position_level_text, p.chief_fullname);
i.supervisor1_remark = p.supervisor1_remark;
i.supervisor2_fullname = p.supervisor2_fullname;
i.supervisor2_position = p.supervisor2_position + checkLevel(p.supervisor2_position_type_id, p.supervisor2_position_level_text, p.supervisor2_fullname);
i.supervisor1A_fullname = p.supervisor1A_fullname;
i.supervisor1A_position = p.supervisor1A_position + checkLevel(p.supervisor1A_position_type_id, p.supervisor1A_position_level_text, p.supervisor1A_fullname);
i.supervisor2A_fullname = p.supervisor2A_fullname;
i.supervisor2A_position = p.supervisor2A_position + checkLevel(p.supervisor2A_position_type_id, p.supervisor2A_position_level_text, p.supervisor2A_fullname);
i.supervisor3A_fullname = p.supervisor3A_fullname;
i.supervisor3A_position = p.supervisor3A_position + checkLevel(p.supervisor3A_position_type_id, p.supervisor3A_position_level_text, p.supervisor3A_fullname);
i.main_dept = p.employee_main_dept;
if (i.main_dept != null) i.main_dept = i.main_dept.Replace("กอง","");
@@ -376,8 +429,8 @@ namespace TodoAPI2.Controllers
where n.performance_plan_id == x2.id
select n.start_date).Min();
var end = (from n in context.eva_performance_plan_detail
where n.performance_plan_id == x2.id
select n.end_date).Min();
where n.performance_plan_id == x2.id
select n.end_date).Max();
var text = MyHelper.GetDateStringForReport(start) + " ถึง " + MyHelper.GetDateStringForReport(end);
if(x2.theTime == 1)
{
@@ -389,6 +442,11 @@ namespace TodoAPI2.Controllers
}
}
if (string.IsNullOrEmpty(i.round2_text))
{
i.round2_text = $"1 เมษายน {p.fiscal_year} ถึง 30 กันยายน {p.fiscal_year}";
}
var detail = (from x in context.eva_create_evaluation_detail
where x.id == detail_id
select x).FirstOrDefault();
@@ -429,6 +487,20 @@ namespace TodoAPI2.Controllers
i.txt_status_chief_a_click_date = MyHelper.GetDateStringForReport(p.status_chief_a_click_date);
if (i.txt_status_chief_a_click_date == "") i.txt_status_chief_a_click_date = "..................................";
i.txt_status_self_click_date = MyHelper.GetDateStringForReport(p.status_self_click_date);
if (i.txt_status_self_click_date == "") i.txt_status_self_click_date = "..................................";
i.txt_status_chief_click_date = MyHelper.GetDateStringForReport(p.status_chief_click_date);
if (i.txt_status_chief_click_date == "") i.txt_status_chief_click_date = "..................................";
i.txt_status_supervisor_click_date = MyHelper.GetDateStringForReport(p.status_supervisor_click_date);
if (i.txt_status_supervisor_click_date == "") i.txt_status_supervisor_click_date = "..................................";
i.txt_status_supervisor1A_click_date = MyHelper.GetDateStringForReport(p.status_supervisor1A_click_date);
if (i.txt_status_supervisor1A_click_date == "") i.txt_status_supervisor1A_click_date = "..................................";
i.txt_status_supervisor2A_click_date = MyHelper.GetDateStringForReport(p.status_supervisor2A_click_date);
if (i.txt_status_supervisor2A_click_date == "") i.txt_status_supervisor2A_click_date = "..................................";
i.txt_status_supervisor3A_click_date = MyHelper.GetDateStringForReport(p.status_supervisor3A_click_date);
if (i.txt_status_supervisor3A_click_date == "") i.txt_status_supervisor3A_click_date = "..................................";
i.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now);
return i;
@@ -436,7 +508,18 @@ namespace TodoAPI2.Controllers
private void checkValue(eva_create_evaluation_detailEntity detail, ref rep_eva_xInputModel2 i)
{
if (detail.status_supervisor2A == "Y")
if (detail.status_supervisor3A == "Y")
{
i.total_summary_supervisor2a = detail.total_summary_supervisor3A;
i.final_summary_supervisor2a = detail.Final_summary_supervisor3A;
i.total_summary_competency_supervisor2a = detail.total_summary_competency_supervisor3A;
i.final_summary_competency_supervisor2a = detail.Final_summary_competency_supervisor3A;
i.achievement_supervisor2a = detail.achievement_supervisor3A;
i.competency_supervisor2a = detail.competency_supervisor3A;
i.score_supervisor2a = detail.score_supervisor3A;
i.level_score_supervisor2a = detail.level_score_supervisor3A;
}
else if (detail.status_supervisor2A == "Y")
{
i.total_summary_supervisor2a = detail.total_summary_supervisor2A;
i.final_summary_supervisor2a = detail.Final_summary_supervisor2A;
@@ -458,7 +541,7 @@ namespace TodoAPI2.Controllers
i.score_supervisor2a = detail.score_supervisor1A;
i.level_score_supervisor2a = detail.level_score_supervisor1A;
}
else if (detail.status_supervisor == "Y")
else if (detail.status_supervisor == "Y" || detail.supervisor2_result == "Y")
{
i.total_summary_supervisor2a = detail.total_summary_supervisor;
i.final_summary_supervisor2a = detail.Final_summary_supervisor;

View File

@@ -94,7 +94,9 @@ namespace TodoAPI2.Controllers
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now);
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");

View File

@@ -94,7 +94,9 @@ namespace TodoAPI2.Controllers
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now);
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");

View File

@@ -14,6 +14,8 @@ namespace TTSW.EF {
public DbSet<eva_create_evaluation_detailEntity> eva_create_evaluation_detail { get; set; }
//public DbSet<eva_create_evaluation_detail_agreementEntity> eva_create_evaluation_detail_agreement { get; set; }
public DbSet<eva_evaluation_achievementEntity> eva_evaluation_achievement { get; set; }
public DbSet<eva_evaluation_achievement_detailEntity> eva_evaluation_achievement_detail { get; set; }
public DbSet<eva_evaluation_behaviorEntity> eva_evaluation_behavior { get; set; }
public DbSet<eva_evaluation_groupEntity> eva_evaluation_group { get; set; }
public DbSet<eva_evaluation_group_detailEntity> eva_evaluation_group_detail { get; set; }

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class UpdateFieldLength : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "behavior",
table: "eva_evaluation_behavior",
maxLength: 16000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 1000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "achievement",
table: "eva_evaluation_achievement",
maxLength: 16000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 8000,
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "behavior",
table: "eva_evaluation_behavior",
maxLength: 1000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 16000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "achievement",
table: "eva_evaluation_achievement",
maxLength: 8000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 16000,
oldNullable: true);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class UpdateFieldLength2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "properties",
table: "activity_log_eva",
maxLength: 32000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 8000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "description",
table: "activity_log_eva",
maxLength: 32000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 4000,
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "properties",
table: "activity_log_eva",
maxLength: 8000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 32000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "description",
table: "activity_log_eva",
maxLength: 4000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 32000,
oldNullable: true);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,153 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class AddLevelScoreForGroup2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_eva_level_score_detail_eva_level_score_level_score_id",
table: "eva_level_score_detail");
migrationBuilder.AlterColumn<Guid>(
name: "level_score_id",
table: "eva_level_score_detail",
nullable: true,
oldClrType: typeof(Guid));
migrationBuilder.AddColumn<Guid>(
name: "group_guid",
table: "eva_level_score_detail",
nullable: true);
migrationBuilder.AlterColumn<string>(
name: "behavior",
table: "eva_evaluation_behavior",
maxLength: 16000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 1000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "achievement",
table: "eva_evaluation_achievement",
maxLength: 16000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 8000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "properties",
table: "activity_log_eva",
maxLength: 32000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 8000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "description",
table: "activity_log_eva",
maxLength: 32000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 4000,
oldNullable: true);
migrationBuilder.CreateIndex(
name: "IX_eva_level_score_detail_group_guid",
table: "eva_level_score_detail",
column: "group_guid");
migrationBuilder.AddForeignKey(
name: "FK_eva_level_score_detail_eva_evaluation_group_group_guid",
table: "eva_level_score_detail",
column: "group_guid",
principalTable: "eva_evaluation_group",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_eva_level_score_detail_eva_level_score_level_score_id",
table: "eva_level_score_detail",
column: "level_score_id",
principalTable: "eva_level_score",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_eva_level_score_detail_eva_evaluation_group_group_guid",
table: "eva_level_score_detail");
migrationBuilder.DropForeignKey(
name: "FK_eva_level_score_detail_eva_level_score_level_score_id",
table: "eva_level_score_detail");
migrationBuilder.DropIndex(
name: "IX_eva_level_score_detail_group_guid",
table: "eva_level_score_detail");
migrationBuilder.DropColumn(
name: "group_guid",
table: "eva_level_score_detail");
migrationBuilder.AlterColumn<Guid>(
name: "level_score_id",
table: "eva_level_score_detail",
nullable: false,
oldClrType: typeof(Guid),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "behavior",
table: "eva_evaluation_behavior",
maxLength: 1000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 16000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "achievement",
table: "eva_evaluation_achievement",
maxLength: 8000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 16000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "properties",
table: "activity_log_eva",
maxLength: 8000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 32000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "description",
table: "activity_log_eva",
maxLength: 4000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 32000,
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_eva_level_score_detail_eva_level_score_level_score_id",
table: "eva_level_score_detail",
column: "level_score_id",
principalTable: "eva_level_score",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,46 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class Addachievement_detail : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "eva_evaluation_achievement_detail",
columns: table => new
{
id = table.Column<Guid>(nullable: false),
created = table.Column<DateTime>(nullable: false),
updated = table.Column<DateTime>(nullable: false),
isActive = table.Column<bool>(nullable: false),
create_evaluation_detail_id = table.Column<int>(nullable: true),
achievement_id = table.Column<int>(nullable: true),
achievement_detail = table.Column<string>(maxLength: 16000, nullable: true),
achievement_order = table.Column<int>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_eva_evaluation_achievement_detail", x => x.id);
table.ForeignKey(
name: "FK_eva_evaluation_achievement_detail_eva_create_evaluation_det~",
column: x => x.create_evaluation_detail_id,
principalTable: "eva_create_evaluation_detail",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_eva_evaluation_achievement_detail_create_evaluation_detail_~",
table: "eva_evaluation_achievement_detail",
column: "create_evaluation_detail_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "eva_evaluation_achievement_detail");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,74 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class ManageAchievement : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_eva_evaluation_achievement_detail_eva_create_evaluation_det~",
table: "eva_evaluation_achievement_detail");
migrationBuilder.DropIndex(
name: "IX_eva_evaluation_achievement_detail_create_evaluation_detail_~",
table: "eva_evaluation_achievement_detail");
migrationBuilder.DropColumn(
name: "create_evaluation_detail_id",
table: "eva_evaluation_achievement_detail");
migrationBuilder.AddColumn<string>(
name: "achievement_line1",
table: "eva_evaluation_achievement",
maxLength: 16000,
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_eva_evaluation_achievement_detail_achievement_id",
table: "eva_evaluation_achievement_detail",
column: "achievement_id");
migrationBuilder.AddForeignKey(
name: "FK_eva_evaluation_achievement_detail_eva_evaluation_achievemen~",
table: "eva_evaluation_achievement_detail",
column: "achievement_id",
principalTable: "eva_evaluation_achievement",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_eva_evaluation_achievement_detail_eva_evaluation_achievemen~",
table: "eva_evaluation_achievement_detail");
migrationBuilder.DropIndex(
name: "IX_eva_evaluation_achievement_detail_achievement_id",
table: "eva_evaluation_achievement_detail");
migrationBuilder.DropColumn(
name: "achievement_line1",
table: "eva_evaluation_achievement");
migrationBuilder.AddColumn<int>(
name: "create_evaluation_detail_id",
table: "eva_evaluation_achievement_detail",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_eva_evaluation_achievement_detail_create_evaluation_detail_~",
table: "eva_evaluation_achievement_detail",
column: "create_evaluation_detail_id");
migrationBuilder.AddForeignKey(
name: "FK_eva_evaluation_achievement_detail_eva_create_evaluation_det~",
table: "eva_evaluation_achievement_detail",
column: "create_evaluation_detail_id",
principalTable: "eva_create_evaluation_detail",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
}
}
}

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class AddX111 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "status_supervisor3A",
table: "eva_create_evaluation_detail",
maxLength: 1,
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "status_supervisor3A_click_date",
table: "eva_create_evaluation_detail",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "supervisor3A",
table: "eva_create_evaluation_detail",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "supervisor3A_date",
table: "eva_create_evaluation_detail",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "supervisor3A_remark",
table: "eva_create_evaluation_detail",
maxLength: 1000,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "supervisor3A_result",
table: "eva_create_evaluation_detail",
maxLength: 1,
nullable: true);
migrationBuilder.AddColumn<int>(
name: "supervisor3_id",
table: "eva_create_evaluation_detail",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "status_supervisor3A",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "status_supervisor3A_click_date",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "supervisor3A",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "supervisor3A_date",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "supervisor3A_remark",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "supervisor3A_result",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "supervisor3_id",
table: "eva_create_evaluation_detail");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,86 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class AddEx01 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<decimal>(
name: "Final_summary_competency_supervisor3A",
table: "eva_create_evaluation_detail",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "Final_summary_supervisor3A",
table: "eva_create_evaluation_detail",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "achievement_supervisor3A",
table: "eva_create_evaluation_detail",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "competency_supervisor3A",
table: "eva_create_evaluation_detail",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "level_score_supervisor3A",
table: "eva_create_evaluation_detail",
maxLength: 255,
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "score_supervisor3A",
table: "eva_create_evaluation_detail",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "total_summary_competency_supervisor3A",
table: "eva_create_evaluation_detail",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "total_summary_supervisor3A",
table: "eva_create_evaluation_detail",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Final_summary_competency_supervisor3A",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "Final_summary_supervisor3A",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "achievement_supervisor3A",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "competency_supervisor3A",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "level_score_supervisor3A",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "score_supervisor3A",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "total_summary_competency_supervisor3A",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "total_summary_supervisor3A",
table: "eva_create_evaluation_detail");
}
}
}

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,92 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class AddPostponementStatus : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "postponement_status",
table: "eva_adjust_postponement",
maxLength: 5,
nullable: true);
migrationBuilder.AddColumn<int>(
name: "postponement_status_by",
table: "eva_adjust_postponement",
maxLength: 255,
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "postponement_status_date",
table: "eva_adjust_postponement",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "postponement_status_note",
table: "eva_adjust_postponement",
maxLength: 1000,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "quota_status",
table: "eva_adjust_postponement",
maxLength: 5,
nullable: true);
migrationBuilder.AddColumn<int>(
name: "quota_status_by",
table: "eva_adjust_postponement",
maxLength: 255,
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "quota_status_date",
table: "eva_adjust_postponement",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "quota_status_note",
table: "eva_adjust_postponement",
maxLength: 1000,
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "postponement_status",
table: "eva_adjust_postponement");
migrationBuilder.DropColumn(
name: "postponement_status_by",
table: "eva_adjust_postponement");
migrationBuilder.DropColumn(
name: "postponement_status_date",
table: "eva_adjust_postponement");
migrationBuilder.DropColumn(
name: "postponement_status_note",
table: "eva_adjust_postponement");
migrationBuilder.DropColumn(
name: "quota_status",
table: "eva_adjust_postponement");
migrationBuilder.DropColumn(
name: "quota_status_by",
table: "eva_adjust_postponement");
migrationBuilder.DropColumn(
name: "quota_status_date",
table: "eva_adjust_postponement");
migrationBuilder.DropColumn(
name: "quota_status_note",
table: "eva_adjust_postponement");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,62 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class AddFinalApprover : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "quota_final_status",
table: "eva_adjust_postponement",
maxLength: 5,
nullable: true);
migrationBuilder.AddColumn<int>(
name: "quota_final_status_by",
table: "eva_adjust_postponement",
maxLength: 255,
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "quota_final_status_date",
table: "eva_adjust_postponement",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "quota_final_status_note",
table: "eva_adjust_postponement",
maxLength: 1000,
nullable: true);
migrationBuilder.AddColumn<int>(
name: "quota_status_submit_to",
table: "eva_adjust_postponement",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "quota_final_status",
table: "eva_adjust_postponement");
migrationBuilder.DropColumn(
name: "quota_final_status_by",
table: "eva_adjust_postponement");
migrationBuilder.DropColumn(
name: "quota_final_status_date",
table: "eva_adjust_postponement");
migrationBuilder.DropColumn(
name: "quota_final_status_note",
table: "eva_adjust_postponement");
migrationBuilder.DropColumn(
name: "quota_status_submit_to",
table: "eva_adjust_postponement");
}
}
}

View File

@@ -16,7 +16,7 @@ namespace tb320eva.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("TodoAPI2.Models.activity_log_evaEntity", b =>
@@ -32,7 +32,7 @@ namespace tb320eva.Migrations
b.Property<DateTime?>("created_at");
b.Property<string>("description")
.HasMaxLength(4000);
.HasMaxLength(32000);
b.Property<string>("ip_address")
.HasMaxLength(191);
@@ -44,7 +44,7 @@ namespace tb320eva.Migrations
.HasMaxLength(191);
b.Property<string>("properties")
.HasMaxLength(8000);
.HasMaxLength(32000);
b.Property<int?>("subject_id");
@@ -90,6 +90,41 @@ namespace tb320eva.Migrations
b.Property<decimal?>("percentage");
b.Property<string>("postponement_status")
.HasMaxLength(5);
b.Property<int?>("postponement_status_by")
.HasMaxLength(255);
b.Property<DateTime?>("postponement_status_date");
b.Property<string>("postponement_status_note")
.HasMaxLength(1000);
b.Property<string>("quota_final_status")
.HasMaxLength(5);
b.Property<int?>("quota_final_status_by")
.HasMaxLength(255);
b.Property<DateTime?>("quota_final_status_date");
b.Property<string>("quota_final_status_note")
.HasMaxLength(1000);
b.Property<string>("quota_status")
.HasMaxLength(5);
b.Property<int?>("quota_status_by")
.HasMaxLength(255);
b.Property<DateTime?>("quota_status_date");
b.Property<string>("quota_status_note")
.HasMaxLength(1000);
b.Property<int?>("quota_status_submit_to");
b.Property<string>("report_type")
.HasMaxLength(1000);
@@ -216,6 +251,8 @@ namespace tb320eva.Migrations
b.Property<int?>("supervisor2_id");
b.Property<int?>("supervisor3_id");
b.Property<DateTime>("updated");
b.HasKey("id");
@@ -241,12 +278,16 @@ namespace tb320eva.Migrations
b.Property<decimal?>("Final_summary_competency_supervisor2A");
b.Property<decimal?>("Final_summary_competency_supervisor3A");
b.Property<decimal?>("Final_summary_supervisor");
b.Property<decimal?>("Final_summary_supervisor1A");
b.Property<decimal?>("Final_summary_supervisor2A");
b.Property<decimal?>("Final_summary_supervisor3A");
b.Property<decimal?>("achievement_chief");
b.Property<decimal?>("achievement_supervisor");
@@ -255,6 +296,8 @@ namespace tb320eva.Migrations
b.Property<decimal?>("achievement_supervisor2A");
b.Property<decimal?>("achievement_supervisor3A");
b.Property<int?>("chief");
b.Property<int?>("chief_a");
@@ -278,6 +321,8 @@ namespace tb320eva.Migrations
b.Property<decimal?>("competency_supervisor2A");
b.Property<decimal?>("competency_supervisor3A");
b.Property<int?>("create_evaluation_id");
b.Property<DateTime>("created");
@@ -302,6 +347,9 @@ namespace tb320eva.Migrations
b.Property<string>("level_score_supervisor2A")
.HasMaxLength(255);
b.Property<string>("level_score_supervisor3A")
.HasMaxLength(255);
b.Property<int?>("order_of_data");
b.Property<string>("remark")
@@ -315,6 +363,8 @@ namespace tb320eva.Migrations
b.Property<decimal?>("score_supervisor2A");
b.Property<decimal?>("score_supervisor3A");
b.Property<string>("status_chief")
.HasMaxLength(1);
@@ -348,6 +398,11 @@ namespace tb320eva.Migrations
b.Property<DateTime?>("status_supervisor2A_click_date");
b.Property<string>("status_supervisor3A")
.HasMaxLength(1);
b.Property<DateTime?>("status_supervisor3A_click_date");
b.Property<string>("status_supervisor_a")
.HasMaxLength(1);
@@ -399,6 +454,18 @@ namespace tb320eva.Migrations
b.Property<string>("supervisor2_result")
.HasMaxLength(1);
b.Property<int?>("supervisor3A");
b.Property<DateTime?>("supervisor3A_date");
b.Property<string>("supervisor3A_remark")
.HasMaxLength(1000);
b.Property<string>("supervisor3A_result")
.HasMaxLength(1);
b.Property<int?>("supervisor3_id");
b.Property<decimal?>("total_summary_chief");
b.Property<decimal?>("total_summary_competency_chief");
@@ -409,12 +476,16 @@ namespace tb320eva.Migrations
b.Property<decimal?>("total_summary_competency_supervisor2A");
b.Property<decimal?>("total_summary_competency_supervisor3A");
b.Property<decimal?>("total_summary_supervisor");
b.Property<decimal?>("total_summary_supervisor1A");
b.Property<decimal?>("total_summary_supervisor2A");
b.Property<decimal?>("total_summary_supervisor3A");
b.Property<DateTime>("updated");
b.Property<decimal?>("work_period");
@@ -459,7 +530,10 @@ namespace tb320eva.Migrations
b.Property<int>("id");
b.Property<string>("achievement")
.HasMaxLength(8000);
.HasMaxLength(16000);
b.Property<string>("achievement_line1")
.HasMaxLength(16000);
b.Property<int?>("create_evaluation_detail_id");
@@ -534,12 +608,36 @@ namespace tb320eva.Migrations
b.ToTable("eva_evaluation_achievement_attach");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievement_detailEntity", b =>
{
b.Property<Guid>("id");
b.Property<string>("achievement_detail")
.HasMaxLength(16000);
b.Property<int?>("achievement_id");
b.Property<int?>("achievement_order");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("achievement_id");
b.ToTable("eva_evaluation_achievement_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b =>
{
b.Property<int>("id");
b.Property<string>("behavior")
.HasMaxLength(1000);
.HasMaxLength(16000);
b.Property<int?>("create_evaluation_detail_id");
@@ -729,9 +827,11 @@ namespace tb320eva.Migrations
b.Property<DateTime>("created");
b.Property<Guid?>("group_guid");
b.Property<bool>("isActive");
b.Property<Guid>("level_score_id");
b.Property<Guid?>("level_score_id");
b.Property<decimal?>("max_percentage");
@@ -745,6 +845,8 @@ namespace tb320eva.Migrations
b.HasKey("id");
b.HasIndex("group_guid");
b.HasIndex("level_score_id");
b.ToTable("eva_level_score_detail");
@@ -1083,6 +1185,13 @@ namespace tb320eva.Migrations
.HasForeignKey("achievement_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievement_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_evaluation_achievementEntity", "eva_evaluation_achievement")
.WithMany()
.HasForeignKey("achievement_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail")
@@ -1106,10 +1215,13 @@ namespace tb320eva.Migrations
modelBuilder.Entity("TodoAPI2.Models.eva_level_score_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group_group_guid")
.WithMany()
.HasForeignKey("group_guid");
b.HasOne("TodoAPI2.Models.eva_level_scoreEntity", "eva_level_score_level_score_id")
.WithMany()
.HasForeignKey("level_score_id")
.OnDelete(DeleteBehavior.Cascade);
.HasForeignKey("level_score_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b =>

View File

@@ -20,7 +20,7 @@ namespace TodoAPI2.Models
[MaxLength(191)]
public string log_name { get; set; }
[MaxLength(4000)]
[MaxLength(32000)]
public string description { get; set; }
public int? subject_id { get; set; }
@@ -33,7 +33,7 @@ namespace TodoAPI2.Models
[MaxLength(191)]
public string causer_type { get; set; }
[MaxLength(8000)]
[MaxLength(32000)]
public string properties { get; set; }
[MaxLength(191)]

View File

@@ -58,5 +58,33 @@ namespace TodoAPI2.Models
public string report_type { get; set; }
public DateTime? imported_date { get; set; }
[MaxLength(5)]
public string postponement_status { get; set; }
public DateTime? postponement_status_date { get; set; }
[MaxLength(255)]
public int? postponement_status_by { get; set; }
[MaxLength(1000)]
public string postponement_status_note { get; set; }
[MaxLength(5)]
public string quota_status { get; set; }
public DateTime? quota_status_date { get; set; }
[MaxLength(255)]
public int? quota_status_by { get; set; }
[MaxLength(1000)]
public string quota_status_note { get; set; }
public int? quota_status_submit_to { get; set; }
[MaxLength(5)]
public string quota_final_status { get; set; }
public DateTime? quota_final_status_date { get; set; }
[MaxLength(255)]
public int? quota_final_status_by { get; set; }
[MaxLength(1000)]
public string quota_final_status_note { get; set; }
}
}

View File

@@ -98,29 +98,29 @@ namespace TodoAPI2.Models
}
else
{
return (0, null);
return (detail.score_chief, detail.level_score_chief);
}
}
private void ReloadPostponement(int? adjust_postponement_id)
{
var rawData = from i in _repository.Context.eva_adjust_postponement_detail
where i.adjust_postponement_id == adjust_postponement_id
select i;
where i.adjust_postponement_id == adjust_postponement_id
select i;
var baseScore = from i in _repository.Context.eva_adjust_postponement_detail
join j in _repository.Context.eva_adjust_postponement on i.adjust_postponement_id equals j.id
join k in _repository.Context.eva_create_evaluation on j.create_evaluation_id equals k.id
join m in _repository.Context.eva_create_evaluation_detail on k.id equals m.create_evaluation_id
where i.adjust_postponement_id == adjust_postponement_id
&& m.employee_id == i.employee_id
select m;
join j in _repository.Context.eva_adjust_postponement on i.adjust_postponement_id equals j.id
join k in _repository.Context.eva_create_evaluation on j.create_evaluation_id equals k.id
join m in _repository.Context.eva_create_evaluation_detail on k.id equals m.create_evaluation_id
where i.adjust_postponement_id == adjust_postponement_id
&& m.employee_id == i.employee_id
select m;
foreach(var x in rawData)
foreach (var x in rawData)
{
var y = (from i in baseScore
where i.employee_id == x.employee_id
select getData(i)).FirstOrDefault();
where i.employee_id == x.employee_id
select getData(i)).FirstOrDefault();
x.level_score_final = y.Item2;
x.score_final = y.Item1;
}
@@ -151,20 +151,26 @@ namespace TodoAPI2.Models
private (decimal?, decimal?) GetRangePercentage(List<eva_level_score_detailEntity> level_detail, decimal? score)
{
var item = (from i in level_detail
/*var item = (from i in level_detail
where i.min_value <= score && i.max_value >= score
select i).FirstOrDefault();
if(item != null)
if (item != null)
{
return (item.min_percentage, item.max_percentage);
}
}*/
return (-100, 100);
}
public List<eva_adjust_postponement_detail_normal_02ViewModel> GetListBySearch(eva_adjust_postponement_detail_normal_02SearchModel model)
{
var theGroup = (from i in _repository.Context.eva_adjust_postponement
join j in _repository.Context.eva_create_evaluation on i.create_evaluation_id equals j.id
where i.id == model.adjust_postponement_id
select j.evaluation_group_id).FirstOrDefault();
var level_detail = (from i in _repository.Context.eva_level_score_detail
select i).ToList();
where i.group_guid == theGroup
select i).ToList();
var all_emp = emp.GetListByemployee_type(null, null);
@@ -174,10 +180,10 @@ namespace TodoAPI2.Models
into eva_adjust_postponementResult1
from fk_eva_adjust_postponementResult1 in eva_adjust_postponementResult1.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
// on fk_eva_adjust_postponementResult1.create_evaluation_id equals create_detail.create_evaluation_id
// into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
// on fk_eva_adjust_postponementResult1.create_evaluation_id equals create_detail.create_evaluation_id
// into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
join create_data in _repository.Context.eva_create_evaluation
on fk_eva_adjust_postponementResult1.create_evaluation_id equals create_data.id

View File

@@ -98,7 +98,7 @@ namespace TodoAPI2.Models
}
else
{
return (0, null);
return (detail.score_chief, detail.level_score_chief);
}
}

View File

@@ -23,6 +23,8 @@ namespace TodoAPI2.Models
rep_eva_savemessageReportRequestModel setModelFor_rep_eva_savemessageReport(rep_eva_savemessageReportRequestModel model);
DataContext GetContext();
void updateAllpostponement(int id);
}
}

View File

@@ -70,6 +70,39 @@ namespace TodoAPI2.Models
return GetDto(entity);
}
private string isStringNull(string a, string b)
{
if (!string.IsNullOrEmpty(a)) return a;
else return b;
}
private T isNull<T>(T a, T b)
{
if (a != null) return a;
else return b;
}
public void updateAllpostponement(int id)
{
var entity = _repository.Get(id);
var postponement = from x in _repository.Context.eva_adjust_postponement
where x.fiscal_year == entity.fiscal_year
&& x.theRound == entity.theRound
&& x.id != entity.id
select x;
foreach(var i in postponement)
{
//i.postponement_status = entity.postponement_status;
i.quota_status = entity.quota_status;
i.quota_final_status = entity.quota_final_status;
}
_repository.Context.SaveChanges();
}
public eva_adjust_postponement_quotaWithSelectionViewModel GetWithSelection(int id)
{
var entity = _repository.Get(id);
@@ -84,6 +117,19 @@ namespace TodoAPI2.Models
select new external_linkageViewModel { external_id = x.theRound, external_name = x.theRound.ToString() }
).Distinct().OrderByDescending(x => x.external_id).ToList();
var postponement = from x in _repository.Context.eva_adjust_postponement
join e in emp.GetAllEmployee() on isNull(x.managed_by, x.postponement_status_by) equals e.id
join v in ext.GetAgreeDisagree4() on isStringNull(x.postponement_status, "W") equals v.external_code
join c in _repository.Context.eva_create_evaluation on x.create_evaluation_id equals c.id
join d in _repository.Context.eva_evaluation_group on c.evaluation_group_id equals d.id
where x.fiscal_year == entity.fiscal_year
&& x.theRound == entity.theRound
&& x.id != entity.id
select d.thegroup + " โดย " + e.fullname + " " + v.external_name;
i.approve_status = postponement.ToList();
return i;
}
public eva_adjust_postponement_quotaWithSelectionViewModel GetBlankItem()
@@ -142,6 +188,8 @@ namespace TodoAPI2.Models
managed_by = m_eva_adjust_postponement_quota.managed_by,
limit = m_eva_adjust_postponement_quota.limit,
quota_status_submit_to = m_eva_adjust_postponement_quota.quota_status_submit_to,
managed_by_external_linkage_external_name = fk_external_linkageResult7.fullname,
isActive = m_eva_adjust_postponement_quota.isActive,
@@ -196,7 +244,16 @@ namespace TodoAPI2.Models
entity.limit_quota = 0;
entity.limit_frame_quota = 0;
var all_emp = (from i in emp.GetListByemployee_type(null, null) where i.workingstatus == "สถานะปฏิบัติงาน" select i).ToList();
var active_emp = (from i in _repository.Context.eva_adjust_postponement_detail
join j in _repository.Context.eva_adjust_postponement on i.adjust_postponement_id equals j.id
where j.fiscal_year == model.fiscal_year
&& j.theRound == model.theRound
select i.employee_id).ToList();
var all_emp = (from i in emp.GetListByemployee_type(null, null)
where i.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
&& active_emp.Contains(i.id)
select i).ToList();
var all_emp_id_list = (from i in all_emp select i.id).ToList();
entity.limit = AddMultipleDetail(entity.id, all_emp_id_list, entity.fiscal_year, entity.theRound, all_emp);

View File

@@ -34,5 +34,7 @@ namespace TodoAPI2.Models
public string managed_by_external_linkage_external_name { get; set; }
public int? quota_status_submit_to { get; set; }
}
}

View File

@@ -10,5 +10,7 @@ namespace TodoAPI2.Models
public List<external_employeeViewModel> item_managed_by { get; set; }
public List<external_linkageViewModel> item_fiscal_year_search { get; set; }
public List<external_linkageViewModel> item_theRound_search { get; set; }
public List<string> approve_status { get; set; }
}
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
namespace TodoAPI2.Models
{
public interface Ieva_adjust_postponement_update_statusService
{
new eva_adjust_postponement_update_statusViewModel Update(int id, eva_adjust_postponement_update_statusInputModel model, bool is_force_save, int? updateby);
List<eva_adjust_postponement_update_statusViewModel> GetListBypostponement_status_note(string postponement_status_note);
List<eva_adjust_postponement_update_statusViewModel> GetListBySearch(eva_adjust_postponement_update_statusSearchModel model);
eva_adjust_postponement_update_statusWithSelectionViewModel GetWithSelection(int id);
eva_adjust_postponement_update_statusWithSelectionViewModel GetBlankItem();
eva_adjust_postponementEntity GetEntity(int id);
DataContext GetContext();
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_adjust_postponement_update_statusInputModel
{
public int? id { get; set; }
public string postponement_status { get; set; }
public DateTime? postponement_status_date { get; set; }
public int? postponement_status_by { get; set; }
public string postponement_status_note { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_adjust_postponement_update_statusReportRequestModel : eva_adjust_postponement_update_statusSearchModel
{
public string filetype { get; set; }
public string contentType { get { return MyHelper.GetContentType(filetype); } }
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_adjust_postponement_update_statusSearchModel
{
public int id { get; set; }
public string postponement_status_note { get; set; }
}
}

View File

@@ -0,0 +1,244 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.IO;
using System.Web;
using System.Net;
using TTSW.Configure;
using Microsoft.Extensions.Options;
using System.Data;
namespace TodoAPI2.Models
{
public class eva_adjust_postponement_update_statusService : Ieva_adjust_postponement_update_statusService
{
private IBaseRepository2<eva_adjust_postponementEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private Iexternal_employeeService emp;
private Ieva_adjust_postponement_quotaService quotaStatus;
public eva_adjust_postponement_update_statusService(
IBaseRepository2<eva_adjust_postponementEntity, int> repository,
IMyDatabase mydb,
Iexternal_linkageService inext,
Iexternal_employeeService inemp,
Ieva_adjust_postponement_quotaService inquotaStatus
)
{
_repository = repository;
db = mydb;
ext = inext;
emp = inemp;
quotaStatus = inquotaStatus;
}
#region Private Functions
private eva_adjust_postponementEntity GetEntity(eva_adjust_postponement_update_statusInputModel model)
{
return Mapper.Map<eva_adjust_postponementEntity>(model);
}
private List<eva_adjust_postponementEntity> GetEntityList(List<eva_adjust_postponement_update_statusInputModel> models)
{
return Mapper.Map<List<eva_adjust_postponementEntity>>(models);
}
private eva_adjust_postponement_update_statusViewModel GetDto(eva_adjust_postponementEntity entity)
{
return Mapper.Map<eva_adjust_postponement_update_statusViewModel>(entity);
}
private List<eva_adjust_postponement_update_statusViewModel> GetDtoList(List<eva_adjust_postponementEntity> entities)
{
return Mapper.Map<List<eva_adjust_postponement_update_statusViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public eva_adjust_postponement_update_statusViewModel Get(int id)
{
var entity = _repository.Get(id);
if (!entity.postponement_status_date.HasValue) entity.postponement_status_date = DateTime.Now;
return GetDto(entity);
}
public eva_adjust_postponementEntity GetEntity(int id)
{
var entity = _repository.Get(id);
if (!entity.postponement_status_date.HasValue) entity.postponement_status_date = DateTime.Now;
return entity;
}
public DataContext GetContext()
{
return _repository.Context;
}
public eva_adjust_postponement_update_statusWithSelectionViewModel GetWithSelection(int id)
{
var entity = _repository.Get(id);
var i = Mapper.Map<eva_adjust_postponement_update_statusWithSelectionViewModel>(entity);
i.item_postponement_status = (from x in ext.GetAgreeDisagree4() select x).ToList();
i.item_postponement_status_by = (from x in emp.GetAllEmployee() select x).ToList();
i.postponement_status_date = DateTime.Now;
return i;
}
public eva_adjust_postponement_update_statusWithSelectionViewModel GetBlankItem()
{
var i = new eva_adjust_postponement_update_statusWithSelectionViewModel();
i.item_postponement_status = (from x in ext.GetAgreeDisagree4() select x).ToList();
i.item_postponement_status_by = (from x in emp.GetAllEmployee() select x).ToList();
i.postponement_status_date = DateTime.Now;
return i;
}
public List<eva_adjust_postponement_update_statusViewModel> GetListBypostponement_status_note(string postponement_status_note)
{
var model = new eva_adjust_postponement_update_statusSearchModel();
model.postponement_status_note = postponement_status_note;
return GetListBySearch(model);
}
public List<eva_adjust_postponement_update_statusViewModel> GetListBySearch(eva_adjust_postponement_update_statusSearchModel model)
{
var data = (
from m_eva_adjust_postponement_update_status in _repository.Context.eva_adjust_postponement
join fk_external_linkage1 in ext.GetAgreeDisagree4() on m_eva_adjust_postponement_update_status.postponement_status equals fk_external_linkage1.external_code
into external_linkageResult1
from fk_external_linkageResult1 in external_linkageResult1.DefaultIfEmpty()
join fk_external_linkage3 in emp.GetAllEmployee() on m_eva_adjust_postponement_update_status.postponement_status_by equals fk_external_linkage3.id
into external_linkageResult3
from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty()
where
1 == 1
&& (string.IsNullOrEmpty(model.postponement_status_note) || m_eva_adjust_postponement_update_status.postponement_status_note.Contains(model.postponement_status_note))
orderby m_eva_adjust_postponement_update_status.created descending
select new eva_adjust_postponement_update_statusViewModel()
{
id = m_eva_adjust_postponement_update_status.id,
postponement_status = m_eva_adjust_postponement_update_status.postponement_status,
postponement_status_date = m_eva_adjust_postponement_update_status.postponement_status_date,
postponement_status_by = m_eva_adjust_postponement_update_status.postponement_status_by,
postponement_status_note = m_eva_adjust_postponement_update_status.postponement_status_note,
postponement_status_external_linkage_external_name = fk_external_linkageResult1.external_name,
postponement_status_by_external_linkage_external_name = fk_external_linkageResult3.fullname,
isActive = m_eva_adjust_postponement_update_status.isActive,
Created = m_eva_adjust_postponement_update_status.created,
Updated = m_eva_adjust_postponement_update_status.updated
}
).Take(1000).ToList();
return data;
}
#endregion
#region Manipulation Functions
public int GetNewPrimaryKey()
{
int? newkey = 0;
var x = (from i in _repository.Context.eva_adjust_postponement
orderby i.id descending
select i).Take(1).ToList();
if(x.Count > 0)
{
newkey = x[0].id + 1;
}
return newkey.Value;
}
public eva_adjust_postponement_update_statusViewModel Update(int id, eva_adjust_postponement_update_statusInputModel model, bool is_force_save, int? updateby)
{
var existingEntity = _repository.Get(id);
if (existingEntity != null)
{
existingEntity.postponement_status = model.postponement_status;
existingEntity.postponement_status_date = DateTime.Now;
existingEntity.postponement_status_by = updateby;
existingEntity.postponement_status_note = model.postponement_status_note;
var updated = _repository.Update(id, existingEntity);
//quotaStatus.updateAllpostponement(id);
return Get(updated.id);
}
else
throw new NotificationException("No data to update");
}
public eva_adjust_postponement_update_statusViewModel SetAsActive(int id)
{
var updated = _repository.SetAsActive(id);
return Get(updated.id);
}
public eva_adjust_postponement_update_statusViewModel SetAsInactive(int id)
{
var updated = _repository.SetAsInActive(id);
return Get(updated.id);
}
public void Delete(int id)
{
_repository.Delete(id);
return;
}
private Dictionary<string,string> GetLookupForLog()
{
var i = new Dictionary<string, string>();
i.Add("postponement_status", "สถานะการปรับเลื่อนเงินเดือน");
i.Add("postponement_status_external_linkage_external_name", "สถานะการปรับเลื่อนเงินเดือน");
i.Add("postponement_status_date", "วันที่");
i.Add("txt_postponement_status_date", "วันที่");
i.Add("postponement_status_by", "ปรับสถานะโดย");
i.Add("postponement_status_by_external_linkage_external_name", "ปรับสถานะโดย");
i.Add("postponement_status_note", "หมายเหตุ");
return i;
}
#endregion
#region Match Item
#endregion
#endregion
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_adjust_postponement_update_statusViewModel : BaseViewModel2<int>
{
public string postponement_status { get; set; }
public DateTime? postponement_status_date { get; set; }
public string txt_postponement_status_date { get { return MyHelper.GetDateStringForReport(this.postponement_status_date); } }
public int? postponement_status_by { get; set; }
public string postponement_status_note { get; set; }
public string postponement_status_external_linkage_external_name { get; set; }
public string postponement_status_by_external_linkage_external_name { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TodoAPI2.Models
{
public class eva_adjust_postponement_update_statusWithSelectionViewModel: eva_adjust_postponement_update_statusViewModel
{
public List<external_linkageViewModel> item_postponement_status { get; set; }
public List<external_employeeViewModel> item_postponement_status_by { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
namespace TodoAPI2.Models
{
public interface Ieva_adjust_quota_update_final_statusService
{
new eva_adjust_quota_update_final_statusViewModel Update(int id, eva_adjust_quota_update_final_statusInputModel model, bool is_force_save, int? updateby);
List<eva_adjust_quota_update_final_statusViewModel> GetListByquota_final_status_note(string quota_final_status_note);
List<eva_adjust_quota_update_final_statusViewModel> GetListBySearch(eva_adjust_quota_update_final_statusSearchModel model);
eva_adjust_quota_update_final_statusWithSelectionViewModel GetWithSelection(int id);
eva_adjust_quota_update_final_statusWithSelectionViewModel GetBlankItem();
eva_adjust_postponementEntity GetEntity(int id);
DataContext GetContext();
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_adjust_quota_update_final_statusInputModel
{
public int? id { get; set; }
public string quota_final_status { get; set; }
public DateTime? quota_final_status_date { get; set; }
public int? quota_final_status_by { get; set; }
public string quota_final_status_note { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_adjust_quota_update_final_statusReportRequestModel : eva_adjust_quota_update_final_statusSearchModel
{
public string filetype { get; set; }
public string contentType { get { return MyHelper.GetContentType(filetype); } }
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_adjust_quota_update_final_statusSearchModel
{
public int id { get; set; }
public string quota_final_status_note { get; set; }
}
}

View File

@@ -0,0 +1,248 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.IO;
using System.Web;
using System.Net;
using TTSW.Configure;
using Microsoft.Extensions.Options;
using System.Data;
namespace TodoAPI2.Models
{
public class eva_adjust_quota_update_final_statusService : Ieva_adjust_quota_update_final_statusService
{
private IBaseRepository2<eva_adjust_postponementEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private Iexternal_employeeService emp;
private Ieva_adjust_postponement_quotaService quotaStatus;
public eva_adjust_quota_update_final_statusService(IBaseRepository2<eva_adjust_postponementEntity, int> repository,
IMyDatabase mydb, Iexternal_linkageService inext,
Iexternal_employeeService inemp,
Ieva_adjust_postponement_quotaService inquotaStatus)
{
_repository = repository;
db = mydb;
ext = inext;
emp = inemp;
quotaStatus = inquotaStatus;
}
#region Private Functions
private eva_adjust_postponementEntity GetEntity(eva_adjust_quota_update_final_statusInputModel model)
{
return Mapper.Map<eva_adjust_postponementEntity>(model);
}
private List<eva_adjust_postponementEntity> GetEntityList(List<eva_adjust_quota_update_final_statusInputModel> models)
{
return Mapper.Map<List<eva_adjust_postponementEntity>>(models);
}
private eva_adjust_quota_update_final_statusViewModel GetDto(eva_adjust_postponementEntity entity)
{
return Mapper.Map<eva_adjust_quota_update_final_statusViewModel>(entity);
}
private List<eva_adjust_quota_update_final_statusViewModel> GetDtoList(List<eva_adjust_postponementEntity> entities)
{
return Mapper.Map<List<eva_adjust_quota_update_final_statusViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public eva_adjust_quota_update_final_statusViewModel Get(int id)
{
var entity = _repository.Get(id);
return GetDto(entity);
}
public eva_adjust_postponementEntity GetEntity(int id)
{
var entity = _repository.Get(id);
return entity;
}
public DataContext GetContext()
{
return _repository.Context;
}
public eva_adjust_quota_update_final_statusWithSelectionViewModel GetWithSelection(int id)
{
var entity = _repository.Get(id);
var i = Mapper.Map<eva_adjust_quota_update_final_statusWithSelectionViewModel>(entity);
i.item_quota_final_status = (from x in ext.GetAgreeDisagree5() select x).ToList();
i.item_quota_final_status_by = (from x in emp.GetAllEmployee() select x).ToList();
return i;
}
public eva_adjust_quota_update_final_statusWithSelectionViewModel GetBlankItem()
{
var i = new eva_adjust_quota_update_final_statusWithSelectionViewModel();
i.item_quota_final_status = (from x in ext.GetAgreeDisagree5() select x).ToList();
i.item_quota_final_status_by = (from x in emp.GetAllEmployee() select x).ToList();
return i;
}
public List<eva_adjust_quota_update_final_statusViewModel> GetListByquota_final_status_note(string quota_final_status_note)
{
var model = new eva_adjust_quota_update_final_statusSearchModel();
model.quota_final_status_note = quota_final_status_note;
return GetListBySearch(model);
}
public List<eva_adjust_quota_update_final_statusViewModel> GetListBySearch(eva_adjust_quota_update_final_statusSearchModel model)
{
var data = (
from m_eva_adjust_quota_update_final_status in _repository.Context.eva_adjust_postponement
join fk_external_linkage1 in ext.GetAgreeDisagree5() on m_eva_adjust_quota_update_final_status.quota_final_status equals fk_external_linkage1.external_code
into external_linkageResult1
from fk_external_linkageResult1 in external_linkageResult1.DefaultIfEmpty()
join fk_external_linkage3 in emp.GetAllEmployee() on m_eva_adjust_quota_update_final_status.quota_final_status_by equals fk_external_linkage3.id
into external_linkageResult3
from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty()
where
1 == 1
&& (string.IsNullOrEmpty(model.quota_final_status_note) || m_eva_adjust_quota_update_final_status.quota_final_status_note.Contains(model.quota_final_status_note))
orderby m_eva_adjust_quota_update_final_status.created descending
select new eva_adjust_quota_update_final_statusViewModel()
{
id = m_eva_adjust_quota_update_final_status.id,
quota_final_status = m_eva_adjust_quota_update_final_status.quota_final_status,
quota_final_status_date = m_eva_adjust_quota_update_final_status.quota_final_status_date,
quota_final_status_by = m_eva_adjust_quota_update_final_status.quota_final_status_by,
quota_final_status_note = m_eva_adjust_quota_update_final_status.quota_final_status_note,
quota_final_status_external_linkage_external_name = fk_external_linkageResult1.external_name,
quota_final_status_by_external_linkage_external_name = fk_external_linkageResult3.fullname,
isActive = m_eva_adjust_quota_update_final_status.isActive,
Created = m_eva_adjust_quota_update_final_status.created,
Updated = m_eva_adjust_quota_update_final_status.updated
}
).Take(1000).ToList();
return data;
}
#endregion
#region Manipulation Functions
public int GetNewPrimaryKey()
{
int? newkey = 0;
var x = (from i in _repository.Context.eva_adjust_postponement
orderby i.id descending
select i).Take(1).ToList();
if(x.Count > 0)
{
newkey = x[0].id + 1;
}
return newkey.Value;
}
public eva_adjust_quota_update_final_statusViewModel Update(int id,
eva_adjust_quota_update_final_statusInputModel model, bool is_force_save, int? updateby)
{
var existingEntity = _repository.Get(id);
if (existingEntity != null)
{
if(model.quota_final_status == "Y" && existingEntity.quota_status != "Y")
{
throw new Exception("ผู้อนุมัติวงเงินที่กันไว้ คนแรก, ยังไม่ได้อนุมัติ วงเงินที่กันไว้");
}
existingEntity.quota_final_status = model.quota_final_status;
existingEntity.quota_final_status_date = DateTime.Now;
existingEntity.quota_final_status_by = updateby;
existingEntity.quota_final_status_note = model.quota_final_status_note;
if (model.quota_final_status == "N")
{
existingEntity.quota_status = "W";
existingEntity.quota_status_note = existingEntity.quota_final_status_note;
}
var updated = _repository.Update(id, existingEntity);
quotaStatus.updateAllpostponement(id);
return Get(updated.id);
}
else
throw new NotificationException("No data to update");
}
public eva_adjust_quota_update_final_statusViewModel SetAsActive(int id)
{
var updated = _repository.SetAsActive(id);
return Get(updated.id);
}
public eva_adjust_quota_update_final_statusViewModel SetAsInactive(int id)
{
var updated = _repository.SetAsInActive(id);
return Get(updated.id);
}
public void Delete(int id)
{
_repository.Delete(id);
return;
}
private Dictionary<string,string> GetLookupForLog()
{
var i = new Dictionary<string, string>();
i.Add("quota_final_status", "สถานะการปรับเลื่อนเงินเดือน");
i.Add("quota_final_status_external_linkage_external_name", "สถานะการปรับเลื่อนเงินเดือน");
i.Add("quota_final_status_date", "วันที่");
i.Add("txt_quota_final_status_date", "วันที่");
i.Add("quota_final_status_by", "ปรับสถานะโดย");
i.Add("quota_final_status_by_external_linkage_external_name", "ปรับสถานะโดย");
i.Add("quota_final_status_note", "หมายเหตุ");
return i;
}
#endregion
#region Match Item
#endregion
#endregion
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_adjust_quota_update_final_statusViewModel : BaseViewModel2<int>
{
public string quota_final_status { get; set; }
public DateTime? quota_final_status_date { get; set; }
public string txt_quota_final_status_date { get { return MyHelper.GetDateStringForReport(this.quota_final_status_date); } }
public int? quota_final_status_by { get; set; }
public string quota_final_status_note { get; set; }
public string quota_final_status_external_linkage_external_name { get; set; }
public string quota_final_status_by_external_linkage_external_name { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TodoAPI2.Models
{
public class eva_adjust_quota_update_final_statusWithSelectionViewModel: eva_adjust_quota_update_final_statusViewModel
{
public List<external_linkageViewModel> item_quota_final_status { get; set; }
public List<external_employeeViewModel> item_quota_final_status_by { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
namespace TodoAPI2.Models
{
public interface Ieva_adjust_quota_update_statusService
{
new eva_adjust_quota_update_statusViewModel Update(int id, eva_adjust_quota_update_statusInputModel model, bool is_force_save, int? updateby);
List<eva_adjust_quota_update_statusViewModel> GetListByquota_status_note(string quota_status_note);
List<eva_adjust_quota_update_statusViewModel> GetListBySearch(eva_adjust_quota_update_statusSearchModel model);
eva_adjust_quota_update_statusWithSelectionViewModel GetWithSelection(int id);
eva_adjust_quota_update_statusWithSelectionViewModel GetBlankItem();
eva_adjust_postponementEntity GetEntity(int id);
DataContext GetContext();
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_adjust_quota_update_statusInputModel
{
public int? id { get; set; }
public string quota_status { get; set; }
public DateTime? quota_status_date { get; set; }
public int? quota_status_by { get; set; }
public string quota_status_note { get; set; }
public int? quota_status_submit_to { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_adjust_quota_update_statusReportRequestModel : eva_adjust_quota_update_statusSearchModel
{
public string filetype { get; set; }
public string contentType { get { return MyHelper.GetContentType(filetype); } }
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_adjust_quota_update_statusSearchModel
{
public int id { get; set; }
public string quota_status_note { get; set; }
}
}

View File

@@ -0,0 +1,256 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.IO;
using System.Web;
using System.Net;
using TTSW.Configure;
using Microsoft.Extensions.Options;
using System.Data;
namespace TodoAPI2.Models
{
public class eva_adjust_quota_update_statusService : Ieva_adjust_quota_update_statusService
{
private IBaseRepository2<eva_adjust_postponementEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private Iexternal_employeeService emp;
private Ieva_adjust_postponement_quotaService quotaStatus;
public eva_adjust_quota_update_statusService(IBaseRepository2<eva_adjust_postponementEntity, int> repository,
IMyDatabase mydb,
Iexternal_linkageService inext,
Iexternal_employeeService inemp,
Ieva_adjust_postponement_quotaService inquotaStatus)
{
_repository = repository;
db = mydb;
ext = inext;
emp = inemp;
quotaStatus = inquotaStatus;
}
#region Private Functions
private eva_adjust_postponementEntity GetEntity(eva_adjust_quota_update_statusInputModel model)
{
return Mapper.Map<eva_adjust_postponementEntity>(model);
}
private List<eva_adjust_postponementEntity> GetEntityList(List<eva_adjust_quota_update_statusInputModel> models)
{
return Mapper.Map<List<eva_adjust_postponementEntity>>(models);
}
private eva_adjust_quota_update_statusViewModel GetDto(eva_adjust_postponementEntity entity)
{
return Mapper.Map<eva_adjust_quota_update_statusViewModel>(entity);
}
private List<eva_adjust_quota_update_statusViewModel> GetDtoList(List<eva_adjust_postponementEntity> entities)
{
return Mapper.Map<List<eva_adjust_quota_update_statusViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public eva_adjust_quota_update_statusViewModel Get(int id)
{
var entity = _repository.Get(id);
return GetDto(entity);
}
public eva_adjust_postponementEntity GetEntity(int id)
{
var entity = _repository.Get(id);
return entity;
}
public DataContext GetContext()
{
return _repository.Context;
}
public eva_adjust_quota_update_statusWithSelectionViewModel GetWithSelection(int id)
{
var entity = _repository.Get(id);
var i = Mapper.Map<eva_adjust_quota_update_statusWithSelectionViewModel>(entity);
i.item_quota_status = (from x in ext.GetAgreeDisagree4() select x).ToList();
i.item_quota_status_by = (from x in emp.GetAllEmployee() select x).ToList();
i.item_quota_status_submit_to = (from x in emp.GetAllEmployee() select x).ToList();
return i;
}
public eva_adjust_quota_update_statusWithSelectionViewModel GetBlankItem()
{
var i = new eva_adjust_quota_update_statusWithSelectionViewModel();
i.item_quota_status = (from x in ext.GetAgreeDisagree4() select x).ToList();
i.item_quota_status_by = (from x in emp.GetAllEmployee() select x).ToList();
i.item_quota_status_submit_to = (from x in emp.GetAllEmployee() select x).ToList();
return i;
}
public List<eva_adjust_quota_update_statusViewModel> GetListByquota_status_note(string quota_status_note)
{
var model = new eva_adjust_quota_update_statusSearchModel();
model.quota_status_note = quota_status_note;
return GetListBySearch(model);
}
public List<eva_adjust_quota_update_statusViewModel> GetListBySearch(eva_adjust_quota_update_statusSearchModel model)
{
var data = (
from m_eva_adjust_quota_update_status in _repository.Context.eva_adjust_postponement
join fk_external_linkage1 in ext.GetAgreeDisagree4() on m_eva_adjust_quota_update_status.quota_status equals fk_external_linkage1.external_code
into external_linkageResult1
from fk_external_linkageResult1 in external_linkageResult1.DefaultIfEmpty()
join fk_external_linkage3 in emp.GetAllEmployee() on m_eva_adjust_quota_update_status.quota_status_by equals fk_external_linkage3.id
into external_linkageResult3
from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty()
where
1 == 1
&& (string.IsNullOrEmpty(model.quota_status_note) || m_eva_adjust_quota_update_status.quota_status_note.Contains(model.quota_status_note))
orderby m_eva_adjust_quota_update_status.created descending
select new eva_adjust_quota_update_statusViewModel()
{
id = m_eva_adjust_quota_update_status.id,
quota_status = m_eva_adjust_quota_update_status.quota_status,
quota_status_date = m_eva_adjust_quota_update_status.quota_status_date,
quota_status_by = m_eva_adjust_quota_update_status.quota_status_by,
quota_status_note = m_eva_adjust_quota_update_status.quota_status_note,
quota_status_external_linkage_external_name = fk_external_linkageResult1.external_name,
quota_status_by_external_linkage_external_name = fk_external_linkageResult3.fullname,
isActive = m_eva_adjust_quota_update_status.isActive,
Created = m_eva_adjust_quota_update_status.created,
Updated = m_eva_adjust_quota_update_status.updated
}
).Take(1000).ToList();
return data;
}
#endregion
#region Manipulation Functions
public int GetNewPrimaryKey()
{
int? newkey = 0;
var x = (from i in _repository.Context.eva_adjust_postponement
orderby i.id descending
select i).Take(1).ToList();
if(x.Count > 0)
{
newkey = x[0].id + 1;
}
return newkey.Value;
}
public eva_adjust_quota_update_statusViewModel Update(int id, eva_adjust_quota_update_statusInputModel model, bool is_force_save, int? updateby)
{
var existingEntity = _repository.Get(id);
if (existingEntity != null)
{
if (model.quota_status == "Y")
{
var postponement = from x in _repository.Context.eva_adjust_postponement
where x.fiscal_year == existingEntity.fiscal_year
&& x.theRound == existingEntity.theRound
&& x.id != existingEntity.id
&& x.postponement_status != "Y"
select x;
if (postponement.Count() > 0)
{
throw new Exception("ยังมีบางหน่วยงาน ยังไม่ได้อนุมัติ ปรับเลื่อนค่าตอบแทน");
}
}
existingEntity.quota_status = model.quota_status;
existingEntity.quota_status_date = DateTime.Now;
existingEntity.quota_status_by = updateby;
existingEntity.quota_status_note = model.quota_status_note;
existingEntity.quota_status_submit_to = model.quota_status_submit_to;
if (model.quota_status == "Y")
{
existingEntity.quota_final_status = "W";
existingEntity.quota_final_status_note = existingEntity.quota_status_note;
}
var updated = _repository.Update(id, existingEntity);
quotaStatus.updateAllpostponement(id);
return Get(updated.id);
}
else
throw new NotificationException("No data to update");
}
public eva_adjust_quota_update_statusViewModel SetAsActive(int id)
{
var updated = _repository.SetAsActive(id);
return Get(updated.id);
}
public eva_adjust_quota_update_statusViewModel SetAsInactive(int id)
{
var updated = _repository.SetAsInActive(id);
return Get(updated.id);
}
public void Delete(int id)
{
_repository.Delete(id);
return;
}
private Dictionary<string,string> GetLookupForLog()
{
var i = new Dictionary<string, string>();
i.Add("quota_status", "สถานะการปรับเลื่อนเงินเดือน");
i.Add("quota_status_external_linkage_external_name", "สถานะการปรับเลื่อนเงินเดือน");
i.Add("quota_status_date", "วันที่");
i.Add("txt_quota_status_date", "วันที่");
i.Add("quota_status_by", "ปรับสถานะโดย");
i.Add("quota_status_by_external_linkage_external_name", "ปรับสถานะโดย");
i.Add("quota_status_note", "หมายเหตุ");
return i;
}
#endregion
#region Match Item
#endregion
#endregion
}
}

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_adjust_quota_update_statusViewModel : BaseViewModel2<int>
{
public string quota_status { get; set; }
public DateTime? quota_status_date { get; set; }
public string txt_quota_status_date { get { return MyHelper.GetDateStringForReport(this.quota_status_date); } }
public int? quota_status_by { get; set; }
public string quota_status_note { get; set; }
public int? quota_status_submit_to { get; set; }
public string quota_status_external_linkage_external_name { get; set; }
public string quota_status_by_external_linkage_external_name { get; set; }
public string quota_status_submit_to_external_linkage_external_name { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TodoAPI2.Models
{
public class eva_adjust_quota_update_statusWithSelectionViewModel: eva_adjust_quota_update_statusViewModel
{
public List<external_linkageViewModel> item_quota_status { get; set; }
public List<external_employeeViewModel> item_quota_status_by { get; set; }
public List<external_employeeViewModel> item_quota_status_submit_to { get; set; }
}
}

View File

@@ -34,6 +34,6 @@ namespace TodoAPI2.Models
public int? supervisor2_id { get; set; }
public int? supervisor3_id { get; set; }
}
}

View File

@@ -30,6 +30,8 @@ namespace TodoAPI2.Models
public int? supervisor2_id { get; set; }
public int? supervisor3_id { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -71,11 +71,12 @@ namespace TodoAPI2.Models
var entity = _repository.Get(id);
var i = Mapper.Map<eva_create_evaluationWithSelectionViewModel>(entity);
i.item_performance_plan_id = (from x in _repository.Context.eva_performance_plan select x).ToList();
i.item_performance_plan_id = (from x in _repository.Context.eva_performance_plan orderby x.fiscal_year descending, x.theTime descending select x).ToList();
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;
i.item_supervisor3_id = all_emp;
return i;
}
@@ -84,11 +85,12 @@ namespace TodoAPI2.Models
var all_emp = emp.GetAllEmployee();
var i = new eva_create_evaluationWithSelectionViewModel();
i.item_performance_plan_id = (from x in _repository.Context.eva_performance_plan select x).ToList();
i.item_performance_plan_id = (from x in _repository.Context.eva_performance_plan orderby x.fiscal_year descending, x.theTime descending select x).ToList();
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;
i.item_supervisor3_id = all_emp;
return i;
}
@@ -127,12 +129,16 @@ namespace TodoAPI2.Models
into external_linkageResult7
from fk_external_linkageResult7 in external_linkageResult7.DefaultIfEmpty()
join fk_external_linkage8 in all_emp on m_eva_create_evaluation.supervisor3_id equals fk_external_linkage8.id
into external_linkageResult8
from fk_external_linkageResult8 in external_linkageResult8.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)
orderby fk_eva_performance_planResult1.fiscal_year, fk_eva_performance_planResult1.theTime, fk_eva_evaluation_groupResult5.code
orderby fk_eva_performance_planResult1.fiscal_year descending, fk_eva_performance_planResult1.theTime descending, fk_eva_evaluation_groupResult5.code ascending
select new eva_create_evaluationViewModel()
{
id = m_eva_create_evaluation.id,
@@ -143,6 +149,7 @@ namespace TodoAPI2.Models
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,
supervisor3_id = m_eva_create_evaluation.supervisor3_id,
performance_plan_id_eva_performance_plan_fiscal_year = fk_eva_performance_planResult1.display_text,
employee_id_external_linkage_external_name = fk_external_linkageResult2.fullname,
@@ -150,6 +157,7 @@ namespace TodoAPI2.Models
evaluation_group_id_eva_evaluation_group_name = fk_eva_evaluation_groupResult5.thegroup,
supervisor1_id_external_linkage_external_name = fk_external_linkageResult6.fullname,
supervisor2_id_external_linkage_external_name = fk_external_linkageResult7.fullname,
supervisor3_id_external_linkage_external_name = fk_external_linkageResult8.fullname,
isActive = m_eva_create_evaluation.isActive,
Created = m_eva_create_evaluation.created,
@@ -209,7 +217,7 @@ namespace TodoAPI2.Models
existingEntity.evaluation_group_id = model.evaluation_group_id;
existingEntity.supervisor1_id = model.supervisor1_id;
existingEntity.supervisor2_id = model.supervisor2_id;
existingEntity.supervisor3_id = model.supervisor3_id;
var updated = _repository.Update(id, existingEntity);
return Get(updated.id);
@@ -234,7 +242,7 @@ namespace TodoAPI2.Models
existingEntity.evaluation_group_id = i.evaluation_group_id;
existingEntity.supervisor1_id = i.supervisor1_id;
existingEntity.supervisor2_id = i.supervisor2_id;
existingEntity.supervisor3_id = i.supervisor3_id;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}

View File

@@ -28,6 +28,8 @@ namespace TodoAPI2.Models
public int? supervisor2_id { get; set; }
public int? supervisor3_id { get; set; }
public string 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; }
@@ -36,6 +38,8 @@ namespace TodoAPI2.Models
public string supervisor1_id_external_linkage_external_name { get; set; }
public string supervisor2_id_external_linkage_external_name { get; set; }
public string supervisor3_id_external_linkage_external_name { get; set; }
public string description
{
get

View File

@@ -12,6 +12,6 @@ namespace TodoAPI2.Models
public List<eva_evaluation_groupEntity> item_evaluation_group_id { get; set; }
public List<external_employeeViewModel> item_supervisor1_id { get; set; }
public List<external_employeeViewModel> item_supervisor2_id { get; set; }
public List<external_employeeViewModel> item_supervisor3_id { get; set; }
}
}

View File

@@ -137,6 +137,8 @@ namespace TodoAPI2.Models
public DateTime? status_supervisor1A_click_date { get; set; }
public DateTime? status_supervisor2A_click_date { get; set; }
public DateTime? status_supervisor3A_click_date { get; set; }
public decimal? total_summary_supervisor1A { get; set; }
public decimal? Final_summary_supervisor1A { get; set; }
@@ -198,6 +200,38 @@ namespace TodoAPI2.Models
[MaxLength(1000)]
public string remark { get; set; }
public int? supervisor3_id { get; set; }
public int? supervisor3A { get; set; }
[MaxLength(1)]
public string supervisor3A_result { get; set; }
[MaxLength(1000)]
public string supervisor3A_remark { get; set; }
public DateTime? supervisor3A_date { get; set; }
[MaxLength(1)]
public string status_supervisor3A { get; set; }
public decimal? total_summary_supervisor3A { get; set; }
public decimal? Final_summary_supervisor3A { get; set; }
public decimal? total_summary_competency_supervisor3A { get; set; }
public decimal? Final_summary_competency_supervisor3A { get; set; }
public decimal? achievement_supervisor3A { get; set; }
public decimal? competency_supervisor3A { get; set; }
public decimal? score_supervisor3A { get; set; }
[MaxLength(255)]
public string level_score_supervisor3A { get; set; }
}
}

View File

@@ -36,6 +36,8 @@ namespace TodoAPI2.Models
public string remark { get; set; }
public int? supervisor3_id { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -82,6 +82,7 @@ namespace TodoAPI2.Models
i.item_eva_employee_id = i.item_employee_id;
i.item_supervisor1_id = i.item_employee_id;
i.item_supervisor2_id = i.item_employee_id;
i.item_supervisor3_id = i.item_employee_id;
i.item_help_org_id = ext.GetDepartmentData();
return i;
@@ -95,6 +96,7 @@ namespace TodoAPI2.Models
i.item_eva_employee_id = i.item_employee_id;
i.item_supervisor1_id = i.item_employee_id;
i.item_supervisor2_id = i.item_employee_id;
i.item_supervisor3_id = i.item_employee_id;
i.item_help_org_id = ext.GetDepartmentData();
return i;
@@ -139,6 +141,10 @@ namespace TodoAPI2.Models
into external_linkageResult46
from fk_external_linkageResult46 in external_linkageResult46.DefaultIfEmpty()
join fk_external_linkage48 in allemp on m_eva_create_evaluation_detail.supervisor3_id equals fk_external_linkage48.id
into external_linkageResult48
from fk_external_linkageResult48 in external_linkageResult48.DefaultIfEmpty()
join fk_external_linkage99 in ext.GetDepartmentData() on (m_eva_create_evaluation_detail.help_org_id.HasValue ? m_eva_create_evaluation_detail.help_org_id : fk_external_linkageResult2.department_id) equals fk_external_linkage99.id
into external_linkageResult99
from fk_external_linkageResult99 in external_linkageResult99.DefaultIfEmpty()
@@ -197,6 +203,7 @@ namespace TodoAPI2.Models
status_supervisor1A = m_eva_create_evaluation_detail.status_supervisor1A,
status_supervisor2A = m_eva_create_evaluation_detail.status_supervisor2A,
status_supervisor3A = m_eva_create_evaluation_detail.status_supervisor3A,
employee_id_external_linkage_external_name = fk_external_linkageResult2.fullname,
chief_external_linkage_external_name = fk_external_linkageResult3.fullname,
@@ -216,6 +223,7 @@ namespace TodoAPI2.Models
status_supervisor_click_date = m_eva_create_evaluation_detail.status_supervisor_click_date,
status_supervisor1A_click_date = m_eva_create_evaluation_detail.status_supervisor1A_click_date,
status_supervisor2A_click_date = m_eva_create_evaluation_detail.status_supervisor2A_click_date,
status_supervisor3A_click_date = m_eva_create_evaluation_detail.status_supervisor3A_click_date,
department_name = fk_external_linkageResult99.external_name,
help_org_id_external_linkage_external_name = fk_external_linkageResult46.external_name,

View File

@@ -82,10 +82,13 @@ namespace TodoAPI2.Models
public string status_supervisor2A { get; set; }
public string status_supervisor3A { get; set; }
public string employee_id_external_linkage_external_name { get; set; }
public string chief_external_linkage_external_name { get; set; }
public string supervisor1_result_external_linkage_external_name { get; set; }
public string supervisor2_result_external_linkage_external_name { get; set; }
public string supervisor3_result_external_linkage_external_name { get; set; }
public string position_type_text { get; set; }
public string position_level_text { get; set; }
@@ -103,6 +106,7 @@ namespace TodoAPI2.Models
public DateTime? status_supervisor_click_date { get; set; }
public DateTime? status_supervisor1A_click_date { get; set; }
public DateTime? status_supervisor2A_click_date { get; set; }
public DateTime? status_supervisor3A_click_date { get; set; }
public int? eva_employee_id { get; set; }
@@ -110,6 +114,8 @@ namespace TodoAPI2.Models
public int? supervisor2_id { get; set; }
public int? supervisor3_id { get; set; }
public decimal? work_period { get; set; }
public int? order_of_data { get; set; }
@@ -120,6 +126,7 @@ namespace TodoAPI2.Models
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date); } }
public string txt_status_supervisor1A { get { return getStatusText(status_supervisor1A) + MyHelper.GetDateStringForReport(status_supervisor1A_click_date); } }
public string txt_status_supervisor2A { get { return getStatusText(status_supervisor2A) + MyHelper.GetDateStringForReport(status_supervisor2A_click_date); } }
public string txt_status_supervisor3A { get { return getStatusText(status_supervisor3A) + MyHelper.GetDateStringForReport(status_supervisor3A_click_date); } }
public string help_org_id_external_linkage_external_name { get; set; }

View File

@@ -13,6 +13,7 @@ namespace TodoAPI2.Models
public List<external_employeeViewModel> item_eva_employee_id { get; set; }
public List<external_employeeViewModel> item_supervisor1_id { get; set; }
public List<external_employeeViewModel> item_supervisor2_id { get; set; }
public List<external_employeeViewModel> item_supervisor3_id { get; set; }
public List<external_linkageViewModel> item_help_org_id { get; set; }
}
}

View File

@@ -128,7 +128,7 @@ namespace TodoAPI2.Models
status_chief = m_eva_create_evaluation_detail_agreement.status_chief,
status_chief_a = m_eva_create_evaluation_detail_agreement.status_chief_a,
status_supervisor = m_eva_create_evaluation_detail_agreement.status_supervisor,
status_supervisor_a = null,
status_supervisor_a = m_eva_create_evaluation_detail_agreement.status_supervisor_a,
org_id_external_linkage_external_name = fk_external_employee.department_name,
@@ -445,6 +445,7 @@ namespace TodoAPI2.Models
status_chief = m_eva_create_evaluation_detail_agreement.status_chief,
status_chief_a = m_eva_create_evaluation_detail_agreement.status_chief_a,
status_supervisor = m_eva_create_evaluation_detail_agreement.status_supervisor,
status_supervisor_a = m_eva_create_evaluation_detail_agreement.status_supervisor_a,
org_id_external_linkage_external_name = !string.IsNullOrEmpty(fk_external_linkageResult11.external_name) ? fk_external_linkageResult11.external_name : fk_external_linkageResult12.external_name,
@@ -453,6 +454,7 @@ namespace TodoAPI2.Models
status_self_a_click_date = m_eva_create_evaluation_detail_agreement.status_self_a_click_date,
status_chief_a_click_date = m_eva_create_evaluation_detail_agreement.status_chief_a_click_date,
status_supervisor_click_date = m_eva_create_evaluation_detail_agreement.status_supervisor_click_date,
status_supervisor_a_click_date = m_eva_create_evaluation_detail_agreement.status_supervisor_a_click_date,
plan_round_year = checkNull(fk_planResult.theTime) + "/" + checkNull(fk_planResult.fiscal_year),

View File

@@ -101,7 +101,7 @@ namespace TodoAPI2.Models
{
if (s == "Y")
{
return "ส่งแบบประเมินแล้ว <br/>";
return "ส่งข้อตกลงแล้ว <br/>";
}
else if (s == "N")
{

View File

@@ -20,16 +20,16 @@ namespace TodoAPI2.Models
public class eva_create_evaluation_detail_processService : Ieva_create_evaluation_detail_processService
{
private IBaseRepository2<eva_create_evaluation_detailEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private IMyDatabase db;
private Iexternal_linkageService ext;
Iexternal_employeeService emp;
public eva_create_evaluation_detail_processService(IBaseRepository2<eva_create_evaluation_detailEntity, int> repository,
public eva_create_evaluation_detail_processService(IBaseRepository2<eva_create_evaluation_detailEntity, int> repository,
IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp)
{
_repository = repository;
db = mydb;
ext = inext;
db = mydb;
ext = inext;
emp = inemp;
}
@@ -50,7 +50,7 @@ namespace TodoAPI2.Models
{
return Mapper.Map<List<eva_create_evaluation_detail_processViewModel>>(entities);
}
#endregion
#region Public Functions
@@ -72,6 +72,13 @@ namespace TodoAPI2.Models
return end;
}
private T isNull<T>(T s, T o)
{
if(s == null) return o;
return s;
}
public eva_create_evaluation_detail_processWithSelectionViewModel Get(int id, int? emp_id, string path)
{
object special_person = (from x in _repository.Context.eva_setup_permission
@@ -121,19 +128,21 @@ namespace TodoAPI2.Models
into external_chiefResult
from fk_external_chief in external_chiefResult.DefaultIfEmpty()
join fk_external_supervisor2 in allemp on fk_eva_create_evaluationResult10.employee_id equals fk_external_supervisor2.id
join fk_external_supervisor2 in allemp on isNull<int?>(m_eva_create_evaluation_detail_process.eva_employee_id,fk_eva_create_evaluationResult10.employee_id) equals fk_external_supervisor2.id
into external_supervisor2Result
from fk_external_supervisor2 in external_supervisor2Result.DefaultIfEmpty()
join fk_external_supervisor1A in allemp on fk_eva_create_evaluationResult10.supervisor1_id equals fk_external_supervisor1A.id
join fk_external_supervisor1A in allemp on isNull<int?>(m_eva_create_evaluation_detail_process.supervisor1_id, fk_eva_create_evaluationResult10.supervisor1_id) equals fk_external_supervisor1A.id
into external_supervisor1AResult
from fk_external_supervisor1A in external_supervisor1AResult.DefaultIfEmpty()
join fk_external_supervisor2A in allemp on fk_eva_create_evaluationResult10.supervisor2_id equals fk_external_supervisor2A.id
join fk_external_supervisor2A in allemp on isNull<int?>(m_eva_create_evaluation_detail_process.supervisor2_id, fk_eva_create_evaluationResult10.supervisor2_id) equals fk_external_supervisor2A.id
into external_supervisor2AResult
from fk_external_supervisor2A in external_supervisor2AResult.DefaultIfEmpty()
join fk_external_supervisor3A in allemp on isNull<int?>(m_eva_create_evaluation_detail_process.supervisor3_id, fk_eva_create_evaluationResult10.supervisor3_id) equals fk_external_supervisor3A.id
into external_supervisor3AResult
from fk_external_supervisor3A in external_supervisor3AResult.DefaultIfEmpty()
where m_eva_create_evaluation_detail_process.id == id
@@ -155,6 +164,7 @@ namespace TodoAPI2.Models
employee_id = m_eva_create_evaluation_detail_process.employee_id,
chief_fullname = fk_external_chief.fullname,
chief_position = fk_external_chief.position_name,
supervisor1_remark = m_eva_create_evaluation_detail_process.supervisor1_remark,
create_evaluation_id = m_eva_create_evaluation_detail_process.create_evaluation_id,
org_id = fk_external_employee.department_id,
search_employee_code = fk_external_employee.employee_no,
@@ -166,6 +176,8 @@ namespace TodoAPI2.Models
supervisor1A_position = fk_external_supervisor1A.position_name,
supervisor2A_fullname = fk_external_supervisor2A.fullname,
supervisor2A_position = fk_external_supervisor2A.position_name,
supervisor3A_fullname = fk_external_supervisor3A.fullname,
supervisor3A_position = fk_external_supervisor3A.position_name,
org_id_external_linkage_external_name = fk_external_employee.department_name,
@@ -178,6 +190,7 @@ namespace TodoAPI2.Models
status_supervisor1A = m_eva_create_evaluation_detail_process.status_supervisor1A,
status_supervisor2A = m_eva_create_evaluation_detail_process.status_supervisor2A,
status_supervisor3A = m_eva_create_evaluation_detail_process.status_supervisor3A,
role_code = getRoleCode(emp_id, m_eva_create_evaluation_detail_process.chief,
m_eva_create_evaluation_detail_process.chief,
@@ -185,7 +198,8 @@ namespace TodoAPI2.Models
m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
path,
special_person),
special_person,
m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id),
role_desc = getRoleName(emp_id, m_eva_create_evaluation_detail_process.chief,
m_eva_create_evaluation_detail_process.chief,
@@ -193,7 +207,8 @@ namespace TodoAPI2.Models
m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
path,
special_person),
special_person,
m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id),
remark_hrm_work_record = fk_external_employee.remark_hrm_work_record
+ GetWorkTimeText(fk_external_employee.packing_date, end_date),
@@ -204,6 +219,14 @@ namespace TodoAPI2.Models
status_self_a_click_date = m_eva_create_evaluation_detail_process.status_self_a_click_date,
status_chief_a_click_date = m_eva_create_evaluation_detail_process.status_chief_a_click_date,
status_self_click_date = m_eva_create_evaluation_detail_process.status_self_click_date,
status_chief_click_date = m_eva_create_evaluation_detail_process.status_chief_click_date,
status_supervisor_click_date = m_eva_create_evaluation_detail_process.status_supervisor_click_date,
status_supervisor1A_click_date = m_eva_create_evaluation_detail_process.status_supervisor1A_click_date,
status_supervisor2A_click_date = m_eva_create_evaluation_detail_process.status_supervisor2A_click_date,
status_supervisor3A_click_date = m_eva_create_evaluation_detail_process.status_supervisor3A_click_date,
isActive = m_eva_create_evaluation_detail_process.isActive,
Created = m_eva_create_evaluation_detail_process.created,
Updated = m_eva_create_evaluation_detail_process.updated,
@@ -211,12 +234,14 @@ namespace TodoAPI2.Models
supervisor2_position_type_id = fk_external_supervisor2.position_type_id,
supervisor1A_position_type_id = fk_external_supervisor1A.position_type_id,
supervisor2A_position_type_id = fk_external_supervisor2A.position_type_id,
supervisor3A_position_type_id = fk_external_supervisor3A.position_type_id,
employee_position_type_id = fk_external_employee.position_type_id,
chief_position_type_id = fk_external_chief.position_type_id,
supervisor2_position_level_text = fk_external_supervisor2.position_level_text,
supervisor1A_position_level_text = fk_external_supervisor1A.position_level_text,
supervisor2A_position_level_text = fk_external_supervisor2A.position_level_text,
supervisor3A_position_level_text = fk_external_supervisor3A.position_level_text,
employee_position_level_text = fk_external_employee.position_level_text,
chief_position_level_text = fk_external_chief.position_level_text,
@@ -363,6 +388,13 @@ namespace TodoAPI2.Models
return GetListBySearch(model, emp_id, path);
}
private string GetOnlyDep(string input)
{
var i = input.Split('-');
if (i.Length == 2) return i[1].Trim();
return input;
}
public List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model, int? emp_id, string path)
{
object special_person = (from x in _repository.Context.eva_setup_permission
@@ -423,6 +455,9 @@ namespace TodoAPI2.Models
|| ((m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id).HasValue && emp_id == (m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id))
|| ((m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id).HasValue && emp_id == (m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id))
|| ((int?[])special_person).Contains(emp_id)
|| ((m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id).HasValue && emp_id == (m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id))
)
&& (!model.employee_id.HasValue || m_eva_create_evaluation_detail_process.employee_id == model.employee_id)
@@ -453,7 +488,7 @@ namespace TodoAPI2.Models
search_employee_code = fk_external_employee.employee_no,
search_employee_fullname = fk_external_employee.fullname,
org_id_external_linkage_external_name = !string.IsNullOrEmpty(fk_external_linkageResult11.external_name) ? fk_external_linkageResult11.external_name : fk_external_employee.department_name,
org_id_external_linkage_external_name = !string.IsNullOrEmpty(fk_external_linkageResult11.external_name) ? GetOnlyDep(fk_external_linkageResult11.external_name) : fk_external_employee.department_name,
status_self = m_eva_create_evaluation_detail_process.status_self,
status_chief = m_eva_create_evaluation_detail_process.status_chief,
@@ -461,6 +496,7 @@ namespace TodoAPI2.Models
status_supervisor1A = m_eva_create_evaluation_detail_process.status_supervisor1A,
status_supervisor2A = m_eva_create_evaluation_detail_process.status_supervisor2A,
status_supervisor3A = m_eva_create_evaluation_detail_process.status_supervisor3A,
role_code = getRoleCodeSearch(emp_id, m_eva_create_evaluation_detail_process.chief,
m_eva_create_evaluation_detail_process.chief,
@@ -468,7 +504,8 @@ namespace TodoAPI2.Models
m_eva_create_evaluation_detail_process.supervisor1_id.HasValue? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_process.status_chief,
special_person
special_person,
m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id
),
role_desc = getRoleName(emp_id, m_eva_create_evaluation_detail_process.chief,
@@ -477,13 +514,20 @@ namespace TodoAPI2.Models
m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
path,
special_person),
special_person,
m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id
),
status_self_a_click_date = m_eva_create_evaluation_detail_process.status_self_a_click_date,
status_chief_a_click_date = m_eva_create_evaluation_detail_process.status_chief_a_click_date,
status_self_click_date = m_eva_create_evaluation_detail_process.status_self_click_date,
status_chief_click_date = m_eva_create_evaluation_detail_process.status_chief_click_date,
status_supervisor_click_date = m_eva_create_evaluation_detail_process.status_supervisor_click_date,
status_supervisor1A_click_date = m_eva_create_evaluation_detail_process.status_supervisor1A_click_date,
status_supervisor2A_click_date = m_eva_create_evaluation_detail_process.status_supervisor2A_click_date,
status_supervisor3A_click_date = m_eva_create_evaluation_detail_process.status_supervisor3A_click_date,
plan_round_year = checkNull(fk_planResult.theTime)+"/"+checkNull(fk_planResult.fiscal_year),
@@ -505,7 +549,7 @@ namespace TodoAPI2.Models
return "";
}
private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person)
private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person, int? supervisor3A)
{
if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && path == "d2") return "2";
else if (emp_id == chief) return "1";
@@ -513,11 +557,12 @@ namespace TodoAPI2.Models
else if (emp_id == supervisor2) return "2";
else if (emp_id == supervisor1A) return "3";
else if (emp_id == supervisor2A) return "4";
else if (emp_id == supervisor3A) return "5";
if (((int?[])special_person).Contains(emp_id)) return "99";
return "";
}
private string getRoleCodeSearch(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string status_chief, object special_person)
private string getRoleCodeSearch(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string status_chief, object special_person, int? supervisor3A)
{
if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && status_chief=="Y") return "2";
else if (emp_id == chief) return "1";
@@ -525,11 +570,12 @@ namespace TodoAPI2.Models
else if (emp_id == supervisor2) return "2";
else if (emp_id == supervisor1A) return "3";
else if (emp_id == supervisor2A) return "4";
else if (emp_id == supervisor3A) return "5";
if (((int?[])special_person).Contains(emp_id)) return "99";
return "";
}
private string getRoleName(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person)
private string getRoleName(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person, int? supervisor3A)
{
if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && path == "d2") return "ผู้ประเมินสูงสุด";
else if (emp_id == chief) return "ผู้ประเมิน";
@@ -537,6 +583,7 @@ namespace TodoAPI2.Models
else if (emp_id == supervisor2) return "ผู้ประเมินสูงสุด";
else if (emp_id == supervisor1A) return "ผู้บังคับบัญชาเหนือขึ้นไป";
else if (emp_id == supervisor2A) return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)";
else if (emp_id == supervisor3A) return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (พิเศษ)";
if (((int?[])special_person).Contains(emp_id)) return "ผู้ตรวจสอบ";
return "";
}

View File

@@ -37,6 +37,8 @@ namespace TodoAPI2.Models
public string chief_position { get; set; }
public string supervisor1_remark { get; set; }
public string supervisor2_fullname { get; set; }
public string supervisor2_position { get; set; }
@@ -49,6 +51,10 @@ namespace TodoAPI2.Models
public string supervisor2A_position { get; set; }
public string supervisor3A_fullname { get; set; }
public string supervisor3A_position { get; set; }
public int? create_evaluation_id { get; set; }
public int? org_id { get; set; }
@@ -70,6 +76,8 @@ namespace TodoAPI2.Models
public string status_supervisor2A { get; set; }
public string status_supervisor3A { get; set; }
public string role_desc { get; set; }
public string role_code { get; set; }
@@ -87,11 +95,14 @@ namespace TodoAPI2.Models
public DateTime? status_supervisor1A_click_date { get; set; }
public DateTime? status_supervisor2A_click_date { get; set; }
public DateTime? status_supervisor3A_click_date { get; set; }
public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_click_date) + getHistoryLink(status_self); } }
public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_click_date) + getHistoryLink(status_chief); } }
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor_click_date) + getHistoryLink(status_supervisor); } }
public string txt_status_supervisor1A { get { return getStatusText(status_supervisor1A) + MyHelper.GetDateStringForReport(status_supervisor1A_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor1A_click_date) + getHistoryLink(status_supervisor1A); } }
public string txt_status_supervisor2A { get { return getStatusText(status_supervisor2A) + MyHelper.GetDateStringForReport(status_supervisor2A_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor2A_click_date) + getHistoryLink(status_supervisor2A); } }
public string txt_status_supervisor3A { get { return getStatusText(status_supervisor3A) + MyHelper.GetDateStringForReport(status_supervisor3A_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor3A_click_date) + getHistoryLink(status_supervisor3A); } }
private string getHistoryLink(string s)
{

View File

@@ -29,12 +29,14 @@ namespace TodoAPI2.Models
public int? supervisor2_position_type_id { get; set; }
public int? supervisor1A_position_type_id { get; set; }
public int? supervisor2A_position_type_id { get; set; }
public int? supervisor3A_position_type_id { get; set; }
public int? employee_position_type_id { get; set; }
public int? chief_position_type_id { get; set; }
public string supervisor2_position_level_text { get; set; }
public string supervisor1A_position_level_text { get; set; }
public string supervisor2A_position_level_text { get; set; }
public string supervisor3A_position_level_text { get; set; }
public string employee_position_level_text { get; set; }
public string chief_position_level_text { get; set; }

View File

@@ -20,14 +20,14 @@ namespace TodoAPI2.Models
public class eva_create_evaluation_detail_review04Service : Ieva_create_evaluation_detail_review04Service
{
private IBaseRepository2<eva_create_evaluation_detailEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private IMyDatabase db;
private Iexternal_linkageService ext;
public eva_create_evaluation_detail_review04Service(IBaseRepository2<eva_create_evaluation_detailEntity, int> repository, IMyDatabase mydb, Iexternal_linkageService inext)
{
_repository = repository;
db = mydb;
ext = inext;
db = mydb;
ext = inext;
}
#region Private Functions
@@ -47,7 +47,7 @@ namespace TodoAPI2.Models
{
return Mapper.Map<List<eva_create_evaluation_detail_review04ViewModel>>(entities);
}
#endregion
#region Public Functions
@@ -79,12 +79,12 @@ namespace TodoAPI2.Models
public List<eva_create_evaluation_detail_review04ViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id)
{
var model = new eva_create_evaluation_detail_review04SearchModel();
var model = new eva_create_evaluation_detail_review04SearchModel();
model.create_evaluation_id = create_evaluation_id;
return GetListBySearch(model);
}
public List<eva_create_evaluation_detail_review04ViewModel> GetListBySearch(eva_create_evaluation_detail_review04SearchModel model)
public List<eva_create_evaluation_detail_review04ViewModel> GetListBySearch(eva_create_evaluation_detail_review04SearchModel model)
{
var data = (
from m_eva_create_evaluation_detail_review04 in _repository.Context.eva_create_evaluation_detail
@@ -94,7 +94,7 @@ namespace TodoAPI2.Models
from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty()
where 1==1
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)
@@ -129,10 +129,10 @@ namespace TodoAPI2.Models
int? newkey = 0;
var x = (from i in _repository.Context.eva_create_evaluation_detail
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;
}
@@ -148,7 +148,7 @@ namespace TodoAPI2.Models
var inserted = _repository.Insert(entity);
return Get(inserted.id);
}
@@ -168,23 +168,23 @@ namespace TodoAPI2.Models
return Get(updated.id);
}
else
throw new NotificationException("No data to update");
throw new NotificationException("No data to update");
}
public string UpdateMultiple(List<eva_create_evaluation_detail_review04InputModel> model)
public string UpdateMultiple(List<eva_create_evaluation_detail_review04InputModel> 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_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;
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);
@@ -197,15 +197,15 @@ namespace TodoAPI2.Models
_repository.InsertWithoutCommit(entity);
}
else if (i.active_mode == "0" && i.id.HasValue) // remove
{
{
_repository.DeleteWithoutCommit(i.id.Value);
}
else if (i.active_mode == "0" && !i.id.HasValue)
{
// nothing to do
}
}
}
_repository.Context.SaveChanges();
_repository.Context.SaveChanges();
return model.Count().ToString();
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
namespace TodoAPI2.Models
{
public interface Ieva_create_evaluation_detail_review05Service : IBaseService2<int, eva_create_evaluation_detail_review05InputModel, eva_create_evaluation_detail_review05ViewModel>
{
new eva_create_evaluation_detail_review05ViewModel Insert(eva_create_evaluation_detail_review05InputModel model, bool is_force_save);
new eva_create_evaluation_detail_review05ViewModel Update(int id, eva_create_evaluation_detail_review05InputModel model, bool is_force_save);
List<eva_create_evaluation_detail_review05ViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id);
List<eva_create_evaluation_detail_review05ViewModel> GetListBySearch(eva_create_evaluation_detail_review05SearchModel model);
string UpdateMultiple(List<eva_create_evaluation_detail_review05InputModel> model, bool is_force_save);
eva_create_evaluation_detail_review05WithSelectionViewModel GetWithSelection(int id);
eva_create_evaluation_detail_review05WithSelectionViewModel GetBlankItem();
void RefreshAutoFieldOfAllData();
eva_create_evaluation_detailEntity GetEntity(int id);
DataContext GetContext();
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_create_evaluation_detail_review05InputModel
{
public int? id { get; set; }
public int? create_evaluation_id { get; set; }
public int? supervisor3A { get; set; }
public string supervisor3A_result { get; set; }
public string supervisor3A_remark { get; set; }
public DateTime? supervisor3A_date { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_create_evaluation_detail_review05ReportRequestModel : eva_create_evaluation_detail_review05SearchModel
{
public string filetype { get; set; }
public string contentType { get { return MyHelper.GetContentType(filetype); } }
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_create_evaluation_detail_review05SearchModel
{
public int id { get; set; }
public int? create_evaluation_id { get; set; }
}
}

View File

@@ -0,0 +1,307 @@
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_review05Service : Ieva_create_evaluation_detail_review05Service
{
private IBaseRepository2<eva_create_evaluation_detailEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
public eva_create_evaluation_detail_review05Service(IBaseRepository2<eva_create_evaluation_detailEntity, int> 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_review05InputModel model)
{
return Mapper.Map<eva_create_evaluation_detailEntity>(model);
}
private List<eva_create_evaluation_detailEntity> GetEntityList(List<eva_create_evaluation_detail_review05InputModel> models)
{
return Mapper.Map<List<eva_create_evaluation_detailEntity>>(models);
}
private eva_create_evaluation_detail_review05ViewModel GetDto(eva_create_evaluation_detailEntity entity)
{
return Mapper.Map<eva_create_evaluation_detail_review05ViewModel>(entity);
}
private List<eva_create_evaluation_detail_review05ViewModel> GetDtoList(List<eva_create_evaluation_detailEntity> entities)
{
return Mapper.Map<List<eva_create_evaluation_detail_review05ViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public eva_create_evaluation_detail_review05ViewModel Get(int id)
{
var entity = _repository.Get(id);
return GetDto(entity);
}
public eva_create_evaluation_detailEntity GetEntity(int id)
{
var entity = _repository.Get(id);
return entity;
}
public DataContext GetContext()
{
return _repository.Context;
}
public eva_create_evaluation_detail_review05WithSelectionViewModel GetWithSelection(int id)
{
var entity = _repository.Get(id);
var i = Mapper.Map<eva_create_evaluation_detail_review05WithSelectionViewModel>(entity);
i.item_supervisor3A_result = (from x in ext.GetAgreeDisagree() select x).ToList();
return i;
}
public eva_create_evaluation_detail_review05WithSelectionViewModel GetBlankItem()
{
var i = new eva_create_evaluation_detail_review05WithSelectionViewModel();
i.item_supervisor3A_result = (from x in ext.GetAgreeDisagree() select x).ToList();
return i;
}
public List<eva_create_evaluation_detail_review05ViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id)
{
var model = new eva_create_evaluation_detail_review05SearchModel();
model.create_evaluation_id = create_evaluation_id;
return GetListBySearch(model);
}
public List<eva_create_evaluation_detail_review05ViewModel> GetListBySearch(eva_create_evaluation_detail_review05SearchModel model)
{
var data = (
from m_eva_create_evaluation_detail_review05 in _repository.Context.eva_create_evaluation_detail
join fk_external_linkage3 in ext.GetAgreeDisagree() on m_eva_create_evaluation_detail_review05.supervisor3A_result equals fk_external_linkage3.external_code
into external_linkageResult3
from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty()
where
1 == 1
&& (!model.create_evaluation_id.HasValue || m_eva_create_evaluation_detail_review05.create_evaluation_id == model.create_evaluation_id)
orderby m_eva_create_evaluation_detail_review05.created descending
select new eva_create_evaluation_detail_review05ViewModel()
{
id = m_eva_create_evaluation_detail_review05.id,
create_evaluation_id = m_eva_create_evaluation_detail_review05.create_evaluation_id,
supervisor3A = m_eva_create_evaluation_detail_review05.supervisor3A,
supervisor3A_result = m_eva_create_evaluation_detail_review05.supervisor3A_result,
supervisor3A_remark = m_eva_create_evaluation_detail_review05.supervisor3A_remark,
supervisor3A_date = m_eva_create_evaluation_detail_review05.supervisor3A_date,
supervisor3A_result_external_linkage_external_name = fk_external_linkageResult3.external_name,
isActive = m_eva_create_evaluation_detail_review05.isActive,
Created = m_eva_create_evaluation_detail_review05.created,
Updated = m_eva_create_evaluation_detail_review05.updated
}
).Take(1000).ToList();
return data;
}
#endregion
#region Manipulation Functions
public int GetNewPrimaryKey()
{
int? newkey = 0;
var x = (from i in _repository.Context.eva_create_evaluation_detail
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_review05ViewModel Insert(eva_create_evaluation_detail_review05InputModel model, bool is_force_save)
{
var entity = GetEntity(model);
entity.id = GetNewPrimaryKey();
//entity.SetAutoField(_repository.Context);
if (is_force_save)
{
var inserted = _repository.Insert(entity);
//entity.DoAfterInsertUpdate(_repository.Context);
return Get(inserted.id);
}
else
{
_repository.InsertWithoutCommit(entity);
//entity.DoAfterInsertUpdate(_repository.Context);
return Mapper.Map<eva_create_evaluation_detail_review05ViewModel>(entity);
}
}
public eva_create_evaluation_detail_review05ViewModel Update(int id, eva_create_evaluation_detail_review05InputModel model, bool is_force_save)
{
var existingEntity = _repository.Get(id);
if (existingEntity != null)
{
existingEntity.create_evaluation_id = model.create_evaluation_id;
existingEntity.supervisor3A = model.supervisor3A;
existingEntity.supervisor3A_result = model.supervisor3A_result;
existingEntity.supervisor3A_remark = model.supervisor3A_remark;
existingEntity.supervisor3A_date = model.supervisor3A_date;
//existingEntity.SetAutoField(_repository.Context);
if (is_force_save)
{
var updated = _repository.Update(id, existingEntity);
//existingEntity.DoAfterInsertUpdate(_repository.Context);
return Get(updated.id);
}
else
{
_repository.UpdateWithoutCommit(id, existingEntity);
//existingEntity.DoAfterInsertUpdate(_repository.Context);
return Mapper.Map<eva_create_evaluation_detail_review05ViewModel>(existingEntity);
}
}
else
throw new NotificationException("No data to update");
}
public string UpdateMultiple(List<eva_create_evaluation_detail_review05InputModel> model, bool is_force_save)
{
foreach (var i in model)
{
if (i.active_mode == "1" && i.id.HasValue) // update
{
var existingEntity = _repository.Get(i.id.Value);
if (existingEntity != null)
{
existingEntity.create_evaluation_id = i.create_evaluation_id;
existingEntity.supervisor3A = i.supervisor3A;
existingEntity.supervisor3A_result = i.supervisor3A_result;
existingEntity.supervisor3A_remark = i.supervisor3A_remark;
existingEntity.supervisor3A_date = i.supervisor3A_date;
//existingEntity.SetAutoField(_repository.Context);
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}
}
else if (i.active_mode == "1" && !i.id.HasValue) // add
{
var entity = GetEntity(i);
entity.id = GetNewPrimaryKey();
//entity.SetAutoField(_repository.Context);
_repository.InsertWithoutCommit(entity);
}
else if (i.active_mode == "0" && i.id.HasValue) // remove
{
_repository.DeleteWithoutCommit(i.id.Value);
}
else if (i.active_mode == "0" && !i.id.HasValue)
{
// nothing to do
}
}
if (is_force_save)
{
_repository.Context.SaveChanges();
}
return model.Count().ToString();
}
public eva_create_evaluation_detail_review05ViewModel SetAsActive(int id)
{
var updated = _repository.SetAsActive(id);
return Get(updated.id);
}
public eva_create_evaluation_detail_review05ViewModel SetAsInactive(int id)
{
var updated = _repository.SetAsInActive(id);
return Get(updated.id);
}
public void Delete(int id)
{
_repository.Delete(id);
return;
}
public void RefreshAutoFieldOfAllData()
{
//var all_items = from i in _repository.Context.eva_create_evaluation_detail
// select i;
//foreach (var item in all_items)
//{
// item.SetAutoField(_repository.Context);
//}
//_repository.Context.SaveChanges();
}
private Dictionary<string, string> GetLookupForLog()
{
var i = new Dictionary<string, string>();
i.Add("create_evaluation_id", "แบบประเมิน");
i.Add("supervisor3A", "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)");
i.Add("supervisor3A_result", "ผลการประเมิน");
i.Add("supervisor3A_result_external_linkage_external_name", "ผลการประเมิน");
i.Add("supervisor3A_remark", "ความเห็นผู้ประเมินสูงสุด");
i.Add("supervisor3A_date", "วันที่ประเมิน");
i.Add("txt_supervisor3A_date", "วันที่ประเมิน");
return i;
}
#endregion
#region Match Item
#endregion
#endregion
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_create_evaluation_detail_review05ViewModel : BaseViewModel2<int>
{
public int? create_evaluation_id { get; set; }
public int? supervisor3A { get; set; }
public string supervisor3A_result { get; set; }
public string supervisor3A_remark { get; set; }
public DateTime? supervisor3A_date { get; set; }
public string txt_supervisor3A_date { get { return MyHelper.GetDateStringForReport(this.supervisor3A_date); } }
public string supervisor3A_result_external_linkage_external_name { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TodoAPI2.Models
{
public class eva_create_evaluation_detail_review05WithSelectionViewModel: eva_create_evaluation_detail_review05ViewModel
{
public List<external_linkageViewModel> item_supervisor3A_result { get; set; }
}
}

View File

@@ -187,10 +187,10 @@ namespace TodoAPI2.Models
where k.id == model.id
select k).FirstOrDefault();
if (current_detail.status_chief_a == "Y")
{
throw new Exception("ผู้ประเมิน อนุมัติข้อตกลงไปแล้ว บันทึกไม่ได้");
}
//if (current_detail.status_chief_a == "Y")
//{
// throw new Exception("ผู้ประเมิน อนุมัติข้อตกลงไปแล้ว บันทึกไม่ได้");
//}
existingEntity.create_evaluation_id = model.create_evaluation_id;
existingEntity.chief_a = model.chief_a;

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