From 682dc2e5aebf17a32abb40d92368db2015998c59 Mon Sep 17 00:00:00 2001 From: Nakorn Rientrakrunchai Date: Wed, 10 Feb 2021 15:54:45 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=A2=E0=B8=81=E0=B9=80=E0=B8=A1?= =?UTF-8?q?=E0=B8=99=E0=B8=B9=20=E0=B9=81=E0=B8=9A=E0=B8=9A=E0=B8=82?= =?UTF-8?q?=E0=B9=89=E0=B8=AD=E0=B8=95=E0=B8=81=E0=B8=A5=E0=B8=87=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B8=9B=E0=B8=8F=E0=B8=B4=E0=B8=9A=E0=B8=B1?= =?UTF-8?q?=E0=B8=95=E0=B8=B4=E0=B8=87=E0=B8=B2=E0=B8=99=E0=B9=80=E0=B8=9E?= =?UTF-8?q?=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=81?= =?UTF-8?q?=E0=B8=AD=E0=B8=9A=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=9E=E0=B8=B4?= =?UTF-8?q?=E0=B8=88=E0=B8=B2=E0=B8=A3=E0=B8=93=E0=B8=B2=E0=B8=9B=E0=B8=A3?= =?UTF-8?q?=E0=B8=B0=E0=B9=80=E0=B8=A1=E0=B8=B4=E0=B8=99=E0=B8=9C=E0=B8=A5?= =?UTF-8?q?=E0=B8=AA=E0=B8=B1=E0=B8=A1=E0=B8=A4=E0=B8=97=E0=B8=98=E0=B8=B4?= =?UTF-8?q?=E0=B9=8C=E0=B8=82=E0=B8=AD=E0=B8=87=E0=B8=87=E0=B8=B2=E0=B8=99?= =?UTF-8?q?=20=E0=B8=87=E0=B8=94.2/2=20=E0=B8=AD=E0=B8=AD=E0=B8=81?= =?UTF-8?q?=E0=B8=A1=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e_evaluation_detail_firstdocControllers.cs | 188 ++++++++++++ EF/_IBaseService2.cs | 22 ++ ...eva_create_evaluation_detail_firstdoc.xlsx | Bin 0 -> 11037 bytes ...reate_evaluation_detail_firstdocService.cs | 23 ++ ...te_evaluation_detail_firstdocInputModel.cs | 48 ++++ ...ation_detail_firstdocReportRequestModel.cs | 21 ++ ...e_evaluation_detail_firstdocSearchModel.cs | 29 ++ ...reate_evaluation_detail_firstdocService.cs | 264 +++++++++++++++++ ...ate_evaluation_detail_firstdocViewModel.cs | 85 ++++++ ...n_detail_firstdocWithSelectionViewModel.cs | 13 + Startup.cs | 6 + ...aluation_detail_firstdocViewControllers.cs | 54 ++++ ...reate_evaluation_detail_agreement_d.cshtml | 117 +------- ...a_create_evaluation_detail_firstdoc.cshtml | 87 ++++++ ...create_evaluation_detail_firstdoc_d.cshtml | 270 ++++++++++++++++++ Views/home/index2.cshtml | 8 + tb320eva.csproj | 4 + tb320eva.xml | 57 ++++ .../eva_create_evaluation_detail_agreement.js | 159 +++++------ .../eva_create_evaluation_detail_firstdoc.js | 251 ++++++++++++++++ ...eva_create_evaluation_detail_firstdoc_d.js | 127 ++++++++ 21 files changed, 1639 insertions(+), 194 deletions(-) create mode 100644 ApiControllers/eva_create_evaluation_detail_firstdocControllers.cs create mode 100644 EF/_IBaseService2.cs create mode 100644 EXCEL/eva_create_evaluation_detail@eva_create_evaluation_detail_firstdoc.xlsx create mode 100644 Models/eva_create_evaluation_detail_firstdoc/Ieva_create_evaluation_detail_firstdocService.cs create mode 100644 Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocInputModel.cs create mode 100644 Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocReportRequestModel.cs create mode 100644 Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocSearchModel.cs create mode 100644 Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs create mode 100644 Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocViewModel.cs create mode 100644 Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocWithSelectionViewModel.cs create mode 100644 ViewControllers/eva_create_evaluation_detail_firstdocViewControllers.cs create mode 100644 Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc.cshtml create mode 100644 Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml create mode 100644 wwwroot/js/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdoc.js create mode 100644 wwwroot/js/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdoc_d.js diff --git a/ApiControllers/eva_create_evaluation_detail_firstdocControllers.cs b/ApiControllers/eva_create_evaluation_detail_firstdocControllers.cs new file mode 100644 index 0000000..3a30c2f --- /dev/null +++ b/ApiControllers/eva_create_evaluation_detail_firstdocControllers.cs @@ -0,0 +1,188 @@ +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_firstdoc")] + public class eva_create_evaluation_detail_firstdocController : BaseController + { + #region Private Variables + private ILogger _logger; + private Ieva_create_evaluation_detail_firstdocService _repository; + private Iexternal_employeeService emp; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + /// + public eva_create_evaluation_detail_firstdocController(ILogger logger, + Ieva_create_evaluation_detail_firstdocService repository, IConfiguration configuration, + Iexternal_employeeService inemp) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + emp = inemp; + } + + /// + /// Get specific item by id + /// + /// + /// + /// Return Get specific item by id + /// Returns the item + /// Error Occurred + [HttpGet("{id}")] + [ProducesResponseType(typeof(eva_create_evaluation_detail_firstdocWithSelectionViewModel), 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_firstdocWithSelectionViewModel), 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_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_id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + + if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"])) + { + var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]); + var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid)); + return Ok(_repository.GetListBycreate_evaluation_id(create_evaluation_id, e.id)); + } + else + { + return Unauthorized(); + } + } + 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_firstdocSearchModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + + if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"])) + { + var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]); + var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid)); + return Ok(_repository.GetListBySearch(model, e.id)); + } + else + { + return Unauthorized(); + } + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + } +} diff --git a/EF/_IBaseService2.cs b/EF/_IBaseService2.cs new file mode 100644 index 0000000..8678465 --- /dev/null +++ b/EF/_IBaseService2.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TTSW.EF +{ + public interface IBaseService2 + { + #region Query Functions + ViewModel Get(Key id); + #endregion + + #region Manipulation Functions + ViewModel Insert(InputModel model, bool is_force_save); + ViewModel Update(Key id, InputModel model, bool is_force_save); + ViewModel SetAsActive(Key id); + ViewModel SetAsInactive(Key id); + void Delete(Key id); + #endregion + } +} diff --git a/EXCEL/eva_create_evaluation_detail@eva_create_evaluation_detail_firstdoc.xlsx b/EXCEL/eva_create_evaluation_detail@eva_create_evaluation_detail_firstdoc.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..304c55fb28190080b6e433ba8f8d35221f092727 GIT binary patch literal 11037 zcmeHN1y>x|wr(7PySux)yE`PfH%{Xgg1ZEFhXBFdf+G_SaRX_TJyw=i6$EP|#QaSO7c#03Zj5^9D_UAO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f%_1^j+DmXU;_Oo4c`lQt+4f zW96KRWJQ%T#xv>@!!sQlXE5@Iu-C#!e*I53oe*6{XuM?G@ z7yv*lIRNmtY0IzXztYT4092~qAL191`A5?E74)x}`X?l~&6WC3&-Aant)>VA_CWvu P3H+l0yYbd GetListBycreate_evaluation_id(int? create_evaluation_id, int? emp_id); + List GetListBySearch(eva_create_evaluation_detail_firstdocSearchModel model, int? emp_id); + + eva_create_evaluation_detail_firstdocWithSelectionViewModel GetWithSelection(int id); + eva_create_evaluation_detail_firstdocWithSelectionViewModel GetBlankItem(); + + } +} + diff --git a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocInputModel.cs b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocInputModel.cs new file mode 100644 index 0000000..399259b --- /dev/null +++ b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocInputModel.cs @@ -0,0 +1,48 @@ +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_firstdocInputModel + { + + public int? id { get; set; } + + public string evaluation_round { get; set; } + + public string employee_code { get; set; } + + public string employee_fullname { get; set; } + + public string employee_position { get; set; } + + public string employee_position_type { get; set; } + + public string employee_position_level { get; set; } + + public string employee_org { get; set; } + + public string chief_fullname { get; set; } + + public string chief_position { get; set; } + + public int? create_evaluation_id { get; set; } + + public int? org_id { get; set; } + + public string search_employee_code { get; set; } + + public string search_employee_fullname { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocReportRequestModel.cs b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocReportRequestModel.cs new file mode 100644 index 0000000..b18abd4 --- /dev/null +++ b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocReportRequestModel.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_firstdocReportRequestModel : eva_create_evaluation_detail_firstdocSearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocSearchModel.cs b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocSearchModel.cs new file mode 100644 index 0000000..d511f95 --- /dev/null +++ b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocSearchModel.cs @@ -0,0 +1,29 @@ +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_firstdocSearchModel + { + + public int id { get; set; } + + public int? create_evaluation_id { get; set; } + + public int? org_id { get; set; } + + public string search_employee_code { get; set; } + + public string search_employee_fullname { get; set; } + + } +} + diff --git a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs new file mode 100644 index 0000000..5d2c2eb --- /dev/null +++ b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs @@ -0,0 +1,264 @@ +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_firstdocService : Ieva_create_evaluation_detail_firstdocService + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + private Iexternal_employeeService emp; + + public eva_create_evaluation_detail_firstdocService(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_detailEntity GetEntity(eva_create_evaluation_detail_firstdocInputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_create_evaluation_detail_firstdocViewModel GetDto(eva_create_evaluation_detailEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public string GetWorkTimeText(DateTime? startDate, DateTime? endDate) + { + if (!endDate.HasValue || !startDate.HasValue) + return ""; + + int monthsApart = 12 * (startDate.Value.Year - endDate.Value.Year) + startDate.Value.Month - endDate.Value.Month; + if (Math.Abs(monthsApart) < 4) + { + return "ปฏิบัติงานไม่ครบ 4 เดือน"; + } + return ""; + } + + public eva_create_evaluation_detail_firstdocViewModel Get(int id) + { + var allemp = emp.GetListByemployee_type(null, null); + + var endDate = (from m_eva_create_evaluation_detail_agreement in _repository.Context.eva_create_evaluation_detail + + join fk_eva_create_evaluation10 in _repository.Context.eva_create_evaluation on m_eva_create_evaluation_detail_agreement.create_evaluation_id equals fk_eva_create_evaluation10.id + into eva_create_evaluationResult10 + from fk_eva_create_evaluationResult10 in eva_create_evaluationResult10.DefaultIfEmpty() + + join i in _repository.Context.eva_performance_plan_detail + on fk_eva_create_evaluationResult10.performance_plan_id equals i.performance_plan_id + + where m_eva_create_evaluation_detail_agreement.id == id + + select i.end_date).Max(); + + var data = ( + from m_eva_create_evaluation_detail_agreement in _repository.Context.eva_create_evaluation_detail + + join fk_external_employee in allemp on m_eva_create_evaluation_detail_agreement.employee_id equals fk_external_employee.id + into external_employeeResult + from fk_external_employee in external_employeeResult.DefaultIfEmpty() + + join fk_external_chief in allemp on m_eva_create_evaluation_detail_agreement.chief equals fk_external_chief.id + into external_chiefResult + from fk_external_chief in external_chiefResult.DefaultIfEmpty() + + join fk_eva_create_evaluation10 in _repository.Context.eva_create_evaluation on m_eva_create_evaluation_detail_agreement.create_evaluation_id equals fk_eva_create_evaluation10.id + into eva_create_evaluationResult10 + from fk_eva_create_evaluationResult10 in eva_create_evaluationResult10.DefaultIfEmpty() + + where m_eva_create_evaluation_detail_agreement.id == id + + orderby m_eva_create_evaluation_detail_agreement.created descending + select new eva_create_evaluation_detail_firstdocWithSelectionViewModel() + { + id = m_eva_create_evaluation_detail_agreement.id, + evaluation_round = fk_eva_create_evaluationResult10.eva_performance_plan.display_text, + employee_code = fk_external_employee.employee_no, + employee_fullname = fk_external_employee.fullname, + employee_position = fk_external_employee.position_name, + employee_position_type = fk_external_employee.position_type_name, + employee_position_level = fk_external_employee.position_level_text, + employee_org = fk_external_employee.department_name, + chief_fullname = fk_external_chief.fullname, + chief_position = fk_external_chief.position_name, + create_evaluation_id = m_eva_create_evaluation_detail_agreement.create_evaluation_id, + org_id = fk_external_employee.department_id, + search_employee_code = fk_external_employee.employee_no, + search_employee_fullname = fk_external_employee.fullname, + status_self = m_eva_create_evaluation_detail_agreement.status_self, + status_chief = m_eva_create_evaluation_detail_agreement.status_chief, + status_supervisor = m_eva_create_evaluation_detail_agreement.status_supervisor, + + org_id_external_linkage_external_name = fk_external_employee.department_name, + + remark_hrm_work_record = fk_external_employee.remark_hrm_work_record + + GetWorkTimeText(fk_external_employee.packing_date, endDate), + + score1 = fk_eva_create_evaluationResult10.score1, + score2 = fk_eva_create_evaluationResult10.score2, + + isActive = m_eva_create_evaluation_detail_agreement.isActive, + Created = m_eva_create_evaluation_detail_agreement.created, + Updated = m_eva_create_evaluation_detail_agreement.updated + } + ).ToList(); + + return data[0]; + } + + public eva_create_evaluation_detailEntity GetEntity(int id) + { + var entity = _repository.Get(id); + + return entity; + } + + public DataContext GetContext() + { + return _repository.Context; + } + + public eva_create_evaluation_detail_firstdocWithSelectionViewModel GetWithSelection(int id) + { + var entity = Get(id); + var i = Mapper.Map(entity); + i.item_org_id = ext.GetDepartmentData(); + + + return i; + } + public eva_create_evaluation_detail_firstdocWithSelectionViewModel GetBlankItem() + { + var i = new eva_create_evaluation_detail_firstdocWithSelectionViewModel(); + i.item_org_id = ext.GetDepartmentData(); + + + return i; + } + + public List GetListBycreate_evaluation_id(int? create_evaluation_id, int? emp_id) + { + var model = new eva_create_evaluation_detail_firstdocSearchModel(); + model.create_evaluation_id = create_evaluation_id; + return GetListBySearch(model, emp_id); + } + + public List GetListBySearch(eva_create_evaluation_detail_firstdocSearchModel model, int? emp_id) + { + var allemp = emp.GetListByemployee_type(null, null); + + var data = ( + from m_eva_create_evaluation_detail_agreement in _repository.Context.eva_create_evaluation_detail + + join fk_external_employee in allemp on m_eva_create_evaluation_detail_agreement.employee_id equals fk_external_employee.id + into external_employeeResult + from fk_external_employee in external_employeeResult.DefaultIfEmpty() + + join fk_external_chief in allemp on m_eva_create_evaluation_detail_agreement.chief equals fk_external_chief.id + into external_chiefResult + from fk_external_chief in external_chiefResult.DefaultIfEmpty() + + join fk_eva_create_evaluation10 in _repository.Context.eva_create_evaluation on m_eva_create_evaluation_detail_agreement.create_evaluation_id equals fk_eva_create_evaluation10.id + into eva_create_evaluationResult10 + from fk_eva_create_evaluationResult10 in eva_create_evaluationResult10.DefaultIfEmpty() + + join fk_plan in _repository.Context.eva_performance_plan on fk_eva_create_evaluationResult10.performance_plan_id equals fk_plan.id + into planResult + from fk_planResult in planResult.DefaultIfEmpty() + + where 1 == 1 + && (m_eva_create_evaluation_detail_agreement.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue) + && (fk_external_employee.department_id == model.org_id || !model.org_id.HasValue) + && (fk_external_employee.employee_no == model.search_employee_code || string.IsNullOrEmpty(model.search_employee_code)) + && (fk_external_employee.fullname.Contains(model.search_employee_fullname) || string.IsNullOrEmpty(model.search_employee_fullname)) + && m_eva_create_evaluation_detail_agreement.employee_id == emp_id + + orderby m_eva_create_evaluation_detail_agreement.created descending + select new eva_create_evaluation_detail_firstdocViewModel() + { + id = m_eva_create_evaluation_detail_agreement.id, + evaluation_round = fk_eva_create_evaluationResult10.eva_performance_plan.theTime.ToString(), + employee_code = fk_external_employee.employee_no, + employee_fullname = fk_external_employee.fullname, + employee_position = fk_external_employee.position_name, + employee_position_type = fk_external_employee.employee_type_name, + employee_position_level = fk_external_employee.position_level_text, + employee_org = fk_external_employee.department_name, + chief_fullname = fk_external_chief.fullname, + chief_position = fk_external_chief.position_name, + create_evaluation_id = m_eva_create_evaluation_detail_agreement.create_evaluation_id, + org_id = fk_external_employee.department_id, + search_employee_code = fk_external_employee.employee_no, + search_employee_fullname = fk_external_employee.fullname, + status_self = m_eva_create_evaluation_detail_agreement.status_self, + status_chief = m_eva_create_evaluation_detail_agreement.status_chief, + status_supervisor = m_eva_create_evaluation_detail_agreement.status_supervisor, + + org_id_external_linkage_external_name = fk_external_employee.department_name, + + status_self_click_date = m_eva_create_evaluation_detail_agreement.status_self_click_date, + status_chief_click_date = m_eva_create_evaluation_detail_agreement.status_chief_click_date, + status_supervisor_click_date = m_eva_create_evaluation_detail_agreement.status_supervisor_click_date, + + plan_round_year = checkNull(fk_planResult.theTime) + "/" + checkNull(fk_planResult.fiscal_year), + + isActive = m_eva_create_evaluation_detail_agreement.isActive, + Created = m_eva_create_evaluation_detail_agreement.created, + Updated = m_eva_create_evaluation_detail_agreement.updated + } + ).ToList(); + + return data; + } + + private string checkNull(object i) + { + if (i != null) + { + return i.ToString(); + } + return ""; + } + + #endregion + + + + #endregion + } +} \ 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 new file mode 100644 index 0000000..482b36f --- /dev/null +++ b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocViewModel.cs @@ -0,0 +1,85 @@ +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_firstdocViewModel : BaseViewModel2 + { + + public string evaluation_round { get; set; } + + public string employee_code { get; set; } + + public string employee_fullname { get; set; } + + public string employee_position { get; set; } + + public string employee_position_type { get; set; } + + public string employee_position_level { get; set; } + + public string employee_org { get; set; } + + public string chief_fullname { get; set; } + + public string chief_position { get; set; } + + public int? create_evaluation_id { get; set; } + + public int? org_id { get; set; } + + public string search_employee_code { get; set; } + + public string search_employee_fullname { get; set; } + + public string org_id_external_linkage_external_name { get; set; } + + public string status_self { get; set; } + + public string status_chief { get; set; } + + public string status_supervisor { get; set; } + + public string remark_hrm_work_record { get; set; } + + public string plan_round_year { get; set; } + + public DateTime? status_self_click_date { get; set; } + public DateTime? status_chief_click_date { get; set; } + public DateTime? status_supervisor_click_date { get; set; } + + public decimal? score1 { get; set; } + + 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); } } + + private string getStatusText(string s) + { + if (!string.IsNullOrEmpty(s)) + { + if (s == "Y") + { + return "ส่งแบบประเมินแล้ว
"; + } + else if (s == "N") + { + return "ตีกลับ
"; + } + } + return " "; + } + + } +} + diff --git a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocWithSelectionViewModel.cs b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocWithSelectionViewModel.cs new file mode 100644 index 0000000..23a1ef0 --- /dev/null +++ b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocWithSelectionViewModel.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_firstdocWithSelectionViewModel: eva_create_evaluation_detail_firstdocViewModel + { + public List item_org_id { get; set; } + + } +} \ No newline at end of file diff --git a/Startup.cs b/Startup.cs index 3256f87..3910ba7 100644 --- a/Startup.cs +++ b/Startup.cs @@ -308,6 +308,8 @@ namespace Test01 services.AddScoped, BaseRepository2>(); services.AddScoped(); + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -559,6 +561,10 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); #endregion diff --git a/ViewControllers/eva_create_evaluation_detail_firstdocViewControllers.cs b/ViewControllers/eva_create_evaluation_detail_firstdocViewControllers.cs new file mode 100644 index 0000000..d273110 --- /dev/null +++ b/ViewControllers/eva_create_evaluation_detail_firstdocViewControllers.cs @@ -0,0 +1,54 @@ +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_firstdocViewController : Controller + { + private ILogger _logger; + private Ieva_create_evaluation_detail_firstdocService _repository; + private IConfiguration Configuration { get; set; } + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_create_evaluation_detail_firstdocViewController(ILogger logger, Ieva_create_evaluation_detail_firstdocService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + public IActionResult eva_create_evaluation_detail_firstdoc() + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + return View(); + } + + public IActionResult eva_create_evaluation_detail_firstdoc_d() + { + 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 8105070..c9adc30 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 @@ -5,6 +5,7 @@ Layout = "_LayoutDirect"; } +