61 Commits

Author SHA1 Message Date
nakorn
77c8e31dcd สร้างตัวเตือน เกณฑ์คะแนน 2021-10-19 22:37:31 +07:00
Nakorn Rientrakrunchai
ee76b39491 Add migration 2021-10-19 20:58:45 +07:00
nakorn
3b8d643eca Add level score detail 2021-10-19 20:41:43 +07:00
nakorn
8a02127499 ปรับปรุงการมองเห็นของ หัวหน้าแผนก 2021-10-18 16:42:58 +07:00
nakorn
3db2768ed5 ปรับปรุง 2021-10-17 10:51:13 +07:00
nakorn
887c4d05dc Add flow agreement 2021-10-16 23:14:06 +07:00
nakorn
df7d36b06b ปรับปรุง คนที่ได้สิทธิพิเศษ ให้ดูรายชื่อได้ทั้งเนติ 2021-10-16 21:51:16 +07:00
nakorn
ac0e022966 เอาเข้าระบบ โควตา เฉพาะคนที่ทำงาน 2021-10-13 21:33:52 +07:00
nakorn
686f22eddb เอากรรมการออก 2021-10-13 21:12:36 +07:00
nakorn
32db80e4aa ปรับปรุง ให้แสดงคนที่ลาออก 2021-10-13 20:01:19 +07:00
nakorn
07d70e4a66 แก้ไข https://app.clickup.com/t/1nav665 2021-10-13 15:49:07 +07:00
nakorn
40de9ca053 ซ่อน reward 2021-10-11 12:36:12 +07:00
nakorn
be227895a5 ปรับปรุง https://app.clickup.com/t/1me7cdm 2021-10-05 22:26:47 +07:00
nakorn
e5cb49c75e Hide back button 2021-09-30 18:04:25 +07:00
nakorn
d6d125cea0 แสดงคะแนน 1-5 ให้กรอก 2021-09-30 17:47:38 +07:00
nakorn
64f6c4b1af แก้บัก ไฟล์หาย 2021-09-29 17:05:12 +07:00
nakorn
c520fb9a99 ปรับเป็น dropdown 2021-09-29 16:47:07 +07:00
nakorn
a71c8bb11e ปรับปรุงการแาดงผลเวลา 2021-09-27 15:37:05 +07:00
nakorn
fe365008c2 เสร็จรายงานใหม่ 2021-09-27 13:47:59 +07:00
LAPTOP-KB8JC2K2\acer
0aac403a33 ปรับปรุง report 2021-09-26 17:36:59 +07:00
LAPTOP-KB8JC2K2\acer
14c7df9d17 Add new report 2021-09-23 16:49:08 +07:00
LAPTOP-KB8JC2K2\acer
dacfe151cf ปรับปรุงตามที่ได้รับแจ้ง 2021-09-16 11:52:23 +07:00
LAPTOP-KB8JC2K2\acer
3016221910 ปรับปรุงตามได้รับแจ้ง 2021-09-14 18:25:36 +07:00
LAPTOP-KB8JC2K2\acer
e201075167 แก้ไขเพิ่มเติม 2021-09-14 17:30:37 +07:00
LAPTOP-KB8JC2K2\acer
7fdf9f7b01 ปรับปรุงหลายข้อ 2021-09-14 15:52:06 +07:00
LAPTOP-KB8JC2K2\acer
d4212da199 แก้ปัญหา clear cache 2021-09-14 10:40:24 +07:00
LAPTOP-KB8JC2K2\acer
646bf3e249 เพิ่มตัวเลือก ทั้งหมด 2021-09-13 16:52:16 +07:00
LAPTOP-KB8JC2K2\acer
656d991f07 ปรับปรุงหน้าจอ ประวัติการแก้ไข 2021-09-11 15:00:56 +07:00
LAPTOP-KB8JC2K2\acer
fdb09a2427 ปรับปรุงการค้นหา ต่อจากเดิม 2021-09-11 14:19:35 +07:00
LAPTOP-KB8JC2K2\acer
98dd8b0860 ปรับปรุงการค้นหา 2021-09-11 12:28:00 +07:00
LAPTOP-KB8JC2K2\acer
edc9bf053e เพิ่มฟิล remark2 2021-09-10 15:13:26 +07:00
LAPTOP-KB8JC2K2\acer
a898de8ab2 - ประเมิน : เรียงลำดับ
- ประเมิน : บันทึกแล้วเลขซ้ำ
2021-09-07 13:36:29 +07:00
LAPTOP-KB8JC2K2\acer
ccacb814a3 ปรับปรุงสูตรและซ่อนปุ่ม 2021-09-02 18:50:32 +07:00
LAPTOP-KB8JC2K2\acer
c86841c480 Fix bug 2021-09-02 18:22:31 +07:00
LAPTOP-KB8JC2K2\acer
65d454ca74 แก้สี ปุ่มตีกลับ 2021-09-02 12:56:27 +07:00
LAPTOP-KB8JC2K2\acer
23c3142058 เพิ่มข้อความ การแนบไฟล์ 2021-09-02 12:08:36 +07:00
LAPTOP-KB8JC2K2\acer
ef178b8120 แก้เอาข้อความออก 2021-09-01 16:36:20 +07:00
LAPTOP-KB8JC2K2\acer
095d8b1a60 แก้ไข https://app.clickup.com/t/cqx9eg 2021-09-01 16:32:23 +07:00
LAPTOP-KB8JC2K2\acer
f1dad78f66 เปิดให้ผู้ประเมินสูงสุด ตีกลับ 2021-08-31 15:53:48 +07:00
LAPTOP-KB8JC2K2\acer
91b4e67522 ทดลองแก้ไข กรณีกดแล้ว ไม่ส่งข้อมูล 2021-08-30 11:38:47 +07:00
LAPTOP-KB8JC2K2\acer
e64f675036 แก้บัก วงเงินที่ใช้ในการเลื่อนเงินเดือน - กรณีที่มีหมายเหตุมากกว่า 1 ข้อ run เลขข้อซ้ำค่ะ และกรณีที่มีหมายเหตุมากกว่า 1 ข้อ run เลขข้อซ้ำ 2021-08-30 10:16:00 +07:00
LAPTOP-KB8JC2K2\acer
d0d9b50238 ปรับปรุง วันลาใน UI 2021-08-27 16:18:19 +07:00
LAPTOP-KB8JC2K2\acer
440454b7dd แก้ด่วน การเรียงลำดับ 2021-08-27 16:05:38 +07:00
LAPTOP-KB8JC2K2\acer
b44c25e2d7 แก้บักด่วน 2021-08-27 16:00:43 +07:00
LAPTOP-KB8JC2K2\acer
e91666e9db ปรับปรุงวันที่่ลาใน report 2021-08-27 13:58:44 +07:00
LAPTOP-KB8JC2K2\acer
8735c12bd7 เพิ่มช่อง วันที่เริ่มลา / สิ้นสุด ลา 2021-08-27 10:20:02 +07:00
LAPTOP-KB8JC2K2\acer
910ef472ec ปรับปรุง เพิ่มเติม 2021-08-26 14:55:35 +07:00
LAPTOP-KB8JC2K2\acer
a108bbbc4a ปรับแก้ตาม https://app.clickup.com/t/e5gb58 2021-08-26 14:43:05 +07:00
LAPTOP-KB8JC2K2\acer
1c01a326b2 https://app.clickup.com/t/cqr5xv เมนูบัญชีเงินเดือนขั้นต่ำขั้นสูงของพนักงานเนติบัณฑิตยสภา - เพิ่มฟิลล์ในการเก็บกรอบเงินเดือนสูงสุด(1 ขั้น)ของกรอบเงินเดือน 2021-08-24 10:41:39 +07:00
LAPTOP-KB8JC2K2\acer
a5664503f0 แก้ไข https://app.clickup.com/t/7hzjan และ https://app.clickup.com/t/71uwkz 2021-08-23 17:34:55 +07:00
Pairat Sangprasert
5747602eb5 Merge branch 'feature/20210719_enhancement_01' into develop 2021-07-19 17:00:41 +07:00
LAPTOP-KB8JC2K2\acer
38a2e1fe88 ปรับปรุงหลายข้อ 2021-07-19 16:47:05 +07:00
LAPTOP-KB8JC2K2\acer
dce57d2ca1 ปรับปรุงให้แสดงผลรวม ของจำนวนพนักงาน และปรับ layout 2021-07-19 14:54:44 +07:00
LAPTOP-KB8JC2K2\acer
99389df14d แก้ไขปัญหา จอยข้อมูลไม่เจอ 2021-07-19 14:19:10 +07:00
Pairat Sangprasert
93ce18f352 Merge branch 'feature/pond_20210714_001_savemessage_report' into develop 2021-07-16 16:33:45 +07:00
Pairat Sangprasert
3de7c45968 เพิ่ม decimal_limit_quota ใน model สำหรับ report บันทีกข้อความ ใช้ค่าจาก limit_quota 2021-07-16 16:20:53 +07:00
LAPTOP-KB8JC2K2\acer
18303d092f ปรับปรุง คิวรี่ เพื่อให้เจอ plan 2021-07-16 11:50:25 +07:00
Pairat Sangprasert
622fb46323 ทำ set parameter จาก font-end และ back-end ให้ jasper กำลังทำต่อ ในส่วนของรายชื่อ ทำวัน พฤหัสบดี ที่ 15/07/2564 เวลา 20.00 - 23.00 น. 2021-07-15 23:04:53 +07:00
LAPTOP-KB8JC2K2\acer
6f06b1e544 เตรียม code เพื่อสอน การดึงข้อมูลผ่าน C# และส่งไปให้ report 2021-07-15 14:31:49 +07:00
Pairat Sangprasert
9aa338ff18 ทำหน้า font ให้แสดง report jasper และ เขียน api controller ให้แสดง report และ ทำ class model รับ parameter จาก font 2021-07-14 18:54:07 +07:00
Pairat Sangprasert
c7745f6ab4 Merge tag 'pond_20210713_001' into develop 2021-07-14 12:27:27 +07:00
201 changed files with 17638 additions and 431 deletions

View File

@@ -15,6 +15,7 @@ using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Net;
namespace TodoAPI2.Controllers
{
@@ -315,6 +316,47 @@ namespace TodoAPI2.Controllers
return BadRequest(ModelState);
}
/// <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("rep_eva_savemessage")]
[ProducesResponseType(typeof(FileStreamResult), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult rep_eva_savemessage(rep_eva_savemessageReportRequestModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
//var httpclient = MyHelper.getHttpClient(Configuration);
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");
_repository.setModelFor_rep_eva_savemessageReport(model);
string url = $"{mainurl}{reportsite}/rep_eva_savemessage.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
var data = httpclient.DownloadData(url);
var stream = new MemoryStream(data);
return File(stream, model.contentType);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while GetReport.", ex);
return StatusCode(500, $"Exception while GetReport. {ex.Message}");
}
}
}
}

View File

@@ -109,7 +109,9 @@ namespace TodoAPI2.Controllers
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetBlankItem();
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
var result = _repository.GetBlankItemWithEmp(e.id);
return Ok(result);
}

View File

@@ -108,7 +108,10 @@ namespace TodoAPI2.Controllers
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetBlankItem();
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
var result = _repository.GetBlankItemWithEmp(e.id);
return Ok(result);
}

View File

