diff --git a/ApiControllers/eva_adjust_quota_update_statusControllers.cs b/ApiControllers/eva_adjust_quota_update_statusControllers.cs new file mode 100644 index 0000000..9ae1d8a --- /dev/null +++ b/ApiControllers/eva_adjust_quota_update_statusControllers.cs @@ -0,0 +1,229 @@ +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_adjust_quota_update_status")] + public class eva_adjust_quota_update_statusController : BaseController + { + #region Private Variables + private ILogger _logger; + private Ieva_adjust_quota_update_statusService _repository; + private Iexternal_employeeService emp; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_adjust_quota_update_statusController(ILogger logger, Ieva_adjust_quota_update_statusService 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_adjust_quota_update_statusWithSelectionViewModel), 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_adjust_quota_update_statusWithSelectionViewModel), 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 quota_status_note + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetList(string quota_status_note) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListByquota_status_note(quota_status_note)); + } + 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_adjust_quota_update_statusSearchModel 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}"); + } + } + + + /// + /// 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_adjust_quota_update_statusInputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + + int? e = null; + + if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"])) + { + var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]); + var theEmp = emp.GetEmployeeForLogin(Convert.ToInt32(loginid)); + if (theEmp != null) + { + e = theEmp.id; + } + else + { + return Unauthorized(); + } + } + else + { + return Unauthorized(); + } + + var result = _repository.Update(id, model, true, e); + 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); + } + + } +} diff --git a/ApiControllers/rep_eva01Controllers.cs b/ApiControllers/rep_eva01Controllers.cs index 0b5958d..06c423e 100644 --- a/ApiControllers/rep_eva01Controllers.cs +++ b/ApiControllers/rep_eva01Controllers.cs @@ -94,7 +94,9 @@ namespace TodoAPI2.Controllers { try { - if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now); + + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); //var httpclient = MyHelper.getHttpClient(Configuration); var httpclient = new WebClient(); diff --git a/ApiControllers/rep_eva02Controllers.cs b/ApiControllers/rep_eva02Controllers.cs index 1998869..8cd0aaa 100644 --- a/ApiControllers/rep_eva02Controllers.cs +++ b/ApiControllers/rep_eva02Controllers.cs @@ -94,7 +94,9 @@ namespace TodoAPI2.Controllers { try { - if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now); + + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); //var httpclient = MyHelper.getHttpClient(Configuration); var httpclient = new WebClient(); string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL"); diff --git a/ApiControllers/rep_eva03Controllers.cs b/ApiControllers/rep_eva03Controllers.cs index 60594fd..6d2f13a 100644 --- a/ApiControllers/rep_eva03Controllers.cs +++ b/ApiControllers/rep_eva03Controllers.cs @@ -93,7 +93,9 @@ namespace TodoAPI2.Controllers { try { - if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now); + + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); //var httpclient = MyHelper.getHttpClient(Configuration); var httpclient = new WebClient(); string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL"); diff --git a/ApiControllers/rep_eva_limit_frame_planControllers.cs b/ApiControllers/rep_eva_limit_frame_planControllers.cs index 6483992..63f7a70 100644 --- a/ApiControllers/rep_eva_limit_frame_planControllers.cs +++ b/ApiControllers/rep_eva_limit_frame_planControllers.cs @@ -95,7 +95,9 @@ namespace TodoAPI2.Controllers { try { - if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now); + + 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"); diff --git a/ApiControllers/rep_eva_self_reviewControllers.cs b/ApiControllers/rep_eva_self_reviewControllers.cs index db53aff..f67a616 100644 --- a/ApiControllers/rep_eva_self_reviewControllers.cs +++ b/ApiControllers/rep_eva_self_reviewControllers.cs @@ -96,7 +96,9 @@ namespace TodoAPI2.Controllers { try { - if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now); + + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); var httpclient = new WebClient(); var stream = new MemoryStream(); diff --git a/ApiControllers/rep_eva_self_review_allControllers.cs b/ApiControllers/rep_eva_self_review_allControllers.cs index d0e7982..eef5e4c 100644 --- a/ApiControllers/rep_eva_self_review_allControllers.cs +++ b/ApiControllers/rep_eva_self_review_allControllers.cs @@ -94,7 +94,9 @@ namespace TodoAPI2.Controllers { try { - if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now); + + 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"); diff --git a/ApiControllers/rep_summary_a01Controllers.cs b/ApiControllers/rep_summary_a01Controllers.cs index 575e40d..753291c 100644 --- a/ApiControllers/rep_summary_a01Controllers.cs +++ b/ApiControllers/rep_summary_a01Controllers.cs @@ -94,7 +94,9 @@ namespace TodoAPI2.Controllers { try { - if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now); + + 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"); diff --git a/ApiControllers/rpt_payroll_summaryControllers.cs b/ApiControllers/rpt_payroll_summaryControllers.cs index 604e6e1..1ec6020 100644 --- a/ApiControllers/rpt_payroll_summaryControllers.cs +++ b/ApiControllers/rpt_payroll_summaryControllers.cs @@ -94,7 +94,9 @@ namespace TodoAPI2.Controllers { try { - if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + model.print_dt = MyHelper.GetDateStringForReport(DateTime.Now) + " " + MyHelper.GetTimeStringFromDate(DateTime.Now); + + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); var httpclient = new WebClient(); string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL"); diff --git a/EXCEL/eva_adjust_postponement@eva_adjust_quota_update_final_status.xlsx b/EXCEL/eva_adjust_postponement@eva_adjust_quota_update_final_status.xlsx new file mode 100644 index 0000000..67eab95 Binary files /dev/null and b/EXCEL/eva_adjust_postponement@eva_adjust_quota_update_final_status.xlsx differ diff --git a/EXCEL/eva_adjust_postponement@eva_adjust_quota_update_status.xlsx b/EXCEL/eva_adjust_postponement@eva_adjust_quota_update_status.xlsx new file mode 100644 index 0000000..3bba927 Binary files /dev/null and b/EXCEL/eva_adjust_postponement@eva_adjust_quota_update_status.xlsx differ diff --git a/Models/eva_adjust_postponement/eva_adjust_postponementEntity.cs b/Models/eva_adjust_postponement/eva_adjust_postponementEntity.cs index 5c7e296..0956518 100644 --- a/Models/eva_adjust_postponement/eva_adjust_postponementEntity.cs +++ b/Models/eva_adjust_postponement/eva_adjust_postponementEntity.cs @@ -76,5 +76,15 @@ namespace TodoAPI2.Models public int? quota_status_by { get; set; } [MaxLength(1000)] public string quota_status_note { get; set; } + public int? quota_status_submit_to { get; set; } + + [MaxLength(5)] + public string quota_final_status { get; set; } + + public DateTime? quota_final_status_date { get; set; } + [MaxLength(255)] + public int? quota_final_status_by { get; set; } + [MaxLength(1000)] + public string quota_final_status_note { get; set; } } } diff --git a/Models/eva_adjust_postponement_update_status/eva_adjust_postponement_update_statusService.cs b/Models/eva_adjust_postponement_update_status/eva_adjust_postponement_update_statusService.cs index 755a82e..67cfa59 100644 --- a/Models/eva_adjust_postponement_update_status/eva_adjust_postponement_update_statusService.cs +++ b/Models/eva_adjust_postponement_update_status/eva_adjust_postponement_update_statusService.cs @@ -119,7 +119,7 @@ namespace TodoAPI2.Models into external_linkageResult1 from fk_external_linkageResult1 in external_linkageResult1.DefaultIfEmpty() - join fk_external_linkage3 in ext.GetAgreeDisagree4() on m_eva_adjust_postponement_update_status.postponement_status_by equals fk_external_linkage3.id + join fk_external_linkage3 in emp.GetAllEmployee() on m_eva_adjust_postponement_update_status.postponement_status_by equals fk_external_linkage3.id into external_linkageResult3 from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty() @@ -139,7 +139,7 @@ namespace TodoAPI2.Models postponement_status_note = m_eva_adjust_postponement_update_status.postponement_status_note, postponement_status_external_linkage_external_name = fk_external_linkageResult1.external_name, - postponement_status_by_external_linkage_external_name = fk_external_linkageResult3.external_name, + postponement_status_by_external_linkage_external_name = fk_external_linkageResult3.fullname, isActive = m_eva_adjust_postponement_update_status.isActive, Created = m_eva_adjust_postponement_update_status.created, diff --git a/Models/eva_adjust_quota_update_status/Ieva_adjust_quota_update_statusService.cs b/Models/eva_adjust_quota_update_status/Ieva_adjust_quota_update_statusService.cs new file mode 100644 index 0000000..1c4a801 --- /dev/null +++ b/Models/eva_adjust_quota_update_status/Ieva_adjust_quota_update_statusService.cs @@ -0,0 +1,25 @@ +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_adjust_quota_update_statusService + { + new eva_adjust_quota_update_statusViewModel Update(int id, eva_adjust_quota_update_statusInputModel model, bool is_force_save, int? updateby); + List GetListByquota_status_note(string quota_status_note); + List GetListBySearch(eva_adjust_quota_update_statusSearchModel model); + eva_adjust_quota_update_statusWithSelectionViewModel GetWithSelection(int id); + eva_adjust_quota_update_statusWithSelectionViewModel GetBlankItem(); + + eva_adjust_postponementEntity GetEntity(int id); + DataContext GetContext(); + } +} + diff --git a/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusInputModel.cs b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusInputModel.cs new file mode 100644 index 0000000..c786e32 --- /dev/null +++ b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusInputModel.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_adjust_quota_update_statusInputModel + { + + public int? id { get; set; } + + public string quota_status { get; set; } + + public DateTime? quota_status_date { get; set; } + + public int? quota_status_by { get; set; } + + public string quota_status_note { get; set; } + + public int? quota_status_submit_to { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusReportRequestModel.cs b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusReportRequestModel.cs new file mode 100644 index 0000000..d322376 --- /dev/null +++ b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusReportRequestModel.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_adjust_quota_update_statusReportRequestModel : eva_adjust_quota_update_statusSearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusSearchModel.cs b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusSearchModel.cs new file mode 100644 index 0000000..3ca8ccd --- /dev/null +++ b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusSearchModel.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_adjust_quota_update_statusSearchModel + { + + public int id { get; set; } + + public string quota_status_note { get; set; } + + } +} + diff --git a/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusService.cs b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusService.cs new file mode 100644 index 0000000..1995a94 --- /dev/null +++ b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusService.cs @@ -0,0 +1,229 @@ +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_adjust_quota_update_statusService : Ieva_adjust_quota_update_statusService + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + private Iexternal_employeeService emp; + + public eva_adjust_quota_update_statusService(IBaseRepository2 repository, + IMyDatabase mydb, + Iexternal_linkageService inext, + Iexternal_employeeService inemp) + { + _repository = repository; + db = mydb; + ext = inext; + emp = inemp; + } + + #region Private Functions + private eva_adjust_postponementEntity GetEntity(eva_adjust_quota_update_statusInputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_adjust_quota_update_statusViewModel GetDto(eva_adjust_postponementEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public eva_adjust_quota_update_statusViewModel Get(int id) + { + var entity = _repository.Get(id); + + return GetDto(entity); + } + + public eva_adjust_postponementEntity GetEntity(int id) + { + var entity = _repository.Get(id); + + return entity; + } + + public DataContext GetContext() + { + return _repository.Context; + } + + public eva_adjust_quota_update_statusWithSelectionViewModel GetWithSelection(int id) + { + var entity = _repository.Get(id); + var i = Mapper.Map(entity); + i.item_quota_status = (from x in ext.GetAgreeDisagree4() select x).ToList(); + i.item_quota_status_by = (from x in emp.GetAllEmployee() select x).ToList(); + i.item_quota_status_submit_to = (from x in emp.GetAllEmployee() select x).ToList(); + + return i; + } + public eva_adjust_quota_update_statusWithSelectionViewModel GetBlankItem() + { + var i = new eva_adjust_quota_update_statusWithSelectionViewModel(); + i.item_quota_status = (from x in ext.GetAgreeDisagree4() select x).ToList(); + i.item_quota_status_by = (from x in emp.GetAllEmployee() select x).ToList(); + i.item_quota_status_submit_to = (from x in emp.GetAllEmployee() select x).ToList(); + + return i; + } + + public List GetListByquota_status_note(string quota_status_note) + { + var model = new eva_adjust_quota_update_statusSearchModel(); + model.quota_status_note = quota_status_note; + return GetListBySearch(model); + } + + public List GetListBySearch(eva_adjust_quota_update_statusSearchModel model) + { + var data = ( + from m_eva_adjust_quota_update_status in _repository.Context.eva_adjust_postponement + + join fk_external_linkage1 in ext.GetAgreeDisagree4() on m_eva_adjust_quota_update_status.quota_status equals fk_external_linkage1.external_code + into external_linkageResult1 + from fk_external_linkageResult1 in external_linkageResult1.DefaultIfEmpty() + + join fk_external_linkage3 in emp.GetAllEmployee() on m_eva_adjust_quota_update_status.quota_status_by equals fk_external_linkage3.id + into external_linkageResult3 + from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty() + + + where + 1 == 1 + && (string.IsNullOrEmpty(model.quota_status_note) || m_eva_adjust_quota_update_status.quota_status_note.Contains(model.quota_status_note)) + + + orderby m_eva_adjust_quota_update_status.created descending + select new eva_adjust_quota_update_statusViewModel() + { + id = m_eva_adjust_quota_update_status.id, + quota_status = m_eva_adjust_quota_update_status.quota_status, + quota_status_date = m_eva_adjust_quota_update_status.quota_status_date, + quota_status_by = m_eva_adjust_quota_update_status.quota_status_by, + quota_status_note = m_eva_adjust_quota_update_status.quota_status_note, + + quota_status_external_linkage_external_name = fk_external_linkageResult1.external_name, + quota_status_by_external_linkage_external_name = fk_external_linkageResult3.fullname, + + isActive = m_eva_adjust_quota_update_status.isActive, + Created = m_eva_adjust_quota_update_status.created, + Updated = m_eva_adjust_quota_update_status.updated + } + ).Take(1000).ToList(); + + return data; + } + + #endregion + + #region Manipulation Functions + + + public int GetNewPrimaryKey() + { + int? newkey = 0; + + var x = (from i in _repository.Context.eva_adjust_postponement + orderby i.id descending + select i).Take(1).ToList(); + + if(x.Count > 0) + { + newkey = x[0].id + 1; + } + + return newkey.Value; + } + + + public eva_adjust_quota_update_statusViewModel Update(int id, eva_adjust_quota_update_statusInputModel model, bool is_force_save, int? updateby) + { + var existingEntity = _repository.Get(id); + if (existingEntity != null) + { + existingEntity.quota_status = model.quota_status; + existingEntity.quota_status_date = DateTime.Now; + existingEntity.quota_status_by = updateby; + existingEntity.quota_status_note = model.quota_status_note; + + var updated = _repository.Update(id, existingEntity); + return Get(updated.id); + } + else + throw new NotificationException("No data to update"); + } + + public eva_adjust_quota_update_statusViewModel SetAsActive(int id) + { + var updated = _repository.SetAsActive(id); + + return Get(updated.id); + } + public eva_adjust_quota_update_statusViewModel SetAsInactive(int id) + { + var updated = _repository.SetAsInActive(id); + + return Get(updated.id); + } + public void Delete(int id) + { + _repository.Delete(id); + + return; + } + + private Dictionary GetLookupForLog() + { + var i = new Dictionary(); + + + i.Add("quota_status", "สถานะการปรับเลื่อนเงินเดือน"); + i.Add("quota_status_external_linkage_external_name", "สถานะการปรับเลื่อนเงินเดือน"); + i.Add("quota_status_date", "วันที่"); + i.Add("txt_quota_status_date", "วันที่"); + i.Add("quota_status_by", "ปรับสถานะโดย"); + i.Add("quota_status_by_external_linkage_external_name", "ปรับสถานะโดย"); + i.Add("quota_status_note", "หมายเหตุ"); + + return i; + } + + #endregion + + #region Match Item + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusViewModel.cs b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusViewModel.cs new file mode 100644 index 0000000..d36eb29 --- /dev/null +++ b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusViewModel.cs @@ -0,0 +1,35 @@ +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_adjust_quota_update_statusViewModel : BaseViewModel2 + { + + public string quota_status { get; set; } + + public DateTime? quota_status_date { get; set; } + + public string txt_quota_status_date { get { return MyHelper.GetDateStringForReport(this.quota_status_date); } } + + public int? quota_status_by { get; set; } + + public string quota_status_note { get; set; } + + public int? quota_status_submit_to { get; set; } + + public string quota_status_external_linkage_external_name { get; set; } + public string quota_status_by_external_linkage_external_name { get; set; } + + public string quota_status_submit_to_external_linkage_external_name { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusWithSelectionViewModel.cs b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusWithSelectionViewModel.cs new file mode 100644 index 0000000..2a598cb --- /dev/null +++ b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusWithSelectionViewModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TodoAPI2.Models +{ + public class eva_adjust_quota_update_statusWithSelectionViewModel: eva_adjust_quota_update_statusViewModel + { + public List item_quota_status { get; set; } + public List item_quota_status_by { get; set; } + public List item_quota_status_submit_to { get; set; } + } +} + diff --git a/Models/external_linkage/external_linkageService.cs b/Models/external_linkage/external_linkageService.cs index bf41c9d..509abbb 100644 --- a/Models/external_linkage/external_linkageService.cs +++ b/Models/external_linkage/external_linkageService.cs @@ -315,7 +315,7 @@ namespace TodoAPI2.Models var k = new external_linkageViewModel(); k.external_id = 1; k.external_code = ""; - k.external_name = "อยู่ระหว่างพิจารณา"; + k.external_name = "ระหว่างพิจารณา"; result.Add(k); var i = new external_linkageViewModel(); @@ -324,11 +324,11 @@ namespace TodoAPI2.Models i.external_name = "อนุมัติและส่งต่อ"; result.Add(i); - var j = new external_linkageViewModel(); - j.external_id = 3; - j.external_code = "N"; - j.external_name = "ตีกลับ"; - result.Add(j); + //var j = new external_linkageViewModel(); + //j.external_id = 3; + //j.external_code = "N"; + //j.external_name = "ตีกลับ"; + //result.Add(j); return result; } diff --git a/Models/rep_eva01/rep_eva01ReportRequestModel.cs b/Models/rep_eva01/rep_eva01ReportRequestModel.cs index 8ea34fd..2022916 100644 --- a/Models/rep_eva01/rep_eva01ReportRequestModel.cs +++ b/Models/rep_eva01/rep_eva01ReportRequestModel.cs @@ -16,6 +16,8 @@ namespace TodoAPI2.Models public string filetype { get; set; } public string contentType { get { return MyHelper.GetContentType(filetype); } } + + public string print_dt { get; set; } } } diff --git a/Models/rep_eva02/rep_eva02ReportRequestModel.cs b/Models/rep_eva02/rep_eva02ReportRequestModel.cs index 612a927..133238e 100644 --- a/Models/rep_eva02/rep_eva02ReportRequestModel.cs +++ b/Models/rep_eva02/rep_eva02ReportRequestModel.cs @@ -16,6 +16,8 @@ namespace TodoAPI2.Models public string filetype { get; set; } public string contentType { get { return MyHelper.GetContentType(filetype); } } + + public string print_dt { get; set; } } } diff --git a/Models/rep_eva03/rep_eva03ReportRequestModel.cs b/Models/rep_eva03/rep_eva03ReportRequestModel.cs index 15516ce..542d3dd 100644 --- a/Models/rep_eva03/rep_eva03ReportRequestModel.cs +++ b/Models/rep_eva03/rep_eva03ReportRequestModel.cs @@ -16,6 +16,8 @@ namespace TodoAPI2.Models public string filetype { get; set; } public string contentType { get { return MyHelper.GetContentType(filetype); } } + + public string print_dt { get; set; } } } diff --git a/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planReportRequestModel.cs b/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planReportRequestModel.cs index 5238fc6..05d03f2 100644 --- a/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planReportRequestModel.cs +++ b/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planReportRequestModel.cs @@ -16,6 +16,8 @@ namespace TodoAPI2.Models public string filetype { get; set; } public string contentType { get { return MyHelper.GetContentType(filetype); } } + + public string print_dt { get; set; } } } diff --git a/Models/rep_eva_self_review/rep_eva_self_reviewReportRequestModel.cs b/Models/rep_eva_self_review/rep_eva_self_reviewReportRequestModel.cs index b104b59..848e7d7 100644 --- a/Models/rep_eva_self_review/rep_eva_self_reviewReportRequestModel.cs +++ b/Models/rep_eva_self_review/rep_eva_self_reviewReportRequestModel.cs @@ -26,6 +26,8 @@ namespace TodoAPI2.Models public string x2 { get; set; } public string thedesc { get; set; } + + public string print_dt { get; set; } } } diff --git a/Models/rep_eva_self_review_all/rep_eva_self_review_allReportRequestModel.cs b/Models/rep_eva_self_review_all/rep_eva_self_review_allReportRequestModel.cs index 44829e6..54f6d93 100644 --- a/Models/rep_eva_self_review_all/rep_eva_self_review_allReportRequestModel.cs +++ b/Models/rep_eva_self_review_all/rep_eva_self_review_allReportRequestModel.cs @@ -16,6 +16,8 @@ namespace TodoAPI2.Models public string filetype { get; set; } public string contentType { get { return MyHelper.GetContentType(filetype); } } + + public string print_dt { get; set; } } } diff --git a/Models/rep_summary_a01/rep_summary_a01ReportRequestModel.cs b/Models/rep_summary_a01/rep_summary_a01ReportRequestModel.cs index bd6407e..093a0a7 100644 --- a/Models/rep_summary_a01/rep_summary_a01ReportRequestModel.cs +++ b/Models/rep_summary_a01/rep_summary_a01ReportRequestModel.cs @@ -16,6 +16,8 @@ namespace TodoAPI2.Models public string filetype { get; set; } public string contentType { get { return MyHelper.GetContentType(filetype); } } + + public string print_dt { get; set; } } } diff --git a/Models/rpt_payroll_summary/rpt_payroll_summaryReportRequestModel.cs b/Models/rpt_payroll_summary/rpt_payroll_summaryReportRequestModel.cs index 805683b..faf34c3 100644 --- a/Models/rpt_payroll_summary/rpt_payroll_summaryReportRequestModel.cs +++ b/Models/rpt_payroll_summary/rpt_payroll_summaryReportRequestModel.cs @@ -16,6 +16,8 @@ namespace TodoAPI2.Models public string filetype { get; set; } public string contentType { get { return MyHelper.GetContentType(filetype); } } + + public string print_dt { get; set; } } } diff --git a/Startup.cs b/Startup.cs index 3d0327d..13d74d8 100644 --- a/Startup.cs +++ b/Startup.cs @@ -347,6 +347,8 @@ namespace Test01 services.AddScoped(); + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -661,6 +663,10 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); + + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); }); #endregion diff --git a/Views/eva_adjust_postponement_normalView/eva_adjust_postponement_normal_d.cshtml b/Views/eva_adjust_postponement_normalView/eva_adjust_postponement_normal_d.cshtml index 491fdce..e94eead 100644 --- a/Views/eva_adjust_postponement_normalView/eva_adjust_postponement_normal_d.cshtml +++ b/Views/eva_adjust_postponement_normalView/eva_adjust_postponement_normal_d.cshtml @@ -33,7 +33,7 @@
@@ -153,7 +153,9 @@
- + + +
@@ -227,7 +229,10 @@ if (id) { eva_adjust_postponement_normal_SetEditForm(id); eva_adjust_postponement_detail_normal_02_InitialForm(id); - eva_adjust_postponement_update_status_InitialForm(); + //eva_adjust_postponement_update_status_InitialForm(); + + eva_adjust_postponement_update_status_SetEditForm(getUrlParameter('id'), false); + } else { eva_adjust_postponement_normal_SetCreateForm(); } diff --git a/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml b/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml index 7bb880e..6c2b829 100644 --- a/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml +++ b/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml @@ -5,6 +5,54 @@ Layout = "_LayoutDirect"; } + + +