From df7d36b06b25388678fa0363fb909e15d6f327c0 Mon Sep 17 00:00:00 2001 From: nakorn Date: Sat, 16 Oct 2021 21:51:16 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=9B?= =?UTF-8?q?=E0=B8=A3=E0=B8=B8=E0=B8=87=20=E0=B8=84=E0=B8=99=E0=B8=97?= =?UTF-8?q?=E0=B8=B5=E0=B9=88=E0=B9=84=E0=B8=94=E0=B9=89=E0=B8=AA=E0=B8=B4?= =?UTF-8?q?=E0=B8=97=E0=B8=98=E0=B8=B4=E0=B8=9E=E0=B8=B4=E0=B9=80=E0=B8=A8?= =?UTF-8?q?=E0=B8=A9=20=E0=B9=83=E0=B8=AB=E0=B9=89=E0=B8=94=E0=B8=B9?= =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD?= =?UTF-8?q?=E0=B9=84=E0=B8=94=E0=B9=89=E0=B8=97=E0=B8=B1=E0=B9=89=E0=B8=87?= =?UTF-8?q?=E0=B9=80=E0=B8=99=E0=B8=95=E0=B8=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eva_setup_permissionControllers.cs | 403 ++++++ EF/DataContext.cs | 3 +- EXCEL/eva_setup_permission.xlsx | Bin 0 -> 10201 bytes ...0211016124831_AddEvaPermission.Designer.cs | 1118 +++++++++++++++++ Migrations/20211016124831_AddEvaPermission.cs | 33 + Migrations/DataContextModelSnapshot.cs | 20 + ...reate_evaluation_detail_firstdocService.cs | 43 +- ...create_evaluation_detail_processService.cs | 42 +- .../Ieva_setup_permissionService.cs | 32 + .../eva_setup_permissionEntity.cs | 36 + .../eva_setup_permissionInputModel.cs | 26 + .../eva_setup_permissionReportRequestModel.cs | 21 + .../eva_setup_permissionSearchModel.cs | 23 + .../eva_setup_permissionService.cs | 279 ++++ .../eva_setup_permissionViewModel.cs | 24 + ..._setup_permissionWithSelectionViewModel.cs | 13 + Startup.cs | 7 + .../eva_setup_permissionViewControllers.cs | 66 + ...create_evaluation_detail_firstdoc_d.cshtml | 22 +- .../eva_setup_permission.cshtml | 110 ++ Views/home/index2.cshtml | 3 + tb320eva.csproj | 2 + tb320eva.xml | 126 ++ ...eva_create_evaluation_detail_firstdoc_d.js | 3 +- .../eva_create_evaluation_detail_process_d.js | 6 +- ...eva_create_evaluation_detail_process_d2.js | 6 +- .../eva_evaluation_operating_agreement.js | 3 +- .../eva_setup_permission.js | 220 ++++ 28 files changed, 2660 insertions(+), 30 deletions(-) create mode 100644 ApiControllers/eva_setup_permissionControllers.cs create mode 100644 EXCEL/eva_setup_permission.xlsx create mode 100644 Migrations/20211016124831_AddEvaPermission.Designer.cs create mode 100644 Migrations/20211016124831_AddEvaPermission.cs create mode 100644 Models/eva_setup_permission/Ieva_setup_permissionService.cs create mode 100644 Models/eva_setup_permission/eva_setup_permissionEntity.cs create mode 100644 Models/eva_setup_permission/eva_setup_permissionInputModel.cs create mode 100644 Models/eva_setup_permission/eva_setup_permissionReportRequestModel.cs create mode 100644 Models/eva_setup_permission/eva_setup_permissionSearchModel.cs create mode 100644 Models/eva_setup_permission/eva_setup_permissionService.cs create mode 100644 Models/eva_setup_permission/eva_setup_permissionViewModel.cs create mode 100644 Models/eva_setup_permission/eva_setup_permissionWithSelectionViewModel.cs create mode 100644 ViewControllers/eva_setup_permissionViewControllers.cs create mode 100644 Views/eva_setup_permissionView/eva_setup_permission.cshtml create mode 100644 wwwroot/js/eva_setup_permission/eva_setup_permission.js diff --git a/ApiControllers/eva_setup_permissionControllers.cs b/ApiControllers/eva_setup_permissionControllers.cs new file mode 100644 index 0000000..853603b --- /dev/null +++ b/ApiControllers/eva_setup_permissionControllers.cs @@ -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 _logger; + private Ieva_setup_permissionService _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_setup_permissionController(ILogger logger, Ieva_setup_permissionService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + /// + /// Get specific item by id + /// + /// + /// + /// Return Get specific item by id + /// Returns the item + /// Error Occurred + [HttpGet("{id}")] + [ProducesResponseType(typeof(eva_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}"); + } + } + + /// + /// Get Blank Item + /// + /// + /// + /// Return a blank item + /// Returns the item + /// Error Occurred + [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}"); + } + } + + /// + /// Get list items by remark + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetList(string 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}"); + } + } + + /// + /// Get list items by search + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("GetListBySearch")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetListBySearch(eva_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}"); + } + } + + /// + /// Download Report + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [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}"); + } + } + + /// + /// Create new item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPost("")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Insert([FromBody] eva_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); + } + + /// + /// Update item + /// + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("{id}")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Update(Guid id, [FromBody] eva_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); + } + + /// + /// Delete item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpDelete("{id}")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Delete(Guid id) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + _repository.Delete(id); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"ลบข้อมูล เรียบร้อย"; + message.data = null; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while delete {id.ToString()}.", ex); + return StatusCode(500, $"{id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Update multiple item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("UpdateMultiple")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult UpdateMultiple([FromBody] List model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + string rowCount = _repository.UpdateMultiple(model, 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); + } + + /// + /// Refresh AutoField of all items + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [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); + } + + + + } +} diff --git a/EF/DataContext.cs b/EF/DataContext.cs index 992fa69..99c4dd0 100644 --- a/EF/DataContext.cs +++ b/EF/DataContext.cs @@ -43,10 +43,9 @@ namespace TTSW.EF { public DbSet eva_limit_frame_plan { get; set; } public DbSet eva_idp_plan { get; set; } public DbSet eva_create_evaluation_detail_history { get; set; } - public DbSet eva_evaluation_achievement_attach { get; set; } - public DbSet activity_log_eva { get; set; } + public DbSet eva_setup_permission { get; set; } protected override void OnModelCreating (ModelBuilder modelBuilder) { diff --git a/EXCEL/eva_setup_permission.xlsx b/EXCEL/eva_setup_permission.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..666e501ff5a5f817b6ee9ddb47f99a58baa3c3d0 GIT binary patch literal 10201 zcmeHtg;yQP_VvXfINaa~?(XgoEWs^Ekl-F5xVyUq30w&7?(Xg+IKhIu`|oCE-j^9B z-(T=v_gdYnSM}MeyXx#Zr}im%87OEV02Tlb004*q!kj*%RuBLHGzSQ$=xKwxUltv0F8v&-M#@fK2s`Xi1$my@p|J)ZQET2qq(3#%$wX^Pzo6^6LWaB5(=e0|joq14X6 z1Q4WMZi34rN+@Jn1d(USLWsl~fPhxc3_Kw+_JU<3U2GVrV|ms&=j5ilD}mGSd99@8 zqs|?#&v;ar3P^6c!m-|LJreOW$?kNItuMPcn0`RRa8LFU;lT;V(CyrsF6$KAdvuE^ zjXCPrx!DiiE&$DR5wO&-kA6mAR}8s@aD1l9iG7598;24x#l;nwItNH})WeQ0;WeJy{{hUi$44lD{6A<~t-?fl2KK$z;8sL1O?7My zE$kQ>eqR4a&;Mdh{_WR`V&2GgG9d*VO5O$bT~04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Dnso@JW{P+pOg&=s!dKFGv7D8!W&7EAT%x|K~*gck?CUznT9vZOhBRfPD}E QKmwl>U^o6u_Velg0G5rtdjJ3c literal 0 HcmV?d00001 diff --git a/Migrations/20211016124831_AddEvaPermission.Designer.cs b/Migrations/20211016124831_AddEvaPermission.Designer.cs new file mode 100644 index 0000000..eeccd79 --- /dev/null +++ b/Migrations/20211016124831_AddEvaPermission.Designer.cs @@ -0,0 +1,1118 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using TTSW.EF; + +namespace tb320eva.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20211016124831_AddEvaPermission")] + partial class AddEvaPermission + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn) + .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("TodoAPI2.Models.activity_log_evaEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("causer_id"); + + b.Property("causer_type") + .HasMaxLength(191); + + b.Property("created_at"); + + b.Property("description") + .HasMaxLength(4000); + + b.Property("ip_address") + .HasMaxLength(191); + + b.Property("log_name") + .HasMaxLength(191); + + b.Property("mac_address") + .HasMaxLength(191); + + b.Property("properties") + .HasMaxLength(8000); + + b.Property("subject_id"); + + b.Property("subject_type") + .HasMaxLength(191); + + b.Property("updated_at"); + + b.HasKey("id"); + + b.ToTable("activity_log_eva"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b => + { + b.Property("id"); + + b.Property("command_no") + .HasMaxLength(4000); + + b.Property("create_evaluation_id"); + + b.Property("created"); + + b.Property("fiscal_year"); + + b.Property("imported_date"); + + b.Property("imported_file") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("limit"); + + b.Property("limit_frame"); + + b.Property("limit_frame_quota"); + + b.Property("limit_quota"); + + b.Property("managed_by"); + + b.Property("percentage"); + + b.Property("report_type") + .HasMaxLength(1000); + + b.Property("theDate"); + + b.Property("theRound"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_id"); + + b.ToTable("eva_adjust_postponement"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b => + { + b.Property("id"); + + b.Property("achievement_final"); + + b.Property("adjust_postponement_id"); + + b.Property("adjust_postponement_quota_id"); + + b.Property("competency_final"); + + b.Property("cost_living"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("employee_no_at_this_time") + .HasMaxLength(1000); + + b.Property("fullname_at_this_time") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("is_for_postponement"); + + b.Property("level_score_final") + .HasMaxLength(255); + + b.Property("level_this_time") + .HasMaxLength(1000); + + b.Property("middle"); + + b.Property("migration_eva_result") + .HasMaxLength(1000); + + b.Property("migration_total_score"); + + b.Property("new_cost_living"); + + b.Property("new_sarary"); + + b.Property("new_sarary_with_quota"); + + b.Property("order_at_this_time"); + + b.Property("org_at_this_time"); + + b.Property("other_money_at_this_time"); + + b.Property("position_allowance_at_this_time"); + + b.Property("position_this_time") + .HasMaxLength(1000); + + b.Property("promoted_percentage"); + + b.Property("receive_quota"); + + b.Property("remark") + .HasMaxLength(1000); + + b.Property("reward_new"); + + b.Property("reward_new2"); + + b.Property("reward_old"); + + b.Property("sarary"); + + b.Property("score_final"); + + b.Property("total_promote"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("adjust_postponement_id"); + + b.HasIndex("adjust_postponement_quota_id"); + + b.ToTable("eva_adjust_postponement_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("evaluation_group_id"); + + b.Property("isActive"); + + b.Property("performance_plan_id"); + + b.Property("score1"); + + b.Property("score2"); + + b.Property("supervisor1_id"); + + b.Property("supervisor2_id"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("evaluation_group_id"); + + b.HasIndex("performance_plan_id"); + + b.ToTable("eva_create_evaluation"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b => + { + b.Property("id"); + + b.Property("Final_summary_chief"); + + b.Property("Final_summary_competency_chief"); + + b.Property("Final_summary_competency_supervisor"); + + b.Property("Final_summary_competency_supervisor1A"); + + b.Property("Final_summary_competency_supervisor2A"); + + b.Property("Final_summary_supervisor"); + + b.Property("Final_summary_supervisor1A"); + + b.Property("Final_summary_supervisor2A"); + + b.Property("achievement_chief"); + + b.Property("achievement_supervisor"); + + b.Property("achievement_supervisor1A"); + + b.Property("achievement_supervisor2A"); + + b.Property("chief"); + + b.Property("chief_a"); + + b.Property("chief_a_date"); + + b.Property("chief_a_reject_reason") + .HasMaxLength(1000); + + b.Property("chief_a_remark") + .HasMaxLength(1000); + + b.Property("chief_a_result") + .HasMaxLength(1); + + b.Property("competency_chief"); + + b.Property("competency_supervisor"); + + b.Property("competency_supervisor1A"); + + b.Property("competency_supervisor2A"); + + b.Property("create_evaluation_id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("eva_employee_id"); + + b.Property("help_org_id"); + + b.Property("isActive"); + + b.Property("level_score_chief") + .HasMaxLength(255); + + b.Property("level_score_supervisor") + .HasMaxLength(255); + + b.Property("level_score_supervisor1A") + .HasMaxLength(255); + + b.Property("level_score_supervisor2A") + .HasMaxLength(255); + + b.Property("order_of_data"); + + b.Property("remark") + .HasMaxLength(1000); + + b.Property("score_chief"); + + b.Property("score_supervisor"); + + b.Property("score_supervisor1A"); + + b.Property("score_supervisor2A"); + + b.Property("status_chief") + .HasMaxLength(1); + + b.Property("status_chief_a") + .HasMaxLength(1); + + b.Property("status_chief_a_click_date"); + + b.Property("status_chief_click_date"); + + b.Property("status_self") + .HasMaxLength(1); + + b.Property("status_self_a") + .HasMaxLength(1); + + b.Property("status_self_a_click_date"); + + b.Property("status_self_click_date"); + + b.Property("status_supervisor") + .HasMaxLength(1); + + b.Property("status_supervisor1A") + .HasMaxLength(1); + + b.Property("status_supervisor1A_click_date"); + + b.Property("status_supervisor2A") + .HasMaxLength(1); + + b.Property("status_supervisor2A_click_date"); + + b.Property("status_supervisor_click_date"); + + b.Property("supervisor1"); + + b.Property("supervisor1A"); + + b.Property("supervisor1A_date"); + + b.Property("supervisor1A_remark") + .HasMaxLength(1000); + + b.Property("supervisor1A_result") + .HasMaxLength(1); + + b.Property("supervisor1_date"); + + b.Property("supervisor1_id"); + + b.Property("supervisor1_remark") + .HasMaxLength(1000); + + b.Property("supervisor1_result") + .HasMaxLength(1); + + b.Property("supervisor2"); + + b.Property("supervisor2A"); + + b.Property("supervisor2A_date"); + + b.Property("supervisor2A_remark") + .HasMaxLength(1000); + + b.Property("supervisor2A_result") + .HasMaxLength(1); + + b.Property("supervisor2_date"); + + b.Property("supervisor2_id"); + + b.Property("supervisor2_remark") + .HasMaxLength(1000); + + b.Property("supervisor2_result") + .HasMaxLength(1); + + b.Property("total_summary_chief"); + + b.Property("total_summary_competency_chief"); + + b.Property("total_summary_competency_supervisor"); + + b.Property("total_summary_competency_supervisor1A"); + + b.Property("total_summary_competency_supervisor2A"); + + b.Property("total_summary_supervisor"); + + b.Property("total_summary_supervisor1A"); + + b.Property("total_summary_supervisor2A"); + + b.Property("updated"); + + b.Property("work_period"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_id"); + + b.ToTable("eva_create_evaluation_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detail_historyEntity", b => + { + b.Property("id"); + + b.Property("action_detail") + .HasMaxLength(4000); + + b.Property("action_dt"); + + b.Property("action_emp_id"); + + b.Property("created"); + + b.Property("evaluation_detail_id"); + + b.Property("history_group"); + + b.Property("isActive"); + + b.Property("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("id"); + + b.Property("achievement") + .HasMaxLength(8000); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("score"); + + b.Property("score2"); + + b.Property("score3"); + + b.Property("score4"); + + b.Property("sumary"); + + b.Property("sumary2"); + + b.Property("sumary3"); + + b.Property("sumary4"); + + b.Property("target_score1") + .HasMaxLength(255); + + b.Property("target_score2") + .HasMaxLength(255); + + b.Property("target_score3") + .HasMaxLength(255); + + b.Property("target_score4") + .HasMaxLength(255); + + b.Property("target_score5") + .HasMaxLength(255); + + b.Property("thefile") + .HasMaxLength(1000); + + b.Property("updated"); + + b.Property("weight"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_detail_id"); + + b.ToTable("eva_evaluation_achievement"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievement_attachEntity", b => + { + b.Property("id"); + + b.Property("achievement_id"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("the_file") + .HasMaxLength(1000); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("achievement_id"); + + b.ToTable("eva_evaluation_achievement_attach"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b => + { + b.Property("id"); + + b.Property("behavior") + .HasMaxLength(1000); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("score"); + + b.Property("score2"); + + b.Property("score3"); + + b.Property("score4"); + + b.Property("sumary"); + + b.Property("sumary2"); + + b.Property("sumary3"); + + b.Property("sumary4"); + + b.Property("target_score1") + .HasMaxLength(255); + + b.Property("target_score2") + .HasMaxLength(255); + + b.Property("target_score3") + .HasMaxLength(255); + + b.Property("target_score4") + .HasMaxLength(255); + + b.Property("target_score5") + .HasMaxLength(255); + + b.Property("updated"); + + b.Property("weight"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_detail_id"); + + b.ToTable("eva_evaluation_behavior"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_groupEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("main_dept_id"); + + b.Property("percentage"); + + b.Property("thegroup") + .HasMaxLength(255); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_evaluation_group"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("evaluation_group_id"); + + b.Property("isActive"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("evaluation_group_id"); + + b.ToTable("eva_evaluation_group_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b => + { + b.Property("id"); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("indicators") + .HasMaxLength(4000); + + b.Property("isActive"); + + b.Property("mission_detail") + .HasMaxLength(4000); + + b.Property("mission_no"); + + b.Property("target") + .HasMaxLength(4000); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_detail_id"); + + b.ToTable("eva_evaluation_operating_agreement"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_idp_planEntity", b => + { + b.Property("id"); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("develop") + .HasMaxLength(1000); + + b.Property("development_method") + .HasMaxLength(1000); + + b.Property("end_date"); + + b.Property("isActive"); + + b.Property("period_text") + .HasMaxLength(1000); + + b.Property("start_date"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_idp_plan"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_level_scoreEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("detail") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("max_score"); + + b.Property("min_score"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_level_score"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b => + { + b.Property("id"); + + b.Property("cost_of_living"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("frame_group_guid"); + + b.Property("help_org_id"); + + b.Property("isActive"); + + b.Property("level_text") + .HasMaxLength(1000); + + b.Property("monthly_remuneration"); + + b.Property("order_of_data"); + + b.Property("org_id"); + + b.Property("position_allowance"); + + b.Property("position_text") + .HasMaxLength(1000); + + b.Property("salary"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("frame_group_guid"); + + b.ToTable("eva_limit_frame_employee"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("frame_plan_guid"); + + b.Property("group_guid"); + + b.Property("isActive"); + + b.Property("limit_frame_295"); + + b.Property("main_dept_id"); + + b.Property("remark") + .HasMaxLength(4000); + + b.Property("remark2") + .HasMaxLength(4000); + + b.Property("total_salary"); + + b.Property("total_salary_limit"); + + b.Property("total_salary_limit_rounded"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("frame_plan_guid"); + + b.HasIndex("group_guid"); + + b.ToTable("eva_limit_frame_group"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("executed_date"); + + b.Property("isActive"); + + b.Property("limit_frame_005"); + + b.Property("limit_frame_005_total"); + + b.Property("limit_frame_005_total_rounded"); + + b.Property("plan_guid"); + + b.Property("salary_adjustment_date"); + + b.Property("status_chief") + .HasMaxLength(1); + + b.Property("status_self") + .HasMaxLength(1); + + b.Property("supervisor1"); + + b.Property("supervisor1_date"); + + b.Property("supervisor1_remark") + .HasMaxLength(1000); + + b.Property("supervisor1_result") + .HasMaxLength(1); + + b.Property("total_salary"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("plan_guid"); + + b.ToTable("eva_limit_frame_plan"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_planEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("end_leave"); + + b.Property("fiscal_year"); + + b.Property("isActive"); + + b.Property("percent"); + + b.Property("remark") + .HasMaxLength(500); + + b.Property("start_leave"); + + b.Property("theTime"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_performance_plan"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("end_date"); + + b.Property("isActive"); + + b.Property("list_no"); + + b.Property("performance_plan_id"); + + b.Property("remark") + .HasMaxLength(1000); + + b.Property("start_date"); + + b.Property("step") + .HasMaxLength(1000); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("performance_plan_id"); + + b.ToTable("eva_performance_plan_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("detail") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("level_score_id"); + + b.Property("max_score"); + + b.Property("min_score"); + + b.Property("promoted_percentage"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("level_score_id"); + + b.ToTable("eva_promoted_percentage"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_salary_cylinderEntity", b => + { + b.Property("id"); + + b.Property("cost_living"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("middle"); + + b.Property("monthly_compensation"); + + b.Property("position_allowance"); + + b.Property("position_level"); + + b.Property("position_type"); + + b.Property("salary_max"); + + b.Property("temporary_min"); + + b.Property("themax"); + + b.Property("themin"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_salary_cylinder"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_setup_permissionEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("isActive"); + + b.Property("remark") + .HasMaxLength(4000); + + b.Property("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") + .WithMany() + .HasForeignKey("create_evaluation_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement") + .WithMany() + .HasForeignKey("adjust_postponement_id"); + + b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement_quota") + .WithMany() + .HasForeignKey("adjust_postponement_quota_id") + .HasConstraintName("FK_eva_adjust_postponement_detail_eva_adjust_postponement_adj~1"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group") + .WithMany() + .HasForeignKey("evaluation_group_id"); + + b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan") + .WithMany() + .HasForeignKey("performance_plan_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation_create_evaluation_id") + .WithMany() + .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") + .WithMany() + .HasForeignKey("create_evaluation_detail_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievement_attachEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_evaluation_achievementEntity", "eva_evaluation_achievement_achievement_id") + .WithMany() + .HasForeignKey("achievement_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail") + .WithMany() + .HasForeignKey("create_evaluation_detail_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group") + .WithMany() + .HasForeignKey("evaluation_group_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail_create_evaluation_detail_id") + .WithMany() + .HasForeignKey("create_evaluation_detail_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_limit_frame_groupEntity", "eva_limit_frame_group_frame_group_guid") + .WithMany() + .HasForeignKey("frame_group_guid"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_limit_frame_planEntity", "eva_limit_frame_plan_frame_plan_guid") + .WithMany() + .HasForeignKey("frame_plan_guid"); + + b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group_group_guid") + .WithMany() + .HasForeignKey("group_guid"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan_plan_guid") + .WithMany() + .HasForeignKey("plan_guid"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan") + .WithMany() + .HasForeignKey("performance_plan_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_level_scoreEntity", "eva_level_score") + .WithMany() + .HasForeignKey("level_score_id"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/20211016124831_AddEvaPermission.cs b/Migrations/20211016124831_AddEvaPermission.cs new file mode 100644 index 0000000..b026508 --- /dev/null +++ b/Migrations/20211016124831_AddEvaPermission.cs @@ -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(nullable: false), + created = table.Column(nullable: false), + updated = table.Column(nullable: false), + isActive = table.Column(nullable: false), + employee_id = table.Column(nullable: true), + remark = table.Column(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"); + } + } +} diff --git a/Migrations/DataContextModelSnapshot.cs b/Migrations/DataContextModelSnapshot.cs index 54ef167..47c7c83 100644 --- a/Migrations/DataContextModelSnapshot.cs +++ b/Migrations/DataContextModelSnapshot.cs @@ -973,6 +973,26 @@ namespace tb320eva.Migrations b.ToTable("eva_salary_cylinder"); }); + modelBuilder.Entity("TodoAPI2.Models.eva_setup_permissionEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("isActive"); + + b.Property("remark") + .HasMaxLength(4000); + + b.Property("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") diff --git a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs index 238050e..18ff55a 100644 --- a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs +++ b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs @@ -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(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 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, diff --git a/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processService.cs b/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processService.cs index fbb8a63..2d3cbf5 100644 --- a/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processService.cs +++ b/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processService.cs @@ -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 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 ""; } diff --git a/Models/eva_setup_permission/Ieva_setup_permissionService.cs b/Models/eva_setup_permission/Ieva_setup_permissionService.cs new file mode 100644 index 0000000..1e09913 --- /dev/null +++ b/Models/eva_setup_permission/Ieva_setup_permissionService.cs @@ -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 + { + 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 GetListByremark(string remark); + List GetListBySearch(eva_setup_permissionSearchModel model); + + string UpdateMultiple(List 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(); + + + + } +} + diff --git a/Models/eva_setup_permission/eva_setup_permissionEntity.cs b/Models/eva_setup_permission/eva_setup_permissionEntity.cs new file mode 100644 index 0000000..5d7f356 --- /dev/null +++ b/Models/eva_setup_permission/eva_setup_permissionEntity.cs @@ -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 + { + + + public int? employee_id { get; set; } + + [MaxLength(4000)] + public string remark { get; set; } + + + public void SetAutoField(DataContext context) + { + + } + + public void DoAfterInsertUpdate(DataContext context) + { + + } + + } +} diff --git a/Models/eva_setup_permission/eva_setup_permissionInputModel.cs b/Models/eva_setup_permission/eva_setup_permissionInputModel.cs new file mode 100644 index 0000000..d1c730d --- /dev/null +++ b/Models/eva_setup_permission/eva_setup_permissionInputModel.cs @@ -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; } + } +} + diff --git a/Models/eva_setup_permission/eva_setup_permissionReportRequestModel.cs b/Models/eva_setup_permission/eva_setup_permissionReportRequestModel.cs new file mode 100644 index 0000000..7efc3ad --- /dev/null +++ b/Models/eva_setup_permission/eva_setup_permissionReportRequestModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_setup_permissionReportRequestModel : eva_setup_permissionSearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_setup_permission/eva_setup_permissionSearchModel.cs b/Models/eva_setup_permission/eva_setup_permissionSearchModel.cs new file mode 100644 index 0000000..adc73f4 --- /dev/null +++ b/Models/eva_setup_permission/eva_setup_permissionSearchModel.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_setup_permissionSearchModel + { + + public Guid id { get; set; } + + public string remark { get; set; } + + } +} + diff --git a/Models/eva_setup_permission/eva_setup_permissionService.cs b/Models/eva_setup_permission/eva_setup_permissionService.cs new file mode 100644 index 0000000..7816f12 --- /dev/null +++ b/Models/eva_setup_permission/eva_setup_permissionService.cs @@ -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 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + private Iexternal_employeeService emp; + + public eva_setup_permissionService(IBaseRepository2 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(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_setup_permissionViewModel GetDto(eva_setup_permissionEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(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(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 GetListByremark(string remark) + { + var model = new eva_setup_permissionSearchModel(); + model.remark = remark; + return GetListBySearch(model); + } + + public List 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(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(existingEntity); + } + } + else + throw new NotificationException("No data to update"); + } + + public string UpdateMultiple(List 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 GetLookupForLog() + { + var i = new Dictionary(); + + + i.Add("employee_id", "ชื่อพนักงาน"); + i.Add("employee_id_external_linkage_external_name", "ชื่อพนักงาน"); + i.Add("remark", "หมายเหตุ"); + + return i; + } + + #endregion + + #region Match Item + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/Models/eva_setup_permission/eva_setup_permissionViewModel.cs b/Models/eva_setup_permission/eva_setup_permissionViewModel.cs new file mode 100644 index 0000000..e006b7c --- /dev/null +++ b/Models/eva_setup_permission/eva_setup_permissionViewModel.cs @@ -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 + { + + public int? employee_id { get; set; } + + public string remark { get; set; } + + public string employee_id_external_linkage_external_name { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_setup_permission/eva_setup_permissionWithSelectionViewModel.cs b/Models/eva_setup_permission/eva_setup_permissionWithSelectionViewModel.cs new file mode 100644 index 0000000..5f498b8 --- /dev/null +++ b/Models/eva_setup_permission/eva_setup_permissionWithSelectionViewModel.cs @@ -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 item_employee_id { get; set; } + + } +} \ No newline at end of file diff --git a/Startup.cs b/Startup.cs index 2f9a66b..f84face 100644 --- a/Startup.cs +++ b/Startup.cs @@ -337,6 +337,9 @@ namespace Test01 services.AddScoped(); + services.AddScoped, BaseRepository2>(); + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -636,6 +639,10 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); #endregion diff --git a/ViewControllers/eva_setup_permissionViewControllers.cs b/ViewControllers/eva_setup_permissionViewControllers.cs new file mode 100644 index 0000000..33f2bf1 --- /dev/null +++ b/ViewControllers/eva_setup_permissionViewControllers.cs @@ -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 _logger; + private Ieva_setup_permissionService _repository; + private IConfiguration Configuration { get; set; } + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_setup_permissionViewController(ILogger 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 }); + } + } +} + + diff --git a/Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml b/Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml index 6f95944..93fc4d6 100644 --- a/Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml +++ b/Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml @@ -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(); diff --git a/Views/eva_setup_permissionView/eva_setup_permission.cshtml b/Views/eva_setup_permissionView/eva_setup_permission.cshtml new file mode 100644 index 0000000..9966e6e --- /dev/null +++ b/Views/eva_setup_permissionView/eva_setup_permission.cshtml @@ -0,0 +1,110 @@ +@using Microsoft.Extensions.Configuration +@inject IConfiguration Configuration +@{ + ViewData["Title"] = "eva_setup_permission"; +} + + + +
+
+
+ @Configuration["SiteInformation:modulename"] +
+
+
+ +
+
+ +
+
รายชื่อ ผู้มีสิทธิดูข้อมูล
+
+
+ + + +
+ + + +
+ +
+
+ + + + + + + + + + + + +
เครื่องมือ
+
+ +@section FooterPlaceHolder{ + + +} + diff --git a/Views/home/index2.cshtml b/Views/home/index2.cshtml index e3f9190..d60b00b 100644 --- a/Views/home/index2.cshtml +++ b/Views/home/index2.cshtml @@ -94,6 +94,9 @@ + diff --git a/tb320eva.csproj b/tb320eva.csproj index d0debdd..c511453 100644 --- a/tb320eva.csproj +++ b/tb320eva.csproj @@ -77,6 +77,7 @@ + @@ -99,6 +100,7 @@ + diff --git a/tb320eva.xml b/tb320eva.xml index 6dbd0ec..2e4d7e4 100644 --- a/tb320eva.xml +++ b/tb320eva.xml @@ -4520,6 +4520,124 @@ Returns the item Error Occurred + + + Default constructure for dependency injection + + + + + + + + Get specific item by id + + + + Return Get specific item by id + Returns the item + Error Occurred + + + + Get Blank Item + + + + Return a blank item + Returns the item + Error Occurred + + + + Get list items by remark + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Get list items by search + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Download Report + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Create new item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Update item + + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Delete item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Update multiple item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Refresh AutoField of all items + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + Default constructure for dependency injection @@ -5571,6 +5689,14 @@ + + + Default constructure for dependency injection + + + + + Default constructure for dependency injection diff --git a/wwwroot/js/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdoc_d.js b/wwwroot/js/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdoc_d.js index 1530379..a0f1a4f 100644 --- a/wwwroot/js/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdoc_d.js +++ b/wwwroot/js/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdoc_d.js @@ -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() { diff --git a/wwwroot/js/eva_create_evaluation_detail_process/eva_create_evaluation_detail_process_d.js b/wwwroot/js/eva_create_evaluation_detail_process/eva_create_evaluation_detail_process_d.js index bfff7fe..9d51dcf 100644 --- a/wwwroot/js/eva_create_evaluation_detail_process/eva_create_evaluation_detail_process_d.js +++ b/wwwroot/js/eva_create_evaluation_detail_process/eva_create_evaluation_detail_process_d.js @@ -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(); diff --git a/wwwroot/js/eva_create_evaluation_detail_process/eva_create_evaluation_detail_process_d2.js b/wwwroot/js/eva_create_evaluation_detail_process/eva_create_evaluation_detail_process_d2.js index 8e5c852..f054b9a 100644 --- a/wwwroot/js/eva_create_evaluation_detail_process/eva_create_evaluation_detail_process_d2.js +++ b/wwwroot/js/eva_create_evaluation_detail_process/eva_create_evaluation_detail_process_d2.js @@ -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(); } } diff --git a/wwwroot/js/eva_evaluation_operating_agreement/eva_evaluation_operating_agreement.js b/wwwroot/js/eva_evaluation_operating_agreement/eva_evaluation_operating_agreement.js index 88786f2..f4a6729 100644 --- a/wwwroot/js/eva_evaluation_operating_agreement/eva_evaluation_operating_agreement.js +++ b/wwwroot/js/eva_evaluation_operating_agreement/eva_evaluation_operating_agreement.js @@ -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(); }; diff --git a/wwwroot/js/eva_setup_permission/eva_setup_permission.js b/wwwroot/js/eva_setup_permission/eva_setup_permission.js new file mode 100644 index 0000000..178c0c0 --- /dev/null +++ b/wwwroot/js/eva_setup_permission/eva_setup_permission.js @@ -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 " "; + } + }, + //{ + // 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 ========================================= + + +