@@ -0,0 +1,403 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using TTSW.Controllers;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Net;
namespace TodoAPI2.Controllers
{
//[Authorize]
[Produces("application/json")]
[Route("api/eva_level_score_detail")]
public class eva_level_score_detailController : BaseController
{
#region Private Variables
private ILogger<eva_level_score_detailController> _logger;
private Ieva_level_score_detailService _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_level_score_detailController(ILogger<eva_level_score_detailController> logger, Ieva_level_score_detailService 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_level_score_detailWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Get(Guid id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetWithSelection(id);
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult Get.", ex);
return StatusCode(500, $"{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_level_score_detailWithSelectionViewModel), 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 level_score_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_level_score_detailViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetList(Guid level_score_id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListBylevel_score_id(level_score_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_level_score_detailViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetListBySearch(eva_level_score_detailSearchModel 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_level_score_detail_report")]
[ProducesResponseType(typeof(FileStreamResult), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult eva_level_score_detail_report(eva_level_score_detailReportRequestModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
string url = $"{mainurl}{reportsite}/xxใส่ชื่อรายงานตรงนี้xx.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
if (model.filetype == "xlsx")
{
url += "&ignorePagination=true";
}
var data = httpclient.DownloadData(url);
var stream = new MemoryStream(data);
return File(stream, model.contentType);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while GetReport.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Create new item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPost("")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Insert([FromBody] eva_level_score_detailInputModel 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(Guid id, [FromBody] eva_level_score_detailInputModel 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(Guid id)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.Delete(id);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ลบข้อมูล เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while delete {id.ToString()}.", ex);
return StatusCode(500, $"{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_level_score_detailInputModel> model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
string rowCount = _repository.UpdateMultiple(model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = "ปรับปรุงข้อมูลเรียบร้อย จำนวน "+rowCount+" รายการ";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while UpdateMultiple.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Refresh AutoField of all items
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("RefreshAutoField")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult RefreshAutoField()
{
if (ModelState.IsValid)
{
try
{
//if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.RefreshAutoFieldOfAllData();
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ปรับปรุง Auto Field ของทุก record เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while RefreshAutoField.", ex);
return StatusCode(500, $"มีปัญหาระหว่างการปรับปรุง Auto Field. {ex.Message}");
}
}
return BadRequest(ModelState);
}
}
}

View File

@@ -0,0 +1,403 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using TTSW.Controllers;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Net;
namespace TodoAPI2.Controllers
{
//[Authorize]
[Produces("application/json")]
[Route("api/eva_setup_permission")]
public class eva_setup_permissionController : BaseController
{
#region Private Variables
private ILogger<eva_setup_permissionController> _logger;
private Ieva_setup_permissionService _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_setup_permissionController(ILogger<eva_setup_permissionController> logger, Ieva_setup_permissionService 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_setup_permissionWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Get(Guid id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.GetWithSelection(id);
return Ok(result);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult Get.", ex);
return StatusCode(500, $"{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_setup_permissionWithSelectionViewModel), 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 remark
/// </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_setup_permissionViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetList(string remark)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListByremark(remark));
}
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_setup_permissionViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetListBySearch(eva_setup_permissionSearchModel 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_setup_permission_report")]
[ProducesResponseType(typeof(FileStreamResult), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult eva_setup_permission_report(eva_setup_permissionReportRequestModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
string url = $"{mainurl}{reportsite}/xxใส่ชื่อรายงานตรงนี้xx.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
if (model.filetype == "xlsx")
{
url += "&ignorePagination=true";
}
var data = httpclient.DownloadData(url);
var stream = new MemoryStream(data);
return File(stream, model.contentType);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while GetReport.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Create new item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPost("")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Insert([FromBody] eva_setup_permissionInputModel 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(Guid id, [FromBody] eva_setup_permissionInputModel 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(Guid id)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.Delete(id);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ลบข้อมูล เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while delete {id.ToString()}.", ex);
return StatusCode(500, $"{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_setup_permissionInputModel> 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

@@ -101,6 +101,9 @@ namespace TodoAPI2.Controllers
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
_repository.SetEvaDate(model);
string url = $"{mainurl}{reportsite}/rep_eva02.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
var data = httpclient.DownloadData(url);

View File

@@ -275,6 +275,11 @@ namespace TodoAPI2.Controllers
{
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)
{
url = $"{mainurl}{reportsite}/rep_eva_x{k}A.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
}
var data = httpclient.DownloadData(url);
PdfReader reader = new PdfReader(data);
@@ -296,6 +301,18 @@ namespace TodoAPI2.Controllers
return data2;
}
private string checkLevel(int? position_type_id, string position_level_text, string name)
{
if (position_type_id.HasValue)
{
if(position_type_id == 3 || position_type_id == 4 || position_type_id == 5)
{
return " " + position_level_text;
}
}
return "";
}
private rep_eva_xInputModel2 GetParameter(int detail_id)
{
var i = new rep_eva_xInputModel2();
@@ -312,6 +329,8 @@ namespace TodoAPI2.Controllers
if (i.employee_org != null) i.employee_org = i.employee_org.Replace("แผนก", "");
i.employee_position = p.employee_position;
i.employee_position_full = p.employee_position + checkLevel(p.employee_position_type_id, p.employee_position_level_text, p.employee_fullname);
if (!string.IsNullOrEmpty(p.employee_profile_picture))
{
i.image_url = MyHelper.GetConfig(Configuration, "SiteInformation:hr_svc") + "/api/image/" + p.employee_profile_picture;
@@ -330,19 +349,21 @@ namespace TodoAPI2.Controllers
}
i.chief_fullname = p.chief_fullname;
i.chief_position = p.chief_position;
i.chief_position = p.chief_position + checkLevel(p.chief_position_type_id, p.chief_position_level_text, p.chief_fullname);
i.supervisor2_fullname = p.supervisor2_fullname;
i.supervisor2_position = p.supervisor2_position;
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;
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;
i.supervisor2A_position = p.supervisor2A_position + checkLevel(p.supervisor2A_position_type_id, p.supervisor2A_position_level_text, p.supervisor2A_fullname);
i.main_dept = p.employee_main_dept;
if (i.main_dept != null) i.main_dept = i.main_dept.Replace("กอง","");
i.leave_period = MyHelper.GetDateStringForReport(p.start_date) + " ถึง " + MyHelper.GetDateStringForReport(p.end_date);
i.leave_period = MyHelper.GetDateStringForReport(p.leave_start_date) + " ถึง " + MyHelper.GetDateStringForReport(p.leave_end_date);
i.selected_round = p.selected_round;
i.plan_remark = p.plan_remark;
i.eva_detail_remark = p.eva_detail_remark;
var context = _process.GetDataContext();
var all_eva = (from x in context.eva_performance_plan
@@ -388,9 +409,9 @@ namespace TodoAPI2.Controllers
i.w1 = p.create_evaluation_score1;
i.w2 = p.create_evaluation_score2;
if(p.start_date.HasValue && p.end_date.HasValue)
if(p.leave_start_date.HasValue && p.leave_end_date.HasValue)
{
var q = emp.GetLeaveOfEmployee(p.employee_id.Value, p.start_date, p.end_date);
var q = emp.GetLeaveOfEmployee(p.employee_id.Value, p.leave_start_date, p.leave_end_date);
i.sum_day_sick_leave = q.sum_day_sick_leave;
i.count_sick_leave = q.count_sick_leave;
i.sum_day_personal_leave = q.sum_day_personal_leave;
@@ -408,6 +429,8 @@ 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.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now);
return i;
}

View File

@@ -0,0 +1,125 @@
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/rep_summary_a01")]
public class rep_summary_a01Controller : BaseController
{
#region Private Variables
private ILogger<rep_summary_a01Controller> _logger;
private Irep_summary_a01Service _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 rep_summary_a01Controller(ILogger<rep_summary_a01Controller> logger, Irep_summary_a01Service repository, IConfiguration configuration)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
}
/// <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(rep_summary_a01WithSelectionViewModel), 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>
/// 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("rep_summary_a01_report")]
[ProducesResponseType(typeof(FileStreamResult), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult rep_summary_a01_report(rep_summary_a01ReportRequestModel 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");
model.round_text = _repository.GetDisplayText(model.round_id);
string url = $"{mainurl}{reportsite}/rep_summary_a01.{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}");
}
}
}
}

View File

@@ -43,11 +43,10 @@ namespace TTSW.EF {
public DbSet<eva_limit_frame_planEntity> eva_limit_frame_plan { get; set; }
public DbSet<eva_idp_planEntity> eva_idp_plan { get; set; }
public DbSet<eva_create_evaluation_detail_historyEntity> eva_create_evaluation_detail_history { get; set; }
public DbSet<eva_evaluation_achievement_attachEntity> eva_evaluation_achievement_attach { get; set; }
public DbSet<activity_log_evaEntity> activity_log_eva { get; set; }
public DbSet<eva_setup_permissionEntity> eva_setup_permission { get; set; }
public DbSet<eva_level_score_detailEntity> eva_level_score_detail { get; set; }
protected override void OnModelCreating (ModelBuilder modelBuilder) {
base.OnModelCreating (modelBuilder);

Binary file not shown.

Binary file not shown.

Binary file not shown.

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,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class UpdateCylindar : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<decimal>(
name: "salary_max",
table: "eva_salary_cylinder",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "salary_max",
table: "eva_salary_cylinder");
}
}
}

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class AddRemark2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "remark2",
table: "eva_limit_frame_group",
maxLength: 4000,
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "remark2",
table: "eva_limit_frame_group");
}
}
}

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 AddHistoryField : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "history_group",
table: "eva_create_evaluation_detail_history",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "history_group",
table: "eva_create_evaluation_detail_history");
}
}
}

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class UpdateRemarkToEvaDetail : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "remark",
table: "eva_create_evaluation_detail",
maxLength: 1000,
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "remark",
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 AddRewardSalary : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<decimal>(
name: "reward_new",
table: "eva_adjust_postponement_detail",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "reward_old",
table: "eva_adjust_postponement_detail",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "reward_new",
table: "eva_adjust_postponement_detail");
migrationBuilder.DropColumn(
name: "reward_old",
table: "eva_adjust_postponement_detail");
}
}
}

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 AddRewardSalary2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<decimal>(
name: "reward_new2",
table: "eva_adjust_postponement_detail",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "reward_new2",
table: "eva_adjust_postponement_detail");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,33 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class AddEvaPermission : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "eva_setup_permission",
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),
employee_id = table.Column<int>(nullable: true),
remark = table.Column<string>(maxLength: 4000, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_eva_setup_permission", x => x.id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "eva_setup_permission");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,33 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class AddFlowAgreement : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "status_supervisor_a",
table: "eva_create_evaluation_detail",
maxLength: 1,
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "status_supervisor_a_click_date",
table: "eva_create_evaluation_detail",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "status_supervisor_a",
table: "eva_create_evaluation_detail");
migrationBuilder.DropColumn(
name: "status_supervisor_a_click_date",
table: "eva_create_evaluation_detail");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class AddLevelScore : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "eva_level_score_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),
level_score_id = table.Column<Guid>(nullable: false),
min_value = table.Column<decimal>(nullable: true),
max_value = table.Column<decimal>(nullable: true),
min_percentage = table.Column<decimal>(nullable: true),
max_percentage = table.Column<decimal>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_eva_level_score_detail", x => x.id);
table.ForeignKey(
name: "FK_eva_level_score_detail_eva_level_score_level_score_id",
column: x => x.level_score_id,
principalTable: "eva_level_score",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_eva_level_score_detail_level_score_id",
table: "eva_level_score_detail",
column: "level_score_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "eva_level_score_detail");
}
}
}

View File

@@ -16,7 +16,7 @@ namespace tb320eva.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("TodoAPI2.Models.activity_log_evaEntity", b =>
@@ -171,6 +171,12 @@ namespace tb320eva.Migrations
b.Property<string>("remark")
.HasMaxLength(1000);
b.Property<decimal?>("reward_new");
b.Property<decimal?>("reward_new2");
b.Property<decimal?>("reward_old");
b.Property<decimal?>("sarary");
b.Property<decimal?>("score_final");
@@ -298,6 +304,9 @@ namespace tb320eva.Migrations
b.Property<int?>("order_of_data");
b.Property<string>("remark")
.HasMaxLength(1000);
b.Property<decimal?>("score_chief");
b.Property<decimal?>("score_supervisor");
@@ -339,6 +348,11 @@ namespace tb320eva.Migrations
b.Property<DateTime?>("status_supervisor2A_click_date");
b.Property<string>("status_supervisor_a")
.HasMaxLength(1);
b.Property<DateTime?>("status_supervisor_a_click_date");
b.Property<DateTime?>("status_supervisor_click_date");
b.Property<int?>("supervisor1");
@@ -427,6 +441,8 @@ namespace tb320eva.Migrations
b.Property<int?>("evaluation_detail_id");
b.Property<int?>("history_group");
b.Property<bool>("isActive");
b.Property<DateTime>("updated");
@@ -707,6 +723,33 @@ namespace tb320eva.Migrations
b.ToTable("eva_level_score");
});
modelBuilder.Entity("TodoAPI2.Models.eva_level_score_detailEntity", b =>
{
b.Property<Guid>("id");
b.Property<DateTime>("created");
b.Property<bool>("isActive");
b.Property<Guid>("level_score_id");
b.Property<decimal?>("max_percentage");
b.Property<decimal?>("max_value");
b.Property<decimal?>("min_percentage");
b.Property<decimal?>("min_value");
b.Property<DateTime>("updated");
b.HasKey("id");
b.HasIndex("level_score_id");
b.ToTable("eva_level_score_detail");
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b =>
{
b.Property<Guid>("id");
@@ -767,6 +810,9 @@ namespace tb320eva.Migrations
b.Property<string>("remark")
.HasMaxLength(4000);
b.Property<string>("remark2")
.HasMaxLength(4000);
b.Property<decimal?>("total_salary");
b.Property<decimal?>("total_salary_limit");
@@ -838,12 +884,19 @@ namespace tb320eva.Migrations
b.Property<DateTime>("created");
b.Property<DateTime?>("end_leave");
b.Property<int?>("fiscal_year");
b.Property<bool>("isActive");
b.Property<decimal?>("percent");
b.Property<string>("remark")
.HasMaxLength(500);
b.Property<DateTime?>("start_leave");
b.Property<int?>("theTime");
b.Property<DateTime>("updated");
@@ -937,6 +990,8 @@ namespace tb320eva.Migrations
b.Property<int?>("position_type");
b.Property<decimal?>("salary_max");
b.Property<decimal?>("temporary_min");
b.Property<decimal?>("themax");
@@ -950,6 +1005,26 @@ namespace tb320eva.Migrations
b.ToTable("eva_salary_cylinder");
});
modelBuilder.Entity("TodoAPI2.Models.eva_setup_permissionEntity", b =>
{
b.Property<Guid>("id");
b.Property<DateTime>("created");
b.Property<int?>("employee_id");
b.Property<bool>("isActive");
b.Property<string>("remark")
.HasMaxLength(4000);
b.Property<DateTime>("updated");
b.HasKey("id");
b.ToTable("eva_setup_permission");
});
modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation")
@@ -1029,6 +1104,14 @@ namespace tb320eva.Migrations
.HasForeignKey("create_evaluation_detail_id");
});
modelBuilder.Entity("TodoAPI2.Models.eva_level_score_detailEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_level_scoreEntity", "eva_level_score_level_score_id")
.WithMany()
.HasForeignKey("level_score_id")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b =>
{
b.HasOne("TodoAPI2.Models.eva_limit_frame_groupEntity", "eva_limit_frame_group_frame_group_guid")

View File

@@ -81,6 +81,12 @@ namespace TodoAPI2.Models
public string employee_no_at_this_time { get; set; }
public bool? is_for_postponement { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new { get; set; }
public decimal? reward_new2 { get; set; }
}
}

