From ddb4232254683ac0700cd487b4ed07af696fca7a Mon Sep 17 00:00:00 2001 From: "LAPTOP-KB8JC2K2\\acer" Date: Tue, 13 Apr 2021 15:14:51 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4?= =?UTF-8?q?=20=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=94=E0=B8=B3=E0=B9=80?= =?UTF-8?q?=E0=B8=99=E0=B8=B4=E0=B8=99=E0=B8=81=E0=B8=B4=E0=B8=88=E0=B8=81?= =?UTF-8?q?=E0=B8=A3=E0=B8=A3=E0=B8=A1=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=9B?= =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=A1=E0=B8=B4=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...te_evaluation_detail_historyControllers.cs | 403 +++++++ ...ate_evaluation_detail_statusControllers.cs | 34 +- EF/DataContext.cs | 2 +- .../eva_create_evaluation_detail_history.xlsx | Bin 0 -> 10770 bytes .../20210413072130_AddEvaLog.Designer.cs | 1032 +++++++++++++++++ Migrations/20210413072130_AddEvaLog.cs | 46 + Migrations/DataContextModelSnapshot.cs | 33 + ...te_evaluation_detail_agreementViewModel.cs | 18 +- ...ate_evaluation_detail_firstdocViewModel.cs | 19 +- ...create_evaluation_detail_historyService.cs | 32 + ..._create_evaluation_detail_historyEntity.cs | 42 + ...ate_evaluation_detail_historyInputModel.cs | 30 + ...uation_detail_historyReportRequestModel.cs | 21 + ...te_evaluation_detail_historySearchModel.cs | 23 + ...create_evaluation_detail_historyService.cs | 310 +++++ ...eate_evaluation_detail_historyViewModel.cs | 31 + ...on_detail_historyWithSelectionViewModel.cs | 13 + ...eate_evaluation_detail_processViewModel.cs | 23 +- ...eate_evaluation_detail_statusInputModel.cs | 2 + ..._create_evaluation_detail_statusService.cs | 63 +- Startup.cs | 7 + Utils/MyHelper.cs | 12 + ...valuation_detail_historyViewControllers.cs | 66 ++ ...reate_evaluation_detail_agreement_d.cshtml | 10 +- ...create_evaluation_detail_firstdoc_d.cshtml | 2 +- ...va_create_evaluation_detail_history.cshtml | 59 + tb320eva.csproj | 2 + tb320eva.xml | 129 ++- .../eva_create_evaluation_detail_history.js | 209 ++++ 29 files changed, 2626 insertions(+), 47 deletions(-) create mode 100644 ApiControllers/eva_create_evaluation_detail_historyControllers.cs create mode 100644 EXCEL/eva_create_evaluation_detail_history.xlsx create mode 100644 Migrations/20210413072130_AddEvaLog.Designer.cs create mode 100644 Migrations/20210413072130_AddEvaLog.cs create mode 100644 Models/eva_create_evaluation_detail_history/Ieva_create_evaluation_detail_historyService.cs create mode 100644 Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyEntity.cs create mode 100644 Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyInputModel.cs create mode 100644 Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyReportRequestModel.cs create mode 100644 Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historySearchModel.cs create mode 100644 Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyService.cs create mode 100644 Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyViewModel.cs create mode 100644 Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyWithSelectionViewModel.cs create mode 100644 ViewControllers/eva_create_evaluation_detail_historyViewControllers.cs create mode 100644 Views/eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history.cshtml create mode 100644 wwwroot/js/eva_create_evaluation_detail_history/eva_create_evaluation_detail_history.js diff --git a/ApiControllers/eva_create_evaluation_detail_historyControllers.cs b/ApiControllers/eva_create_evaluation_detail_historyControllers.cs new file mode 100644 index 0000000..a354ddb --- /dev/null +++ b/ApiControllers/eva_create_evaluation_detail_historyControllers.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_create_evaluation_detail_history")] + public class eva_create_evaluation_detail_historyController : BaseController + { + #region Private Variables + private ILogger _logger; + private Ieva_create_evaluation_detail_historyService _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_create_evaluation_detail_historyController(ILogger logger, Ieva_create_evaluation_detail_historyService 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_create_evaluation_detail_historyWithSelectionViewModel), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Get(int id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.GetWithSelection(id); + + return Ok(result); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult Get.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Get Blank Item + /// + /// + /// + /// Return a blank item + /// Returns the item + /// Error Occurred + [HttpGet("GetBlankItem")] + [ProducesResponseType(typeof(eva_create_evaluation_detail_historyWithSelectionViewModel), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetBlankItem() + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.GetBlankItem(); + + return Ok(result); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Get list items by evaluation_detail_id + /// + /// + /// + /// 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(int? evaluation_detail_id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListByevaluation_detail_id(evaluation_detail_id)); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetList.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// 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_create_evaluation_detail_historySearchModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListBySearch(model)); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Download Report + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("eva_create_evaluation_detail_history_report")] + [ProducesResponseType(typeof(FileStreamResult), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult eva_create_evaluation_detail_history_report(eva_create_evaluation_detail_historyReportRequestModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var httpclient = new WebClient(); + string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL"); + string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite"); + string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username"); + string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password"); + + string url = $"{mainurl}{reportsite}/xxใส่ชื่อรายงานตรงนี้xx.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}"; + + if (model.filetype == "xlsx") + { + url += "&ignorePagination=true"; + } + + var data = httpclient.DownloadData(url); + var stream = new MemoryStream(data); + + return File(stream, model.contentType); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while GetReport.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// 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_create_evaluation_detail_historyInputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.Insert(model, true); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"เพิ่มข้อมูล เรียบร้อย"; + message.data = result; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while insert.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// 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(int id, [FromBody] eva_create_evaluation_detail_historyInputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.Update(id, model, true); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"แก้ไขข้อมูล เรียบร้อย"; + message.data = result; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while update {id.ToString()}.", ex); + return StatusCode(500, $"{id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// 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(int id) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + _repository.Delete(id); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"ลบข้อมูล เรียบร้อย"; + message.data = null; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while delete {id.ToString()}.", ex); + return StatusCode(500, $"{id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// 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/ApiControllers/eva_create_evaluation_detail_statusControllers.cs b/ApiControllers/eva_create_evaluation_detail_statusControllers.cs index c7ea76f..29b445d 100644 --- a/ApiControllers/eva_create_evaluation_detail_statusControllers.cs +++ b/ApiControllers/eva_create_evaluation_detail_statusControllers.cs @@ -27,6 +27,7 @@ namespace TodoAPI2.Controllers private ILogger _logger; private Ieva_create_evaluation_detail_statusService _repository; private IConfiguration Configuration { get; set; } + private Iexternal_employeeService emp; #endregion #region Properties @@ -37,13 +38,17 @@ namespace TodoAPI2.Controllers /// Default constructure for dependency injection /// /// - /// + /// + /// /// - public eva_create_evaluation_detail_statusController(ILogger logger, Ieva_create_evaluation_detail_statusService repository, IConfiguration configuration) + public eva_create_evaluation_detail_statusController(ILogger logger, + Ieva_create_evaluation_detail_statusService repository, IConfiguration configuration, + Iexternal_employeeService inemp) { _logger = logger; _repository = repository; Configuration = configuration; + emp = inemp; } /// @@ -220,12 +225,25 @@ namespace TodoAPI2.Controllers try { if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); - var result = _repository.Update(id, model); - var message = new CommonResponseMessage(); - message.code = "200"; - message.message = $"แก้ไขข้อมูล เรียบร้อย"; - message.data = result; - return Ok(message); + + if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"])) + { + var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]); + var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid)); + model.employee_id = e.id; + var result = _repository.Update(id, model); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"แก้ไขข้อมูล เรียบร้อย"; + message.data = result; + return Ok(message); + } + else + { + return Unauthorized(); + } + + } catch (Exception ex) { diff --git a/EF/DataContext.cs b/EF/DataContext.cs index 2a374d9..f4dd0b9 100644 --- a/EF/DataContext.cs +++ b/EF/DataContext.cs @@ -41,8 +41,8 @@ namespace TTSW.EF { public DbSet eva_limit_frame_employee { get; set; } public DbSet eva_limit_frame_group { get; set; } 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; } protected override void OnModelCreating (ModelBuilder modelBuilder) { diff --git a/EXCEL/eva_create_evaluation_detail_history.xlsx b/EXCEL/eva_create_evaluation_detail_history.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..b634e6eccde3dd970e69522658b23626d39ffd0a GIT binary patch literal 10770 zcmeHtg;yNe_I2Y;a0wD1KyZQ+Jh(f-UAu92cXtR5Ap|G5ySsZJxCVj-*TC1AnfIF+ zX1>4Rz3R20|bHC~;(ZX2Ka-iylkok}IJlj5D_xEAHvTfEW*N(~`_O-qJb4S8~Xq=KkY z`xD-u5+6nVb4ygCs$(PAvhYxjkKw0l5o8(`3>nN{J-(vAVXJw@y3=_o_g$zslwX*l zmG;|b=$rX{-oY*nXlWWJJVQ>`07d#2QY&gLE$>)ZRmscK9f(vI60V|XuqzcBYi@}p z_lBmhvvev=@wtVG1y{dg||s<28NQ zEURDsLLO+1&P;^PEZLRAUu0~gaIi0ji$9KOl0Q}-;;sdMS{>& z&mL^)z{v3H{6BjB7jyD2uU--_E8oq89DFQsA2M(?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@)0Eb zK0%>Sy2`MI`?Nr1T>7w|4}~ceSJc}T2rntsVFz$Fx#&jq9Xh95o$-l{$e%2po;2#Q zspK~&0+gRCGOhcDd{L=ae66(hUdp94_^u){M3*MkRVrp!{M8b%3rSMM{hwf&#-LA>sdBO_kWW|0Xw=osdf7(y_r0hs57%1}$z?)rz4O?~UWKsjY-~7K z0t?*BMA!Lc9q;FG@rbo2%mNhAz8hkCo{H&&SRi{}IC0n#5$Oa~#cZojtPT2H6;nM+ z_#5oUV9OUK>+B23sL+GORV_)jBtW*AW9VX4IQoM1`;+?Dx6CQmn%7y&S2iiL%45-7}jF z$V)+T^l`OP%f7ZkhtH5Yr{uv3t%P5kiL8~E(BSXAkE92DinmM&HsZP(v$zsv6ogzSv*C6a1^R$)sClWI9|NV)7H1?jNJk`|yL>WZ?4dtoA z{uJQp%KuLQ5TwBfd7VFXfTyNUtK~mUEr@FWz zMarLmAtb*6J}FWDwPbk;`u9BlCnNxnN(un{BkMmk|9hbRt2r+DU(Ejq+X~Wf5FZ2p QkRd-xh#P;Q{B`yJ07ZkoJOBUy literal 0 HcmV?d00001 diff --git a/Migrations/20210413072130_AddEvaLog.Designer.cs b/Migrations/20210413072130_AddEvaLog.Designer.cs new file mode 100644 index 0000000..ed93980 --- /dev/null +++ b/Migrations/20210413072130_AddEvaLog.Designer.cs @@ -0,0 +1,1032 @@ +// +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("20210413072130_AddEvaLog")] + partial class AddEvaLog + { + 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.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("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("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("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("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("fiscal_year"); + + b.Property("isActive"); + + b.Property("percent"); + + 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("position_level"); + + b.Property("position_type"); + + 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_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/20210413072130_AddEvaLog.cs b/Migrations/20210413072130_AddEvaLog.cs new file mode 100644 index 0000000..932de5d --- /dev/null +++ b/Migrations/20210413072130_AddEvaLog.cs @@ -0,0 +1,46 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace tb320eva.Migrations +{ + public partial class AddEvaLog : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "eva_create_evaluation_detail_history", + columns: table => new + { + id = table.Column(nullable: false), + created = table.Column(nullable: false), + updated = table.Column(nullable: false), + isActive = table.Column(nullable: false), + evaluation_detail_id = table.Column(nullable: true), + action_dt = table.Column(nullable: true), + action_detail = table.Column(maxLength: 4000, nullable: true), + action_emp_id = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_eva_create_evaluation_detail_history", x => x.id); + table.ForeignKey( + name: "FK_eva_create_evaluation_detail_history_eva_create_evaluation_~", + column: x => x.evaluation_detail_id, + principalTable: "eva_create_evaluation_detail", + principalColumn: "id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_eva_create_evaluation_detail_history_evaluation_detail_id", + table: "eva_create_evaluation_detail_history", + column: "evaluation_detail_id"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "eva_create_evaluation_detail_history"); + } + } +} diff --git a/Migrations/DataContextModelSnapshot.cs b/Migrations/DataContextModelSnapshot.cs index 4832bab..4a9b151 100644 --- a/Migrations/DataContextModelSnapshot.cs +++ b/Migrations/DataContextModelSnapshot.cs @@ -373,6 +373,32 @@ namespace tb320eva.Migrations b.ToTable("eva_create_evaluation_detail"); }); + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detail_historyEntity", b => + { + b.Property("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("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"); @@ -918,6 +944,13 @@ namespace tb320eva.Migrations .HasForeignKey("create_evaluation_id"); }); + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detail_historyEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail_evaluation_detail_id") + .WithMany() + .HasForeignKey("evaluation_detail_id"); + }); + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b => { b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail") diff --git a/Models/eva_create_evaluation_detail_agreement/eva_create_evaluation_detail_agreementViewModel.cs b/Models/eva_create_evaluation_detail_agreement/eva_create_evaluation_detail_agreementViewModel.cs index be64814..b53171c 100644 --- a/Models/eva_create_evaluation_detail_agreement/eva_create_evaluation_detail_agreementViewModel.cs +++ b/Models/eva_create_evaluation_detail_agreement/eva_create_evaluation_detail_agreementViewModel.cs @@ -60,9 +60,9 @@ namespace TodoAPI2.Models public decimal? score2 { get; set; } - public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date); } } - public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date); } } - public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date); } } + public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_click_date) + getHistoryLink(status_self); } } + public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_click_date) + getHistoryLink(status_chief); } } + public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor_click_date) + getHistoryLink(status_supervisor); } } private string getStatusText(string s) { @@ -80,5 +80,15 @@ namespace TodoAPI2.Models return " "; } + private string getHistoryLink(string s) + { + if (!string.IsNullOrEmpty(s)) + { + return ("
ดูประวัติ").Replace("{0}", '"'.ToString()); + } + return ""; + } + } -} \ No newline at end of file +} + diff --git a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocViewModel.cs b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocViewModel.cs index e64f18f..3e78561 100644 --- a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocViewModel.cs +++ b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocViewModel.cs @@ -68,19 +68,28 @@ namespace TodoAPI2.Models public decimal? score2 { get; set; } - public string txt_status_self_a { get { return getStatusText2(status_self_a) + MyHelper.GetDateStringForReport(status_self_a_click_date); } } + public string txt_status_self_a { get { return getStatusText2(status_self_a) + MyHelper.GetDateStringForReport(status_self_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_a_click_date) + getHistoryLink(status_self_a); } } - public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date); } } + public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_click_date) + getHistoryLink(status_self); } } - public string txt_status_chief_a { get { return getStatusText2(status_chief_a) + MyHelper.GetDateStringForReport(status_chief_a_click_date); } } + public string txt_status_chief_a { get { return getStatusText2(status_chief_a) + MyHelper.GetDateStringForReport(status_chief_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_a_click_date) + getHistoryLink(status_chief_a); } } - public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date); } } - public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date); } } + public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_click_date) + getHistoryLink(status_chief); } } + public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor_click_date) + getHistoryLink(status_supervisor); } } public string role_desc { get; set; } public string role_code { get; set; } + private string getHistoryLink(string s) + { + if (!string.IsNullOrEmpty(s)) + { + return ("
ดูประวัติ").Replace("{0}", '"'.ToString()); + } + return ""; + } + private string getStatusText(string s) { if (!string.IsNullOrEmpty(s)) diff --git a/Models/eva_create_evaluation_detail_history/Ieva_create_evaluation_detail_historyService.cs b/Models/eva_create_evaluation_detail_history/Ieva_create_evaluation_detail_historyService.cs new file mode 100644 index 0000000..1746352 --- /dev/null +++ b/Models/eva_create_evaluation_detail_history/Ieva_create_evaluation_detail_historyService.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_create_evaluation_detail_historyService : IBaseService2 + { + new eva_create_evaluation_detail_historyViewModel Insert(eva_create_evaluation_detail_historyInputModel model, bool is_force_save); + new eva_create_evaluation_detail_historyViewModel Update(int id, eva_create_evaluation_detail_historyInputModel model, bool is_force_save); + List GetListByevaluation_detail_id(int? evaluation_detail_id); + List GetListBySearch(eva_create_evaluation_detail_historySearchModel model); + + string UpdateMultiple(List model, bool is_force_save); + eva_create_evaluation_detail_historyWithSelectionViewModel GetWithSelection(int id); + eva_create_evaluation_detail_historyWithSelectionViewModel GetBlankItem(); + + void RefreshAutoFieldOfAllData(); + eva_create_evaluation_detail_historyEntity GetEntity(int id); + DataContext GetContext(); + + + + } +} + diff --git a/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyEntity.cs b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyEntity.cs new file mode 100644 index 0000000..17e0e37 --- /dev/null +++ b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyEntity.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using System.IO; + +namespace TodoAPI2.Models +{ + public class eva_create_evaluation_detail_historyEntity : BaseEntity2 + { + + + [ForeignKey("evaluation_detail_id")] + public eva_create_evaluation_detailEntity eva_create_evaluation_detail_evaluation_detail_id { get; set; } + public int? evaluation_detail_id { get; set; } + + public DateTime? action_dt { get; set; } + + [MaxLength(4000)] + public string action_detail { get; set; } + + public int? action_emp_id { get; set; } + + + public void SetAutoField(DataContext context) + { + + } + + public void DoAfterInsertUpdate(DataContext context) + { + + } + + } +} diff --git a/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyInputModel.cs b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyInputModel.cs new file mode 100644 index 0000000..461d2ff --- /dev/null +++ b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyInputModel.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_create_evaluation_detail_historyInputModel + { + + public int? id { get; set; } + + public int? evaluation_detail_id { get; set; } + + public DateTime? action_dt { get; set; } + + public string action_detail { get; set; } + + public int? action_emp_id { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyReportRequestModel.cs b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyReportRequestModel.cs new file mode 100644 index 0000000..e3c8f5a --- /dev/null +++ b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyReportRequestModel.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_create_evaluation_detail_historyReportRequestModel : eva_create_evaluation_detail_historySearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historySearchModel.cs b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historySearchModel.cs new file mode 100644 index 0000000..385381f --- /dev/null +++ b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historySearchModel.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_create_evaluation_detail_historySearchModel + { + + public int id { get; set; } + + public int? evaluation_detail_id { get; set; } + + } +} + diff --git a/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyService.cs b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyService.cs new file mode 100644 index 0000000..4129a92 --- /dev/null +++ b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyService.cs @@ -0,0 +1,310 @@ +using AutoMapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using TodoAPI2.Models; +using System.IO; +using System.Web; +using System.Net; +using TTSW.Configure; +using Microsoft.Extensions.Options; +using System.Data; + +namespace TodoAPI2.Models +{ + public class eva_create_evaluation_detail_historyService : Ieva_create_evaluation_detail_historyService + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + private Iexternal_employeeService emp; + + public eva_create_evaluation_detail_historyService(IBaseRepository2 repository, IMyDatabase mydb, + Iexternal_linkageService inext, Iexternal_employeeService inemp) + { + _repository = repository; + db = mydb; + ext = inext; + emp = inemp; + } + + #region Private Functions + private eva_create_evaluation_detail_historyEntity GetEntity(eva_create_evaluation_detail_historyInputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_create_evaluation_detail_historyViewModel GetDto(eva_create_evaluation_detail_historyEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public eva_create_evaluation_detail_historyViewModel Get(int id) + { + var entity = _repository.Get(id); + + return GetDto(entity); + } + + public eva_create_evaluation_detail_historyEntity GetEntity(int id) + { + var entity = _repository.Get(id); + + return entity; + } + + public DataContext GetContext() + { + return _repository.Context; + } + + public eva_create_evaluation_detail_historyWithSelectionViewModel GetWithSelection(int id) + { + var entity = _repository.Get(id); + var i = Mapper.Map(entity); + i.item_action_emp_id = emp.GetAllEmployee(); + + + return i; + } + public eva_create_evaluation_detail_historyWithSelectionViewModel GetBlankItem() + { + var i = new eva_create_evaluation_detail_historyWithSelectionViewModel(); + i.item_action_emp_id = emp.GetAllEmployee(); + + + return i; + } + + public List GetListByevaluation_detail_id(int? evaluation_detail_id) + { + var model = new eva_create_evaluation_detail_historySearchModel(); + model.evaluation_detail_id = evaluation_detail_id; + return GetListBySearch(model); + } + + public List GetListBySearch(eva_create_evaluation_detail_historySearchModel model) + { + var data = ( + from m_eva_create_evaluation_detail_history in _repository.Context.eva_create_evaluation_detail_history + + join fk_eva_create_evaluation_detail1 in _repository.Context.eva_create_evaluation_detail on m_eva_create_evaluation_detail_history.evaluation_detail_id equals fk_eva_create_evaluation_detail1.id + into eva_create_evaluation_detailResult1 + from fk_eva_create_evaluation_detailResult1 in eva_create_evaluation_detailResult1.DefaultIfEmpty() + + join fk_external_employee4 in emp.GetAllEmployee() on m_eva_create_evaluation_detail_history.action_emp_id equals fk_external_employee4.id + into external_employeeResult4 + from fk_external_employeeResult4 in external_employeeResult4.DefaultIfEmpty() + + where + 1 == 1 + && (!model.evaluation_detail_id.HasValue || m_eva_create_evaluation_detail_history.evaluation_detail_id == model.evaluation_detail_id) + + orderby m_eva_create_evaluation_detail_history.action_dt + select new eva_create_evaluation_detail_historyViewModel() + { + id = m_eva_create_evaluation_detail_history.id, + evaluation_detail_id = m_eva_create_evaluation_detail_history.evaluation_detail_id, + action_dt = m_eva_create_evaluation_detail_history.action_dt, + action_detail = m_eva_create_evaluation_detail_history.action_detail, + action_emp_id = m_eva_create_evaluation_detail_history.action_emp_id, + + evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id = fk_eva_create_evaluation_detailResult1.create_evaluation_id, + action_emp_id_external_employee_fullname = fk_external_employeeResult4.fullname, + + isActive = m_eva_create_evaluation_detail_history.isActive, + Created = m_eva_create_evaluation_detail_history.created, + Updated = m_eva_create_evaluation_detail_history.updated + } + ).Take(1000).ToList(); + + return data; + } + + #endregion + + #region Manipulation Functions + + + public int GetNewPrimaryKey() + { + int? newkey = 0; + + var x = (from i in _repository.Context.eva_create_evaluation_detail_history + orderby i.id descending + select i).Take(1).ToList(); + + if(x.Count > 0) + { + newkey = x[0].id + 1; + } + + return newkey.Value; + } + + + public eva_create_evaluation_detail_historyViewModel Insert(eva_create_evaluation_detail_historyInputModel model, bool is_force_save) + { + var entity = GetEntity(model); + entity.id = GetNewPrimaryKey(); + + + entity.SetAutoField(_repository.Context); + + if (is_force_save) + { + var inserted = _repository.Insert(entity); + entity.DoAfterInsertUpdate(_repository.Context); + return Get(inserted.id); + } + else + { + _repository.InsertWithoutCommit(entity); + entity.DoAfterInsertUpdate(_repository.Context); + return Mapper.Map(entity); + } + } + + public eva_create_evaluation_detail_historyViewModel Update(int id, eva_create_evaluation_detail_historyInputModel model, bool is_force_save) + { + var existingEntity = _repository.Get(id); + if (existingEntity != null) + { + existingEntity.evaluation_detail_id = model.evaluation_detail_id; + existingEntity.action_dt = model.action_dt; + existingEntity.action_detail = model.action_detail; + existingEntity.action_emp_id = model.action_emp_id; + + existingEntity.SetAutoField(_repository.Context); + + if (is_force_save) + { + var updated = _repository.Update(id, existingEntity); + existingEntity.DoAfterInsertUpdate(_repository.Context); + return Get(updated.id); + } + else + { + _repository.UpdateWithoutCommit(id, existingEntity); + existingEntity.DoAfterInsertUpdate(_repository.Context); + return Mapper.Map(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.evaluation_detail_id = i.evaluation_detail_id; + existingEntity.action_dt = i.action_dt; + existingEntity.action_detail = i.action_detail; + existingEntity.action_emp_id = i.action_emp_id; + + existingEntity.SetAutoField(_repository.Context); + _repository.UpdateWithoutCommit(i.id.Value, existingEntity); + } + } + else if (i.active_mode == "1" && !i.id.HasValue) // add + { + var entity = GetEntity(i); + entity.id = GetNewPrimaryKey(); + entity.SetAutoField(_repository.Context); + _repository.InsertWithoutCommit(entity); + } + else if (i.active_mode == "0" && i.id.HasValue) // remove + { + _repository.DeleteWithoutCommit(i.id.Value); + } + else if (i.active_mode == "0" && !i.id.HasValue) + { + // nothing to do + } + } + if (is_force_save) + { + _repository.Context.SaveChanges(); + } + + return model.Count().ToString(); + } + + public eva_create_evaluation_detail_historyViewModel SetAsActive(int id) + { + var updated = _repository.SetAsActive(id); + + return Get(updated.id); + } + public eva_create_evaluation_detail_historyViewModel SetAsInactive(int id) + { + var updated = _repository.SetAsInActive(id); + + return Get(updated.id); + } + public void Delete(int id) + { + _repository.Delete(id); + + return; + } + + public void RefreshAutoFieldOfAllData() + { + var all_items = from i in _repository.Context.eva_create_evaluation_detail_history + select i; + foreach (var item in all_items) + { + item.SetAutoField(_repository.Context); + } + _repository.Context.SaveChanges(); + } + + private Dictionary GetLookupForLog() + { + var i = new Dictionary(); + + + i.Add("evaluation_detail_id", "การประเมิน"); + i.Add("evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id", "การประเมิน"); + i.Add("action_dt", "วันที่/เวลา"); + i.Add("txt_action_dt", "วันที่/เวลา"); + i.Add("action_detail", "รายละเอียด"); + i.Add("action_emp_id", "ผู้ดำเนินการ"); + i.Add("action_emp_id_external_employee_employee_type", "ผู้ดำเนินการ"); + + return i; + } + + #endregion + + #region Match Item + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyViewModel.cs b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyViewModel.cs new file mode 100644 index 0000000..61a5215 --- /dev/null +++ b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyViewModel.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_create_evaluation_detail_historyViewModel : BaseViewModel2 + { + + public int? evaluation_detail_id { get; set; } + + public DateTime? action_dt { get; set; } + + public string txt_action_dt { get { return MyHelper.GetDateStringForReport(this.action_dt); } } + + public string action_detail { get; set; } + + public int? action_emp_id { get; set; } + + public int? evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id { get; set; } + public string action_emp_id_external_employee_fullname { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyWithSelectionViewModel.cs b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyWithSelectionViewModel.cs new file mode 100644 index 0000000..85ce478 --- /dev/null +++ b/Models/eva_create_evaluation_detail_history/eva_create_evaluation_detail_historyWithSelectionViewModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TodoAPI2.Models +{ + public class eva_create_evaluation_detail_historyWithSelectionViewModel: eva_create_evaluation_detail_historyViewModel + { + public List item_action_emp_id { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processViewModel.cs b/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processViewModel.cs index be97079..8af11e3 100644 --- a/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processViewModel.cs +++ b/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processViewModel.cs @@ -88,11 +88,20 @@ namespace TodoAPI2.Models public DateTime? status_supervisor1A_click_date { get; set; } public DateTime? status_supervisor2A_click_date { get; set; } - public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date); } } - public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date); } } - public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date); } } - public string txt_status_supervisor1A { get { return getStatusText(status_supervisor1A) + MyHelper.GetDateStringForReport(status_supervisor1A_click_date); } } - public string txt_status_supervisor2A { get { return getStatusText(status_supervisor2A) + MyHelper.GetDateStringForReport(status_supervisor2A_click_date); } } + public string txt_status_self { get { return getStatusText(status_self) + MyHelper.GetDateStringForReport(status_self_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_click_date) + getHistoryLink(status_self); } } + public string txt_status_chief { get { return getStatusText(status_chief) + MyHelper.GetDateStringForReport(status_chief_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_click_date) + getHistoryLink(status_chief); } } + public string txt_status_supervisor { get { return getStatusText(status_supervisor) + MyHelper.GetDateStringForReport(status_supervisor_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor_click_date) + getHistoryLink(status_supervisor); } } + public string txt_status_supervisor1A { get { return getStatusText(status_supervisor1A) + MyHelper.GetDateStringForReport(status_supervisor1A_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor1A_click_date) + getHistoryLink(status_supervisor1A); } } + public string txt_status_supervisor2A { get { return getStatusText(status_supervisor2A) + MyHelper.GetDateStringForReport(status_supervisor2A_click_date) + " " + MyHelper.GetTimeStringFromDate(status_supervisor2A_click_date) + getHistoryLink(status_supervisor2A); } } + + private string getHistoryLink(string s) + { + if (!string.IsNullOrEmpty(s)) + { + return ("
ดูประวัติ").Replace("{0}", '"'.ToString()); + } + return ""; + } private string getStatusText(string s) { @@ -110,8 +119,8 @@ namespace TodoAPI2.Models return " "; } - public string txt_status_self_a_click_date { get { return MyHelper.GetDateStringForReport(status_self_a_click_date); } } - public string txt_status_chief_a_click_date { get { return MyHelper.GetDateStringForReport(status_chief_a_click_date); } } + public string txt_status_self_a_click_date { get { return MyHelper.GetDateStringForReport(status_self_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_self_a_click_date); } } + public string txt_status_chief_a_click_date { get { return MyHelper.GetDateStringForReport(status_chief_a_click_date) + " " + MyHelper.GetTimeStringFromDate(status_chief_a_click_date); } } } } diff --git a/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusInputModel.cs b/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusInputModel.cs index 75bd35e..47aca51 100644 --- a/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusInputModel.cs +++ b/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusInputModel.cs @@ -34,6 +34,8 @@ namespace TodoAPI2.Models public string status_mode { get; set; } + public int? employee_id { get; set; } + public string active_mode { get; set; } } } diff --git a/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs b/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs index 8f2ab33..7e0d3f4 100644 --- a/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs +++ b/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs @@ -28,16 +28,18 @@ namespace TodoAPI2.Models private IMyDatabase db; private Iexternal_linkageService ext; private Iexternal_employeeService emp; + private Ieva_create_evaluation_detail_historyService his; private IConfiguration Configuration { get; set; } public eva_create_evaluation_detail_statusService(IBaseRepository2 repository, - IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp, IConfiguration configuration) + IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp, IConfiguration configuration, Ieva_create_evaluation_detail_historyService inhis) { _repository = repository; db = mydb; ext = inext; emp = inemp; Configuration = configuration; + his = inhis; } #region Private Functions @@ -155,13 +157,33 @@ namespace TodoAPI2.Models var entity = GetEntity(model); entity.id = GetNewPrimaryKey(); - - var inserted = _repository.Insert(entity); return Get(inserted.id); } + private void add_history(DateTime? dt, string action, int? action_user_id, int? detail_id) + { + int? newkey = 0; + + var x = (from i in _repository.Context.eva_create_evaluation_detail_history + orderby i.id descending + select i).Take(1).ToList(); + + if (x.Count > 0) + { + newkey = x[0].id + 1; + } + + var n = new eva_create_evaluation_detail_historyEntity(); + n.id = newkey.Value; + n.action_detail = action; + n.action_dt = dt; + n.action_emp_id = action_user_id; + n.evaluation_detail_id = detail_id; + _repository.Context.Add(n); + } + public eva_create_evaluation_detail_statusViewModel Update(int id, eva_create_evaluation_detail_statusInputModel model) { var existingEntity = _repository.Get(id); @@ -198,23 +220,25 @@ namespace TodoAPI2.Models if (model.status_mode == "nextA") { - existingEntity.status_self_a_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now); + existingEntity.status_self_a_click_date = DateTime.Now; existingEntity.status_chief_a_click_date = null; noti_to_employee_id = existingEntity.chief; noti_message = "กรุณาตรวจสอบ ข้อตกลงการประเมิน ของ {0}"; noti_url = "/eva/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString(); + add_history(DateTime.Now, "ส่งข้อตกลงการประเมิน", model.employee_id, existingEntity.id); } else if (model.status_mode == "backB") { - existingEntity.status_chief_a_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now); + existingEntity.status_chief_a_click_date = DateTime.Now; existingEntity.status_self_a_click_date = null; noti_to_employee_id = existingEntity.employee_id; noti_message = "ข้อตกลงการประเมินของคุณ ({0}) ถูกตีกลับ"; noti_url = "/eva/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString(); + add_history(DateTime.Now, "ข้อตกลงการประเมิน ถูกตีกลับ", model.employee_id, existingEntity.id); } else if (model.status_mode == "nextB") { - existingEntity.status_chief_a_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now); + existingEntity.status_chief_a_click_date = DateTime.Now; if (current_eva.employee_id == existingEntity.chief) // หัวหน้าและผู้ประเมินสูงสุด เป็นคนคนเดียวกัน { noti_to_employee_id = current_eva.supervisor1_id; @@ -224,10 +248,11 @@ namespace TodoAPI2.Models noti_to_employee_id = current_eva.employee_id; } need_noti = false; + add_history(DateTime.Now, "อนุมัติ ข้อตกลงการประเมิน", existingEntity.chief, existingEntity.id); } else if (model.status_mode == "next0") { - existingEntity.status_self_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now); + existingEntity.status_self_click_date = DateTime.Now; noti_to_employee_id = existingEntity.chief; noti_message = "กรุณาตรวจสอบแบบประเมินของ {0}"; noti_url = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString(); @@ -235,10 +260,11 @@ namespace TodoAPI2.Models noti_to_employee_id2 = owner_eva_employee_id; noti_message2 = "แบบประเมินของ {0} ได้ถูกส่งต่อไปยังขั้นตอนถัดไปแล้ว"; noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString(); + add_history(DateTime.Now, "ส่งแบบประเมิน", model.employee_id, existingEntity.id); } else if (model.status_mode == "next1") { - existingEntity.status_chief_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now); + existingEntity.status_chief_click_date = DateTime.Now; if (current_eva.employee_id == existingEntity.chief) // หัวหน้าและผู้ประเมินสูงสุด เป็นคนคนเดียวกัน { noti_to_employee_id = current_eva.supervisor1_id; @@ -250,61 +276,68 @@ namespace TodoAPI2.Models } else if (model.status_mode == "back1") { - existingEntity.status_chief_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now); + existingEntity.status_chief_click_date = DateTime.Now; existingEntity.status_self_click_date = null; noti_to_employee_id = existingEntity.employee_id; noti_message = "ข้อตกลงการประเมินของคุณ ({0}) ถูกตีกลับ"; noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d?id=" + existingEntity.id.ToString(); + add_history(DateTime.Now, "ข้อตกลงการประเมิน ถูกตีกลับ โดยผู้ประเมิน", model.employee_id, existingEntity.id); } else if (model.status_mode == "next2") { - existingEntity.status_supervisor_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now); + existingEntity.status_supervisor_click_date = DateTime.Now; noti_to_employee_id = current_eva.supervisor1_id; noti_to_employee_id2 = owner_eva_employee_id; noti_message2 = "แบบประเมินของ {0} ได้ถูกส่งต่อไปยังขั้นตอนถัดไปแล้ว"; noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString(); + add_history(DateTime.Now, "ผู้ประเมินสูงสุด อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id); } else if (model.status_mode == "back2") { - existingEntity.status_supervisor_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now); + existingEntity.status_supervisor_click_date = DateTime.Now; existingEntity.status_chief_click_date = null; noti_to_employee_id = existingEntity.chief; noti_message = "แบบประเมินของ {0} ถูกตีกลับ"; noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d?id=" + existingEntity.id.ToString(); + add_history(DateTime.Now, "แบบประเมิน ถูกตีกลับ โดยผู้ประเมินสูงสุด", model.employee_id, existingEntity.id); } else if (model.status_mode == "next3") { - existingEntity.status_supervisor1A_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now); + existingEntity.status_supervisor1A_click_date = DateTime.Now; noti_to_employee_id = current_eva.supervisor2_id; noti_to_employee_id2 = owner_eva_employee_id; noti_message2 = "แบบประเมินของ {0} ได้ถูกส่งต่อไปยังขั้นตอนถัดไปแล้ว"; noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString(); + add_history(DateTime.Now, "ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id); } else if (model.status_mode == "back3") { - existingEntity.status_supervisor1A_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now); + existingEntity.status_supervisor1A_click_date = DateTime.Now; existingEntity.status_supervisor_click_date = null; noti_to_employee_id = current_eva.employee_id; noti_message = "แบบประเมินของ {0} ถูกตีกลับ"; noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString(); + add_history(DateTime.Now, "แบบประเมินถูกตีกลับ โดย ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง", model.employee_id, existingEntity.id); } else if (model.status_mode == "next4") { - existingEntity.status_supervisor2A_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now); + existingEntity.status_supervisor2A_click_date = DateTime.Now; noti_to_employee_id2 = owner_eva_employee_id; noti_message2 = "แบบประเมินของ {0} ได้รับการประเมินเรียบร้อยแล้ว"; noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString(); + add_history(DateTime.Now, "ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด) อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id); } else if (model.status_mode == "back4") { - existingEntity.status_supervisor2A_click_date = MyHelper.RemoveTimeFromDate(DateTime.Now); + existingEntity.status_supervisor2A_click_date = DateTime.Now; existingEntity.status_supervisor1A_click_date = null; noti_to_employee_id = current_eva.supervisor1_id; noti_message = "แบบประเมินของ {0} ถูกตีกลับ"; noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString(); + add_history(DateTime.Now, "แบบประเมินถูกตีกลับ โดย ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)", model.employee_id, existingEntity.id); } if (need_noti) diff --git a/Startup.cs b/Startup.cs index d4ee490..e89fc55 100644 --- a/Startup.cs +++ b/Startup.cs @@ -332,6 +332,9 @@ namespace Test01 services.AddScoped(); + services.AddScoped, BaseRepository2>(); + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -623,6 +626,10 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); #endregion diff --git a/Utils/MyHelper.cs b/Utils/MyHelper.cs index 19f3754..f82548b 100644 --- a/Utils/MyHelper.cs +++ b/Utils/MyHelper.cs @@ -95,6 +95,18 @@ public class MyHelper } } + public static string GetTimeStringFromDate(DateTime? date) + { + if (date.HasValue) + { + return date.Value.ToShortTimeString() + "น."; + } + else + { + return ""; + } + } + public static DateTime? GetDateFromString(string date) { if (string.IsNullOrEmpty(date)) return null; diff --git a/ViewControllers/eva_create_evaluation_detail_historyViewControllers.cs b/ViewControllers/eva_create_evaluation_detail_historyViewControllers.cs new file mode 100644 index 0000000..34d32b1 --- /dev/null +++ b/ViewControllers/eva_create_evaluation_detail_historyViewControllers.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_create_evaluation_detail_historyViewController : Controller + { + private ILogger _logger; + private Ieva_create_evaluation_detail_historyService _repository; + private IConfiguration Configuration { get; set; } + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_create_evaluation_detail_historyViewController(ILogger logger, Ieva_create_evaluation_detail_historyService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + public IActionResult eva_create_evaluation_detail_history() + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + return View(); + } + + // public IActionResult eva_create_evaluation_detail_history_d() + // { + //if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + // return View(); + // } + + //public IActionResult eva_create_evaluation_detail_history_report() + //{ + // if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + // return View(); + //} + + //public IActionResult eva_create_evaluation_detail_history_inline() + //{ + // if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + // return View(); + //} + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} + + diff --git a/Views/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d.cshtml b/Views/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d.cshtml index 25e48c7..10fefbc 100644 --- a/Views/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d.cshtml +++ b/Views/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d.cshtml @@ -453,11 +453,11 @@ }); function CheckPermission() { - //if (status_self === "Y") { - // $(".status_self").hide(); - // $(".status_self_text").attr("disabled", true); - // $("#status").text("คุณส่งแบบประเมินไปแล้ว"); - //} + if (status_self === "Y") { + $(".status_self").hide(); + $(".status_self_text").attr("disabled", true); + $("#status").text("คุณส่งแบบประเมินไปแล้ว"); + } } function OnWeightChanged(c) { 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 93d67e8..6f95944 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 @@ -154,7 +154,7 @@
- +
diff --git a/Views/eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history.cshtml b/Views/eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history.cshtml new file mode 100644 index 0000000..c92ae60 --- /dev/null +++ b/Views/eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history.cshtml @@ -0,0 +1,59 @@ +@using Microsoft.Extensions.Configuration +@inject IConfiguration Configuration +@{ + ViewData["Title"] = "eva_create_evaluation_detail_history"; + Layout = "_LayoutDirect"; +} + +
+
+
+ @Configuration["SiteInformation:modulename"] +
+
+
+ +
+
+ +
+
ประวัติการดำเนินการ
+ +
+
+
+ +
+ +
+
+ + + + + + + + + + + + +
+
+ +@section FooterPlaceHolder{ + + +} + diff --git a/tb320eva.csproj b/tb320eva.csproj index 52c903f..f557aa5 100644 --- a/tb320eva.csproj +++ b/tb320eva.csproj @@ -69,6 +69,7 @@ + @@ -84,6 +85,7 @@ + diff --git a/tb320eva.xml b/tb320eva.xml index a4b66cc..d6cf165 100644 --- a/tb320eva.xml +++ b/tb320eva.xml @@ -1191,6 +1191,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 evaluation_detail_id + + + + 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 @@ -1746,12 +1864,13 @@ If the model is invalid Error Occurred - + Default constructure for dependency injection + @@ -5266,6 +5385,14 @@ + + + Default constructure for dependency injection + + + + + Default constructure for dependency injection diff --git a/wwwroot/js/eva_create_evaluation_detail_history/eva_create_evaluation_detail_history.js b/wwwroot/js/eva_create_evaluation_detail_history/eva_create_evaluation_detail_history.js new file mode 100644 index 0000000..4660b8f --- /dev/null +++ b/wwwroot/js/eva_create_evaluation_detail_history/eva_create_evaluation_detail_history.js @@ -0,0 +1,209 @@ +var eva_create_evaluation_detail_history_editMode = "CREATE"; +var eva_create_evaluation_detail_history_API = "/api/eva_create_evaluation_detail_history/"; + +//================= Search Customizaiton ========================================= + +function eva_create_evaluation_detail_history_GetSearchParameter() { + var eva_create_evaluation_detail_historySearchObject = new Object(); + eva_create_evaluation_detail_historySearchObject.evaluation_detail_id = getUrlParameter("id"); + + return eva_create_evaluation_detail_historySearchObject; +} + +function eva_create_evaluation_detail_history_FeedDataToSearchForm(data) { + $("#s_eva_create_evaluation_detail_history_evaluation_detail_id").val(data.evaluation_detail_id); + +} + +//================= Form Data Customizaiton ========================================= + +function eva_create_evaluation_detail_history_FeedDataToForm(data) { + $("#eva_create_evaluation_detail_history_id").val(data.id); + $("#eva_create_evaluation_detail_history_evaluation_detail_id").val(data.evaluation_detail_id); + $("#eva_create_evaluation_detail_history_action_dt").val(formatDate(data.action_dt)); + $("#eva_create_evaluation_detail_history_action_detail").val(data.action_detail); + //DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_history_action_emp_id"), data, "id", "employee_type", "item_action_emp_id", data.action_emp_id); + +} + +function eva_create_evaluation_detail_history_GetFromForm() { + var eva_create_evaluation_detail_historyObject = new Object(); + eva_create_evaluation_detail_historyObject.id = $("#eva_create_evaluation_detail_history_id").val(); + eva_create_evaluation_detail_historyObject.evaluation_detail_id = getUrlParameter("id"); + eva_create_evaluation_detail_historyObject.action_dt = getDate($("#eva_create_evaluation_detail_history_action_dt").val()); + eva_create_evaluation_detail_historyObject.action_detail = $("#eva_create_evaluation_detail_history_action_detail").val(); + eva_create_evaluation_detail_historyObject.action_emp_id = $("#eva_create_evaluation_detail_history_action_emp_id").val(); + + + return eva_create_evaluation_detail_historyObject; +} + +function eva_create_evaluation_detail_history_InitialForm(s) { + var successFunc = function (result) { + eva_create_evaluation_detail_history_FeedDataToForm(result); + eva_create_evaluation_detail_history_FeedDataToSearchForm(result); + if (s) { + // Incase model popup + $("#eva_create_evaluation_detail_historyModel").modal("show"); + } + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_create_evaluation_detail_history_API + "GetBlankItem", successFunc, AlertDanger); +} + +//================= Form Mode Setup and Flow ========================================= + +function eva_create_evaluation_detail_history_GoCreate() { + // Incase model popup + eva_create_evaluation_detail_history_SetCreateForm(true); + + // Incase open new page + //window_open(appsite + "/eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history_d"); +} + +function eva_create_evaluation_detail_history_GoEdit(a) { + // Incase model popup + eva_create_evaluation_detail_history_SetEditForm(a); + + // Incase open new page + //window_open(appsite + "/eva_create_evaluation_detail_historyView/eva_create_evaluation_detail_history_d?id=" + a); +} + +function eva_create_evaluation_detail_history_SetEditForm(a) { + var successFunc = function (result) { + eva_create_evaluation_detail_history_editMode = "UPDATE"; + eva_create_evaluation_detail_history_FeedDataToForm(result); + $("#eva_create_evaluation_detail_historyModel").modal("show"); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_create_evaluation_detail_history_API + a, successFunc, AlertDanger); +} + +function eva_create_evaluation_detail_history_SetCreateForm(s) { + eva_create_evaluation_detail_history_editMode = "CREATE"; + eva_create_evaluation_detail_history_InitialForm(s); +} + +function eva_create_evaluation_detail_history_RefreshTable() { + // Incase model popup + eva_create_evaluation_detail_history_DoSearch(); + + // Incase open new page + //window.parent.eva_create_evaluation_detail_history_DoSearch(); +} + +//================= Update and Delete ========================================= + +var eva_create_evaluation_detail_history_customValidation = function (group) { + return ""; +}; + +function eva_create_evaluation_detail_history_PutUpdate() { + if (!ValidateForm('eva_create_evaluation_detail_history', eva_create_evaluation_detail_history_customValidation)) { + return; + } + + var data = eva_create_evaluation_detail_history_GetFromForm(); + + //Update Mode + if (eva_create_evaluation_detail_history_editMode === "UPDATE") { + var successFunc1 = function (result) { + $("#eva_create_evaluation_detail_historyModel").modal("hide"); + AlertSuccess(result.code + " " + result.message); + eva_create_evaluation_detail_history_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxPutRequest(apisite + eva_create_evaluation_detail_history_API + data.id, data, successFunc1, AlertDanger); + } + // Create mode + else { + var successFunc2 = function (result) { + $("#eva_create_evaluation_detail_historyModel").modal("hide"); + AlertSuccess(result.code + " " + result.message); + eva_create_evaluation_detail_history_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxPostRequest(apisite + eva_create_evaluation_detail_history_API, data, successFunc2, AlertDanger); + } +} + +function eva_create_evaluation_detail_history_GoDelete(a) { + if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) { + var successFunc = function (result) { + $("#eva_create_evaluation_detail_historyModel").modal("hide"); + AlertSuccess(result.code + " " + result.message); + eva_create_evaluation_detail_history_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxDeleteRequest(apisite + eva_create_evaluation_detail_history_API + a, null, successFunc, AlertDanger); + } +} + +//================= Data Table ========================================= + +var eva_create_evaluation_detail_historyTableV; + +var eva_create_evaluation_detail_history_setupTable = function (result) { + tmp = '"'; + eva_create_evaluation_detail_historyTableV = $('#eva_create_evaluation_detail_historyTable').DataTable({ + "processing": true, + "serverSide": false, + "data": result, + //"select": { + // "style": 'multi' + //}, + "columns": [ + { "data": "txt_action_dt" }, + { "data": "action_detail" }, + { "data": "action_emp_id_external_employee_fullname" }, + ], + "columnDefs": [ + + ], + "language": { + "url": appsite + "/DataTables-1.10.16/thai.json" + }, + "paging": true, + "searching": false + }); + endLoad(); +}; + +function eva_create_evaluation_detail_history_InitiateDataTable() { + startLoad(); + var p = $.param(eva_create_evaluation_detail_history_GetSearchParameter()); + AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail_history/GetListBySearch?" + p, eva_create_evaluation_detail_history_setupTable, AlertDanger); +} + +function eva_create_evaluation_detail_history_DoSearch() { + var p = $.param(eva_create_evaluation_detail_history_GetSearchParameter()); + var eva_create_evaluation_detail_history_reload = function (result) { + eva_create_evaluation_detail_historyTableV.destroy(); + eva_create_evaluation_detail_history_setupTable(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail_history/GetListBySearch?" + p, eva_create_evaluation_detail_history_reload, AlertDanger); +} + +function eva_create_evaluation_detail_history_GetSelect(f) { + var eva_create_evaluation_detail_history_selectitem = []; + $.each(eva_create_evaluation_detail_historyTableV.rows('.selected').data(), function (key, value) { + eva_create_evaluation_detail_history_selectitem.push(value[f]); + }); + alert(eva_create_evaluation_detail_history_selectitem); +} + +//================= File Upload ========================================= + + + +//================= Multi-Selection Function ========================================= + + +