diff --git a/ApiControllers/eva_evaluation_operating_agreementControllers.cs b/ApiControllers/eva_evaluation_operating_agreementControllers.cs new file mode 100644 index 0000000..d6025d1 --- /dev/null +++ b/ApiControllers/eva_evaluation_operating_agreementControllers.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_evaluation_operating_agreement")] + public class eva_evaluation_operating_agreementController : BaseController + { + #region Private Variables + private ILogger _logger; + private Ieva_evaluation_operating_agreementService _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_evaluation_operating_agreementController(ILogger logger, Ieva_evaluation_operating_agreementService 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_evaluation_operating_agreementWithSelectionViewModel), 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_evaluation_operating_agreementWithSelectionViewModel), 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 create_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? create_evaluation_detail_id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListBycreate_evaluation_detail_id(create_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_evaluation_operating_agreementSearchModel 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_evaluation_operating_agreement_report")] + [ProducesResponseType(typeof(FileStreamResult), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult eva_evaluation_operating_agreement_report(eva_evaluation_operating_agreementReportRequestModel 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_evaluation_operating_agreementInputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.Insert(model); + 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_evaluation_operating_agreementInputModel model) + { + if (ModelState.IsValid) + { + 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); + } + 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/EF/DataContext.cs b/EF/DataContext.cs index f15795c..e72701c 100644 --- a/EF/DataContext.cs +++ b/EF/DataContext.cs @@ -37,6 +37,8 @@ namespace TTSW.EF { public DbSet eva_adjust_postponement_detail { get; set; } //public DbSet eva_adjust_postponement_detail_normal { get; set; } + public DbSet eva_evaluation_operating_agreement { get; set; } + public DbSet eva_idp_plan { get; set; } protected override void OnModelCreating (ModelBuilder modelBuilder) { diff --git a/EXCEL/eva_evaluation_operating_agreement.xlsx b/EXCEL/eva_evaluation_operating_agreement.xlsx new file mode 100644 index 0000000..28b54d6 Binary files /dev/null and b/EXCEL/eva_evaluation_operating_agreement.xlsx differ diff --git a/Migrations/25640202082506_AddOperatingAgreement.Designer.cs b/Migrations/25640202082506_AddOperatingAgreement.Designer.cs new file mode 100644 index 0000000..d528111 --- /dev/null +++ b/Migrations/25640202082506_AddOperatingAgreement.Designer.cs @@ -0,0 +1,754 @@ +// +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("25640202082506_AddOperatingAgreement")] + partial class AddOperatingAgreement + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn) + .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") + .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("adjust_postponement_id"); + + b.Property("adjust_postponement_quota_id"); + + b.Property("cost_living"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("isActive"); + + 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("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("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("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("score_chief"); + + b.Property("score_supervisor"); + + b.Property("score_supervisor1A"); + + b.Property("score_supervisor2A"); + + b.Property("status_chief") + .HasMaxLength(1); + + b.Property("status_chief_click_date"); + + b.Property("status_self") + .HasMaxLength(1); + + 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_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_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.HasKey("id"); + + b.ToTable("eva_create_evaluation_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b => + { + b.Property("id"); + + b.Property("achievement") + .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("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_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("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_performance_planEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("fiscal_year"); + + b.Property("isActive"); + + 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_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_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_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/25640202082506_AddOperatingAgreement.cs b/Migrations/25640202082506_AddOperatingAgreement.cs new file mode 100644 index 0000000..5eaf567 --- /dev/null +++ b/Migrations/25640202082506_AddOperatingAgreement.cs @@ -0,0 +1,47 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace tb320eva.Migrations +{ + public partial class AddOperatingAgreement : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "eva_evaluation_operating_agreement", + columns: table => new + { + id = table.Column(nullable: false), + created = table.Column(nullable: false), + updated = table.Column(nullable: false), + isActive = table.Column(nullable: false), + create_evaluation_detail_id = table.Column(nullable: true), + mission_no = table.Column(nullable: true), + mission_detail = table.Column(maxLength: 4000, nullable: true), + target = table.Column(maxLength: 4000, nullable: true), + indicators = table.Column(maxLength: 4000, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_eva_evaluation_operating_agreement", x => x.id); + table.ForeignKey( + name: "FK_eva_evaluation_operating_agreement_eva_create_evaluation_de~", + column: x => x.create_evaluation_detail_id, + principalTable: "eva_create_evaluation_detail", + principalColumn: "id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_eva_evaluation_operating_agreement_create_evaluation_detail~", + table: "eva_evaluation_operating_agreement", + column: "create_evaluation_detail_id"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "eva_evaluation_operating_agreement"); + } + } +} diff --git a/Migrations/DataContextModelSnapshot.cs b/Migrations/DataContextModelSnapshot.cs index 9c0013a..1a2052b 100644 --- a/Migrations/DataContextModelSnapshot.cs +++ b/Migrations/DataContextModelSnapshot.cs @@ -476,6 +476,36 @@ namespace tb320eva.Migrations 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"); @@ -696,6 +726,13 @@ namespace tb320eva.Migrations .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_performance_plan_detailEntity", b => { b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan") diff --git a/Models/eva_evaluation_operating_agreement/Ieva_evaluation_operating_agreementService.cs b/Models/eva_evaluation_operating_agreement/Ieva_evaluation_operating_agreementService.cs new file mode 100644 index 0000000..bf718e1 --- /dev/null +++ b/Models/eva_evaluation_operating_agreement/Ieva_evaluation_operating_agreementService.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_evaluation_operating_agreementService : IBaseService + { + new eva_evaluation_operating_agreementViewModel Insert(eva_evaluation_operating_agreementInputModel model); + new eva_evaluation_operating_agreementViewModel Update(int id, eva_evaluation_operating_agreementInputModel model); + List GetListBycreate_evaluation_detail_id(int? create_evaluation_detail_id); + List GetListBySearch(eva_evaluation_operating_agreementSearchModel model); + + string UpdateMultiple(List model, bool is_force_save); + eva_evaluation_operating_agreementWithSelectionViewModel GetWithSelection(int id); + eva_evaluation_operating_agreementWithSelectionViewModel GetBlankItem(); + + void RefreshAutoFieldOfAllData(); + eva_evaluation_operating_agreementEntity GetEntity(int id); + DataContext GetContext(); + + + + } +} + diff --git a/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementEntity.cs b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementEntity.cs new file mode 100644 index 0000000..5fbbff1 --- /dev/null +++ b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementEntity.cs @@ -0,0 +1,46 @@ +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_evaluation_operating_agreementEntity : BaseEntity2 + { + + + [ForeignKey("create_evaluation_detail_id")] + public eva_create_evaluation_detailEntity eva_create_evaluation_detail_create_evaluation_detail_id { get; set; } + public int? create_evaluation_detail_id { get; set; } + + public int? mission_no { get; set; } + + [MaxLength(4000)] + public string mission_detail { get; set; } + + [MaxLength(4000)] + public string target { get; set; } + + [MaxLength(4000)] + public string indicators { get; set; } + + + public void SetAutoField(DataContext context) + { + + } + + public void DoAfterInsertUpdate(DataContext context) + { + + } + + } +} diff --git a/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementInputModel.cs b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementInputModel.cs new file mode 100644 index 0000000..de5c958 --- /dev/null +++ b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementInputModel.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_evaluation_operating_agreementInputModel + { + + public int? id { get; set; } + + public int? create_evaluation_detail_id { get; set; } + + public int? mission_no { get; set; } + + public string mission_detail { get; set; } + + public string target { get; set; } + + public string indicators { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementReportRequestModel.cs b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementReportRequestModel.cs new file mode 100644 index 0000000..64519d2 --- /dev/null +++ b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementReportRequestModel.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_evaluation_operating_agreementReportRequestModel : eva_evaluation_operating_agreementSearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementSearchModel.cs b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementSearchModel.cs new file mode 100644 index 0000000..6a5c222 --- /dev/null +++ b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementSearchModel.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_evaluation_operating_agreementSearchModel + { + + public int id { get; set; } + + public int? create_evaluation_detail_id { get; set; } + + } +} + diff --git a/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementService.cs b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementService.cs new file mode 100644 index 0000000..cc4e8f8 --- /dev/null +++ b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementService.cs @@ -0,0 +1,287 @@ +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_evaluation_operating_agreementService : Ieva_evaluation_operating_agreementService + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + + public eva_evaluation_operating_agreementService(IBaseRepository2 repository, IMyDatabase mydb, Iexternal_linkageService inext) + { + _repository = repository; + db = mydb; + ext = inext; + } + + #region Private Functions + private eva_evaluation_operating_agreementEntity GetEntity(eva_evaluation_operating_agreementInputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_evaluation_operating_agreementViewModel GetDto(eva_evaluation_operating_agreementEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public eva_evaluation_operating_agreementViewModel Get(int id) + { + var entity = _repository.Get(id); + + return GetDto(entity); + } + + public eva_evaluation_operating_agreementEntity GetEntity(int id) + { + var entity = _repository.Get(id); + + return entity; + } + + public DataContext GetContext() + { + return _repository.Context; + } + + public eva_evaluation_operating_agreementWithSelectionViewModel GetWithSelection(int id) + { + var entity = _repository.Get(id); + var i = Mapper.Map(entity); + + + return i; + } + public eva_evaluation_operating_agreementWithSelectionViewModel GetBlankItem() + { + var i = new eva_evaluation_operating_agreementWithSelectionViewModel(); + + + return i; + } + + public List GetListBycreate_evaluation_detail_id(int? create_evaluation_detail_id) + { + var model = new eva_evaluation_operating_agreementSearchModel(); + model.create_evaluation_detail_id = create_evaluation_detail_id; + return GetListBySearch(model); + } + + public List GetListBySearch(eva_evaluation_operating_agreementSearchModel model) + { + var data = ( + from m_eva_evaluation_operating_agreement in _repository.Context.eva_evaluation_operating_agreement + + join fk_eva_create_evaluation_detail1 in _repository.Context.eva_create_evaluation_detail on m_eva_evaluation_operating_agreement.create_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() + + + where + (model.create_evaluation_detail_id.HasValue && m_eva_evaluation_operating_agreement.create_evaluation_detail_id == model.create_evaluation_detail_id) + + + orderby m_eva_evaluation_operating_agreement.created descending + select new eva_evaluation_operating_agreementViewModel() + { + id = m_eva_evaluation_operating_agreement.id, + create_evaluation_detail_id = m_eva_evaluation_operating_agreement.create_evaluation_detail_id, + mission_no = m_eva_evaluation_operating_agreement.mission_no, + mission_detail = m_eva_evaluation_operating_agreement.mission_detail, + target = m_eva_evaluation_operating_agreement.target, + indicators = m_eva_evaluation_operating_agreement.indicators, + + create_evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id = fk_eva_create_evaluation_detailResult1.create_evaluation_id, + + isActive = m_eva_evaluation_operating_agreement.isActive, + Created = m_eva_evaluation_operating_agreement.created, + Updated = m_eva_evaluation_operating_agreement.updated + } + ).Take(1000).ToList(); + + return data; + } + + #endregion + + #region Manipulation Functions + + + public int GetNewPrimaryKey() + { + int? newkey = 0; + + var x = (from i in _repository.Context.eva_evaluation_operating_agreement + orderby i.id descending + select i).Take(1).ToList(); + + if(x.Count > 0) + { + newkey = x[0].id + 1; + } + + return newkey.Value; + } + + + public eva_evaluation_operating_agreementViewModel Insert(eva_evaluation_operating_agreementInputModel model) + { + var entity = GetEntity(model); + entity.id = GetNewPrimaryKey(); + + + entity.SetAutoField(_repository.Context); + + var inserted = _repository.Insert(entity); + entity.DoAfterInsertUpdate(_repository.Context); + return Get(inserted.id); + } + + public eva_evaluation_operating_agreementViewModel Update(int id, eva_evaluation_operating_agreementInputModel model) + { + var existingEntity = _repository.Get(id); + if (existingEntity != null) + { + existingEntity.create_evaluation_detail_id = model.create_evaluation_detail_id; + existingEntity.mission_no = model.mission_no; + existingEntity.mission_detail = model.mission_detail; + existingEntity.target = model.target; + existingEntity.indicators = model.indicators; + + existingEntity.SetAutoField(_repository.Context); + + var updated = _repository.Update(id, existingEntity); + existingEntity.DoAfterInsertUpdate(_repository.Context); + return Get(updated.id); + } + 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.create_evaluation_detail_id = i.create_evaluation_detail_id; + existingEntity.mission_no = i.mission_no; + existingEntity.mission_detail = i.mission_detail; + existingEntity.target = i.target; + existingEntity.indicators = i.indicators; + + 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_evaluation_operating_agreementViewModel SetAsActive(int id) + { + var updated = _repository.SetAsActive(id); + + return Get(updated.id); + } + public eva_evaluation_operating_agreementViewModel 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_evaluation_operating_agreement + select i; + foreach (var item in all_items) + { + item.SetAutoField(_repository.Context); + } + _repository.Context.SaveChanges(); + } + + private Dictionary GetLookupForLog() + { + var i = new Dictionary(); + + + i.Add("create_evaluation_detail_id", "อ้างอิงตาราง eva_create_evaluation_detail"); + i.Add("create_evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id", "อ้างอิงตาราง eva_create_evaluation_detail"); + i.Add("mission_no", "ภารกิจที่"); + i.Add("mission_detail", "รายละเอียดภารกิจ"); + i.Add("target", "เป้าหมาย"); + i.Add("indicators", "ตัวชี้วัด"); + + return i; + } + + + + #endregion + + #region Match Item + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementViewModel.cs b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementViewModel.cs new file mode 100644 index 0000000..4b99a6b --- /dev/null +++ b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementViewModel.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_evaluation_operating_agreementViewModel : BaseViewModel2 + { + + public int? create_evaluation_detail_id { get; set; } + + public int? mission_no { get; set; } + + public string mission_detail { get; set; } + + public string target { get; set; } + + public string indicators { get; set; } + + public int? create_evaluation_detail_id_eva_create_evaluation_detail_create_evaluation_id { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementWithSelectionViewModel.cs b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementWithSelectionViewModel.cs new file mode 100644 index 0000000..0a6e0c5 --- /dev/null +++ b/Models/eva_evaluation_operating_agreement/eva_evaluation_operating_agreementWithSelectionViewModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TodoAPI2.Models +{ + public class eva_evaluation_operating_agreementWithSelectionViewModel: eva_evaluation_operating_agreementViewModel + { + + } +} \ No newline at end of file diff --git a/Startup.cs b/Startup.cs index bb7184a..3256f87 100644 --- a/Startup.cs +++ b/Startup.cs @@ -305,6 +305,9 @@ namespace Test01 services.AddScoped(); + services.AddScoped, BaseRepository2>(); + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -551,6 +554,11 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); + + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); #endregion 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 a05852a..8105070 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 @@ -233,6 +233,60 @@ + + +
การประเมินผลการปฏิบัติงานของพนักงานเนติบัณฑิตยสภา
@@ -291,6 +345,38 @@
+
+
ข้อตกลงการปฏิบัติงาน
+
+
+ + + +
+ + +
+ +
+
+ + + + + + + + + + + + + +
เครื่องมือ
+
+ +
+
ผลสัมฤทธิ์ของงาน (น้ำหนัก %)
@@ -398,7 +484,7 @@
- + @@ -414,6 +500,7 @@ + + +} + diff --git a/tb320eva.csproj b/tb320eva.csproj index 68c6c13..8fd25de 100644 --- a/tb320eva.csproj +++ b/tb320eva.csproj @@ -68,15 +68,11 @@ - - - - - - + + diff --git a/tb320eva.xml b/tb320eva.xml index 3e682bc..0b2be61 100644 --- a/tb320eva.xml +++ b/tb320eva.xml @@ -2659,6 +2659,124 @@ If the model is invalid 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 create_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 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 new file mode 100644 index 0000000..bb48525 --- /dev/null +++ b/wwwroot/js/eva_evaluation_operating_agreement/eva_evaluation_operating_agreement.js @@ -0,0 +1,227 @@ +var eva_evaluation_operating_agreement_editMode = "CREATE"; +var eva_evaluation_operating_agreement_API = "/api/eva_evaluation_operating_agreement/"; + +//================= Search Customizaiton ========================================= + +function eva_evaluation_operating_agreement_GetSearchParameter() { + var eva_evaluation_operating_agreementSearchObject = new Object(); + eva_evaluation_operating_agreementSearchObject.create_evaluation_detail_id = getUrlParameter("id"); + + return eva_evaluation_operating_agreementSearchObject; +} + +function eva_evaluation_operating_agreement_FeedDataToSearchForm(data) { + $("#s_eva_evaluation_operating_agreement_create_evaluation_detail_id").val(data.create_evaluation_detail_id); + +} + +//================= Form Data Customizaiton ========================================= + +function eva_evaluation_operating_agreement_FeedDataToForm(data) { + $("#eva_evaluation_operating_agreement_id").val(data.id); + $("#eva_evaluation_operating_agreement_create_evaluation_detail_id").val(data.create_evaluation_detail_id); + $("#eva_evaluation_operating_agreement_mission_no").val(data.mission_no); + $("#eva_evaluation_operating_agreement_mission_detail").val(data.mission_detail); + $("#eva_evaluation_operating_agreement_target").val(data.target); + $("#eva_evaluation_operating_agreement_indicators").val(data.indicators); + +} + +function eva_evaluation_operating_agreement_GetFromForm() { + var eva_evaluation_operating_agreementObject = new Object(); + eva_evaluation_operating_agreementObject.id = $("#eva_evaluation_operating_agreement_id").val(); + eva_evaluation_operating_agreementObject.create_evaluation_detail_id = getUrlParameter("id"); + eva_evaluation_operating_agreementObject.mission_no = $("#eva_evaluation_operating_agreement_mission_no").val(); + eva_evaluation_operating_agreementObject.mission_detail = $("#eva_evaluation_operating_agreement_mission_detail").val(); + eva_evaluation_operating_agreementObject.target = $("#eva_evaluation_operating_agreement_target").val(); + eva_evaluation_operating_agreementObject.indicators = $("#eva_evaluation_operating_agreement_indicators").val(); + + + return eva_evaluation_operating_agreementObject; +} + +function eva_evaluation_operating_agreement_InitialForm(s) { + var successFunc = function (result) { + eva_evaluation_operating_agreement_FeedDataToForm(result); + eva_evaluation_operating_agreement_FeedDataToSearchForm(result); + if (s) { + // Incase model popup + $("#eva_evaluation_operating_agreementModel").modal("show"); + } + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_evaluation_operating_agreement_API + "GetBlankItem", successFunc, AlertDanger); +} + +//================= Form Mode Setup and Flow ========================================= + +function eva_evaluation_operating_agreement_GoCreate() { + // Incase model popup + eva_evaluation_operating_agreement_SetCreateForm(true); + + // Incase open new page + //window_open(appsite + "/eva_evaluation_operating_agreementView/eva_evaluation_operating_agreement_d"); +} + +function eva_evaluation_operating_agreement_GoEdit(a) { + // Incase model popup + eva_evaluation_operating_agreement_SetEditForm(a); + + // Incase open new page + //window_open(appsite + "/eva_evaluation_operating_agreementView/eva_evaluation_operating_agreement_d?id=" + a); +} + +function eva_evaluation_operating_agreement_SetEditForm(a) { + var successFunc = function (result) { + eva_evaluation_operating_agreement_editMode = "UPDATE"; + eva_evaluation_operating_agreement_FeedDataToForm(result); + $("#eva_evaluation_operating_agreementModel").modal("show"); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_evaluation_operating_agreement_API + a, successFunc, AlertDanger); +} + +function eva_evaluation_operating_agreement_SetCreateForm(s) { + eva_evaluation_operating_agreement_editMode = "CREATE"; + eva_evaluation_operating_agreement_InitialForm(s); +} + +function eva_evaluation_operating_agreement_RefreshTable() { + // Incase model popup + eva_evaluation_operating_agreement_DoSearch(); + + // Incase open new page + //window.parent.eva_evaluation_operating_agreement_DoSearch(); +} + +//================= Update and Delete ========================================= + +var eva_evaluation_operating_agreement_customValidation = function (group) { + return ""; +}; + +function eva_evaluation_operating_agreement_PutUpdate() { + if (!ValidateForm('eva_evaluation_operating_agreement', eva_evaluation_operating_agreement_customValidation)) { + return; + } + + var data = eva_evaluation_operating_agreement_GetFromForm(); + + //Update Mode + if (eva_evaluation_operating_agreement_editMode === "UPDATE") { + var successFunc1 = function (result) { + $("#eva_evaluation_operating_agreementModel").modal("hide"); + AlertSuccess(result.code + " " + result.message); + eva_evaluation_operating_agreement_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxPutRequest(apisite + eva_evaluation_operating_agreement_API + data.id, data, successFunc1, AlertDanger); + } + // Create mode + else { + var successFunc2 = function (result) { + $("#eva_evaluation_operating_agreementModel").modal("hide"); + AlertSuccess(result.code + " " + result.message); + eva_evaluation_operating_agreement_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxPostRequest(apisite + eva_evaluation_operating_agreement_API, data, successFunc2, AlertDanger); + } +} + +function eva_evaluation_operating_agreement_GoDelete(a) { + if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) { + var successFunc = function (result) { + $("#eva_evaluation_operating_agreementModel").modal("hide"); + AlertSuccess(result.code + " " + result.message); + eva_evaluation_operating_agreement_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxDeleteRequest(apisite + eva_evaluation_operating_agreement_API + a, null, successFunc, AlertDanger); + } +} + +//================= Data Table ========================================= + +var eva_evaluation_operating_agreementTableV; + +var eva_evaluation_operating_agreement_setupTable = function (result) { + tmp = '"'; + eva_evaluation_operating_agreementTableV = $('#eva_evaluation_operating_agreementTable').DataTable({ + "processing": true, + "serverSide": false, + "data": result, + //"select": { + // "style": 'multi' + //}, + "columns": [ + //{ "data": "" }, + { "data": "id" }, + { "data": "mission_no" }, + { "data": "mission_detail" }, + { "data": "target" }, + { "data": "indicators" }, + ], + "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_evaluation_operating_agreement_InitiateDataTable() { + startLoad(); + var p = $.param(eva_evaluation_operating_agreement_GetSearchParameter()); + AjaxGetRequest(apisite + "/api/eva_evaluation_operating_agreement/GetListBySearch?" + p, eva_evaluation_operating_agreement_setupTable, AlertDanger); +} + +function eva_evaluation_operating_agreement_DoSearch() { + var p = $.param(eva_evaluation_operating_agreement_GetSearchParameter()); + var eva_evaluation_operating_agreement_reload = function (result) { + eva_evaluation_operating_agreementTableV.destroy(); + eva_evaluation_operating_agreement_setupTable(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + "/api/eva_evaluation_operating_agreement/GetListBySearch?" + p, eva_evaluation_operating_agreement_reload, AlertDanger); +} + +function eva_evaluation_operating_agreement_GetSelect(f) { + var eva_evaluation_operating_agreement_selectitem = []; + $.each(eva_evaluation_operating_agreementTableV.rows('.selected').data(), function (key, value) { + eva_evaluation_operating_agreement_selectitem.push(value[f]); + }); + alert(eva_evaluation_operating_agreement_selectitem); +} + +//================= File Upload ========================================= + + + +//================= Multi-Selection Function ========================================= + + +