View File

@@ -48,6 +48,10 @@ namespace TodoAPI2.Models
public string eva_result { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -141,9 +141,15 @@ namespace TodoAPI2.Models
adjust_postponement_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult1.fiscal_year,
employee_id_external_linkage_external_name = fk_external_linkageResult2.fullname,
reward_old = m_eva_adjust_postponement_detail_normal.reward_old,
reward_new = m_eva_adjust_postponement_detail_normal.reward_new,
isActive = m_eva_adjust_postponement_detail_normal.isActive,
Created = m_eva_adjust_postponement_detail_normal.created,
Updated = m_eva_adjust_postponement_detail_normal.updated
Updated = m_eva_adjust_postponement_detail_normal.updated,
salary_max = fk_external_linkageResult2.salary_max,
themax = fk_external_linkageResult2.themax
}
).ToList();
@@ -203,6 +209,8 @@ namespace TodoAPI2.Models
//existingEntity.emp_level = model.emp_level;
//existingEntity.total_score = model.total_score;
//existingEntity.eva_result = model.eva_result;
existingEntity.reward_old = model.reward_old;
existingEntity.reward_new = model.reward_new;
var updated = _repository.Update(id, existingEntity);
@@ -252,11 +260,6 @@ namespace TodoAPI2.Models
if (theemp == null) continue;
if (theemp.fullname.Contains("อุบลวรรณ"))
{
string zz = "1";
}
var n = new eva_adjust_postponement_detailEntity();
n.id = newkey;
newkey++;
@@ -467,6 +470,8 @@ namespace TodoAPI2.Models
//existingEntity.emp_level = i.emp_level;
//existingEntity.total_score = i.total_score;
//existingEntity.eva_result = i.eva_result;
existingEntity.reward_old = i.reward_old;
existingEntity.reward_new = i.reward_new;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);

View File

@@ -50,8 +50,14 @@ namespace TodoAPI2.Models
public string eva_result { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new { get; set; }
public int? adjust_postponement_id_eva_adjust_postponement_fiscal_year { get; set; }
public string employee_id_external_linkage_external_name { get; set; }
public decimal? salary_max { get; set; }
public decimal? themax { get; set; }
}
}

View File

@@ -48,6 +48,10 @@ namespace TodoAPI2.Models
public string eva_result { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new { get; set; }
public string active_mode { get; set; }

View File

@@ -78,8 +78,59 @@ namespace TodoAPI2.Models
return i;
}
private (decimal?, string) getData(eva_create_evaluation_detailEntity detail)
{
if (detail.status_supervisor2A == "Y")
{
return (detail.score_supervisor2A, detail.level_score_supervisor2A);
}
else if (detail.status_supervisor1A == "Y")
{
return (detail.score_supervisor1A, detail.level_score_supervisor1A);
}
else if (detail.status_supervisor == "Y")
{
return (detail.score_supervisor, detail.level_score_supervisor);
}
else if (detail.status_chief == "Y")
{
return (detail.score_chief, detail.level_score_chief);
}
else
{
return (0, null);
}
}
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;
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;
foreach(var x in rawData)
{
var y = (from i in baseScore
where i.employee_id == x.employee_id
select getData(i)).FirstOrDefault();
x.level_score_final = y.Item2;
x.score_final = y.Item1;
}
_repository.Context.SaveChanges();
}
public List<eva_adjust_postponement_detail_normal_02ViewModel> GetListByadjust_postponement_id(int? adjust_postponement_id)
{
ReloadPostponement(adjust_postponement_id);
var model = new eva_adjust_postponement_detail_normal_02SearchModel();
model.adjust_postponement_id = adjust_postponement_id;
return GetListBySearch(model);
@@ -98,8 +149,23 @@ namespace TodoAPI2.Models
return "";
}
private (decimal?, decimal?) GetRangePercentage(List<eva_level_score_detailEntity> level_detail, decimal? score)
{
var item = (from i in level_detail
where i.min_value <= score && i.max_value >= score
select i).FirstOrDefault();
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 level_detail = (from i in _repository.Context.eva_level_score_detail
select i).ToList();
var all_emp = emp.GetListByemployee_type(null, null);
var endDate = (from m_eva_adjust_postponement_detail_normal_02 in _repository.Context.eva_adjust_postponement_detail
@@ -154,7 +220,8 @@ namespace TodoAPI2.Models
&& (m_eva_adjust_postponement_detail_normal_02.adjust_postponement_id == model.adjust_postponement_id || !model.adjust_postponement_id.HasValue)
//&& fk_create_detailResult.employee_id == m_eva_adjust_postponement_detail_normal_02.employee_id
//&& (m_eva_adjust_postponement_detail_normal_02.is_for_postponement == null?true: m_eva_adjust_postponement_detail_normal_02.is_for_postponement.Value)
&& fk_external_linkageResult2.workingstatus == "สถานะปฏิบัติงาน"
&& fk_external_linkageResult2.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
orderby
fk_sort_depResult2.external_code,
@@ -200,6 +267,12 @@ namespace TodoAPI2.Models
startDate = fk_external_linkageResult2.packing_date,
endDate = endDate,
salary_max = fk_external_linkageResult2.salary_max,
themax = fk_external_linkageResult2.themax,
min_percentage = GetRangePercentage(level_detail, m_eva_adjust_postponement_detail_normal_02.migration_total_score.HasValue ? m_eva_adjust_postponement_detail_normal_02.migration_total_score : m_eva_adjust_postponement_detail_normal_02.score_final).Item1,
max_percentage = GetRangePercentage(level_detail, m_eva_adjust_postponement_detail_normal_02.migration_total_score.HasValue ? m_eva_adjust_postponement_detail_normal_02.migration_total_score : m_eva_adjust_postponement_detail_normal_02.score_final).Item2,
isActive = m_eva_adjust_postponement_detail_normal_02.isActive,
Created = m_eva_adjust_postponement_detail_normal_02.created,
Updated = m_eva_adjust_postponement_detail_normal_02.updated
@@ -262,7 +335,8 @@ namespace TodoAPI2.Models
//existingEntity.emp_level = model.emp_level;
//existingEntity.total_score = model.total_score;
//existingEntity.eva_result = model.eva_result;
existingEntity.reward_old = model.reward_old;
existingEntity.reward_new = model.reward_new;
var updated = _repository.Update(id, existingEntity);
return Get(updated.id);
@@ -296,7 +370,8 @@ namespace TodoAPI2.Models
//existingEntity.emp_level = i.emp_level;
//existingEntity.total_score = i.total_score;
//existingEntity.eva_result = i.eva_result;
existingEntity.reward_old = i.reward_old;
existingEntity.reward_new = i.reward_new;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}

View File

@@ -60,5 +60,16 @@ namespace TodoAPI2.Models
public DateTime? startDate { get; set; }
public DateTime? endDate { get; set; }
public decimal? salary_max { get; set; }
public decimal? themax { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new { get; set; }
public decimal? min_percentage { get; set; }
public decimal? max_percentage { get; set; }
}
}

View File

@@ -52,6 +52,10 @@ namespace TodoAPI2.Models
public string eva_result { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new2 { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -20,16 +20,16 @@ namespace TodoAPI2.Models
public class eva_adjust_postponement_detail_quota_02Service : Ieva_adjust_postponement_detail_quota_02Service
{
private IBaseRepository2<eva_adjust_postponement_detailEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private IMyDatabase db;
private Iexternal_linkageService ext;
private Iexternal_employeeService emp;
public eva_adjust_postponement_detail_quota_02Service(IBaseRepository2<eva_adjust_postponement_detailEntity, int> repository,
public eva_adjust_postponement_detail_quota_02Service(IBaseRepository2<eva_adjust_postponement_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_adjust_postponement_detail_quota_02ViewModel>>(entities);
}
#endregion
#region Public Functions
@@ -78,15 +78,66 @@ namespace TodoAPI2.Models
return i;
}
private (decimal?, string) getData(eva_create_evaluation_detailEntity detail)
{
if (detail.status_supervisor2A == "Y")
{
return (detail.score_supervisor2A, detail.level_score_supervisor2A);
}
else if (detail.status_supervisor1A == "Y")
{
return (detail.score_supervisor1A, detail.level_score_supervisor1A);
}
else if (detail.status_supervisor == "Y")
{
return (detail.score_supervisor, detail.level_score_supervisor);
}
else if (detail.status_chief == "Y")
{
return (detail.score_chief, detail.level_score_chief);
}
else
{
return (0, null);
}
}
private void ReloadPostponement(int? adjust_postponement_quota_id)
{
var rawData = from i in _repository.Context.eva_adjust_postponement_detail
where i.adjust_postponement_quota_id == adjust_postponement_quota_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_quota_id == adjust_postponement_quota_id
&& m.employee_id == i.employee_id
select m;
foreach (var x in rawData)
{
var y = (from i in baseScore
where i.employee_id == x.employee_id
select getData(i)).FirstOrDefault();
x.level_score_final = y.Item2;
x.score_final = y.Item1;
}
_repository.Context.SaveChanges();
}
public List<eva_adjust_postponement_detail_quota_02ViewModel> GetListByadjust_postponement_quota_id(int? adjust_postponement_quota_id)
{
var model = new eva_adjust_postponement_detail_quota_02SearchModel();
ReloadPostponement(adjust_postponement_quota_id);
var model = new eva_adjust_postponement_detail_quota_02SearchModel();
model.adjust_postponement_quota_id = adjust_postponement_quota_id;
return GetListBySearch(model);
}
public string GetWorkTimeText(DateTime? startDate, DateTime? endDate)
{
{
if (!endDate.HasValue || !startDate.HasValue)
return "";
@@ -98,7 +149,7 @@ namespace TodoAPI2.Models
return "";
}
public List<eva_adjust_postponement_detail_quota_02ViewModel> GetListBySearch(eva_adjust_postponement_detail_quota_02SearchModel model)
public List<eva_adjust_postponement_detail_quota_02ViewModel> GetListBySearch(eva_adjust_postponement_detail_quota_02SearchModel model)
{
var all_emp = emp.GetListByemployee_type(null, null);
@@ -112,10 +163,10 @@ namespace TodoAPI2.Models
into eva_adjust_postponementResult1A
from fk_eva_adjust_postponementResult1A in eva_adjust_postponementResult1A.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
// on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
// into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
// on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
// into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
join create_data in _repository.Context.eva_create_evaluation
on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_data.id
@@ -142,12 +193,12 @@ namespace TodoAPI2.Models
join fk_external_linkage2 in all_emp on m_eva_adjust_postponement_detail_quota_02.employee_id equals fk_external_linkage2.id
into external_linkageResult2
from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty()
from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
//on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
//into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
//join create_detail in _repository.Context.eva_create_evaluation_detail
//on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
//into create_detailResult
//from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
join sort_dep in ext.GetSortingDep() on m_eva_adjust_postponement_detail_quota_02.org_at_this_time.HasValue ? m_eva_adjust_postponement_detail_quota_02.org_at_this_time : fk_external_linkageResult2.department_id equals sort_dep.id
into sort_depResult2
@@ -162,13 +213,14 @@ namespace TodoAPI2.Models
into external_linkageResult11
from fk_external_linkageResult11 in sort_depResult2.DefaultIfEmpty()
where 1==1
where 1 == 1
//&& (m_eva_adjust_postponement_detail_quota_02.id == model.id || !model.id.HasValue)
&& (m_eva_adjust_postponement_detail_quota_02.adjust_postponement_quota_id == model.adjust_postponement_quota_id || !model.adjust_postponement_quota_id.HasValue)
//&& (fk_create_detailResult.employee_id == m_eva_adjust_postponement_detail_quota_02.employee_id || fk_create_detailResult == null)
//&& (m_eva_adjust_postponement_detail_quota_02.is_for_postponement == null ? true : m_eva_adjust_postponement_detail_quota_02.is_for_postponement.Value)
&& fk_external_linkageResult2.workingstatus == "สถานะปฏิบัติงาน"
&& fk_external_linkageResult2.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
orderby
fk_sort_depResult2.external_code,
@@ -203,7 +255,7 @@ namespace TodoAPI2.Models
emp_department_name = !string.IsNullOrEmpty(fk_external_linkageResult11.external_name) ? fk_external_linkageResult11.external_name : fk_sort_depResult2.external_name,
total_score = m_eva_adjust_postponement_detail_quota_02.migration_total_score.HasValue? m_eva_adjust_postponement_detail_quota_02.migration_total_score : m_eva_adjust_postponement_detail_quota_02.score_final,
total_score = m_eva_adjust_postponement_detail_quota_02.migration_total_score.HasValue ? m_eva_adjust_postponement_detail_quota_02.migration_total_score : m_eva_adjust_postponement_detail_quota_02.score_final,
eva_result = !string.IsNullOrEmpty(m_eva_adjust_postponement_detail_quota_02.migration_eva_result) ? m_eva_adjust_postponement_detail_quota_02.migration_eva_result : m_eva_adjust_postponement_detail_quota_02.level_score_final,
adjust_postponement_quota_id_eva_adjust_postponement_fiscal_year = fk_eva_adjust_postponementResult1.fiscal_year,
@@ -213,9 +265,16 @@ namespace TodoAPI2.Models
startDate = fk_external_linkageResult2.packing_date,
endDate = endDate,
reward_old = m_eva_adjust_postponement_detail_quota_02.reward_old,
reward_new2 = m_eva_adjust_postponement_detail_quota_02.reward_new2,
salary_max = fk_external_linkageResult2.salary_max,
themax = fk_external_linkageResult2.themax,
isActive = m_eva_adjust_postponement_detail_quota_02.isActive,
Created = m_eva_adjust_postponement_detail_quota_02.created,
Updated = m_eva_adjust_postponement_detail_quota_02.updated
}
).ToList();
@@ -231,10 +290,10 @@ namespace TodoAPI2.Models
int? newkey = 0;
var x = (from i in _repository.Context.eva_adjust_postponement_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;
}
@@ -250,7 +309,7 @@ namespace TodoAPI2.Models
var inserted = _repository.Insert(entity);
return Get(inserted.id);
}
@@ -277,44 +336,46 @@ namespace TodoAPI2.Models
//existingEntity.emp_level = model.emp_level;
//existingEntity.total_score = model.total_score;
//existingEntity.eva_result = model.eva_result;
existingEntity.reward_old = model.reward_old;
existingEntity.reward_new2 = model.reward_new2;
var updated = _repository.Update(id, existingEntity);
return Get(updated.id);
}
else
throw new NotificationException("No data to update");
throw new NotificationException("No data to update");
}
public string UpdateMultiple(List<eva_adjust_postponement_detail_quota_02InputModel> model)
public string UpdateMultiple(List<eva_adjust_postponement_detail_quota_02InputModel> 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.adjust_postponement_quota_id = i.adjust_postponement_quota_id;
//existingEntity.employee_id = i.employee_id;
//existingEntity.sarary = i.sarary;
//existingEntity.cost_living = i.cost_living;
//existingEntity.middle = i.middle;
//existingEntity.promoted_percentage = i.promoted_percentage;
//existingEntity.total_promote = i.total_promote;
//existingEntity.new_sarary = i.new_sarary;
//existingEntity.new_cost_living = i.new_cost_living;
existingEntity.remark = i.remark;
existingEntity.receive_quota = i.receive_quota;
existingEntity.new_sarary_with_quota = i.new_sarary_with_quota;
//existingEntity.emp_code = i.emp_code;
//existingEntity.emp_fullname = i.emp_fullname;
//existingEntity.emp_position = i.emp_position;
//existingEntity.emp_level = i.emp_level;
//existingEntity.total_score = i.total_score;
//existingEntity.eva_result = i.eva_result;
//existingEntity.adjust_postponement_quota_id = i.adjust_postponement_quota_id;
//existingEntity.employee_id = i.employee_id;
//existingEntity.sarary = i.sarary;
//existingEntity.cost_living = i.cost_living;
//existingEntity.middle = i.middle;
//existingEntity.promoted_percentage = i.promoted_percentage;
//existingEntity.total_promote = i.total_promote;
//existingEntity.new_sarary = i.new_sarary;
//existingEntity.new_cost_living = i.new_cost_living;
existingEntity.remark = i.remark;
existingEntity.receive_quota = i.receive_quota;
existingEntity.new_sarary_with_quota = i.new_sarary_with_quota;
//existingEntity.emp_code = i.emp_code;
//existingEntity.emp_fullname = i.emp_fullname;
//existingEntity.emp_position = i.emp_position;
//existingEntity.emp_level = i.emp_level;
//existingEntity.total_score = i.total_score;
//existingEntity.eva_result = i.eva_result;
existingEntity.reward_old = i.reward_old;
existingEntity.reward_new2 = i.reward_new2;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}
@@ -326,15 +387,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

