ปรับปรุง คนที่ได้สิทธิพิเศษ ให้ดูรายชื่อได้ทั้งเนติ
This commit is contained in:
403
ApiControllers/eva_setup_permissionControllers.cs
Normal file
403
ApiControllers/eva_setup_permissionControllers.cs
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -43,10 +43,9 @@ 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; }
|
||||
|
||||
protected override void OnModelCreating (ModelBuilder modelBuilder) {
|
||||
|
||||
|
||||
BIN
EXCEL/eva_setup_permission.xlsx
Normal file
BIN
EXCEL/eva_setup_permission.xlsx
Normal file
Binary file not shown.
1118
Migrations/20211016124831_AddEvaPermission.Designer.cs
generated
Normal file
1118
Migrations/20211016124831_AddEvaPermission.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
33
Migrations/20211016124831_AddEvaPermission.cs
Normal file
33
Migrations/20211016124831_AddEvaPermission.cs
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -973,6 +973,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")
|
||||
|
||||
@@ -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
|
||||
@@ -148,7 +151,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 +163,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,7 +177,7 @@ 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";
|
||||
@@ -179,6 +185,7 @@ namespace TodoAPI2.Models
|
||||
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 (((int?[])special_person).Contains(emp_id)) return "99";
|
||||
|
||||
if (emp_id == chief) return "1";
|
||||
else if (emp_id == supervisor1) return "1";
|
||||
@@ -189,7 +196,7 @@ namespace TodoAPI2.Models
|
||||
}
|
||||
|
||||
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 "ผู้ประเมิน";
|
||||
@@ -197,6 +204,7 @@ namespace TodoAPI2.Models
|
||||
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 (((int?[])special_person).Contains(emp_id)) return "ผู้ตรวจสอบ";
|
||||
|
||||
if (emp_id == chief) return "ผู้ประเมิน";
|
||||
else if (emp_id == supervisor1) return "ผู้ประเมิน";
|
||||
@@ -223,11 +231,14 @@ namespace TodoAPI2.Models
|
||||
var entity = Get(id, emp_id);
|
||||
var i = Mapper.Map<eva_create_evaluation_detail_firstdocWithSelectionViewModel>(entity);
|
||||
|
||||
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
|
||||
where x.id == emp_id
|
||||
select x.department_id).FirstOrDefault();
|
||||
var alldep = (from x in emp.GetDeptMapping()
|
||||
where x.id == dep || x.id2 == dep
|
||||
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;
|
||||
@@ -243,6 +254,7 @@ namespace TodoAPI2.Models
|
||||
|| 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();
|
||||
@@ -268,11 +280,14 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
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
|
||||
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;
|
||||
@@ -288,6 +303,7 @@ namespace TodoAPI2.Models
|
||||
|| 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();
|
||||
@@ -334,6 +350,9 @@ 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
|
||||
@@ -385,7 +404,7 @@ namespace TodoAPI2.Models
|
||||
&& (fk_external_employee.department_id == model.org_id || !model.org_id.HasValue)
|
||||
&& (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)
|
||||
&& (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))
|
||||
|
||||
orderby
|
||||
fk_sort_depResult2.external_code,
|
||||
@@ -439,7 +458,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,
|
||||
@@ -449,7 +470,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,
|
||||
|
||||
@@ -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
|
||||
@@ -181,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),
|
||||
@@ -228,12 +233,15 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
var item = Get(id, emp_id, path);
|
||||
|
||||
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
|
||||
select x.id);
|
||||
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 = "ทั้งหมด";
|
||||
@@ -248,6 +256,7 @@ namespace TodoAPI2.Models
|
||||
|| 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();
|
||||
@@ -275,11 +284,14 @@ namespace TodoAPI2.Models
|
||||
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
|
||||
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;
|
||||
@@ -296,6 +308,7 @@ namespace TodoAPI2.Models
|
||||
|| 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();
|
||||
@@ -352,6 +365,9 @@ 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
|
||||
@@ -406,6 +422,7 @@ 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)).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)
|
||||
|
||||
@@ -450,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,
|
||||
@@ -458,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,
|
||||
@@ -486,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";
|
||||
@@ -494,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";
|
||||
@@ -505,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 "ผู้ประเมิน";
|
||||
@@ -516,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 "";
|
||||
}
|
||||
|
||||
|
||||
32
Models/eva_setup_permission/Ieva_setup_permissionService.cs
Normal file
32
Models/eva_setup_permission/Ieva_setup_permissionService.cs
Normal 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_setup_permissionService : IBaseService2<Guid, eva_setup_permissionInputModel, eva_setup_permissionViewModel>
|
||||
{
|
||||
new eva_setup_permissionViewModel Insert(eva_setup_permissionInputModel model, bool is_force_save);
|
||||
new eva_setup_permissionViewModel Update(Guid id, eva_setup_permissionInputModel model, bool is_force_save);
|
||||
List<eva_setup_permissionViewModel> GetListByremark(string remark);
|
||||
List<eva_setup_permissionViewModel> GetListBySearch(eva_setup_permissionSearchModel model);
|
||||
|
||||
string UpdateMultiple(List<eva_setup_permissionInputModel> model, bool is_force_save);
|
||||
eva_setup_permissionWithSelectionViewModel GetWithSelection(Guid id);
|
||||
eva_setup_permissionWithSelectionViewModel GetBlankItem();
|
||||
|
||||
void RefreshAutoFieldOfAllData();
|
||||
eva_setup_permissionEntity GetEntity(Guid id);
|
||||
DataContext GetContext();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
36
Models/eva_setup_permission/eva_setup_permissionEntity.cs
Normal file
36
Models/eva_setup_permission/eva_setup_permissionEntity.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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_setup_permissionEntity : BaseEntity2<Guid>
|
||||
{
|
||||
|
||||
|
||||
public int? employee_id { get; set; }
|
||||
|
||||
[MaxLength(4000)]
|
||||
public string remark { get; set; }
|
||||
|
||||
|
||||
public void SetAutoField(DataContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DoAfterInsertUpdate(DataContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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_setup_permissionInputModel
|
||||
{
|
||||
|
||||
public Guid? id { get; set; }
|
||||
|
||||
public int? employee_id { get; set; }
|
||||
|
||||
public string remark { 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_setup_permissionReportRequestModel : eva_setup_permissionSearchModel
|
||||
{
|
||||
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_setup_permissionSearchModel
|
||||
{
|
||||
|
||||
public Guid id { get; set; }
|
||||
|
||||
public string remark { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
279
Models/eva_setup_permission/eva_setup_permissionService.cs
Normal file
279
Models/eva_setup_permission/eva_setup_permissionService.cs
Normal file
@@ -0,0 +1,279 @@
|
||||
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_setup_permissionService : Ieva_setup_permissionService
|
||||
{
|
||||
private IBaseRepository2<eva_setup_permissionEntity, Guid> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
|
||||
public eva_setup_permissionService(IBaseRepository2<eva_setup_permissionEntity, Guid> repository, IMyDatabase mydb,
|
||||
Iexternal_linkageService inext, Iexternal_employeeService inemp)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
private eva_setup_permissionEntity GetEntity(eva_setup_permissionInputModel model)
|
||||
{
|
||||
return Mapper.Map<eva_setup_permissionEntity>(model);
|
||||
}
|
||||
private List<eva_setup_permissionEntity> GetEntityList(List<eva_setup_permissionInputModel> models)
|
||||
{
|
||||
return Mapper.Map<List<eva_setup_permissionEntity>>(models);
|
||||
}
|
||||
private eva_setup_permissionViewModel GetDto(eva_setup_permissionEntity entity)
|
||||
{
|
||||
return Mapper.Map<eva_setup_permissionViewModel>(entity);
|
||||
}
|
||||
private List<eva_setup_permissionViewModel> GetDtoList(List<eva_setup_permissionEntity> entities)
|
||||
{
|
||||
return Mapper.Map<List<eva_setup_permissionViewModel>>(entities);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
#region Query Functions
|
||||
|
||||
public eva_setup_permissionViewModel Get(Guid id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
return GetDto(entity);
|
||||
}
|
||||
|
||||
public eva_setup_permissionEntity GetEntity(Guid id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public DataContext GetContext()
|
||||
{
|
||||
return _repository.Context;
|
||||
}
|
||||
|
||||
public eva_setup_permissionWithSelectionViewModel GetWithSelection(Guid id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
var i = Mapper.Map<eva_setup_permissionWithSelectionViewModel>(entity);
|
||||
i.item_employee_id = (from x in emp.GetAllEmployee() select x).ToList();
|
||||
|
||||
return i;
|
||||
}
|
||||
public eva_setup_permissionWithSelectionViewModel GetBlankItem()
|
||||
{
|
||||
var i = new eva_setup_permissionWithSelectionViewModel();
|
||||
i.item_employee_id = (from x in emp.GetAllEmployee() select x).ToList();
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public List<eva_setup_permissionViewModel> GetListByremark(string remark)
|
||||
{
|
||||
var model = new eva_setup_permissionSearchModel();
|
||||
model.remark = remark;
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
public List<eva_setup_permissionViewModel> GetListBySearch(eva_setup_permissionSearchModel model)
|
||||
{
|
||||
var data = (
|
||||
from m_eva_setup_permission in _repository.Context.eva_setup_permission
|
||||
|
||||
join fk_external_linkage1 in emp.GetAllEmployee() on m_eva_setup_permission.employee_id equals fk_external_linkage1.id
|
||||
into external_linkageResult1
|
||||
from fk_external_linkageResult1 in external_linkageResult1.DefaultIfEmpty()
|
||||
|
||||
|
||||
where
|
||||
1 == 1
|
||||
&& (string.IsNullOrEmpty(model.remark) || m_eva_setup_permission.remark.Contains(model.remark))
|
||||
|
||||
|
||||
orderby m_eva_setup_permission.created descending
|
||||
select new eva_setup_permissionViewModel()
|
||||
{
|
||||
id = m_eva_setup_permission.id,
|
||||
employee_id = m_eva_setup_permission.employee_id,
|
||||
remark = m_eva_setup_permission.remark,
|
||||
|
||||
employee_id_external_linkage_external_name = fk_external_linkageResult1.fullname,
|
||||
|
||||
isActive = m_eva_setup_permission.isActive,
|
||||
Created = m_eva_setup_permission.created,
|
||||
Updated = m_eva_setup_permission.updated
|
||||
}
|
||||
).Take(1000).ToList();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Manipulation Functions
|
||||
|
||||
|
||||
|
||||
public eva_setup_permissionViewModel Insert(eva_setup_permissionInputModel 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_setup_permissionViewModel>(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public eva_setup_permissionViewModel Update(Guid id, eva_setup_permissionInputModel model, bool is_force_save)
|
||||
{
|
||||
var existingEntity = _repository.Get(id);
|
||||
if (existingEntity != null)
|
||||
{
|
||||
existingEntity.employee_id = model.employee_id;
|
||||
existingEntity.remark = model.remark;
|
||||
|
||||
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_setup_permissionViewModel>(existingEntity);
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new NotificationException("No data to update");
|
||||
}
|
||||
|
||||
public string UpdateMultiple(List<eva_setup_permissionInputModel> 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.employee_id = i.employee_id;
|
||||
existingEntity.remark = i.remark;
|
||||
|
||||
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_setup_permissionViewModel SetAsActive(Guid id)
|
||||
{
|
||||
var updated = _repository.SetAsActive(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
public eva_setup_permissionViewModel 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_setup_permission
|
||||
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("employee_id", "ชื่อพนักงาน");
|
||||
i.Add("employee_id_external_linkage_external_name", "ชื่อพนักงาน");
|
||||
i.Add("remark", "หมายเหตุ");
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Match Item
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
24
Models/eva_setup_permission/eva_setup_permissionViewModel.cs
Normal file
24
Models/eva_setup_permission/eva_setup_permissionViewModel.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
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_setup_permissionViewModel : BaseViewModel2<Guid>
|
||||
{
|
||||
|
||||
public int? employee_id { get; set; }
|
||||
|
||||
public string remark { get; set; }
|
||||
|
||||
public string employee_id_external_linkage_external_name { 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_setup_permissionWithSelectionViewModel: eva_setup_permissionViewModel
|
||||
{
|
||||
public List<external_employeeViewModel> item_employee_id { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -337,6 +337,9 @@ namespace Test01
|
||||
|
||||
services.AddScoped<Irep_summary_a01Service, rep_summary_a01Service>();
|
||||
|
||||
services.AddScoped<IBaseRepository2<eva_setup_permissionEntity, Guid>, BaseRepository2<eva_setup_permissionEntity, Guid>>();
|
||||
services.AddScoped<Ieva_setup_permissionService, eva_setup_permissionService>();
|
||||
|
||||
#endregion
|
||||
|
||||
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
@@ -636,6 +639,10 @@ namespace Test01
|
||||
cfg.CreateMap<eva_level_scoreEntity, rep_summary_a01ViewModel>();
|
||||
cfg.CreateMap<eva_level_scoreEntity, rep_summary_a01WithSelectionViewModel>();
|
||||
|
||||
cfg.CreateMap<eva_setup_permissionInputModel, eva_setup_permissionEntity>();
|
||||
cfg.CreateMap<eva_setup_permissionEntity, eva_setup_permissionViewModel>();
|
||||
cfg.CreateMap<eva_setup_permissionEntity, eva_setup_permissionWithSelectionViewModel>();
|
||||
|
||||
});
|
||||
#endregion
|
||||
|
||||
|
||||
66
ViewControllers/eva_setup_permissionViewControllers.cs
Normal file
66
ViewControllers/eva_setup_permissionViewControllers.cs
Normal file
@@ -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_setup_permissionViewController : Controller
|
||||
{
|
||||
private ILogger<eva_setup_permissionController> _logger;
|
||||
private Ieva_setup_permissionService _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_setup_permissionViewController(ILogger<eva_setup_permissionController> logger, Ieva_setup_permissionService repository, IConfiguration configuration)
|
||||
{
|
||||
_logger = logger;
|
||||
_repository = repository;
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
public IActionResult eva_setup_permission()
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult eva_setup_permission_d()
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
|
||||
return View();
|
||||
}
|
||||
|
||||
//public IActionResult eva_setup_permission_report()
|
||||
//{
|
||||
// if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
|
||||
// return View();
|
||||
//}
|
||||
|
||||
//public IActionResult eva_setup_permission_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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -325,7 +325,24 @@
|
||||
$("#s2_text").hide();
|
||||
$(".reject_section").hide();
|
||||
|
||||
if (role_code === "1") { // ผู้ประเมิน
|
||||
if (role_code === "99") { // ผู้ตรวจสอบ
|
||||
|
||||
$(".approve_item").prop("disabled", true);
|
||||
$(".status_chief").hide();
|
||||
$("#eva_create_evaluation_detail_review0A_chief_a_reject_reason").prop("disabled", true);
|
||||
|
||||
if (status_chief_a === "Y") {
|
||||
$("#status").text("ข้อตกลงการประเมิน ได้รับการอนุมัติไปแล้ว");
|
||||
|
||||
}
|
||||
else if (status_chief_a === "N") {
|
||||
$("#status").text("คุณตีกลับข้อตกลงการประเมิน กรูณารอผู้ประเมินแก้ไขและส่งกลับ");
|
||||
}
|
||||
|
||||
$("#s1_text").text("ส่วนที่ 1 ข้อตกลงการปฏิบัติงาน");
|
||||
$("#s2_text").show();
|
||||
}
|
||||
else if (role_code === "1") { // ผู้ประเมิน
|
||||
$(".approve_section").show();
|
||||
$(".reject_section").show();
|
||||
|
||||
@@ -346,8 +363,7 @@
|
||||
}
|
||||
|
||||
$("#s1_text").text("ส่วนที่ 1 ข้อตกลงการปฏิบัติงาน");
|
||||
$("#s2_text").show();
|
||||
|
||||
$("#s2_text").show();
|
||||
|
||||
} else if (role_code === "") { // ผู้รับการประเมิน
|
||||
$(".status_self").show();
|
||||
|
||||
110
Views/eva_setup_permissionView/eva_setup_permission.cshtml
Normal file
110
Views/eva_setup_permissionView/eva_setup_permission.cshtml
Normal file
@@ -0,0 +1,110 @@
|
||||
@using Microsoft.Extensions.Configuration
|
||||
@inject IConfiguration Configuration
|
||||
@{
|
||||
ViewData["Title"] = "eva_setup_permission";
|
||||
}
|
||||
|
||||
<div class="modal fade" id="eva_setup_permissionModel" style="z-index:1500" tabindex="-1" role="dialog" aria-labelledby="eva_setup_permissionModelLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="eva_setup_permissionModelLabel">บันทึกข้อมูล ผู้มีสิทธิดูข้อมูล</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<input class="form-control" type="hidden" id="eva_setup_permission_id" />
|
||||
|
||||
<div class='row'></div>
|
||||
<div class='row'></div>
|
||||
<div class='row'>
|
||||
<div class="form-group col-md-8">
|
||||
<label id="lab_eva_setup_permission_employee_id" for="eva_setup_permission_employee_id">ชื่อพนักงาน</label>
|
||||
<select class="form-control" id="eva_setup_permission_employee_id" iLabel="ชื่อพนักงาน" iRequire="true" iGroup="eva_setup_permission"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class="form-group col-md-12">
|
||||
<label id="lab_eva_setup_permission_remark" for="eva_setup_permission_remark">หมายเหตุ</label>
|
||||
<textarea class="form-control" rows="4" cols="50" id="eva_setup_permission_remark" iLabel="หมายเหตุ" iRequire="false" iGroup="eva_setup_permission"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">ยกเลิก</button>
|
||||
<button type="button" class="btn btn-primary" onclick="javascript:eva_setup_permission_PutUpdate()">บันทึก</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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="form-group col-md-3" style="display:none;">
|
||||
<label id='lab_s_eva_setup_permission_remark' for='s_eva_setup_permission_remark'>หมายเหตุ</label>
|
||||
<textarea class="form-control" rows="4" cols="50" id="s_eva_setup_permission_remark" iLabel="หมายเหตุ" iRequire="false" iGroup="s_eva_setup_permission" title='หมายเหตุ' placeholder='หมายเหตุ'></textarea>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<button style="display:none;" class="btn btn-info" onclick="javascript:eva_setup_permission_DoSearch();">ค้นหา</button>
|
||||
<button class="btn btn-info" onclick="javascript:eva_setup_permission_GoCreate();"><i class="fa fa-plus" style="font-size: 14px;"></i> เพิ่มรายการ</button>
|
||||
<button style="display:none;" class="btn btn-info" onclick="javascript:eva_setup_permission_GetSelect('id');">ดึงตัวเลือก</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="eva_setup_permissionTable" class="display table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!--<th>เลือก</th>-->
|
||||
<th>เครื่องมือ</th>
|
||||
<th><label id='h_eva_setup_permission_employee_id'>ชื่อพนักงาน</label></th>
|
||||
<th><label id='h_eva_setup_permission_remark'>หมายเหตุ</label></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
@section FooterPlaceHolder{
|
||||
<script src="~/js/eva_setup_permission/eva_setup_permission.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
eva_setup_permission_InitiateDataTable();
|
||||
eva_setup_permission_InitialForm();
|
||||
SetupValidationRemark("eva_setup_permission");
|
||||
$("#eva_setup_permission_employee_id").select2({
|
||||
dropdownParent: $('#eva_setup_permissionModel')
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
@@ -94,6 +94,9 @@
|
||||
<ul>
|
||||
<li><a href="~/eva_adjust_postponement_migrationView/eva_adjust_postponement_migration"><div style="display: flex;align-items: center;"><span class="menu-dot">·</span>หน้าจอ migration</div></a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="~/eva_setup_permissionView/eva_setup_permission"><div style="display: flex;align-items: center;"><span class="menu-dot">·</span>สิทธิการดูทุกหน่วยงาน</div></a>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
<None Include="Views\eva_limit_frame_groupView\eva_limit_frame_group_d.cshtml" />
|
||||
<None Include="Views\eva_limit_frame_planView\eva_limit_frame_plan.cshtml" />
|
||||
<None Include="Views\eva_limit_frame_planView\eva_limit_frame_plan_d.cshtml" />
|
||||
<None Include="Views\eva_setup_permissionView\eva_setup_permission.cshtml" />
|
||||
<None Include="Views\rep_eva_limit_frame_planView\rep_eva_limit_frame_plan_report.cshtml" />
|
||||
<None Include="Views\rep_summary_a01View\rep_summary_a01_report.cshtml" />
|
||||
<None Include="Views\vw_limit_frame_planView\vw_limit_frame_plan.cshtml" />
|
||||
@@ -99,6 +100,7 @@
|
||||
<None Include="wwwroot\js\eva_limit_frame_plan\eva_limit_frame_plan_inline.js" />
|
||||
<None Include="wwwroot\js\eva_limit_frame_plan\eva_limit_frame_plan_report.js" />
|
||||
<None Include="wwwroot\js\eva_self_review\eva_self_review.js" />
|
||||
<None Include="wwwroot\js\eva_setup_permission\eva_setup_permission.js" />
|
||||
<None Include="wwwroot\js\rep_eva01\rep_eva01_report.js" />
|
||||
<None Include="wwwroot\js\rep_eva_limit_frame_plan\rep_eva_limit_frame_plan_report.js" />
|
||||
<None Include="wwwroot\js\rep_eva_self_review\rep_eva_self_review_report.js" />
|
||||
|
||||
126
tb320eva.xml
126
tb320eva.xml
@@ -4520,6 +4520,124 @@
|
||||
<response code="200">Returns the item</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_setup_permissionController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_setup_permissionController},TodoAPI2.Models.Ieva_setup_permissionService,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_setup_permissionController.Get(System.Guid)">
|
||||
<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_setup_permissionController.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_setup_permissionController.GetList(System.String)">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_setup_permissionController.GetListBySearch(TodoAPI2.Models.eva_setup_permissionSearchModel)">
|
||||
<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_setup_permissionController.eva_setup_permission_report(TodoAPI2.Models.eva_setup_permissionReportRequestModel)">
|
||||
<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_setup_permissionController.Insert(TodoAPI2.Models.eva_setup_permissionInputModel)">
|
||||
<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_setup_permissionController.Update(System.Guid,TodoAPI2.Models.eva_setup_permissionInputModel)">
|
||||
<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_setup_permissionController.Delete(System.Guid)">
|
||||
<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_setup_permissionController.UpdateMultiple(System.Collections.Generic.List{TodoAPI2.Models.eva_setup_permissionInputModel})">
|
||||
<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_setup_permissionController.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_temp_fingerscanController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_temp_fingerscanController},TodoAPI2.Models.Ieva_temp_fingerscanService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<summary>
|
||||
Default constructure for dependency injection
|
||||
@@ -5571,6 +5689,14 @@
|
||||
<param name="inemp"></param>
|
||||
<param name="logger"></param>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.eva_setup_permissionViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_setup_permissionController},TodoAPI2.Models.Ieva_setup_permissionService,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.external_employeeViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.external_employeeController},TodoAPI2.Models.Iexternal_employeeService)">
|
||||
<summary>
|
||||
Default constructure for dependency injection
|
||||
|
||||
@@ -25,7 +25,7 @@ function eva_create_evaluation_detail_firstdoc_FeedDataToForm(data) {
|
||||
status_chief_a = data.status_chief_a;
|
||||
role_code = data.role_code;
|
||||
|
||||
if (role_code === "1") {
|
||||
if (role_code === "1" || role_code === "99") {
|
||||
show_tool = false;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ function eva_create_evaluation_detail_firstdoc_FeedDataToForm(data) {
|
||||
eva_evaluation_operating_agreement_InitialForm();
|
||||
|
||||
CheckPermission();
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_firstdoc_GetFromForm() {
|
||||
|
||||
@@ -188,7 +188,11 @@ function setPageByRoleAndStatus(role_code, status_self, status_chief, status_sup
|
||||
$(".mycontrol02").attr("disabled", true);
|
||||
$("#eva_create_evaluation_detail_review01_supervisor1_remark").attr("disabled", true);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else if (role_code === "99") { // ผู้ตรวจสอบ
|
||||
|
||||
}
|
||||
else {
|
||||
console.log(role_code);
|
||||
//alert('คุณไม่มีสิทธิเข้าถึงหน้าจอนี้!');
|
||||
//window_close();
|
||||
|
||||
@@ -299,10 +299,14 @@ function setPageByRoleAndStatus(role_code, status_self, status_chief, status_sup
|
||||
$("#thestatus2A").text("(ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด) ส่งแบบประเมินแล้ว)");
|
||||
$(".myeditor").attr("disabled", true);
|
||||
}
|
||||
}
|
||||
else if (role_code === "99") { // ผู้ตรวจสอบ
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
alert('คุณไม่มีสิทธิเข้าถึงหน้าจอนี้!');
|
||||
window_close();
|
||||
window_close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ function eva_evaluation_operating_agreement_GoDelete(a) {
|
||||
var eva_evaluation_operating_agreementTableV;
|
||||
|
||||
var eva_evaluation_operating_agreement_setupTable = function (result) {
|
||||
console.log(result);
|
||||
|
||||
tmp = '"';
|
||||
eva_evaluation_operating_agreementTableV = $('#eva_evaluation_operating_agreementTable').DataTable({
|
||||
"processing": true,
|
||||
@@ -192,6 +192,7 @@ var eva_evaluation_operating_agreement_setupTable = function (result) {
|
||||
"searching": false,
|
||||
"bSort": false
|
||||
});
|
||||
|
||||
endLoad();
|
||||
};
|
||||
|
||||
|
||||
220
wwwroot/js/eva_setup_permission/eva_setup_permission.js
Normal file
220
wwwroot/js/eva_setup_permission/eva_setup_permission.js
Normal file
@@ -0,0 +1,220 @@
|
||||
var eva_setup_permission_editMode = "CREATE";
|
||||
var eva_setup_permission_API = "/api/eva_setup_permission/";
|
||||
|
||||
//================= Search Customizaiton =========================================
|
||||
|
||||
function eva_setup_permission_GetSearchParameter() {
|
||||
var eva_setup_permissionSearchObject = new Object();
|
||||
eva_setup_permissionSearchObject.remark = $("#s_eva_setup_permission_remark").val();
|
||||
|
||||
return eva_setup_permissionSearchObject;
|
||||
}
|
||||
|
||||
function eva_setup_permission_FeedDataToSearchForm(data) {
|
||||
$("#s_eva_setup_permission_remark").val(data.remark);
|
||||
|
||||
}
|
||||
|
||||
//================= Form Data Customizaiton =========================================
|
||||
|
||||
function eva_setup_permission_FeedDataToForm(data) {
|
||||
$("#eva_setup_permission_id").val(data.id);
|
||||
console.log(data);
|
||||
DropDownClearFormAndFeedWithData($("#eva_setup_permission_employee_id"), data, "id", "fullname", "item_employee_id", data.employee_id);
|
||||
$("#eva_setup_permission_remark").val(data.remark);
|
||||
|
||||
}
|
||||
|
||||
function eva_setup_permission_GetFromForm() {
|
||||
var eva_setup_permissionObject = new Object();
|
||||
eva_setup_permissionObject.id = $("#eva_setup_permission_id").val();
|
||||
eva_setup_permissionObject.employee_id = $("#eva_setup_permission_employee_id").val();
|
||||
eva_setup_permissionObject.remark = $("#eva_setup_permission_remark").val();
|
||||
|
||||
|
||||
return eva_setup_permissionObject;
|
||||
}
|
||||
|
||||
function eva_setup_permission_InitialForm(s) {
|
||||
var successFunc = function (result) {
|
||||
eva_setup_permission_FeedDataToForm(result);
|
||||
eva_setup_permission_FeedDataToSearchForm(result);
|
||||
if (s) {
|
||||
// Incase model popup
|
||||
$("#eva_setup_permissionModel").modal("show");
|
||||
}
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_setup_permission_API + "GetBlankItem", successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
//================= Form Mode Setup and Flow =========================================
|
||||
|
||||
function eva_setup_permission_GoCreate() {
|
||||
// Incase model popup
|
||||
eva_setup_permission_SetCreateForm(true);
|
||||
|
||||
// Incase open new page
|
||||
//window_open(appsite + "/eva_setup_permissionView/eva_setup_permission_d");
|
||||
}
|
||||
|
||||
function eva_setup_permission_GoEdit(a) {
|
||||
// Incase model popup
|
||||
eva_setup_permission_SetEditForm(a);
|
||||
|
||||
// Incase open new page
|
||||
//window_open(appsite + "/eva_setup_permissionView/eva_setup_permission_d?id=" + a);
|
||||
}
|
||||
|
||||
function eva_setup_permission_SetEditForm(a) {
|
||||
var successFunc = function (result) {
|
||||
eva_setup_permission_editMode = "UPDATE";
|
||||
eva_setup_permission_FeedDataToForm(result);
|
||||
$("#eva_setup_permissionModel").modal("show");
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_setup_permission_API + a, successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_setup_permission_SetCreateForm(s) {
|
||||
eva_setup_permission_editMode = "CREATE";
|
||||
eva_setup_permission_InitialForm(s);
|
||||
}
|
||||
|
||||
function eva_setup_permission_RefreshTable() {
|
||||
// Incase model popup
|
||||
eva_setup_permission_DoSearch();
|
||||
|
||||
// Incase open new page
|
||||
//window.parent.eva_setup_permission_DoSearch();
|
||||
}
|
||||
|
||||
//================= Update and Delete =========================================
|
||||
|
||||
var eva_setup_permission_customValidation = function (group) {
|
||||
return "";
|
||||
};
|
||||
|
||||
function eva_setup_permission_PutUpdate() {
|
||||
if (!ValidateForm('eva_setup_permission', eva_setup_permission_customValidation)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = eva_setup_permission_GetFromForm();
|
||||
|
||||
//Update Mode
|
||||
if (eva_setup_permission_editMode === "UPDATE") {
|
||||
var successFunc1 = function (result) {
|
||||
$("#eva_setup_permissionModel").modal("hide");
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
eva_setup_permission_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPutRequest(apisite + eva_setup_permission_API + data.id, data, successFunc1, AlertDanger);
|
||||
}
|
||||
// Create mode
|
||||
else {
|
||||
var successFunc2 = function (result) {
|
||||
$("#eva_setup_permissionModel").modal("hide");
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
eva_setup_permission_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPostRequest(apisite + eva_setup_permission_API, data, successFunc2, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
function eva_setup_permission_GoDelete(a) {
|
||||
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
|
||||
var successFunc = function (result) {
|
||||
$("#eva_setup_permissionModel").modal("hide");
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
eva_setup_permission_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxDeleteRequest(apisite + eva_setup_permission_API + a, null, successFunc, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
//================= Data Table =========================================
|
||||
|
||||
var eva_setup_permissionTableV;
|
||||
|
||||
var eva_setup_permission_setupTable = function (result) {
|
||||
tmp = '"';
|
||||
eva_setup_permissionTableV = $('#eva_setup_permissionTable').DataTable({
|
||||
"processing": true,
|
||||
"serverSide": false,
|
||||
"data": result,
|
||||
//"select": {
|
||||
// "style": 'multi'
|
||||
//},
|
||||
"columns": [
|
||||
//{ "data": "" },
|
||||
{ "data": "id" },
|
||||
{ "data": "employee_id_external_linkage_external_name" },
|
||||
{ "data": "remark" },
|
||||
],
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": 0, //1,
|
||||
"data": "id",
|
||||
"render": function (data, type, row, meta) {
|
||||
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:eva_setup_permission_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> <button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_setup_permission_GoDelete(" + tmp + data + tmp + ")'><i class='fa fa-trash-o '></i></button> ";
|
||||
}
|
||||
},
|
||||
//{
|
||||
// targets: 0,
|
||||
// data: "",
|
||||
// defaultContent: '',
|
||||
// orderable: false,
|
||||
// className: 'select-checkbox'
|
||||
//}
|
||||
],
|
||||
"language": {
|
||||
"url": appsite + "/DataTables-1.10.16/thai.json"
|
||||
},
|
||||
"paging": true,
|
||||
"searching": false
|
||||
});
|
||||
endLoad();
|
||||
};
|
||||
|
||||
function eva_setup_permission_InitiateDataTable() {
|
||||
startLoad();
|
||||
var p = $.param(eva_setup_permission_GetSearchParameter());
|
||||
AjaxGetRequest(apisite + "/api/eva_setup_permission/GetListBySearch?" + p, eva_setup_permission_setupTable, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_setup_permission_DoSearch() {
|
||||
var p = $.param(eva_setup_permission_GetSearchParameter());
|
||||
var eva_setup_permission_reload = function (result) {
|
||||
eva_setup_permissionTableV.destroy();
|
||||
eva_setup_permission_setupTable(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + "/api/eva_setup_permission/GetListBySearch?" + p, eva_setup_permission_reload, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_setup_permission_GetSelect(f) {
|
||||
var eva_setup_permission_selectitem = [];
|
||||
$.each(eva_setup_permissionTableV.rows('.selected').data(), function (key, value) {
|
||||
eva_setup_permission_selectitem.push(value[f]);
|
||||
});
|
||||
alert(eva_setup_permission_selectitem);
|
||||
}
|
||||
|
||||
//================= File Upload =========================================
|
||||
|
||||
|
||||
|
||||
//================= Multi-Selection Function =========================================
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user