เพิ่มประวัติ การดำเนินกิจกรรมการประเมิน
This commit is contained in:
@@ -0,0 +1,403 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using TTSW.Controllers;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
using TodoAPI2.Models;
|
||||
using System.Data;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
||||
namespace TodoAPI2.Controllers
|
||||
{
|
||||
//[Authorize]
|
||||
[Produces("application/json")]
|
||||
[Route("api/eva_create_evaluation_detail_history")]
|
||||
public class eva_create_evaluation_detail_historyController : BaseController
|
||||
{
|
||||
#region Private Variables
|
||||
private ILogger<eva_create_evaluation_detail_historyController> _logger;
|
||||
private Ieva_create_evaluation_detail_historyService _repository;
|
||||
private IConfiguration Configuration { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Default constructure for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="repository"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="logger"></param>
|
||||
public eva_create_evaluation_detail_historyController(ILogger<eva_create_evaluation_detail_historyController> logger, Ieva_create_evaluation_detail_historyService repository, IConfiguration configuration)
|
||||
{
|
||||
_logger = logger;
|
||||
_repository = repository;
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get specific item by id
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <returns>Return Get specific item by id</returns>
|
||||
/// <response code="200">Returns the item</response>
|
||||
/// <response code="500">Error Occurred</response>
|
||||
[HttpGet("{id}")]
|
||||
[ProducesResponseType(typeof(eva_create_evaluation_detail_historyWithSelectionViewModel), 200)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(500)]
|
||||
//[ValidateAntiForgeryToken]
|
||||
public IActionResult Get(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
var result = _repository.GetWithSelection(id);
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical($"Exception in IActionResult Get.", ex);
|
||||
return StatusCode(500, $"{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Blank Item
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <returns>Return a blank item</returns>
|
||||
/// <response code="200">Returns the item</response>
|
||||
/// <response code="500">Error Occurred</response>
|
||||
[HttpGet("GetBlankItem")]
|
||||
[ProducesResponseType(typeof(eva_create_evaluation_detail_historyWithSelectionViewModel), 200)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(500)]
|
||||
//[ValidateAntiForgeryToken]
|
||||
public IActionResult GetBlankItem()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
var result = _repository.GetBlankItem();
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex);
|
||||
return StatusCode(500, $"{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get list items by evaluation_detail_id
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <returns>Return list of items by specifced keyword</returns>
|
||||
/// <response code="200">Returns the item</response>
|
||||
/// <response code="500">Error Occurred</response>
|
||||
[HttpGet("")]
|
||||
[ProducesResponseType(typeof(List<eva_create_evaluation_detail_historyViewModel>), 200)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(500)]
|
||||
//[ValidateAntiForgeryToken]
|
||||
public IActionResult GetList(int? evaluation_detail_id)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
return Ok(_repository.GetListByevaluation_detail_id(evaluation_detail_id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical($"Exception in IActionResult GetList.", ex);
|
||||
return StatusCode(500, $"{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get list items by search
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <returns>Return list of items by specifced keyword</returns>
|
||||
/// <response code="200">Returns the item</response>
|
||||
/// <response code="500">Error Occurred</response>
|
||||
[HttpGet("GetListBySearch")]
|
||||
[ProducesResponseType(typeof(List<eva_create_evaluation_detail_historyViewModel>), 200)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(500)]
|
||||
//[ValidateAntiForgeryToken]
|
||||
public IActionResult GetListBySearch(eva_create_evaluation_detail_historySearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
return Ok(_repository.GetListBySearch(model));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex);
|
||||
return StatusCode(500, $"{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Download Report
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <returns>Return list of items by specifced keyword</returns>
|
||||
/// <response code="200">Returns the item</response>
|
||||
/// <response code="500">Error Occurred</response>
|
||||
[HttpGet("eva_create_evaluation_detail_history_report")]
|
||||
[ProducesResponseType(typeof(FileStreamResult), 200)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(500)]
|
||||
//[ValidateAntiForgeryToken]
|
||||
public IActionResult eva_create_evaluation_detail_history_report(eva_create_evaluation_detail_historyReportRequestModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
var httpclient = new WebClient();
|
||||
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
|
||||
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
|
||||
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
|
||||
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
|
||||
|
||||
string url = $"{mainurl}{reportsite}/xxใส่ชื่อรายงานตรงนี้xx.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
|
||||
|
||||
if (model.filetype == "xlsx")
|
||||
{
|
||||
url += "&ignorePagination=true";
|
||||
}
|
||||
|
||||
var data = httpclient.DownloadData(url);
|
||||
var stream = new MemoryStream(data);
|
||||
|
||||
return File(stream, model.contentType);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical($"Exception while GetReport.", ex);
|
||||
return StatusCode(500, $"{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create new item
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <param name="model"></param>
|
||||
/// <returns>Response Result Message</returns>
|
||||
/// <response code="200">Response Result Message</response>
|
||||
/// <response code="400">If the model is invalid</response>
|
||||
/// <response code="500">Error Occurred</response>
|
||||
[HttpPost("")]
|
||||
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(500)]
|
||||
//[ValidateAntiForgeryToken]
|
||||
public IActionResult Insert([FromBody] eva_create_evaluation_detail_historyInputModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
var result = _repository.Insert(model, true);
|
||||
var message = new CommonResponseMessage();
|
||||
message.code = "200";
|
||||
message.message = $"เพิ่มข้อมูล เรียบร้อย";
|
||||
message.data = result;
|
||||
return Ok(message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical($"Exception while insert.", ex);
|
||||
return StatusCode(500, $"{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update item
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="model"></param>
|
||||
/// <returns>Response Result Message</returns>
|
||||
/// <response code="200">Response Result Message</response>
|
||||
/// <response code="400">If the model is invalid</response>
|
||||
/// <response code="500">Error Occurred</response>
|
||||
[HttpPut("{id}")]
|
||||
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(500)]
|
||||
//[ValidateAntiForgeryToken]
|
||||
public IActionResult Update(int id, [FromBody] eva_create_evaluation_detail_historyInputModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
var result = _repository.Update(id, model, true);
|
||||
var message = new CommonResponseMessage();
|
||||
message.code = "200";
|
||||
message.message = $"แก้ไขข้อมูล เรียบร้อย";
|
||||
message.data = result;
|
||||
return Ok(message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical($"Exception while update {id.ToString()}.", ex);
|
||||
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete item
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <param name="id"></param>
|
||||
/// <returns>Response Result Message</returns>
|
||||
/// <response code="200">Response Result Message</response>
|
||||
/// <response code="400">If the model is invalid</response>
|
||||
/// <response code="500">Error Occurred</response>
|
||||
[HttpDelete("{id}")]
|
||||
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(500)]
|
||||
//[ValidateAntiForgeryToken]
|
||||
public IActionResult Delete(int id)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
_repository.Delete(id);
|
||||
var message = new CommonResponseMessage();
|
||||
message.code = "200";
|
||||
message.message = $"ลบข้อมูล เรียบร้อย";
|
||||
message.data = null;
|
||||
return Ok(message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical($"Exception while delete {id.ToString()}.", ex);
|
||||
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update multiple item
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <param name="model"></param>
|
||||
/// <returns>Response Result Message</returns>
|
||||
/// <response code="200">Response Result Message</response>
|
||||
/// <response code="400">If the model is invalid</response>
|
||||
/// <response code="500">Error Occurred</response>
|
||||
[HttpPut("UpdateMultiple")]
|
||||
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(500)]
|
||||
//[ValidateAntiForgeryToken]
|
||||
public IActionResult UpdateMultiple([FromBody] List<eva_create_evaluation_detail_historyInputModel> model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
string rowCount = _repository.UpdateMultiple(model, true);
|
||||
var message = new CommonResponseMessage();
|
||||
message.code = "200";
|
||||
message.message = "ปรับปรุงข้อมูลเรียบร้อย จำนวน "+rowCount+" รายการ";
|
||||
message.data = null;
|
||||
return Ok(message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical($"Exception while UpdateMultiple.", ex);
|
||||
return StatusCode(500, $"{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refresh AutoField of all items
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <returns>Response Result Message</returns>
|
||||
/// <response code="200">Response Result Message</response>
|
||||
/// <response code="400">If the model is invalid</response>
|
||||
/// <response code="500">Error Occurred</response>
|
||||
[HttpPut("RefreshAutoField")]
|
||||
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(500)]
|
||||
//[ValidateAntiForgeryToken]
|
||||
public IActionResult RefreshAutoField()
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
//if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
_repository.RefreshAutoFieldOfAllData();
|
||||
var message = new CommonResponseMessage();
|
||||
message.code = "200";
|
||||
message.message = $"ปรับปรุง Auto Field ของทุก record เรียบร้อย";
|
||||
message.data = null;
|
||||
return Ok(message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical($"Exception while RefreshAutoField.", ex);
|
||||
return StatusCode(500, $"มีปัญหาระหว่างการปรับปรุง Auto Field. {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ namespace TodoAPI2.Controllers
|
||||
private ILogger<eva_create_evaluation_detail_statusController> _logger;
|
||||
private Ieva_create_evaluation_detail_statusService _repository;
|
||||
private IConfiguration Configuration { get; set; }
|
||||
private Iexternal_employeeService emp;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
@@ -37,13 +38,17 @@ namespace TodoAPI2.Controllers
|
||||
/// Default constructure for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="repository"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="inemp"></param>
|
||||
/// <param name="logger"></param>
|
||||
public eva_create_evaluation_detail_statusController(ILogger<eva_create_evaluation_detail_statusController> logger, Ieva_create_evaluation_detail_statusService repository, IConfiguration configuration)
|
||||
public eva_create_evaluation_detail_statusController(ILogger<eva_create_evaluation_detail_statusController> logger,
|
||||
Ieva_create_evaluation_detail_statusService repository, IConfiguration configuration,
|
||||
Iexternal_employeeService inemp)
|
||||
{
|
||||
_logger = logger;
|
||||
_repository = repository;
|
||||
Configuration = configuration;
|
||||
emp = inemp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -220,12 +225,25 @@ namespace TodoAPI2.Controllers
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
var result = _repository.Update(id, model);
|
||||
var message = new CommonResponseMessage();
|
||||
message.code = "200";
|
||||
message.message = $"แก้ไขข้อมูล เรียบร้อย";
|
||||
message.data = result;
|
||||
return Ok(message);
|
||||
|
||||
if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"]))
|
||||
{
|
||||
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
|
||||
var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
|
||||
model.employee_id = e.id;
|
||||
var result = _repository.Update(id, model);
|
||||
var message = new CommonResponseMessage();
|
||||
message.code = "200";
|
||||
message.message = $"แก้ไขข้อมูล เรียบร้อย";
|
||||
message.data = result;
|
||||
return Ok(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace TTSW.EF {
|
||||
public DbSet<eva_limit_frame_employeeEntity> eva_limit_frame_employee { get; set; }
|
||||
public DbSet<eva_limit_frame_groupEntity> eva_limit_frame_group { get; set; }
|
||||
public DbSet<eva_limit_frame_planEntity> eva_limit_frame_plan { get; set; }
|
||||
|
||||
public DbSet<eva_idp_planEntity> eva_idp_plan { get; set; }
|
||||
public DbSet<eva_create_evaluation_detail_historyEntity> eva_create_evaluation_detail_history { get; set; }
|
||||
|
||||
public DbSet<eva_evaluation_achievement_attachEntity> eva_evaluation_achievement_attach { get; set; }
|
||||
protected override void OnModelCreating (ModelBuilder modelBuilder) {
|
||||
|
||||
BIN
EXCEL/eva_create_evaluation_detail_history.xlsx
Normal file
BIN
EXCEL/eva_create_evaluation_detail_history.xlsx
Normal file
Binary file not shown.
1032
Migrations/20210413072130_AddEvaLog.Designer.cs
generated
Normal file
1032
Migrations/20210413072130_AddEvaLog.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
46
Migrations/20210413072130_AddEvaLog.cs
Normal file
46
Migrations/20210413072130_AddEvaLog.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace tb320eva.Migrations
|
||||
{
|
||||
public partial class AddEvaLog : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "eva_create_evaluation_detail_history",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(nullable: false),
|
||||
created = table.Column<DateTime>(nullable: false),
|
||||
updated = table.Column<DateTime>(nullable: false),
|
||||
isActive = table.Column<bool>(nullable: false),
|
||||
evaluation_detail_id = table.Column<int>(nullable: true),
|
||||
action_dt = table.Column<DateTime>(nullable: true),
|
||||
action_detail = table.Column<string>(maxLength: 4000, nullable: true),
|
||||
action_emp_id = table.Column<int>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_eva_create_evaluation_detail_history", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_eva_create_evaluation_detail_history_eva_create_evaluation_~",
|
||||
column: x => x.evaluation_detail_id,
|
||||
principalTable: "eva_create_evaluation_detail",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_eva_create_evaluation_detail_history_evaluation_detail_id",
|
||||
table: "eva_create_evaluation_detail_history",
|
||||
column: "evaluation_detail_id");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "eva_create_evaluation_detail_history");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -373,6 +373,32 @@ namespace tb320eva.Migrations
|
||||
b.ToTable("eva_create_evaluation_detail");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detail_historyEntity", b =>
|
||||
{
|
||||
b.Property<int>("id");
|
||||
|
||||
b.Property<string>("action_detail")
|
||||
.HasMaxLength(4000);
|
||||
|
||||
b.Property<DateTime?>("action_dt");
|
||||
|
||||
b.Property<int?>("action_emp_id");
|
||||
|
||||
b.Property<DateTime>("created");
|
||||
|
||||
b.Property<int?>("evaluation_detail_id");
|
||||
|
||||
b.Property<bool>("isActive");
|
||||
|
||||
b.Property<DateTime>("updated");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("evaluation_detail_id");
|
||||
|
||||
b.ToTable("eva_create_evaluation_detail_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b =>
|
||||
{
|
||||
b.Property<int>("id");
|
||||
@@ -918,6 +944,13 @@ namespace tb320eva.Migrations
|
||||
.HasForeignKey("create_evaluation_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detail_historyEntity", b =>
|
||||
{
|
||||
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail_evaluation_detail_id")
|
||||
.WithMany()
|
||||
.HasForeignKey("evaluation_detail_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b =>
|
||||
{
|
||||
b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail")
|
||||
|
||||
@@ -60,9 +60,9 @@ namespace TodoAPI2.Models
|
||||
|
||||
public decimal? score2 { get; set; }
|
||||
|
||||
public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date); } }
|
||||
public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date); } }
|
||||
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date); } }
|
||||
public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_click_date) + getHistoryLink(status_self); } }
|
||||
public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_click_date) + getHistoryLink(status_chief); } }
|
||||
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor_click_date) + getHistoryLink(status_supervisor); } }
|
||||
|
||||
private string getStatusText(string s)
|
||||
{
|
||||
@@ -80,5 +80,15 @@ namespace TodoAPI2.Models
|
||||
return " ";
|
||||
}
|
||||
|
||||
private string getHistoryLink(string s)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(s))
|
||||
{
|
||||
return ("<br/><a href='javascript:window_open({0}../eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history?id=" + id.ToString() + "{0});'>ดูประวัติ</a>").Replace("{0}", '"'.ToString());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,19 +68,28 @@ namespace TodoAPI2.Models
|
||||
|
||||
public decimal? score2 { get; set; }
|
||||
|
||||
public string txt_status_self_a { get { return getStatusText2(status_self_a) + MyHelper.GetDateStringForReport(status_self_a_click_date); } }
|
||||
public string txt_status_self_a { get { return getStatusText2(status_self_a) + MyHelper.GetDateStringForReport(status_self_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_a_click_date) + getHistoryLink(status_self_a); } }
|
||||
|
||||
public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date); } }
|
||||
public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_click_date) + getHistoryLink(status_self); } }
|
||||
|
||||
public string txt_status_chief_a { get { return getStatusText2(status_chief_a) + MyHelper.GetDateStringForReport(status_chief_a_click_date); } }
|
||||
public string txt_status_chief_a { get { return getStatusText2(status_chief_a) + MyHelper.GetDateStringForReport(status_chief_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_a_click_date) + getHistoryLink(status_chief_a); } }
|
||||
|
||||
public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date); } }
|
||||
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date); } }
|
||||
public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_click_date) + getHistoryLink(status_chief); } }
|
||||
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor_click_date) + getHistoryLink(status_supervisor); } }
|
||||
|
||||
public string role_desc { get; set; }
|
||||
|
||||
public string role_code { get; set; }
|
||||
|
||||
private string getHistoryLink(string s)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(s))
|
||||
{
|
||||
return ("<br/><a href='javascript:window_open({0}../eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history?id=" + id.ToString() + "{0});'>ดูประวัติ</a>").Replace("{0}", '"'.ToString());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private string getStatusText(string s)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(s))
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
using TodoAPI2.Models;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public interface Ieva_create_evaluation_detail_historyService : IBaseService2<int, eva_create_evaluation_detail_historyInputModel, eva_create_evaluation_detail_historyViewModel>
|
||||
{
|
||||
new eva_create_evaluation_detail_historyViewModel Insert(eva_create_evaluation_detail_historyInputModel model, bool is_force_save);
|
||||
new eva_create_evaluation_detail_historyViewModel Update(int id, eva_create_evaluation_detail_historyInputModel model, bool is_force_save);
|
||||
List<eva_create_evaluation_detail_historyViewModel> GetListByevaluation_detail_id(int? evaluation_detail_id);
|
||||
List<eva_create_evaluation_detail_historyViewModel> GetListBySearch(eva_create_evaluation_detail_historySearchModel model);
|
||||
|
||||
string UpdateMultiple(List<eva_create_evaluation_detail_historyInputModel> model, bool is_force_save);
|
||||
eva_create_evaluation_detail_historyWithSelectionViewModel GetWithSelection(int id);
|
||||
eva_create_evaluation_detail_historyWithSelectionViewModel GetBlankItem();
|
||||
|
||||
void RefreshAutoFieldOfAllData();
|
||||
eva_create_evaluation_detail_historyEntity GetEntity(int id);
|
||||
DataContext GetContext();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
using System.IO;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_historyEntity : BaseEntity2<int>
|
||||
{
|
||||
|
||||
|
||||
[ForeignKey("evaluation_detail_id")]
|
||||
public eva_create_evaluation_detailEntity eva_create_evaluation_detail_evaluation_detail_id { get; set; }
|
||||
public int? evaluation_detail_id { get; set; }
|
||||
|
||||
public DateTime? action_dt { get; set; }
|
||||
|
||||
[MaxLength(4000)]
|
||||
public string action_detail { get; set; }
|
||||
|
||||
public int? action_emp_id { get; set; }
|
||||
|
||||
|
||||
public void SetAutoField(DataContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DoAfterInsertUpdate(DataContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_historyInputModel
|
||||
{
|
||||
|
||||
public int? id { get; set; }
|
||||
|
||||
public int? evaluation_detail_id { get; set; }
|
||||
|
||||
public DateTime? action_dt { get; set; }
|
||||
|
||||
public string action_detail { get; set; }
|
||||
|
||||
public int? action_emp_id { get; set; }
|
||||
|
||||
public string active_mode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_historyReportRequestModel : eva_create_evaluation_detail_historySearchModel
|
||||
{
|
||||
public string filetype { get; set; }
|
||||
|
||||
public string contentType { get { return MyHelper.GetContentType(filetype); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_historySearchModel
|
||||
{
|
||||
|
||||
public int id { get; set; }
|
||||
|
||||
public int? evaluation_detail_id { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,310 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
using TodoAPI2.Models;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Net;
|
||||
using TTSW.Configure;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Data;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_historyService : Ieva_create_evaluation_detail_historyService
|
||||
{
|
||||
private IBaseRepository2<eva_create_evaluation_detail_historyEntity, int> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
|
||||
public eva_create_evaluation_detail_historyService(IBaseRepository2<eva_create_evaluation_detail_historyEntity, int> repository, IMyDatabase mydb,
|
||||
Iexternal_linkageService inext, Iexternal_employeeService inemp)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
private eva_create_evaluation_detail_historyEntity GetEntity(eva_create_evaluation_detail_historyInputModel model)
|
||||
{
|
||||
return Mapper.Map<eva_create_evaluation_detail_historyEntity>(model);
|
||||
}
|
||||
private List<eva_create_evaluation_detail_historyEntity> GetEntityList(List<eva_create_evaluation_detail_historyInputModel> models)
|
||||
{
|
||||
return Mapper.Map<List<eva_create_evaluation_detail_historyEntity>>(models);
|
||||
}
|
||||
private eva_create_evaluation_detail_historyViewModel GetDto(eva_create_evaluation_detail_historyEntity entity)
|
||||
{
|
||||
return Mapper.Map<eva_create_evaluation_detail_historyViewModel>(entity);
|
||||
}
|
||||
private List<eva_create_evaluation_detail_historyViewModel> GetDtoList(List<eva_create_evaluation_detail_historyEntity> entities)
|
||||
{
|
||||
return Mapper.Map<List<eva_create_evaluation_detail_historyViewModel>>(entities);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
#region Query Functions
|
||||
|
||||
public eva_create_evaluation_detail_historyViewModel Get(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
return GetDto(entity);
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_historyEntity GetEntity(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public DataContext GetContext()
|
||||
{
|
||||
return _repository.Context;
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_historyWithSelectionViewModel GetWithSelection(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
var i = Mapper.Map<eva_create_evaluation_detail_historyWithSelectionViewModel>(entity);
|
||||
i.item_action_emp_id = emp.GetAllEmployee();
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
public eva_create_evaluation_detail_historyWithSelectionViewModel GetBlankItem()
|
||||
{
|
||||
var i = new eva_create_evaluation_detail_historyWithSelectionViewModel();
|
||||
i.item_action_emp_id = emp.GetAllEmployee();
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_historyViewModel> GetListByevaluation_detail_id(int? evaluation_detail_id)
|
||||
{
|
||||
var model = new eva_create_evaluation_detail_historySearchModel();
|
||||
model.evaluation_detail_id = evaluation_detail_id;
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_historyViewModel> GetListBySearch(eva_create_evaluation_detail_historySearchModel model)
|
||||
{
|
||||
var data = (
|
||||
from m_eva_create_evaluation_detail_history in _repository.Context.eva_create_evaluation_detail_history
|
||||
|
||||
join fk_eva_create_evaluation_detail1 in _repository.Context.eva_create_evaluation_detail on m_eva_create_evaluation_detail_history.evaluation_detail_id equals fk_eva_create_evaluation_detail1.id
|
||||
into eva_create_evaluation_detailResult1
|
||||
from fk_eva_create_evaluation_detailResult1 in eva_create_evaluation_detailResult1.DefaultIfEmpty()
|
||||
|
||||
join fk_external_employee4 in emp.GetAllEmployee() on m_eva_create_evaluation_detail_history.action_emp_id equals fk_external_employee4.id
|
||||
into external_employeeResult4
|
||||
from fk_external_employeeResult4 in external_employeeResult4.DefaultIfEmpty()
|
||||
|
||||
where
|
||||
1 == 1
|
||||
&& (!model.evaluation_detail_id.HasValue || m_eva_create_evaluation_detail_history.evaluation_detail_id == model.evaluation_detail_id)
|
||||
|
||||
orderby m_eva_create_evaluation_detail_history.action_dt
|
||||
select new eva_create_evaluation_detail_historyViewModel()
|
||||
{
|
||||
id = m_eva_create_evaluation_detail_history.id,
|
||||
evaluation_detail_id = m_eva_create_evaluation_detail_history.evaluation_detail_id,
|
||||
action_dt = m_eva_create_evaluation_detail_history.action_dt,
|
||||
action_detail = m_eva_create_evaluation_detail_history.action_detail,
|
||||
action_emp_id = m_eva_create_evaluation_detail_history.action_emp_id,
|
||||
|
||||
evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id = fk_eva_create_evaluation_detailResult1.create_evaluation_id,
|
||||
action_emp_id_external_employee_fullname = fk_external_employeeResult4.fullname,
|
||||
|
||||
isActive = m_eva_create_evaluation_detail_history.isActive,
|
||||
Created = m_eva_create_evaluation_detail_history.created,
|
||||
Updated = m_eva_create_evaluation_detail_history.updated
|
||||
}
|
||||
).Take(1000).ToList();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Manipulation Functions
|
||||
|
||||
|
||||
public int GetNewPrimaryKey()
|
||||
{
|
||||
int? newkey = 0;
|
||||
|
||||
var x = (from i in _repository.Context.eva_create_evaluation_detail_history
|
||||
orderby i.id descending
|
||||
select i).Take(1).ToList();
|
||||
|
||||
if(x.Count > 0)
|
||||
{
|
||||
newkey = x[0].id + 1;
|
||||
}
|
||||
|
||||
return newkey.Value;
|
||||
}
|
||||
|
||||
|
||||
public eva_create_evaluation_detail_historyViewModel Insert(eva_create_evaluation_detail_historyInputModel model, bool is_force_save)
|
||||
{
|
||||
var entity = GetEntity(model);
|
||||
entity.id = GetNewPrimaryKey();
|
||||
|
||||
|
||||
entity.SetAutoField(_repository.Context);
|
||||
|
||||
if (is_force_save)
|
||||
{
|
||||
var inserted = _repository.Insert(entity);
|
||||
entity.DoAfterInsertUpdate(_repository.Context);
|
||||
return Get(inserted.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
_repository.InsertWithoutCommit(entity);
|
||||
entity.DoAfterInsertUpdate(_repository.Context);
|
||||
return Mapper.Map<eva_create_evaluation_detail_historyViewModel>(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_historyViewModel Update(int id, eva_create_evaluation_detail_historyInputModel model, bool is_force_save)
|
||||
{
|
||||
var existingEntity = _repository.Get(id);
|
||||
if (existingEntity != null)
|
||||
{
|
||||
existingEntity.evaluation_detail_id = model.evaluation_detail_id;
|
||||
existingEntity.action_dt = model.action_dt;
|
||||
existingEntity.action_detail = model.action_detail;
|
||||
existingEntity.action_emp_id = model.action_emp_id;
|
||||
|
||||
existingEntity.SetAutoField(_repository.Context);
|
||||
|
||||
if (is_force_save)
|
||||
{
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
existingEntity.DoAfterInsertUpdate(_repository.Context);
|
||||
return Get(updated.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
_repository.UpdateWithoutCommit(id, existingEntity);
|
||||
existingEntity.DoAfterInsertUpdate(_repository.Context);
|
||||
return Mapper.Map<eva_create_evaluation_detail_historyViewModel>(existingEntity);
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new NotificationException("No data to update");
|
||||
}
|
||||
|
||||
public string UpdateMultiple(List<eva_create_evaluation_detail_historyInputModel> model, bool is_force_save)
|
||||
{
|
||||
foreach(var i in model)
|
||||
{
|
||||
if (i.active_mode == "1" && i.id.HasValue) // update
|
||||
{
|
||||
var existingEntity = _repository.Get(i.id.Value);
|
||||
if (existingEntity != null)
|
||||
{
|
||||
existingEntity.evaluation_detail_id = i.evaluation_detail_id;
|
||||
existingEntity.action_dt = i.action_dt;
|
||||
existingEntity.action_detail = i.action_detail;
|
||||
existingEntity.action_emp_id = i.action_emp_id;
|
||||
|
||||
existingEntity.SetAutoField(_repository.Context);
|
||||
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
|
||||
}
|
||||
}
|
||||
else if (i.active_mode == "1" && !i.id.HasValue) // add
|
||||
{
|
||||
var entity = GetEntity(i);
|
||||
entity.id = GetNewPrimaryKey();
|
||||
entity.SetAutoField(_repository.Context);
|
||||
_repository.InsertWithoutCommit(entity);
|
||||
}
|
||||
else if (i.active_mode == "0" && i.id.HasValue) // remove
|
||||
{
|
||||
_repository.DeleteWithoutCommit(i.id.Value);
|
||||
}
|
||||
else if (i.active_mode == "0" && !i.id.HasValue)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
if (is_force_save)
|
||||
{
|
||||
_repository.Context.SaveChanges();
|
||||
}
|
||||
|
||||
return model.Count().ToString();
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_historyViewModel SetAsActive(int id)
|
||||
{
|
||||
var updated = _repository.SetAsActive(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
public eva_create_evaluation_detail_historyViewModel SetAsInactive(int id)
|
||||
{
|
||||
var updated = _repository.SetAsInActive(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
public void Delete(int id)
|
||||
{
|
||||
_repository.Delete(id);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public void RefreshAutoFieldOfAllData()
|
||||
{
|
||||
var all_items = from i in _repository.Context.eva_create_evaluation_detail_history
|
||||
select i;
|
||||
foreach (var item in all_items)
|
||||
{
|
||||
item.SetAutoField(_repository.Context);
|
||||
}
|
||||
_repository.Context.SaveChanges();
|
||||
}
|
||||
|
||||
private Dictionary<string,string> GetLookupForLog()
|
||||
{
|
||||
var i = new Dictionary<string, string>();
|
||||
|
||||
|
||||
i.Add("evaluation_detail_id", "การประเมิน");
|
||||
i.Add("evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id", "การประเมิน");
|
||||
i.Add("action_dt", "วันที่/เวลา");
|
||||
i.Add("txt_action_dt", "วันที่/เวลา");
|
||||
i.Add("action_detail", "รายละเอียด");
|
||||
i.Add("action_emp_id", "ผู้ดำเนินการ");
|
||||
i.Add("action_emp_id_external_employee_employee_type", "ผู้ดำเนินการ");
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Match Item
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_historyViewModel : BaseViewModel2<int>
|
||||
{
|
||||
|
||||
public int? evaluation_detail_id { get; set; }
|
||||
|
||||
public DateTime? action_dt { get; set; }
|
||||
|
||||
public string txt_action_dt { get { return MyHelper.GetDateStringForReport(this.action_dt); } }
|
||||
|
||||
public string action_detail { get; set; }
|
||||
|
||||
public int? action_emp_id { get; set; }
|
||||
|
||||
public int? evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id { get; set; }
|
||||
public string action_emp_id_external_employee_fullname { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_historyWithSelectionViewModel: eva_create_evaluation_detail_historyViewModel
|
||||
{
|
||||
public List<external_employeeViewModel> item_action_emp_id { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -88,11 +88,20 @@ namespace TodoAPI2.Models
|
||||
public DateTime? status_supervisor1A_click_date { get; set; }
|
||||
public DateTime? status_supervisor2A_click_date { get; set; }
|
||||
|
||||
public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date); } }
|
||||
public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date); } }
|
||||
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date); } }
|
||||
public string txt_status_supervisor1A { get { return getStatusText(status_supervisor1A) + MyHelper.GetDateStringForReport(status_supervisor1A_click_date); } }
|
||||
public string txt_status_supervisor2A { get { return getStatusText(status_supervisor2A) + MyHelper.GetDateStringForReport(status_supervisor2A_click_date); } }
|
||||
public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_click_date) + getHistoryLink(status_self); } }
|
||||
public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_click_date) + getHistoryLink(status_chief); } }
|
||||
public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor_click_date) + getHistoryLink(status_supervisor); } }
|
||||
public string txt_status_supervisor1A { get { return getStatusText(status_supervisor1A) + MyHelper.GetDateStringForReport(status_supervisor1A_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor1A_click_date) + getHistoryLink(status_supervisor1A); } }
|
||||
public string txt_status_supervisor2A { get { return getStatusText(status_supervisor2A) + MyHelper.GetDateStringForReport(status_supervisor2A_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor2A_click_date) + getHistoryLink(status_supervisor2A); } }
|
||||
|
||||
private string getHistoryLink(string s)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(s))
|
||||
{
|
||||
return ("<br/><a href='javascript:window_open({0}../eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history?id=" + id.ToString() + "{0});'>ดูประวัติ</a>").Replace("{0}", '"'.ToString());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private string getStatusText(string s)
|
||||
{
|
||||
@@ -110,8 +119,8 @@ namespace TodoAPI2.Models
|
||||
return " ";
|
||||
}
|
||||
|
||||
public string txt_status_self_a_click_date { get { return MyHelper.GetDateStringForReport(status_self_a_click_date); } }
|
||||
public string txt_status_chief_a_click_date { get { return MyHelper.GetDateStringForReport(status_chief_a_click_date); } }
|
||||
public string txt_status_self_a_click_date { get { return MyHelper.GetDateStringForReport(status_self_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_a_click_date); } }
|
||||
public string txt_status_chief_a_click_date { get { return MyHelper.GetDateStringForReport(status_chief_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_a_click_date); } }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace TodoAPI2.Models
|
||||
|
||||
public string status_mode { get; set; }
|
||||
|
||||
public int? employee_id { get; set; }
|
||||
|
||||
public string active_mode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,16 +28,18 @@ namespace TodoAPI2.Models
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
private Ieva_create_evaluation_detail_historyService his;
|
||||
private IConfiguration Configuration { get; set; }
|
||||
|
||||
public eva_create_evaluation_detail_statusService(IBaseRepository2<eva_create_evaluation_detailEntity, int> repository,
|
||||
IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp, IConfiguration configuration)
|
||||
IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp, IConfiguration configuration, Ieva_create_evaluation_detail_historyService inhis)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
Configuration = configuration;
|
||||
his = inhis;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
@@ -155,13 +157,33 @@ namespace TodoAPI2.Models
|
||||
var entity = GetEntity(model);
|
||||
entity.id = GetNewPrimaryKey();
|
||||
|
||||
|
||||
|
||||
var inserted = _repository.Insert(entity);
|
||||
|
||||
return Get(inserted.id);
|
||||
}
|
||||
|
||||
private void add_history(DateTime? dt, string action, int? action_user_id, int? detail_id)
|
||||
{
|
||||
int? newkey = 0;
|
||||
|
||||
var x = (from i in _repository.Context.eva_create_evaluation_detail_history
|
||||
orderby i.id descending
|
||||
select i).Take(1).ToList();
|
||||
|
||||
if (x.Count > 0)
|
||||
{
|
||||
newkey = x[0].id + 1;
|
||||
}
|
||||
|
||||
var n = new eva_create_evaluation_detail_historyEntity();
|
||||
n.id = newkey.Value;
|
||||
n.action_detail = action;
|
||||
n.action_dt = dt;
|
||||
n.action_emp_id = action_user_id;
|
||||
n.evaluation_detail_id = detail_id;
|
||||
_repository.Context.Add(n);
|
||||
}
|
||||
|
||||
public eva_create_evaluation_detail_statusViewModel Update(int id, eva_create_evaluation_detail_statusInputModel model)
|
||||
{
|
||||
var existingEntity = _repository.Get(id);
|
||||
@@ -198,23 +220,25 @@ namespace TodoAPI2.Models
|
||||
|
||||
if (model.status_mode == "nextA")
|
||||
{
|
||||
existingEntity.status_self_a_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
|
||||
existingEntity.status_self_a_click_date = DateTime.Now;
|
||||
existingEntity.status_chief_a_click_date = null;
|
||||
noti_to_employee_id = existingEntity.chief;
|
||||
noti_message = "กรุณาตรวจสอบ ข้อตกลงการประเมิน ของ {0}";
|
||||
noti_url = "/eva/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString();
|
||||
add_history(DateTime.Now, "ส่งข้อตกลงการประเมิน", model.employee_id, existingEntity.id);
|
||||
}
|
||||
else if (model.status_mode == "backB")
|
||||
{
|
||||
existingEntity.status_chief_a_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
|
||||
existingEntity.status_chief_a_click_date = DateTime.Now;
|
||||
existingEntity.status_self_a_click_date = null;
|
||||
noti_to_employee_id = existingEntity.employee_id;
|
||||
noti_message = "ข้อตกลงการประเมินของคุณ ({0}) ถูกตีกลับ";
|
||||
noti_url = "/eva/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString();
|
||||
add_history(DateTime.Now, "ข้อตกลงการประเมิน ถูกตีกลับ", model.employee_id, existingEntity.id);
|
||||
}
|
||||
else if (model.status_mode == "nextB")
|
||||
{
|
||||
existingEntity.status_chief_a_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
|
||||
existingEntity.status_chief_a_click_date = DateTime.Now;
|
||||
if (current_eva.employee_id == existingEntity.chief) // หัวหน้าและผู้ประเมินสูงสุด เป็นคนคนเดียวกัน
|
||||
{
|
||||
noti_to_employee_id = current_eva.supervisor1_id;
|
||||
@@ -224,10 +248,11 @@ namespace TodoAPI2.Models
|
||||
noti_to_employee_id = current_eva.employee_id;
|
||||
}
|
||||
need_noti = false;
|
||||
add_history(DateTime.Now, "อนุมัติ ข้อตกลงการประเมิน", existingEntity.chief, existingEntity.id);
|
||||
}
|
||||
else if (model.status_mode == "next0")
|
||||
{
|
||||
existingEntity.status_self_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
|
||||
existingEntity.status_self_click_date = DateTime.Now;
|
||||
noti_to_employee_id = existingEntity.chief;
|
||||
noti_message = "กรุณาตรวจสอบแบบประเมินของ {0}";
|
||||
noti_url = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString();
|
||||
@@ -235,10 +260,11 @@ 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);
|
||||
}
|
||||
else if (model.status_mode == "next1")
|
||||
{
|
||||
existingEntity.status_chief_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
|
||||
existingEntity.status_chief_click_date = DateTime.Now;
|
||||
if (current_eva.employee_id == existingEntity.chief) // หัวหน้าและผู้ประเมินสูงสุด เป็นคนคนเดียวกัน
|
||||
{
|
||||
noti_to_employee_id = current_eva.supervisor1_id;
|
||||
@@ -250,61 +276,68 @@ namespace TodoAPI2.Models
|
||||
}
|
||||
else if (model.status_mode == "back1")
|
||||
{
|
||||
existingEntity.status_chief_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
|
||||
existingEntity.status_chief_click_date = DateTime.Now;
|
||||
existingEntity.status_self_click_date = null;
|
||||
noti_to_employee_id = existingEntity.employee_id;
|
||||
noti_message = "ข้อตกลงการประเมินของคุณ ({0}) ถูกตีกลับ";
|
||||
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d?id=" + existingEntity.id.ToString();
|
||||
add_history(DateTime.Now, "ข้อตกลงการประเมิน ถูกตีกลับ โดยผู้ประเมิน", model.employee_id, existingEntity.id);
|
||||
}
|
||||
else if (model.status_mode == "next2")
|
||||
{
|
||||
existingEntity.status_supervisor_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
|
||||
existingEntity.status_supervisor_click_date = DateTime.Now;
|
||||
noti_to_employee_id = current_eva.supervisor1_id;
|
||||
|
||||
noti_to_employee_id2 = owner_eva_employee_id;
|
||||
noti_message2 = "แบบประเมินของ {0} ได้ถูกส่งต่อไปยังขั้นตอนถัดไปแล้ว";
|
||||
noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString();
|
||||
add_history(DateTime.Now, "ผู้ประเมินสูงสุด อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id);
|
||||
}
|
||||
else if (model.status_mode == "back2")
|
||||
{
|
||||
existingEntity.status_supervisor_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
|
||||
existingEntity.status_supervisor_click_date = DateTime.Now;
|
||||
existingEntity.status_chief_click_date = null;
|
||||
noti_to_employee_id = existingEntity.chief;
|
||||
noti_message = "แบบประเมินของ {0} ถูกตีกลับ";
|
||||
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d?id=" + existingEntity.id.ToString();
|
||||
add_history(DateTime.Now, "แบบประเมิน ถูกตีกลับ โดยผู้ประเมินสูงสุด", model.employee_id, existingEntity.id);
|
||||
}
|
||||
else if (model.status_mode == "next3")
|
||||
{
|
||||
existingEntity.status_supervisor1A_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
|
||||
existingEntity.status_supervisor1A_click_date = DateTime.Now;
|
||||
noti_to_employee_id = current_eva.supervisor2_id;
|
||||
|
||||
noti_to_employee_id2 = owner_eva_employee_id;
|
||||
noti_message2 = "แบบประเมินของ {0} ได้ถูกส่งต่อไปยังขั้นตอนถัดไปแล้ว";
|
||||
noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString();
|
||||
add_history(DateTime.Now, "ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id);
|
||||
}
|
||||
else if (model.status_mode == "back3")
|
||||
{
|
||||
existingEntity.status_supervisor1A_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
|
||||
existingEntity.status_supervisor1A_click_date = DateTime.Now;
|
||||
existingEntity.status_supervisor_click_date = null;
|
||||
noti_to_employee_id = current_eva.employee_id;
|
||||
noti_message = "แบบประเมินของ {0} ถูกตีกลับ";
|
||||
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString();
|
||||
add_history(DateTime.Now, "แบบประเมินถูกตีกลับ โดย ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง", model.employee_id, existingEntity.id);
|
||||
}
|
||||
else if (model.status_mode == "next4")
|
||||
{
|
||||
existingEntity.status_supervisor2A_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
|
||||
existingEntity.status_supervisor2A_click_date = DateTime.Now;
|
||||
|
||||
noti_to_employee_id2 = owner_eva_employee_id;
|
||||
noti_message2 = "แบบประเมินของ {0} ได้รับการประเมินเรียบร้อยแล้ว";
|
||||
noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString();
|
||||
add_history(DateTime.Now, "ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด) อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id);
|
||||
}
|
||||
else if (model.status_mode == "back4")
|
||||
{
|
||||
existingEntity.status_supervisor2A_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now);
|
||||
existingEntity.status_supervisor2A_click_date = DateTime.Now;
|
||||
existingEntity.status_supervisor1A_click_date = null;
|
||||
noti_to_employee_id = current_eva.supervisor1_id;
|
||||
noti_message = "แบบประเมินของ {0} ถูกตีกลับ";
|
||||
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString();
|
||||
add_history(DateTime.Now, "แบบประเมินถูกตีกลับ โดย ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)", model.employee_id, existingEntity.id);
|
||||
}
|
||||
|
||||
if (need_noti)
|
||||
|
||||
@@ -332,6 +332,9 @@ namespace Test01
|
||||
|
||||
services.AddScoped<Ieva_idp_plan_reviewerService, eva_idp_plan_reviewerService>();
|
||||
|
||||
services.AddScoped<IBaseRepository2<eva_create_evaluation_detail_historyEntity, int>, BaseRepository2<eva_create_evaluation_detail_historyEntity, int>>();
|
||||
services.AddScoped<Ieva_create_evaluation_detail_historyService, eva_create_evaluation_detail_historyService>();
|
||||
|
||||
#endregion
|
||||
|
||||
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
@@ -623,6 +626,10 @@ namespace Test01
|
||||
cfg.CreateMap<eva_idp_planEntity, eva_idp_plan_reviewerViewModel>();
|
||||
cfg.CreateMap<eva_idp_planEntity, eva_idp_plan_reviewerWithSelectionViewModel>();
|
||||
|
||||
cfg.CreateMap<rep_study_historyInputModel, eva_level_scoreEntity>();
|
||||
cfg.CreateMap<eva_level_scoreEntity, rep_study_historyViewModel>();
|
||||
cfg.CreateMap<eva_level_scoreEntity, rep_study_historyWithSelectionViewModel>();
|
||||
|
||||
});
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -95,6 +95,18 @@ public class MyHelper
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetTimeStringFromDate(DateTime? date)
|
||||
{
|
||||
if (date.HasValue)
|
||||
{
|
||||
return date.Value.ToShortTimeString() + "น.";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static DateTime? GetDateFromString(string date)
|
||||
{
|
||||
if (string.IsNullOrEmpty(date)) return null;
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using TodoAPI2.Models;
|
||||
using STAFF_API.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using TodoAPI2.Controllers;
|
||||
|
||||
namespace TodoAPI2.Controllers
|
||||
{
|
||||
public class eva_create_evaluation_detail_historyViewController : Controller
|
||||
{
|
||||
private ILogger<eva_create_evaluation_detail_historyController> _logger;
|
||||
private Ieva_create_evaluation_detail_historyService _repository;
|
||||
private IConfiguration Configuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructure for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="repository"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="logger"></param>
|
||||
public eva_create_evaluation_detail_historyViewController(ILogger<eva_create_evaluation_detail_historyController> logger, Ieva_create_evaluation_detail_historyService repository, IConfiguration configuration)
|
||||
{
|
||||
_logger = logger;
|
||||
_repository = repository;
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
public IActionResult eva_create_evaluation_detail_history()
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
|
||||
return View();
|
||||
}
|
||||
|
||||
// public IActionResult eva_create_evaluation_detail_history_d()
|
||||
// {
|
||||
//if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
|
||||
// return View();
|
||||
// }
|
||||
|
||||
//public IActionResult eva_create_evaluation_detail_history_report()
|
||||
//{
|
||||
// if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
|
||||
// return View();
|
||||
//}
|
||||
|
||||
//public IActionResult eva_create_evaluation_detail_history_inline()
|
||||
//{
|
||||
// if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
|
||||
// return View();
|
||||
//}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -453,11 +453,11 @@
|
||||
});
|
||||
|
||||
function CheckPermission() {
|
||||
//if (status_self === "Y") {
|
||||
// $(".status_self").hide();
|
||||
// $(".status_self_text").attr("disabled", true);
|
||||
// $("#status").text("คุณส่งแบบประเมินไปแล้ว");
|
||||
//}
|
||||
if (status_self === "Y") {
|
||||
$(".status_self").hide();
|
||||
$(".status_self_text").attr("disabled", true);
|
||||
$("#status").text("คุณส่งแบบประเมินไปแล้ว");
|
||||
}
|
||||
}
|
||||
|
||||
function OnWeightChanged(c) {
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12">
|
||||
<button type="button" class="btn btn-danger" onclick="javascript:window_open_from_root('@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")');"><i class="fa fa-repeat"></i> กลับ</button>
|
||||
<button type="button" class="btn btn-danger" onclick="javascript:window_close();"><i class="fa fa-repeat"></i> กลับ</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
@using Microsoft.Extensions.Configuration
|
||||
@inject IConfiguration Configuration
|
||||
@{
|
||||
ViewData["Title"] = "eva_create_evaluation_detail_history";
|
||||
Layout = "_LayoutDirect";
|
||||
}
|
||||
|
||||
<div class="row page-title">
|
||||
<div class="col-md-5">
|
||||
<div class="page-title">
|
||||
@Configuration["SiteInformation:modulename"]
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<ol class="breadcrumb" style="">
|
||||
<li class="breadcrumb-item "><a href="@Configuration["SiteInformation:mainsite"]">หน้าแรก</a></li>
|
||||
<li class="breadcrumb-item "><a href="@Configuration["SiteInformation:mainsite"]@Configuration["SiteInformation:appsite"]">@Configuration["SiteInformation:modulename"]</a></li>
|
||||
<li class="breadcrumb-item active">ประวัติการดำเนินการ</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="wrapper">
|
||||
<div class="title"><div class="line"></div>ประวัติการดำเนินการ</div>
|
||||
|
||||
<div class="tools">
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-danger" onclick="javascript:window_close();"><i class="fa fa-repeat"></i> กลับ</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="eva_create_evaluation_detail_historyTable" class="display table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th><label id='h_eva_create_evaluation_detail_history_action_dt'>วันที่/เวลา</label></th>
|
||||
<th><label id='h_eva_create_evaluation_detail_history_action_detail'>รายละเอียด</label></th>
|
||||
<th><label id='h_eva_create_evaluation_detail_history_action_emp_id'>ผู้ดำเนินการ</label></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
@section FooterPlaceHolder{
|
||||
<script src="~/js/eva_create_evaluation_detail_history/eva_create_evaluation_detail_history.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
eva_create_evaluation_detail_history_InitiateDataTable();
|
||||
eva_create_evaluation_detail_history_InitialForm();
|
||||
SetupValidationRemark("eva_create_evaluation_detail_history");
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
<Folder Include="Seed\" CopyToOutputDirectory="Always" />
|
||||
<None Include="Views\eva_create_evaluation_detail_firstdocView\eva_create_evaluation_detail_firstdoc.cshtml" />
|
||||
<None Include="Views\eva_create_evaluation_detail_firstdocView\eva_create_evaluation_detail_firstdoc_d.cshtml" />
|
||||
<None Include="Views\eva_create_evaluation_detail_historyView\eva_create_evaluation_detail_history.cshtml" />
|
||||
<None Include="Views\eva_evaluation_achievement_attachView\eva_evaluation_achievement_attach.cshtml" />
|
||||
<None Include="Views\eva_evaluation_operating_agreementView\eva_evaluation_operating_agreement.cshtml" />
|
||||
<None Include="Views\eva_idp_plan_reviewerView\eva_idp_plan_reviewer.cshtml" />
|
||||
@@ -84,6 +85,7 @@
|
||||
<None Include="wwwroot\js\eva_adjust_postponement_migration\eva_adjust_postponement_migration_d.js" />
|
||||
<None Include="wwwroot\js\eva_create_evaluation_detail_firstdoc\eva_create_evaluation_detail_firstdoc.js" />
|
||||
<None Include="wwwroot\js\eva_create_evaluation_detail_firstdoc\eva_create_evaluation_detail_firstdoc_d.js" />
|
||||
<None Include="wwwroot\js\eva_create_evaluation_detail_history\eva_create_evaluation_detail_history.js" />
|
||||
<None Include="wwwroot\js\eva_create_evaluation_detail_review0A\eva_create_evaluation_detail_review0A_d.js" />
|
||||
<None Include="wwwroot\js\eva_evaluation_achievement_attach\eva_evaluation_achievement_attach.js" />
|
||||
<None Include="wwwroot\js\eva_evaluation_operating_agreement\eva_evaluation_operating_agreement.js" />
|
||||
|
||||
129
tb320eva.xml
129
tb320eva.xml
@@ -1191,6 +1191,124 @@
|
||||
<response code="200">Returns the item</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_historyController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_create_evaluation_detail_historyController},TodoAPI2.Models.Ieva_create_evaluation_detail_historyService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<summary>
|
||||
Default constructure for dependency injection
|
||||
</summary>
|
||||
<param name="repository"></param>
|
||||
<param name="configuration"></param>
|
||||
<param name="logger"></param>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_historyController.Get(System.Int32)">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_historyController.GetBlankItem">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_historyController.GetList(System.Nullable{System.Int32})">
|
||||
<summary>
|
||||
Get list items by evaluation_detail_id
|
||||
</summary>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<returns>Return list of items by specifced keyword</returns>
|
||||
<response code="200">Returns the item</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_historyController.GetListBySearch(TodoAPI2.Models.eva_create_evaluation_detail_historySearchModel)">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_historyController.eva_create_evaluation_detail_history_report(TodoAPI2.Models.eva_create_evaluation_detail_historyReportRequestModel)">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_historyController.Insert(TodoAPI2.Models.eva_create_evaluation_detail_historyInputModel)">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_historyController.Update(System.Int32,TodoAPI2.Models.eva_create_evaluation_detail_historyInputModel)">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_historyController.Delete(System.Int32)">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_historyController.UpdateMultiple(System.Collections.Generic.List{TodoAPI2.Models.eva_create_evaluation_detail_historyInputModel})">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_historyController.RefreshAutoField">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_processController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_create_evaluation_detail_processController},TodoAPI2.Models.Iexternal_employeeService,TodoAPI2.Models.Ieva_create_evaluation_detail_processService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<summary>
|
||||
Default constructure for dependency injection
|
||||
@@ -1746,12 +1864,13 @@
|
||||
<response code="400">If the model is invalid</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_statusController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_create_evaluation_detail_statusController},TodoAPI2.Models.Ieva_create_evaluation_detail_statusService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_statusController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_create_evaluation_detail_statusController},TodoAPI2.Models.Ieva_create_evaluation_detail_statusService,Microsoft.Extensions.Configuration.IConfiguration,TodoAPI2.Models.Iexternal_employeeService)">
|
||||
<summary>
|
||||
Default constructure for dependency injection
|
||||
</summary>
|
||||
<param name="repository"></param>
|
||||
<param name="configuration"></param>
|
||||
<param name="inemp"></param>
|
||||
<param name="logger"></param>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_statusController.Get(System.Int32)">
|
||||
@@ -5266,6 +5385,14 @@
|
||||
<param name="inemp"></param>
|
||||
<param name="logger"></param>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_historyViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_create_evaluation_detail_historyController},TodoAPI2.Models.Ieva_create_evaluation_detail_historyService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<summary>
|
||||
Default constructure for dependency injection
|
||||
</summary>
|
||||
<param name="repository"></param>
|
||||
<param name="configuration"></param>
|
||||
<param name="logger"></param>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_processViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_create_evaluation_detail_processController},TodoAPI2.Models.Iexternal_employeeService,TodoAPI2.Models.Ieva_create_evaluation_detail_processService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<summary>
|
||||
Default constructure for dependency injection
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
var eva_create_evaluation_detail_history_editMode = "CREATE";
|
||||
var eva_create_evaluation_detail_history_API = "/api/eva_create_evaluation_detail_history/";
|
||||
|
||||
//================= Search Customizaiton =========================================
|
||||
|
||||
function eva_create_evaluation_detail_history_GetSearchParameter() {
|
||||
var eva_create_evaluation_detail_historySearchObject = new Object();
|
||||
eva_create_evaluation_detail_historySearchObject.evaluation_detail_id = getUrlParameter("id");
|
||||
|
||||
return eva_create_evaluation_detail_historySearchObject;
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_history_FeedDataToSearchForm(data) {
|
||||
$("#s_eva_create_evaluation_detail_history_evaluation_detail_id").val(data.evaluation_detail_id);
|
||||
|
||||
}
|
||||
|
||||
//================= Form Data Customizaiton =========================================
|
||||
|
||||
function eva_create_evaluation_detail_history_FeedDataToForm(data) {
|
||||
$("#eva_create_evaluation_detail_history_id").val(data.id);
|
||||
$("#eva_create_evaluation_detail_history_evaluation_detail_id").val(data.evaluation_detail_id);
|
||||
$("#eva_create_evaluation_detail_history_action_dt").val(formatDate(data.action_dt));
|
||||
$("#eva_create_evaluation_detail_history_action_detail").val(data.action_detail);
|
||||
//DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_history_action_emp_id"), data, "id", "employee_type", "item_action_emp_id", data.action_emp_id);
|
||||
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_history_GetFromForm() {
|
||||
var eva_create_evaluation_detail_historyObject = new Object();
|
||||
eva_create_evaluation_detail_historyObject.id = $("#eva_create_evaluation_detail_history_id").val();
|
||||
eva_create_evaluation_detail_historyObject.evaluation_detail_id = getUrlParameter("id");
|
||||
eva_create_evaluation_detail_historyObject.action_dt = getDate($("#eva_create_evaluation_detail_history_action_dt").val());
|
||||
eva_create_evaluation_detail_historyObject.action_detail = $("#eva_create_evaluation_detail_history_action_detail").val();
|
||||
eva_create_evaluation_detail_historyObject.action_emp_id = $("#eva_create_evaluation_detail_history_action_emp_id").val();
|
||||
|
||||
|
||||
return eva_create_evaluation_detail_historyObject;
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_history_InitialForm(s) {
|
||||
var successFunc = function (result) {
|
||||
eva_create_evaluation_detail_history_FeedDataToForm(result);
|
||||
eva_create_evaluation_detail_history_FeedDataToSearchForm(result);
|
||||
if (s) {
|
||||
// Incase model popup
|
||||
$("#eva_create_evaluation_detail_historyModel").modal("show");
|
||||
}
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_create_evaluation_detail_history_API + "GetBlankItem", successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
//================= Form Mode Setup and Flow =========================================
|
||||
|
||||
function eva_create_evaluation_detail_history_GoCreate() {
|
||||
// Incase model popup
|
||||
eva_create_evaluation_detail_history_SetCreateForm(true);
|
||||
|
||||
// Incase open new page
|
||||
//window_open(appsite + "/eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history_d");
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_history_GoEdit(a) {
|
||||
// Incase model popup
|
||||
eva_create_evaluation_detail_history_SetEditForm(a);
|
||||
|
||||
// Incase open new page
|
||||
//window_open(appsite + "/eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history_d?id=" + a);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_history_SetEditForm(a) {
|
||||
var successFunc = function (result) {
|
||||
eva_create_evaluation_detail_history_editMode = "UPDATE";
|
||||
eva_create_evaluation_detail_history_FeedDataToForm(result);
|
||||
$("#eva_create_evaluation_detail_historyModel").modal("show");
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_create_evaluation_detail_history_API + a, successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_history_SetCreateForm(s) {
|
||||
eva_create_evaluation_detail_history_editMode = "CREATE";
|
||||
eva_create_evaluation_detail_history_InitialForm(s);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_history_RefreshTable() {
|
||||
// Incase model popup
|
||||
eva_create_evaluation_detail_history_DoSearch();
|
||||
|
||||
// Incase open new page
|
||||
//window.parent.eva_create_evaluation_detail_history_DoSearch();
|
||||
}
|
||||
|
||||
//================= Update and Delete =========================================
|
||||
|
||||
var eva_create_evaluation_detail_history_customValidation = function (group) {
|
||||
return "";
|
||||
};
|
||||
|
||||
function eva_create_evaluation_detail_history_PutUpdate() {
|
||||
if (!ValidateForm('eva_create_evaluation_detail_history', eva_create_evaluation_detail_history_customValidation)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = eva_create_evaluation_detail_history_GetFromForm();
|
||||
|
||||
//Update Mode
|
||||
if (eva_create_evaluation_detail_history_editMode === "UPDATE") {
|
||||
var successFunc1 = function (result) {
|
||||
$("#eva_create_evaluation_detail_historyModel").modal("hide");
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
eva_create_evaluation_detail_history_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPutRequest(apisite + eva_create_evaluation_detail_history_API + data.id, data, successFunc1, AlertDanger);
|
||||
}
|
||||
// Create mode
|
||||
else {
|
||||
var successFunc2 = function (result) {
|
||||
$("#eva_create_evaluation_detail_historyModel").modal("hide");
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
eva_create_evaluation_detail_history_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPostRequest(apisite + eva_create_evaluation_detail_history_API, data, successFunc2, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_history_GoDelete(a) {
|
||||
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
|
||||
var successFunc = function (result) {
|
||||
$("#eva_create_evaluation_detail_historyModel").modal("hide");
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
eva_create_evaluation_detail_history_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxDeleteRequest(apisite + eva_create_evaluation_detail_history_API + a, null, successFunc, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
//================= Data Table =========================================
|
||||
|
||||
var eva_create_evaluation_detail_historyTableV;
|
||||
|
||||
var eva_create_evaluation_detail_history_setupTable = function (result) {
|
||||
tmp = '"';
|
||||
eva_create_evaluation_detail_historyTableV = $('#eva_create_evaluation_detail_historyTable').DataTable({
|
||||
"processing": true,
|
||||
"serverSide": false,
|
||||
"data": result,
|
||||
//"select": {
|
||||
// "style": 'multi'
|
||||
//},
|
||||
"columns": [
|
||||
{ "data": "txt_action_dt" },
|
||||
{ "data": "action_detail" },
|
||||
{ "data": "action_emp_id_external_employee_fullname" },
|
||||
],
|
||||
"columnDefs": [
|
||||
|
||||
],
|
||||
"language": {
|
||||
"url": appsite + "/DataTables-1.10.16/thai.json"
|
||||
},
|
||||
"paging": true,
|
||||
"searching": false
|
||||
});
|
||||
endLoad();
|
||||
};
|
||||
|
||||
function eva_create_evaluation_detail_history_InitiateDataTable() {
|
||||
startLoad();
|
||||
var p = $.param(eva_create_evaluation_detail_history_GetSearchParameter());
|
||||
AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail_history/GetListBySearch?" + p, eva_create_evaluation_detail_history_setupTable, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_history_DoSearch() {
|
||||
var p = $.param(eva_create_evaluation_detail_history_GetSearchParameter());
|
||||
var eva_create_evaluation_detail_history_reload = function (result) {
|
||||
eva_create_evaluation_detail_historyTableV.destroy();
|
||||
eva_create_evaluation_detail_history_setupTable(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail_history/GetListBySearch?" + p, eva_create_evaluation_detail_history_reload, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_history_GetSelect(f) {
|
||||
var eva_create_evaluation_detail_history_selectitem = [];
|
||||
$.each(eva_create_evaluation_detail_historyTableV.rows('.selected').data(), function (key, value) {
|
||||
eva_create_evaluation_detail_history_selectitem.push(value[f]);
|
||||
});
|
||||
alert(eva_create_evaluation_detail_history_selectitem);
|
||||
}
|
||||
|
||||
//================= File Upload =========================================
|
||||
|
||||
|
||||
|
||||
//================= Multi-Selection Function =========================================
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user