@@ -60,5 +60,13 @@ namespace TodoAPI2.Models
public DateTime? startDate { get; set; }
public DateTime? endDate { get; set; }
public decimal? reward_old { get; set; }
public decimal? reward_new2 { get; set; }
public decimal? salary_max { get; set; }
public decimal? themax { get; set; }
}
}

View File

@@ -20,8 +20,8 @@ namespace TodoAPI2.Models
string UpdateMultiple(List<eva_adjust_postponement_quotaInputModel> model);
eva_adjust_postponement_quotaWithSelectionViewModel GetWithSelection(int id);
eva_adjust_postponement_quotaWithSelectionViewModel GetBlankItem();
rep_eva_savemessageReportRequestModel setModelFor_rep_eva_savemessageReport(rep_eva_savemessageReportRequestModel model);
DataContext GetContext();
}
}

View File

@@ -32,6 +32,10 @@ namespace TodoAPI2.Models
public decimal? limit { get; set; }
public int? fiscal_year_search { get; set; }
public int? theRound_search { get; set; }
public string active_mode { get; set; }
public List<eva_adjust_postponement_detail_quota_02InputModel> adjust_postponement_detail_quota_02_model;

View File

@@ -20,6 +20,9 @@ namespace TodoAPI2.Models
public int? theRound { get; set; }
public int? fiscal_year_search { get; set; }
public int? theRound_search { get; set; }
}
}

View File

@@ -59,6 +59,11 @@ namespace TodoAPI2.Models
#region Public Functions
#region Query Functions
public DataContext GetContext()
{
return _repository.Context;
}
public eva_adjust_postponement_quotaViewModel Get(int id)
{
var entity = _repository.Get(id);
@@ -72,6 +77,13 @@ namespace TodoAPI2.Models
var all_emp = emp.GetListByemployee_type(null, null);
i.item_managed_by = all_emp.ToList();
i.item_fiscal_year_search = (from x in _repository.Context.eva_adjust_postponement
select new external_linkageViewModel { external_id = x.fiscal_year, external_name = x.fiscal_year.ToString() }
).Distinct().OrderByDescending(x => x.external_id).ToList();
i.item_theRound_search = (from x in _repository.Context.eva_adjust_postponement
select new external_linkageViewModel { external_id = x.theRound, external_name = x.theRound.ToString() }
).Distinct().OrderByDescending(x => x.external_id).ToList();
return i;
}
public eva_adjust_postponement_quotaWithSelectionViewModel GetBlankItem()
@@ -80,6 +92,13 @@ namespace TodoAPI2.Models
var all_emp = emp.GetListByemployee_type(null, null);
i.item_managed_by = all_emp.ToList();
i.item_fiscal_year_search = (from x in _repository.Context.eva_adjust_postponement
select new external_linkageViewModel { external_id = x.fiscal_year, external_name = x.fiscal_year.ToString() }
).Distinct().OrderByDescending(x => x.external_id).ToList();
i.item_theRound_search = (from x in _repository.Context.eva_adjust_postponement
select new external_linkageViewModel { external_id = x.theRound, external_name = x.theRound.ToString() }
).Distinct().OrderByDescending(x => x.external_id).ToList();
return i;
}
@@ -107,6 +126,9 @@ namespace TodoAPI2.Models
&& (m_eva_adjust_postponement_quota.theRound == model.theRound || !model.theRound.HasValue)
&& !m_eva_adjust_postponement_quota.create_evaluation_id.HasValue
&& (!model.fiscal_year_search.HasValue || m_eva_adjust_postponement_quota.fiscal_year == model.fiscal_year_search)
&& (!model.theRound_search.HasValue || m_eva_adjust_postponement_quota.theRound == model.theRound_search)
orderby m_eva_adjust_postponement_quota.created descending
select new eva_adjust_postponement_quotaViewModel()
{
@@ -174,7 +196,7 @@ namespace TodoAPI2.Models
entity.limit_quota = 0;
entity.limit_frame_quota = 0;
var all_emp = emp.GetListByemployee_type(null, null);
var all_emp = (from i in emp.GetListByemployee_type(null, null) where i.workingstatus == "สถานะปฏิบัติงาน" 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);
@@ -506,6 +528,54 @@ namespace TodoAPI2.Models
return;
}
public rep_eva_savemessageReportRequestModel setModelFor_rep_eva_savemessageReport(rep_eva_savemessageReportRequestModel model)
{
model.theDate = MyHelper.GetDateFromString(model.theDate_text);
model.theDate_text = MyHelper.GetDateStringForReport(model.theDate);
model.decimal_limit_quota = Convert.ToDecimal(model.limit_quota);
var postponement_data = (from postponement in _repository.Context.eva_adjust_postponement
//join create_evaluation in _repository.Context.eva_create_evaluation on postponement.create_evaluation_id equals create_evaluation.id
where postponement.id == model.quota_id
select new
{
//create_evaluation.performance_plan_id,
postponement.fiscal_year,
postponement.theDate,
postponement.limit_frame,
postponement.limit_frame_quota
}).FirstOrDefault();
if(postponement_data != null)
{
var plan_id = (from plan_in_db in _repository.Context.eva_performance_plan
where plan_in_db.fiscal_year == postponement_data.fiscal_year
&& plan_in_db.theTime == plan_in_db.theTime
select plan_in_db.id).FirstOrDefault();
var plan = (from eva_p_p in _repository.Context.eva_performance_plan
where eva_p_p.id == plan_id
select eva_p_p).FirstOrDefault();
if(plan != null)
{
var start_plan = (from s in _repository.Context.eva_performance_plan_detail
where s.performance_plan_id == plan_id
select s.start_date).Min();
var end_plan = (from s in _repository.Context.eva_performance_plan_detail
where s.performance_plan_id == plan_id
select s.end_date).Max();
model.theTime = plan.theTime;
model.min_plan_start_date = MyHelper.GetDateStringForReport(start_plan);
model.max_plan_end_date = MyHelper.GetDateStringForReport(end_plan);
}
}
return model;
}
#endregion
#region Match Item

View File

@@ -8,6 +8,7 @@ namespace TodoAPI2.Models
public class eva_adjust_postponement_quotaWithSelectionViewModel: eva_adjust_postponement_quotaViewModel
{
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; }
}
}

View File

@@ -91,6 +91,9 @@ namespace TodoAPI2.Models
[MaxLength(1)]
public string status_supervisor { get; set; }
[MaxLength(1)]
public string status_supervisor_a { get; set; }
public int? supervisor1A { get; set; }
[MaxLength(1)]
@@ -130,6 +133,7 @@ namespace TodoAPI2.Models
public DateTime? status_chief_a_click_date { get; set; }
public DateTime? status_chief_click_date { get; set; }
public DateTime? status_supervisor_click_date { get; set; }
public DateTime? status_supervisor_a_click_date { get; set; }
public DateTime? status_supervisor1A_click_date { get; set; }
public DateTime? status_supervisor2A_click_date { get; set; }
@@ -191,6 +195,9 @@ namespace TodoAPI2.Models
public int? order_of_data { get; set; }
public int? help_org_id { get; set; }
[MaxLength(1000)]
public string remark { get; set; }
}
}

View File

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

View File

@@ -209,7 +209,7 @@ namespace TodoAPI2.Models
employee_no = fk_external_linkageResult2.employee_no,
position_number = fk_external_linkageResult2.position_number,
position_name = fk_external_linkageResult2.position_name,
remark = null,
remark = m_eva_create_evaluation_detail.remark,
status_self_click_date = m_eva_create_evaluation_detail.status_self_click_date,
status_chief_click_date = m_eva_create_evaluation_detail.status_chief_click_date,
@@ -254,7 +254,10 @@ namespace TodoAPI2.Models
var entity = GetEntity(model);
entity.id = GetNewPrimaryKey();
if (!entity.work_period.HasValue)
{
entity.work_period = 6;
}
var inserted = _repository.Insert(entity);
@@ -275,6 +278,12 @@ namespace TodoAPI2.Models
existingEntity.work_period = model.work_period;
existingEntity.order_of_data = model.order_of_data;
existingEntity.help_org_id = model.help_org_id;
existingEntity.remark = model.remark;
if (!existingEntity.work_period.HasValue)
{
existingEntity.work_period = 6;
}
var updated = _repository.Update(id, existingEntity);
return Get(updated.id);
@@ -301,6 +310,7 @@ namespace TodoAPI2.Models
existingEntity.work_period = i.work_period;
existingEntity.order_of_data = i.order_of_data;
existingEntity.help_org_id = i.help_org_id;
existingEntity.remark = i.remark;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}

View File

@@ -122,6 +122,7 @@ namespace TodoAPI2.Models
public string txt_status_supervisor2A { get { return getStatusText(status_supervisor2A) + MyHelper.GetDateStringForReport(status_supervisor2A_click_date); } }
public string help_org_id_external_linkage_external_name { get; set; }
private string getStatusText(string s)
{
if (!string.IsNullOrEmpty(s))

View File

@@ -42,6 +42,8 @@ namespace TodoAPI2.Models
public string search_employee_fullname { get; set; }
public string evaluation_round_search { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -22,6 +22,8 @@ namespace TodoAPI2.Models
public string search_employee_fullname { get; set; }
public string evaluation_round_search { get; set; }
}
}

View File

@@ -145,8 +145,22 @@ namespace TodoAPI2.Models
{
var item = Get(id);
var i = item;
var option_1 = new external_linkageViewModel();
option_1.id_guid = Guid.Empty;
option_1.external_name = "ทั้งหมด";
var option_all = new List<external_linkageViewModel>();
option_all.Add(option_1);
i.item_org_id = ext.GetDepartmentData();
var allround = (from y in _repository.Context.eva_create_evaluation
select y.performance_plan_id).ToList();
i.item_evaluation_round_search = option_all.Union((from x in _repository.Context.eva_performance_plan
where allround.Contains(x.id)
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
)).ToList();
return i;
}
@@ -155,6 +169,19 @@ namespace TodoAPI2.Models
var i = new eva_create_evaluation_detail_agreementWithSelectionViewModel();
i.item_org_id = ext.GetDepartmentData();
var option_1 = new external_linkageViewModel();
option_1.id_guid = Guid.Empty;
option_1.external_name = "ทั้งหมด";
var option_all = new List<external_linkageViewModel>();
option_all.Add(option_1);
var allround = (from y in _repository.Context.eva_create_evaluation
select y.performance_plan_id).ToList();
i.item_evaluation_round_search = option_all.Union((from x in _repository.Context.eva_performance_plan
where allround.Contains(x.id)
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
)).ToList();
return i;
}
@@ -168,6 +195,17 @@ namespace TodoAPI2.Models
public List<eva_create_evaluation_detail_agreementViewModel> GetListBySearch(eva_create_evaluation_detail_agreementSearchModel model, int? emp_id)
{
if (string.IsNullOrEmpty(model.evaluation_round_search))
{
model.evaluation_round_search = (from x in _repository.Context.eva_performance_plan
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
).FirstOrDefault().id_guid.ToString();
}
else if (Guid.Parse(model.evaluation_round_search) == Guid.Empty)
{
model.evaluation_round_search = null;
}
var allemp = emp.GetListByemployee_type(null, null);
@@ -196,6 +234,7 @@ namespace TodoAPI2.Models
&& (fk_external_employee.employee_no == model.search_employee_code || string.IsNullOrEmpty(model.search_employee_code))
&& (fk_external_employee.fullname.Contains(model.search_employee_fullname) || string.IsNullOrEmpty(model.search_employee_fullname))
&& m_eva_create_evaluation_detail_agreement.employee_id == emp_id
&& (string.IsNullOrEmpty(model.evaluation_round_search) || fk_planResult.id == Guid.Parse(model.evaluation_round_search))
orderby m_eva_create_evaluation_detail_agreement.created descending
select new eva_create_evaluation_detail_agreementViewModel()

View File

@@ -89,6 +89,8 @@ namespace TodoAPI2.Models
return "";
}
public string evaluation_round_search { get; set; }
}
}

View File

@@ -8,6 +8,6 @@ namespace TodoAPI2.Models
public class eva_create_evaluation_detail_agreementWithSelectionViewModel: eva_create_evaluation_detail_agreementViewModel
{
public List<external_linkageViewModel> item_org_id { get; set; }
public List<external_linkageViewModel> item_evaluation_round_search { get; set; }
}
}

View File

@@ -17,6 +17,7 @@ namespace TodoAPI2.Models
eva_create_evaluation_detail_firstdocWithSelectionViewModel GetWithSelection(int id, int? emp_id);
eva_create_evaluation_detail_firstdocWithSelectionViewModel GetBlankItem();
eva_create_evaluation_detail_firstdocWithSelectionViewModel GetBlankItemWithEmp(int? emp_id);
}
}

View File

@@ -20,9 +20,9 @@ namespace TodoAPI2.Models
public int? org_id { get; set; }
public string search_employee_code { get; set; }
public int? employee_id { get; set; }
public string search_employee_fullname { get; set; }
public string evaluation_round_search { get; set; }
}
}

View File

@@ -71,6 +71,9 @@ namespace TodoAPI2.Models
public eva_create_evaluation_detail_firstdocViewModel Get(int id, int? emp_id)
{
object special_person = (from x in _repository.Context.eva_setup_permission
select x.employee_id).ToArray();
var allemp = emp.GetListByemployee_type(null, null);
var endDate = (from m_eva_create_evaluation_detail_agreement in _repository.Context.eva_create_evaluation_detail
@@ -125,6 +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,
org_id_external_linkage_external_name = fk_external_employee.department_name,
@@ -133,6 +137,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 = null,
remark_hrm_work_record = fk_external_employee.remark_hrm_work_record
+ GetWorkTimeText(fk_external_employee.packing_date, endDate),
@@ -148,7 +153,8 @@ namespace TodoAPI2.Models
m_eva_create_evaluation_detail_agreement.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_agreement.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_agreement.employee_id,
m_eva_create_evaluation_detail_agreement.status_self_a,
m_eva_create_evaluation_detail_agreement.status_chief_a
m_eva_create_evaluation_detail_agreement.status_chief_a,
special_person
),
role_desc = getRoleName(emp_id,
@@ -159,7 +165,9 @@ namespace TodoAPI2.Models
fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_agreement.employee_id,
m_eva_create_evaluation_detail_agreement.status_self_a,
m_eva_create_evaluation_detail_agreement.status_chief_a),
m_eva_create_evaluation_detail_agreement.status_chief_a,
special_person
),
isActive = m_eva_create_evaluation_detail_agreement.isActive,
Created = m_eva_create_evaluation_detail_agreement.created,
@@ -171,38 +179,40 @@ namespace TodoAPI2.Models
}
private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, int? self,
string status_self_a, string status_chief_a)
string status_self_a, string status_chief_a, object special_person)
{
if (emp_id == self && status_self_a != "Y") return ""; // ผู้รับการประเมิน
if (self == chief && emp_id == chief && status_chief_a != "Y") return "1";
if (self == supervisor1 && emp_id == supervisor1 && status_chief_a == "Y") return "1";
if (self == supervisor2 && emp_id == supervisor2 && status_chief_a == "Y") return "2";
if (self == supervisor1A && emp_id == supervisor1A && status_chief_a == "Y") return "3";
if (self == supervisor2A && emp_id == supervisor2A && status_chief_a == "Y") return "4";
if (self == supervisor2A && emp_id == supervisor2A && status_chief_a == "Y") return "4";
if (emp_id == chief) return "1";
else if (emp_id == supervisor1) return "1";
else if (emp_id == supervisor2) return "2";
else if (emp_id == supervisor1A) return "3";
else if (emp_id == supervisor2A) return "4";
else 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, int? self,
string status_self_a, string status_chief_a)
string status_self_a, string status_chief_a, object special_person)
{
if (emp_id == self && status_self_a != "Y") return ""; // ผู้รับการประเมิน
if (self == chief && emp_id == chief && status_chief_a != "Y") return "ผู้ประเมิน";
if (self == supervisor1 && emp_id == supervisor1 && status_chief_a == "Y") return "ผู้ประเมิน";
if (self == supervisor2 && emp_id == supervisor2 && status_chief_a == "Y") return "ผู้ประเมินสูงสุด";
if (self == supervisor1A && emp_id == supervisor1A && status_chief_a == "Y") return "ผู้บังคับบัญชาเหนือขึ้นไป";
if (self == supervisor2A && emp_id == supervisor2A && status_chief_a == "Y") return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)";
if (self == supervisor2A && emp_id == supervisor2A && status_chief_a == "Y") return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)";
if (emp_id == chief) return "ผู้ประเมิน";
else if (emp_id == supervisor1) return "ผู้ประเมิน";
else if (emp_id == supervisor2) return "ผู้ประเมินสูงสุด";
else if (emp_id == supervisor1A) return "ผู้บังคับบัญชาเหนือขึ้นไป";
else if (emp_id == supervisor2A) return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)";
else if (((int?[])special_person).Contains(emp_id)) return "ผู้ตรวจสอบ";
return "";
}
@@ -222,17 +232,114 @@ namespace TodoAPI2.Models
{
var entity = Get(id, emp_id);
var i = Mapper.Map<eva_create_evaluation_detail_firstdocWithSelectionViewModel>(entity);
i.item_org_id = ext.GetDepartmentData();
var special_person = (from x in _repository.Context.eva_setup_permission
select x.employee_id).ToList();
var dep = (from x in emp.GetAllEmployee()
where x.id == emp_id
select x.department_id).FirstOrDefault();
var alldep = (from x in emp.GetDeptMapping()
where x.id == dep || x.id2 == dep || special_person.Contains(emp_id)
select x.id);
var option_1 = new external_linkageViewModel();
option_1.id_guid = Guid.Empty;
option_1.external_name = "ทั้งหมด";
var option_all = new List<external_linkageViewModel>();
option_all.Add(option_1);
var alleva = (from x in _repository.Context.eva_create_evaluation
join y in _repository.Context.eva_create_evaluation_detail on x.id equals y.create_evaluation_id
where x.employee_id == emp_id
|| x.supervisor1_id == emp_id
|| x.supervisor2_id == emp_id
|| y.chief == emp_id
|| y.eva_employee_id == emp_id
|| y.supervisor1_id == emp_id
|| y.supervisor2_id == emp_id
|| special_person.Contains(emp_id)
select y.employee_id).ToList();
i.item_org_id = (from q in ext.GetDepartmentData() where alldep.Contains(q.id) select q).ToList();
i.item_employee_id = (from x in emp.GetAllEmployee()
where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
&& alleva.Contains(x.id)
orderby x.fullname
select new external_linkageViewModel { external_id = x.id, external_name = x.fullname }
).ToList();
var allround = (from y in _repository.Context.eva_create_evaluation
select y.performance_plan_id).ToList();
i.item_evaluation_round_search = option_all.Union((from x in _repository.Context.eva_performance_plan
where allround.Contains(x.id)
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
)).ToList();
return i;
}
public eva_create_evaluation_detail_firstdocWithSelectionViewModel GetBlankItemWithEmp(int? emp_id)
{
var i = new eva_create_evaluation_detail_firstdocWithSelectionViewModel();
var special_person = (from x in _repository.Context.eva_setup_permission
select x.employee_id).ToList();
var dep = (from x in emp.GetAllEmployee()
where x.id == emp_id
select x.department_id).FirstOrDefault();
var alldep = (from x in emp.GetDeptMapping()
where x.id == dep || x.id2 == dep || special_person.Contains(emp_id)
select x.id);
var option_1 = new external_linkageViewModel();
option_1.id_guid = Guid.Empty;
option_1.external_name = "ทั้งหมด";
var option_all = new List<external_linkageViewModel>();
option_all.Add(option_1);
var alleva = (from x in _repository.Context.eva_create_evaluation
join y in _repository.Context.eva_create_evaluation_detail on x.id equals y.create_evaluation_id
where x.employee_id == emp_id
|| x.supervisor1_id == emp_id
|| x.supervisor2_id == emp_id
|| y.chief == emp_id
|| y.eva_employee_id == emp_id
|| y.supervisor1_id == emp_id
|| y.supervisor2_id == emp_id
|| special_person.Contains(emp_id)
select y.employee_id).ToList();
i.item_org_id = (from q in ext.GetDepartmentData() where alldep.Contains(q.id) select q).ToList();
i.item_employee_id = (from x in emp.GetAllEmployee()
where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
&& alleva.Contains(x.id)
orderby x.fullname
select new external_linkageViewModel { external_id = x.id, external_name = x.fullname }
).ToList();
var allround = (from y in _repository.Context.eva_create_evaluation
select y.performance_plan_id).ToList();
i.item_evaluation_round_search = option_all.Union((from x in _repository.Context.eva_performance_plan
where allround.Contains(x.id)
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
)).ToList();
return i;
}
public eva_create_evaluation_detail_firstdocWithSelectionViewModel GetBlankItem()
{
var i = new eva_create_evaluation_detail_firstdocWithSelectionViewModel();
i.item_org_id = ext.GetDepartmentData();
i.item_employee_id = (from x in emp.GetAllEmployee()
where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
orderby x.fullname
select new external_linkageViewModel { external_id = x.id, external_name = x.fullname }
).ToList();
i.item_evaluation_round_search = (from x in _repository.Context.eva_performance_plan
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
).ToList();
return i;
}
@@ -245,7 +352,23 @@ namespace TodoAPI2.Models
public List<eva_create_evaluation_detail_firstdocViewModel> GetListBySearch(eva_create_evaluation_detail_firstdocSearchModel model, int? emp_id)
{
object special_person = (from x in _repository.Context.eva_setup_permission
select x.employee_id).ToArray();
if (string.IsNullOrEmpty(model.evaluation_round_search))
{
model.evaluation_round_search = (from x in _repository.Context.eva_performance_plan
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
).FirstOrDefault().id_guid.ToString();
}
else if (Guid.Parse(model.evaluation_round_search) == Guid.Empty)
{
model.evaluation_round_search = null;
}
var allemp = emp.GetListByemployee_type(null, null);
var dept = ext.GetDepartmentData();
var data = (
from m_eva_create_evaluation_detail_agreement in _repository.Context.eva_create_evaluation_detail
@@ -270,16 +393,24 @@ namespace TodoAPI2.Models
into planResult
from fk_planResult in planResult.DefaultIfEmpty()
join fk_external_linkage11 in ext.GetDepartmentData() on m_eva_create_evaluation_detail_agreement.help_org_id equals fk_external_linkage11.id
join fk_external_linkage11 in dept on m_eva_create_evaluation_detail_agreement.help_org_id equals fk_external_linkage11.id
into external_linkageResult11
from fk_external_linkageResult11 in external_linkageResult11.DefaultIfEmpty()
join fk_external_linkage12 in dept on fk_external_employee.department_id equals fk_external_linkage12.id
into external_linkageResult12
from fk_external_linkageResult12 in external_linkageResult12.DefaultIfEmpty()
where 1 == 1
&& (m_eva_create_evaluation_detail_agreement.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue)
&& (fk_external_employee.department_id == model.org_id || !model.org_id.HasValue)
&& (fk_external_employee.employee_no == model.search_employee_code || string.IsNullOrEmpty(model.search_employee_code))
&& (fk_external_employee.fullname.Contains(model.search_employee_fullname) || string.IsNullOrEmpty(model.search_employee_fullname))
&& (m_eva_create_evaluation_detail_agreement.employee_id == emp_id || m_eva_create_evaluation_detail_agreement.chief == emp_id)
&& (fk_external_employee.id == model.employee_id || !model.employee_id.HasValue)
&& (string.IsNullOrEmpty(model.evaluation_round_search) || fk_planResult.id == Guid.Parse(model.evaluation_round_search))
&& (m_eva_create_evaluation_detail_agreement.employee_id == emp_id
|| m_eva_create_evaluation_detail_agreement.chief == emp_id
|| ((int?[])special_person).Contains(emp_id)
|| fk_eva_create_evaluationResult10.employee_id == emp_id
)
orderby
fk_sort_depResult2.external_code,
@@ -290,7 +421,9 @@ namespace TodoAPI2.Models
fk_external_employee.hpt_position_type_id,
fk_external_employee.hpl_position_level_id,
fk_external_employee.employee_no
fk_external_employee.employee_no,
checkNull(fk_planResult.fiscal_year) descending,
checkNull(fk_planResult.theTime) descending
select new eva_create_evaluation_detail_firstdocViewModel()
{
id = m_eva_create_evaluation_detail_agreement.id,
@@ -313,7 +446,7 @@ namespace TodoAPI2.Models
status_chief_a = m_eva_create_evaluation_detail_agreement.status_chief_a,
status_supervisor = m_eva_create_evaluation_detail_agreement.status_supervisor,
org_id_external_linkage_external_name = !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) ? fk_external_linkageResult11.external_name : fk_external_linkageResult12.external_name,
status_self_click_date = m_eva_create_evaluation_detail_agreement.status_self_click_date,
status_chief_click_date = m_eva_create_evaluation_detail_agreement.status_chief_click_date,
@@ -331,7 +464,9 @@ namespace TodoAPI2.Models
m_eva_create_evaluation_detail_agreement.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_agreement.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_agreement.employee_id,
m_eva_create_evaluation_detail_agreement.status_self_a,
m_eva_create_evaluation_detail_agreement.status_chief_a),
m_eva_create_evaluation_detail_agreement.status_chief_a,
special_person
),
role_desc = getRoleName(emp_id,
m_eva_create_evaluation_detail_agreement.chief,
@@ -341,7 +476,9 @@ namespace TodoAPI2.Models
m_eva_create_evaluation_detail_agreement.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_agreement.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_agreement.employee_id,
m_eva_create_evaluation_detail_agreement.status_self_a,
m_eva_create_evaluation_detail_agreement.status_chief_a),
m_eva_create_evaluation_detail_agreement.status_chief_a,
special_person
),
isActive = m_eva_create_evaluation_detail_agreement.isActive,
Created = m_eva_create_evaluation_detail_agreement.created,

View File

@@ -52,6 +52,8 @@ namespace TodoAPI2.Models
public string status_supervisor { get; set; }
public string status_supervisor_a { get; set; }
public string remark_hrm_work_record { get; set; }
public string plan_round_year { get; set; }
@@ -63,6 +65,7 @@ namespace TodoAPI2.Models
public DateTime? status_chief_a_click_date { get; set; }
public DateTime? status_chief_click_date { get; set; }
public DateTime? status_supervisor_click_date { get; set; }
public DateTime? status_supervisor_a_click_date { get; set; }
public decimal? score1 { get; set; }
@@ -77,6 +80,8 @@ namespace TodoAPI2.Models
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_supervisor_a { get { return getStatusText(status_supervisor_a) + MyHelper.GetDateStringForReport(status_supervisor_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor_a_click_date) + getHistoryLink(status_supervisor_a); } }
public string role_desc { get; set; }
public string role_code { get; set; }
@@ -85,7 +90,7 @@ namespace TodoAPI2.Models
{
if (!string.IsNullOrEmpty(s))
{
return ("<br/><a href='javascript:window_open({0}../eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history?id=" + id.ToString() + "{0});'>ดูประวัติ</a>").Replace("{0}", '"'.ToString());
return ("<br/><a href='javascript:openHistory({0}../eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history?id=" + id.ToString() + "{0});'>ดูประวัติ</a>").Replace("{0}", '"'.ToString());
}
return "";
}

View File

@@ -8,6 +8,8 @@ namespace TodoAPI2.Models
public class eva_create_evaluation_detail_firstdocWithSelectionViewModel: eva_create_evaluation_detail_firstdocViewModel
{
public List<external_linkageViewModel> item_org_id { get; set; }
public List<external_linkageViewModel> item_employee_id { get; set; }
public List<external_linkageViewModel> item_evaluation_round_search { get; set; }
}
}

View File

@@ -27,8 +27,10 @@ namespace TodoAPI2.Models
public int? action_emp_id { get; set; }
public int? history_group { get; set; } // 1 = ข้อตกลง ,2 = การประเมินจริง
public void SetAutoField(DataContext context)
public void SetAutoField(DataContext context)
{
}

View File

@@ -18,6 +18,8 @@ namespace TodoAPI2.Models
public int? evaluation_detail_id { get; set; }
public int? history_group { get; set; }
}
}

View File

@@ -115,7 +115,8 @@ namespace TodoAPI2.Models
where
1 == 1
&& (!model.evaluation_detail_id.HasValue || m_eva_create_evaluation_detail_history.evaluation_detail_id == model.evaluation_detail_id)
&& m_eva_create_evaluation_detail_history.evaluation_detail_id == model.evaluation_detail_id
&& model.history_group == m_eva_create_evaluation_detail_history.history_group
orderby m_eva_create_evaluation_detail_history.action_dt
select new eva_create_evaluation_detail_historyViewModel()

View File

@@ -18,7 +18,7 @@ namespace TodoAPI2.Models
public DateTime? action_dt { get; set; }
public string txt_action_dt { get { return MyHelper.GetDateStringForReport(this.action_dt); } }
public string txt_action_dt { get { return MyHelper.GetDateStringForReport(this.action_dt) + " " + MyHelper.GetTimeStringFromDate(this.action_dt); } }
public string action_detail { get; set; }

View File

@@ -14,10 +14,9 @@ namespace TodoAPI2.Models
{
List<eva_create_evaluation_detail_processViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id, int? emp_id, string path);
List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model, int? emp_id, string path);
eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id, int? emp_id, string path);
eva_create_evaluation_detail_processWithSelectionViewModel GetBlankItem();
eva_create_evaluation_detail_processWithSelectionViewModel GetBlankItemWithEmp(int? emp_id);
eva_create_evaluation_detail_processWithSelectionViewModel Get(int id, int? emp_id, string path);
DataContext GetDataContext();
}

View File

@@ -24,6 +24,8 @@ namespace TodoAPI2.Models
public int? employee_id { get; set; }
public string evaluation_round_search { get; set; }
public string path { get; set; }
}
}

View File

@@ -74,6 +74,9 @@ namespace TodoAPI2.Models
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
select x.employee_id).ToArray();
var allemp = emp.GetListByemployee_type(null, null);
var plan_id = (from m_eva_create_evaluation_detail_process in _repository.Context.eva_create_evaluation_detail
@@ -89,6 +92,20 @@ namespace TodoAPI2.Models
var start_date = getPlanStart(plan_id);
var end_date = getPlanEnd(plan_id);
var plan = (from i in _repository.Context.eva_performance_plan
where i.id == plan_id
select i).FirstOrDefault();
var leave_start_date = plan.start_leave;
var leave_end_date = plan.end_leave;
var plan_remark = plan.remark;
if (!string.IsNullOrEmpty(plan_remark))
{
plan_remark = "<b>หมายเหตุ</b> " + plan_remark;
}
var data = (
from m_eva_create_evaluation_detail_process in _repository.Context.eva_create_evaluation_detail
@@ -116,7 +133,7 @@ namespace TodoAPI2.Models
into external_supervisor2AResult
from fk_external_supervisor2A in external_supervisor2AResult.DefaultIfEmpty()
where m_eva_create_evaluation_detail_process.id == id
@@ -167,14 +184,16 @@ namespace TodoAPI2.Models
m_eva_create_evaluation_detail_process.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_process.eva_employee_id : fk_eva_create_evaluationResult10.employee_id,
m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
path),
path,
special_person),
role_desc = getRoleName(emp_id, m_eva_create_evaluation_detail_process.chief,
m_eva_create_evaluation_detail_process.chief,
m_eva_create_evaluation_detail_process.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_process.eva_employee_id : fk_eva_create_evaluationResult10.employee_id,
m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
path),
path,
special_person),
remark_hrm_work_record = fk_external_employee.remark_hrm_work_record
+ GetWorkTimeText(fk_external_employee.packing_date, end_date),
@@ -187,7 +206,24 @@ namespace TodoAPI2.Models
isActive = m_eva_create_evaluation_detail_process.isActive,
Created = m_eva_create_evaluation_detail_process.created,
Updated = m_eva_create_evaluation_detail_process.updated
Updated = m_eva_create_evaluation_detail_process.updated,
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,
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,
employee_position_level_text = fk_external_employee.position_level_text,
chief_position_level_text = fk_external_chief.position_level_text,
leave_start_date = leave_start_date,
leave_end_date = leave_end_date,
plan_remark = plan_remark,
//eva_detail_remark = m_eva_create_evaluation_detail_process.remark
}
).ToList();
@@ -196,22 +232,113 @@ namespace TodoAPI2.Models
public eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id, int? emp_id, string path)
{
var item = Get(id, emp_id, path);
item.item_org_id = ext.GetDepartmentData();
var special_person = (from x in _repository.Context.eva_setup_permission
select x.employee_id).ToList();
var dep = (from x in emp.GetAllEmployee()
where x.id == emp_id
select x.department_id).FirstOrDefault();
var alldep = (from x in emp.GetDeptMapping()
where x.id == dep || x.id2 == dep || special_person.Contains(emp_id)
select x.id);
var option_1 = new external_linkageViewModel();
option_1.id_guid = Guid.Empty;
option_1.external_name = "ทั้งหมด";
var option_all = new List<external_linkageViewModel>();
option_all.Add(option_1);
var alleva = (from x in _repository.Context.eva_create_evaluation
join y in _repository.Context.eva_create_evaluation_detail on x.id equals y.create_evaluation_id
where x.employee_id == emp_id
|| x.supervisor1_id == emp_id
|| x.supervisor2_id == emp_id
|| y.chief == emp_id
|| y.eva_employee_id == emp_id
|| y.supervisor1_id == emp_id
|| y.supervisor2_id == emp_id
|| special_person.Contains(emp_id)
select y.employee_id).ToList();
item.item_org_id = (from i in ext.GetDepartmentData() where alldep.Contains(i.id) select i).ToList();
item.item_level_score = (from i in _repository.Context.eva_level_score
orderby i.min_score
select Mapper.Map<eva_level_scoreViewModel>(i)).ToList();
item.item_employee_id = (from x in emp.GetAllEmployee() where x.count_resigns == 0 select x).ToList();
orderby i.min_score
select Mapper.Map<eva_level_scoreViewModel>(i)).ToList();
item.item_employee_id = (from x in emp.GetAllEmployee()
where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
&& alleva.Contains(x.id)
orderby x.fullname
select x).ToList();
var allround = (from y in _repository.Context.eva_create_evaluation
select y.performance_plan_id).ToList();
item.item_evaluation_round_search = option_all.Union((from x in _repository.Context.eva_performance_plan
where allround.Contains(x.id)
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
)).ToList();
return item;
}
public eva_create_evaluation_detail_processWithSelectionViewModel GetBlankItemWithEmp(int? emp_id)
{
var i = new eva_create_evaluation_detail_processWithSelectionViewModel();
var special_person = (from x in _repository.Context.eva_setup_permission
select x.employee_id).ToList();
var dep = (from x in emp.GetAllEmployee()
where x.id == emp_id
select x.department_id).FirstOrDefault();
var alldep = (from x in emp.GetDeptMapping()
where x.id == dep || x.id2 == dep || special_person.Contains(emp_id)
select x.id);
var option_1 = new external_linkageViewModel();
option_1.id_guid = Guid.Empty;
option_1.external_name = "ทั้งหมด";
var option_all = new List<external_linkageViewModel>();
option_all.Add(option_1);
var alleva = (from x in _repository.Context.eva_create_evaluation
join y in _repository.Context.eva_create_evaluation_detail on x.id equals y.create_evaluation_id
where x.employee_id == emp_id
|| x.supervisor1_id == emp_id
|| x.supervisor2_id == emp_id
|| y.chief == emp_id
|| y.eva_employee_id == emp_id
|| y.supervisor1_id == emp_id
|| y.supervisor2_id == emp_id
|| special_person.Contains(emp_id)
select y.employee_id).ToList();
i.item_org_id = (from q in ext.GetDepartmentData() where alldep.Contains(q.id) select q).ToList();
i.item_employee_id = (from x in emp.GetAllEmployee()
where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
&& alleva.Contains(x.id)
orderby x.fullname
select x).ToList();
var allround = (from y in _repository.Context.eva_create_evaluation
select y.performance_plan_id).ToList();
i.item_evaluation_round_search = option_all.Union((from x in _repository.Context.eva_performance_plan
where allround.Contains(x.id)
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
)).ToList();
return i;
}
public eva_create_evaluation_detail_processWithSelectionViewModel GetBlankItem()
{
var i = new eva_create_evaluation_detail_processWithSelectionViewModel();
i.item_org_id = ext.GetDepartmentData();
i.item_employee_id = (from x in emp.GetAllEmployee() where x.count_resigns == 0 select x).ToList();
//i.item_level_score = (from j in _repository.Context.eva_level_score
// orderby j.min_score
// select Mapper.Map<eva_level_scoreViewModel>(i)).ToList();
i.item_employee_id = (from x in emp.GetAllEmployee() where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา" select x).ToList();
i.item_evaluation_round_search = (from x in _repository.Context.eva_performance_plan
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
).ToList();
return i;
}
@@ -238,6 +365,21 @@ namespace TodoAPI2.Models
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
select x.employee_id).ToArray();
if (string.IsNullOrEmpty(model.evaluation_round_search))
{
model.evaluation_round_search = (from x in _repository.Context.eva_performance_plan
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
).FirstOrDefault().id_guid.ToString();
}
else if(Guid.Parse(model.evaluation_round_search) == Guid.Empty)
{
model.evaluation_round_search = null;
}
var allemp = emp.GetListByemployee_type(null, null);
var all_org_id = from i in ext.GetAllChildInDep(model.org_id) select i.external_id;
@@ -273,12 +415,14 @@ namespace TodoAPI2.Models
&& (all_org_id.Contains(fk_external_employee.department_id) || !model.org_id.HasValue)
&& (fk_external_employee.employee_no == model.search_employee_code || string.IsNullOrEmpty(model.search_employee_code))
&& (fk_external_employee.fullname.Contains(model.search_employee_fullname) || string.IsNullOrEmpty(model.search_employee_fullname))
&& (string.IsNullOrEmpty(model.evaluation_round_search) || fk_planResult.id == Guid.Parse(model.evaluation_round_search))
&& emp_id.HasValue
&& (
(m_eva_create_evaluation_detail_process.chief.HasValue && emp_id == m_eva_create_evaluation_detail_process.chief)
|| (((m_eva_create_evaluation_detail_process.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_process.eva_employee_id : fk_eva_create_evaluationResult10.employee_id)).HasValue && emp_id == (m_eva_create_evaluation_detail_process.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_process.eva_employee_id : fk_eva_create_evaluationResult10.employee_id))
|| ((m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id).HasValue && emp_id == (m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id))
|| ((m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id).HasValue && emp_id == (m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id))
|| ((int?[])special_person).Contains(emp_id)
)
&& (!model.employee_id.HasValue || m_eva_create_evaluation_detail_process.employee_id == model.employee_id)
@@ -288,7 +432,9 @@ namespace TodoAPI2.Models
//fk_external_employee.department_code,
fk_external_employee.hpt_position_type_id,
fk_external_employee.hpl_position_level_id,
fk_external_employee.employee_no
fk_external_employee.employee_no,
fk_planResult.fiscal_year descending,
fk_planResult.theTime descending
select new eva_create_evaluation_detail_processViewModel()
{
id = m_eva_create_evaluation_detail_process.id,
@@ -321,7 +467,8 @@ namespace TodoAPI2.Models
m_eva_create_evaluation_detail_process.eva_employee_id.HasValue? m_eva_create_evaluation_detail_process.eva_employee_id : fk_eva_create_evaluationResult10.employee_id,
m_eva_create_evaluation_detail_process.supervisor1_id.HasValue? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
m_eva_create_evaluation_detail_process.status_chief
m_eva_create_evaluation_detail_process.status_chief,
special_person
),
role_desc = getRoleName(emp_id, m_eva_create_evaluation_detail_process.chief,
@@ -329,7 +476,8 @@ namespace TodoAPI2.Models
m_eva_create_evaluation_detail_process.eva_employee_id.HasValue ? m_eva_create_evaluation_detail_process.eva_employee_id : fk_eva_create_evaluationResult10.employee_id,
m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id,
m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id,
path),
path,
special_person),
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,
@@ -357,7 +505,7 @@ namespace TodoAPI2.Models
return "";
}
private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path)
private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person)
{
if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && path == "d2") return "2";
else if (emp_id == chief) return "1";
@@ -365,10 +513,11 @@ namespace TodoAPI2.Models
else if (emp_id == supervisor2) return "2";
else if (emp_id == supervisor1A) return "3";
else if (emp_id == supervisor2A) return "4";
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)
private string getRoleCodeSearch(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string status_chief, object special_person)
{
if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && status_chief=="Y") return "2";
else if (emp_id == chief) return "1";
@@ -376,10 +525,11 @@ namespace TodoAPI2.Models
else if (emp_id == supervisor2) return "2";
else if (emp_id == supervisor1A) return "3";
else if (emp_id == supervisor2A) return "4";
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)
private string getRoleName(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person)
{
if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && path == "d2") return "ผู้ประเมินสูงสุด";
else if (emp_id == chief) return "ผู้ประเมิน";
@@ -387,6 +537,7 @@ namespace TodoAPI2.Models
else if (emp_id == supervisor2) return "ผู้ประเมินสูงสุด";
else if (emp_id == supervisor1A) return "ผู้บังคับบัญชาเหนือขึ้นไป";
else if (emp_id == supervisor2A) return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)";
if (((int?[])special_person).Contains(emp_id)) return "ผู้ตรวจสอบ";
return "";
}

View File

@@ -23,7 +23,6 @@ namespace TodoAPI2.Models
public string employee_profile_picture { get; set; }
public string employee_position { get; set; }
public string employee_position_type { get; set; }
public string employee_position_level { get; set; }
@@ -98,7 +97,7 @@ namespace TodoAPI2.Models
{
if (!string.IsNullOrEmpty(s))
{
return ("<br/><a href='javascript:window_open({0}../eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history?id=" + id.ToString() + "{0});'>ดูประวัติ</a>").Replace("{0}", '"'.ToString());
return ("<br/><a href='javascript:openHistory({0}../eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history?id=" + id.ToString() + "{0});'>ดูประวัติ</a>").Replace("{0}", '"'.ToString());
}
return "";
}

View File

@@ -13,6 +13,8 @@ namespace TodoAPI2.Models
public List<external_employeeViewModel> item_employee_id { get; set; }
public List<external_linkageViewModel> item_evaluation_round_search { get; set; }
public decimal? create_evaluation_score1 { get; set; }
public decimal? create_evaluation_score2 { get; set; }
@@ -23,5 +25,24 @@ namespace TodoAPI2.Models
public int? selected_round { get; set; }
public int? fiscal_year { get; set; }
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? 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 employee_position_level_text { get; set; }
public string chief_position_level_text { get; set; }
public DateTime? leave_start_date { get; set; }
public DateTime? leave_end_date { get; set; }
public string plan_remark { get; set; }
public string eva_detail_remark { get; set; }
}
}

View File

@@ -162,7 +162,7 @@ namespace TodoAPI2.Models
return Get(inserted.id);
}
private void add_history(DateTime? dt, string action, int? action_user_id, int? detail_id)
private void add_history(DateTime? dt, string action, int? action_user_id, int? detail_id, int? group)
{
int? newkey = 0;
@@ -181,6 +181,7 @@ namespace TodoAPI2.Models
n.action_dt = dt;
n.action_emp_id = action_user_id;
n.evaluation_detail_id = detail_id;
n.history_group = group;
_repository.Context.Add(n);
}
@@ -225,7 +226,7 @@ namespace TodoAPI2.Models
noti_to_employee_id = existingEntity.chief;
noti_message = "กรุณาตรวจสอบ ข้อตกลงการประเมิน ของ {0}";
noti_url = "/eva/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "ส่งข้อตกลงการประเมิน", model.employee_id, existingEntity.id);
add_history(DateTime.Now, "ส่งข้อตกลงการประเมิน", model.employee_id, existingEntity.id, 1);
}
else if (model.status_mode == "backB")
{
@@ -234,21 +235,31 @@ namespace TodoAPI2.Models
noti_to_employee_id = existingEntity.employee_id;
noti_message = "ข้อตกลงการประเมินของคุณ ({0}) ถูกตีกลับ";
noti_url = "/eva/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "ข้อตกลงการประเมิน ถูกตีกลับ", model.employee_id, existingEntity.id);
add_history(DateTime.Now, "ข้อตกลงการประเมิน ถูกตีกลับ", model.employee_id, existingEntity.id, 1);
}
else if (model.status_mode == "nextB")
{
existingEntity.status_chief_a_click_date = DateTime.Now;
if (current_eva.employee_id == existingEntity.chief) // หัวหน้าและผู้ประเมินสูงสุด เป็นคนคนเดียวกัน
{
noti_to_employee_id = current_eva.supervisor1_id;
}
else
{
noti_to_employee_id = current_eva.employee_id;
}
need_noti = false;
add_history(DateTime.Now, "อนุมัติ ข้อตกลงการประเมิน", existingEntity.chief, existingEntity.id);
existingEntity.status_supervisor_a_click_date = null;
noti_to_employee_id = current_eva.employee_id;
noti_message = "กรุณาตรวจสอบ ข้อตกลงการประเมิน ของ {0}";
noti_url = "/eva/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "ส่งข้อตกลงการประเมิน", model.employee_id, existingEntity.id, 1);
}
else if (model.status_mode == "backC")
{
existingEntity.status_supervisor_a_click_date = DateTime.Now;
existingEntity.status_chief_a_click_date = null;
noti_to_employee_id = existingEntity.chief;
noti_message = "ข้อตกลงการประเมินของคุณ ({0}) ถูกตีกลับ";
noti_url = "/eva/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "ข้อตกลงการประเมิน ถูกตีกลับ", model.employee_id, existingEntity.id, 1);
}
else if (model.status_mode == "nextC")
{
existingEntity.status_supervisor_a_click_date = DateTime.Now;
noti_to_employee_id = existingEntity.employee_id;
add_history(DateTime.Now, "อนุมัติ ข้อตกลงการประเมิน", current_eva.employee_id, existingEntity.id, 1);
}
else if (model.status_mode == "next0")
{
@@ -260,7 +271,7 @@ namespace TodoAPI2.Models
noti_to_employee_id2 = owner_eva_employee_id;
noti_message2 = "แบบประเมินของ {0} ได้ถูกส่งต่อไปยังขั้นตอนถัดไปแล้ว";
noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "ส่งแบบประเมิน", model.employee_id, existingEntity.id);
add_history(DateTime.Now, "ส่งแบบประเมิน", model.employee_id, existingEntity.id, 2);
}
else if (model.status_mode == "next1")
{
@@ -279,9 +290,9 @@ namespace TodoAPI2.Models
existingEntity.status_chief_click_date = DateTime.Now;
existingEntity.status_self_click_date = null;
noti_to_employee_id = existingEntity.employee_id;
noti_message = "ข้อตกลงการประเมินของคุณ ({0}) ถูกตีกลับ";
noti_message = "แบบประเมินของคุณ ({0}) ถูกตีกลับ";
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "ข้อตกลงการประเมิน ถูกตีกลับ โดยผู้ประเมิน", model.employee_id, existingEntity.id);
add_history(DateTime.Now, "ข้อตกลงการประเมิน ถูกตีกลับ โดยผู้ประเมิน", model.employee_id, existingEntity.id, 2);
}
else if (model.status_mode == "next2")
{
@@ -291,7 +302,7 @@ namespace TodoAPI2.Models
noti_to_employee_id2 = owner_eva_employee_id;
noti_message2 = "แบบประเมินของ {0} ได้ถูกส่งต่อไปยังขั้นตอนถัดไปแล้ว";
noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "ผู้ประเมินสูงสุด อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id);
add_history(DateTime.Now, "ผู้ประเมินสูงสุด อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id, 2);
}
else if (model.status_mode == "back2")
{
@@ -300,7 +311,7 @@ namespace TodoAPI2.Models
noti_to_employee_id = existingEntity.chief;
noti_message = "แบบประเมินของ {0} ถูกตีกลับ";
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "แบบประเมิน ถูกตีกลับ โดยผู้ประเมินสูงสุด", model.employee_id, existingEntity.id);
add_history(DateTime.Now, "แบบประเมิน ถูกตีกลับ โดยผู้ประเมินสูงสุด", model.employee_id, existingEntity.id, 2);
}
else if (model.status_mode == "next3")
{
@@ -310,7 +321,7 @@ namespace TodoAPI2.Models
noti_to_employee_id2 = owner_eva_employee_id;
noti_message2 = "แบบประเมินของ {0} ได้ถูกส่งต่อไปยังขั้นตอนถัดไปแล้ว";
noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id);
add_history(DateTime.Now, "ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id, 2);
}
else if (model.status_mode == "back3")
{
@@ -319,7 +330,7 @@ namespace TodoAPI2.Models
noti_to_employee_id = current_eva.employee_id;
noti_message = "แบบประเมินของ {0} ถูกตีกลับ";
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "แบบประเมินถูกตีกลับ โดย ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง", model.employee_id, existingEntity.id);
add_history(DateTime.Now, "แบบประเมินถูกตีกลับ โดย ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง", model.employee_id, existingEntity.id, 2);
}
else if (model.status_mode == "next4")
{
@@ -328,7 +339,7 @@ namespace TodoAPI2.Models
noti_to_employee_id2 = owner_eva_employee_id;
noti_message2 = "แบบประเมินของ {0} ได้รับการประเมินเรียบร้อยแล้ว";
noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด) อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id);
add_history(DateTime.Now, "ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด) อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id, 2);
}
else if (model.status_mode == "back4")
{
@@ -337,7 +348,7 @@ namespace TodoAPI2.Models
noti_to_employee_id = current_eva.supervisor1_id;
noti_message = "แบบประเมินของ {0} ถูกตีกลับ";
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString();
add_history(DateTime.Now, "แบบประเมินถูกตีกลับ โดย ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)", model.employee_id, existingEntity.id);
add_history(DateTime.Now, "แบบประเมินถูกตีกลับ โดย ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)", model.employee_id, existingEntity.id, 2);
}
if (need_noti)

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_level_score_detailService : IBaseService2<Guid, eva_level_score_detailInputModel, eva_level_score_detailViewModel>
{
new eva_level_score_detailViewModel Insert(eva_level_score_detailInputModel model, bool is_force_save);
new eva_level_score_detailViewModel Update(Guid id, eva_level_score_detailInputModel model, bool is_force_save);
List<eva_level_score_detailViewModel> GetListBylevel_score_id(Guid level_score_id);
List<eva_level_score_detailViewModel> GetListBySearch(eva_level_score_detailSearchModel model);
string UpdateMultiple(List<eva_level_score_detailInputModel> model, bool is_force_save);
eva_level_score_detailWithSelectionViewModel GetWithSelection(Guid id);
eva_level_score_detailWithSelectionViewModel GetBlankItem();
void RefreshAutoFieldOfAllData();
eva_level_score_detailEntity GetEntity(Guid id);
DataContext GetContext();
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using System.IO;
namespace TodoAPI2.Models
{
public class eva_level_score_detailEntity : BaseEntity2<Guid>
{
[ForeignKey("level_score_id")]
public eva_level_scoreEntity eva_level_score_level_score_id { get; set; }
public Guid level_score_id { get; set; }
public decimal? min_value { get; set; }
public decimal? max_value { get; set; }
public decimal? min_percentage { get; set; }
public decimal? max_percentage { get; set; }
public void SetAutoField(DataContext context)
{
}
public void DoAfterInsertUpdate(DataContext context)
{
}
}
}

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_level_score_detailInputModel
{
public Guid? id { get; set; }
public Guid level_score_id { get; set; }
public decimal? min_value { get; set; }
public decimal? max_value { get; set; }
public decimal? min_percentage { get; set; }
public decimal? max_percentage { 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_level_score_detailReportRequestModel : eva_level_score_detailSearchModel
{
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_level_score_detailSearchModel
{
public Guid id { get; set; }
public Guid level_score_id { get; set; }
}
}

View File

@@ -0,0 +1,288 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.IO;
using System.Web;
using System.Net;
using TTSW.Configure;
using Microsoft.Extensions.Options;
using System.Data;
namespace TodoAPI2.Models
{
public class eva_level_score_detailService : Ieva_level_score_detailService
{
private IBaseRepository2<eva_level_score_detailEntity, Guid> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
public eva_level_score_detailService(IBaseRepository2<eva_level_score_detailEntity, Guid> repository, IMyDatabase mydb, Iexternal_linkageService inext)
{
_repository = repository;
db = mydb;
ext = inext;
}
#region Private Functions
private eva_level_score_detailEntity GetEntity(eva_level_score_detailInputModel model)
{
return Mapper.Map<eva_level_score_detailEntity>(model);
}
private List<eva_level_score_detailEntity> GetEntityList(List<eva_level_score_detailInputModel> models)
{
return Mapper.Map<List<eva_level_score_detailEntity>>(models);
}
private eva_level_score_detailViewModel GetDto(eva_level_score_detailEntity entity)
{
return Mapper.Map<eva_level_score_detailViewModel>(entity);
}
private List<eva_level_score_detailViewModel> GetDtoList(List<eva_level_score_detailEntity> entities)
{
return Mapper.Map<List<eva_level_score_detailViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public eva_level_score_detailViewModel Get(Guid id)
{
var entity = _repository.Get(id);
return GetDto(entity);
}
public eva_level_score_detailEntity GetEntity(Guid id)
{
var entity = _repository.Get(id);
return entity;
}
public DataContext GetContext()
{
return _repository.Context;
}
public eva_level_score_detailWithSelectionViewModel GetWithSelection(Guid id)
{
var entity = _repository.Get(id);
var i = Mapper.Map<eva_level_score_detailWithSelectionViewModel>(entity);
return i;
}
public eva_level_score_detailWithSelectionViewModel GetBlankItem()
{
var i = new eva_level_score_detailWithSelectionViewModel();
return i;
}
public List<eva_level_score_detailViewModel> GetListBylevel_score_id(Guid level_score_id)
{
var model = new eva_level_score_detailSearchModel();
model.level_score_id = level_score_id;
return GetListBySearch(model);
}
public List<eva_level_score_detailViewModel> GetListBySearch(eva_level_score_detailSearchModel model)
{
var data = (
from m_eva_level_score_detail in _repository.Context.eva_level_score_detail
join fk_eva_level_score1 in _repository.Context.eva_level_score on m_eva_level_score_detail.level_score_id equals fk_eva_level_score1.id
into eva_level_scoreResult1
from fk_eva_level_scoreResult1 in eva_level_scoreResult1.DefaultIfEmpty()
where
1 == 1
&& (m_eva_level_score_detail.level_score_id == model.level_score_id)
orderby m_eva_level_score_detail.min_value descending
select new eva_level_score_detailViewModel()
{
id = m_eva_level_score_detail.id,
level_score_id = m_eva_level_score_detail.level_score_id,
min_value = m_eva_level_score_detail.min_value,
max_value = m_eva_level_score_detail.max_value,
min_percentage = m_eva_level_score_detail.min_percentage,
max_percentage = m_eva_level_score_detail.max_percentage,
level_score_id_eva_level_score_code = fk_eva_level_scoreResult1.code,
isActive = m_eva_level_score_detail.isActive,
Created = m_eva_level_score_detail.created,
Updated = m_eva_level_score_detail.updated
}
).Take(1000).ToList();
return data;
}
#endregion
#region Manipulation Functions
public eva_level_score_detailViewModel Insert(eva_level_score_detailInputModel model, bool is_force_save)
{
var entity = GetEntity(model);
entity.id = Guid.NewGuid();
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_level_score_detailViewModel>(entity);
}
}
public eva_level_score_detailViewModel Update(Guid id, eva_level_score_detailInputModel model, bool is_force_save)
{
var existingEntity = _repository.Get(id);
if (existingEntity != null)
{
existingEntity.level_score_id = model.level_score_id;
existingEntity.min_value = model.min_value;
existingEntity.max_value = model.max_value;
existingEntity.min_percentage = model.min_percentage;
existingEntity.max_percentage = model.max_percentage;
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_level_score_detailViewModel>(existingEntity);
}
}
else
throw new NotificationException("No data to update");
}
public string UpdateMultiple(List<eva_level_score_detailInputModel> 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.level_score_id = i.level_score_id;
existingEntity.min_value = i.min_value;
existingEntity.max_value = i.max_value;
existingEntity.min_percentage = i.min_percentage;
existingEntity.max_percentage = i.max_percentage;
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 = Guid.NewGuid();
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_level_score_detailViewModel SetAsActive(Guid id)
{
var updated = _repository.SetAsActive(id);
return Get(updated.id);
}
public eva_level_score_detailViewModel SetAsInactive(Guid id)
{
var updated = _repository.SetAsInActive(id);
return Get(updated.id);
}
public void Delete(Guid id)
{
_repository.Delete(id);
return;
}
public void RefreshAutoFieldOfAllData()
{
var all_items = from i in _repository.Context.eva_level_score_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("level_score_id", "level_score_id");
i.Add("level_score_id_eva_level_score_code", "level_score_id");
i.Add("min_value", "ช่วงคะแนนต่ำสุด");
i.Add("max_value", "ช่วงคะแนนสูงสุด");
i.Add("min_percentage", "ร้อยละที่ได้เลื่อนต่ำสุด");
i.Add("max_percentage", "ร้อยละที่ได้เลื่อนสูงสุด");
return i;
}
#endregion
#region Match Item
#endregion
#endregion
}
}

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_level_score_detailViewModel : BaseViewModel2<Guid>
{
public Guid level_score_id { get; set; }
public decimal? min_value { get; set; }
public decimal? max_value { get; set; }
public decimal? min_percentage { get; set; }
public decimal? max_percentage { get; set; }
public string level_score_id_eva_level_score_code { get; set; }
}
}

View File

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

View File

@@ -35,6 +35,9 @@ namespace TodoAPI2.Models
[MaxLength(4000)]
public string remark { get; set; }
[MaxLength(4000)]
public string remark2 { get; set; }
public int? main_dept_id { get; set; }
public void SetAutoField(DataContext context)
{

View File

@@ -30,6 +30,8 @@ namespace TodoAPI2.Models
public string remark { get; set; }
public string remark2 { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -102,6 +102,12 @@ namespace TodoAPI2.Models
public List<eva_limit_frame_groupViewModel> GetListBySearch(eva_limit_frame_groupSearchModel model)
{
var group_count = (from i in _repository.Context.eva_limit_frame_employee
join j in _repository.Context.eva_limit_frame_group on i.frame_group_guid equals j.id
where j.frame_plan_guid == model.frame_plan_guid
group i.id by j.id into g
select new { gid = g.Key, emp = g.Count() }).ToList();
var data = (
from m_eva_limit_frame_group in _repository.Context.eva_limit_frame_group
@@ -113,14 +119,12 @@ namespace TodoAPI2.Models
into eva_evaluation_groupResult2
from fk_eva_evaluation_groupResult2 in eva_evaluation_groupResult2.DefaultIfEmpty()
where
1 == 1
where
1 == 1
&& (!model.frame_plan_guid.HasValue || m_eva_limit_frame_group.frame_plan_guid == model.frame_plan_guid)
&& (!model.group_guid.HasValue || m_eva_limit_frame_group.group_guid == model.group_guid)
orderby fk_eva_evaluation_groupResult2.code
orderby fk_eva_evaluation_groupResult2.code
select new eva_limit_frame_groupViewModel()
{
id = m_eva_limit_frame_group.id,
@@ -130,11 +134,14 @@ namespace TodoAPI2.Models
total_salary = m_eva_limit_frame_group.total_salary,
total_salary_limit = m_eva_limit_frame_group.total_salary_limit,
total_salary_limit_rounded = m_eva_limit_frame_group.total_salary_limit_rounded,
remark = m_eva_limit_frame_group.remark,
remark = !string.IsNullOrEmpty(m_eva_limit_frame_group.remark2) ? m_eva_limit_frame_group.remark2 : m_eva_limit_frame_group.remark,
remark2 = m_eva_limit_frame_group.remark2,
frame_plan_guid_eva_limit_frame_plan_executed_date = fk_eva_limit_frame_planResult1.executed_date,
group_guid_eva_evaluation_group_code = fk_eva_evaluation_groupResult2.thegroup,
emp_qty = (from x in group_count where x.gid == m_eva_limit_frame_group.id select x.emp).FirstOrDefault(),
isActive = m_eva_limit_frame_group.isActive,
Created = m_eva_limit_frame_group.created,
Updated = m_eva_limit_frame_group.updated
@@ -195,7 +202,8 @@ namespace TodoAPI2.Models
existingEntity.total_salary = model.total_salary;
existingEntity.total_salary_limit = model.total_salary_limit;
existingEntity.total_salary_limit_rounded = model.total_salary_limit_rounded;
existingEntity.remark = model.remark;
existingEntity.remark = "";
existingEntity.remark2 = model.remark2;
int j = 1;
foreach (var y in from z in _repository.Context.eva_limit_frame_employee where z.frame_group_guid == model.id orderby z.order_of_data select z)
@@ -249,8 +257,9 @@ namespace TodoAPI2.Models
existingEntity.total_salary_limit = i.total_salary_limit;
existingEntity.total_salary_limit_rounded = i.total_salary_limit_rounded;
existingEntity.remark = i.remark;
existingEntity.remark2 = i.remark2;
existingEntity.SetAutoField(_repository.Context);
existingEntity.SetAutoField(_repository.Context);
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}
}
@@ -321,7 +330,8 @@ namespace TodoAPI2.Models
i.Add("total_salary", "อัตราเงินเดือนรวม");
i.Add("total_salary_limit", "วงเงินในการเลื่อนเงินเดือน");
i.Add("total_salary_limit_rounded", "วงเงินในการเลื่อนเงินเดือน ที่ใช้จริง");
i.Add("remark", "หมายเหตุ");
i.Add("remark", "หมายเหตุ");
i.Add("remark2", "หมายเหตุ กรอกเอง");
return i;
}

View File

@@ -28,9 +28,13 @@ namespace TodoAPI2.Models
public string remark { get; set; }
public string remark2 { get; set; }
public DateTime? frame_plan_guid_eva_limit_frame_plan_executed_date { get; set; }
public string group_guid_eva_evaluation_group_code { get; set; }
public int? emp_qty { get; set; }
public string remark_formatted {
get
{

View File

@@ -15,26 +15,46 @@ namespace TodoAPI2.Models
public class eva_performance_planEntity : BaseEntity<Guid>
{
public int? fiscal_year { get; set; }
public int? theTime { get; set; }
public decimal? percent { get; set; }
public DateTime? start_leave { get; set; }
public DateTime? end_leave { get; set; }
[MaxLength(500)]
public string remark { get; set; }
[NotMapped]
public string display_text
{
get
{
if(!theTime.HasValue || !fiscal_year.HasValue)
if (!theTime.HasValue || !fiscal_year.HasValue)
{
return "";
}
else
{
return theTime.ToString() + "/" + fiscal_year.ToString();
}
}
}
}
public void SetAutoField(DataContext context)
{
}
public void DoAfterInsertUpdate(DataContext context)
{
}
}
}

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