จัดการหน้าค้นหารายชื่อพนักงาน
This commit is contained in:
108
ApiControllers/search_employeeControllers.cs
Normal file
108
ApiControllers/search_employeeControllers.cs
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
namespace TodoAPI2.Controllers
|
||||||
|
{
|
||||||
|
//[Authorize]
|
||||||
|
[Produces("application/json")]
|
||||||
|
[Route("api/search_employee")]
|
||||||
|
public class search_employeeController : BaseController
|
||||||
|
{
|
||||||
|
#region Private Variables
|
||||||
|
private ILogger<search_employeeController> _logger;
|
||||||
|
private Isearch_employeeService _repository;
|
||||||
|
private IConfiguration Configuration { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default constructure for dependency injection
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="repository"></param>
|
||||||
|
/// <param name="configuration"></param>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
public search_employeeController(ILogger<search_employeeController> logger, Isearch_employeeService repository, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_repository = repository;
|
||||||
|
Configuration = configuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get Blank Item
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>Return a blank item</returns>
|
||||||
|
/// <response code="200">Returns the item</response>
|
||||||
|
/// <response code="500">Error Occurred</response>
|
||||||
|
[HttpGet("GetBlankItem")]
|
||||||
|
[ProducesResponseType(typeof(search_employeeWithSelectionViewModel), 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}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get list items by search
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>Return list of items by specifced keyword</returns>
|
||||||
|
/// <response code="200">Returns the item</response>
|
||||||
|
/// <response code="500">Error Occurred</response>
|
||||||
|
[HttpGet("GetListBySearch")]
|
||||||
|
[ProducesResponseType(typeof(List<search_employeeViewModel>), 200)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
//[ValidateAntiForgeryToken]
|
||||||
|
public IActionResult GetListBySearch(search_employeeSearchModel 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}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,9 +8,9 @@ namespace TTSW.EF
|
|||||||
public class BaseViewModel2<Key> : IBaseViewModel2<Key>
|
public class BaseViewModel2<Key> : IBaseViewModel2<Key>
|
||||||
{
|
{
|
||||||
public Key id { get; set; }
|
public Key id { get; set; }
|
||||||
public DateTime Created {get; set;}
|
public DateTime? Created {get; set;}
|
||||||
|
|
||||||
public DateTime Updated {get; set;}
|
public DateTime? Updated {get; set;}
|
||||||
public bool isActive { get; set;}
|
public bool isActive { get; set;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ namespace TTSW.EF
|
|||||||
public interface IBaseViewModel2<Key>
|
public interface IBaseViewModel2<Key>
|
||||||
{
|
{
|
||||||
|
|
||||||
DateTime Created { get; set; }
|
DateTime? Created { get; set; }
|
||||||
|
|
||||||
DateTime Updated { get; set; }
|
DateTime? Updated { get; set; }
|
||||||
|
|
||||||
bool isActive { get; set; }
|
bool isActive { get; set; }
|
||||||
|
|
||||||
|
|||||||
BIN
EXCEL/external_employee@search_employee.xlsx
Normal file
BIN
EXCEL/external_employee@search_employee.xlsx
Normal file
Binary file not shown.
@@ -139,7 +139,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_adjust_postponement.created,
|
Created = m_eva_adjust_postponement.created,
|
||||||
Updated = m_eva_adjust_postponement.updated
|
Updated = m_eva_adjust_postponement.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_adjust_postponement_detail.created,
|
Created = m_eva_adjust_postponement_detail.created,
|
||||||
Updated = m_eva_adjust_postponement_detail.updated
|
Updated = m_eva_adjust_postponement_detail.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_adjust_postponement_detail_normal.created,
|
Created = m_eva_adjust_postponement_detail_normal.created,
|
||||||
Updated = m_eva_adjust_postponement_detail_normal.updated
|
Updated = m_eva_adjust_postponement_detail_normal.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_adjust_postponement_detail_normal_02.created,
|
Created = m_eva_adjust_postponement_detail_normal_02.created,
|
||||||
Updated = m_eva_adjust_postponement_detail_normal_02.updated
|
Updated = m_eva_adjust_postponement_detail_normal_02.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_adjust_postponement_detail_quota.created,
|
Created = m_eva_adjust_postponement_detail_quota.created,
|
||||||
Updated = m_eva_adjust_postponement_detail_quota.updated
|
Updated = m_eva_adjust_postponement_detail_quota.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_adjust_postponement_detail_quota_02.created,
|
Created = m_eva_adjust_postponement_detail_quota_02.created,
|
||||||
Updated = m_eva_adjust_postponement_detail_quota_02.updated
|
Updated = m_eva_adjust_postponement_detail_quota_02.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_adjust_postponement_normal.created,
|
Created = m_eva_adjust_postponement_normal.created,
|
||||||
Updated = m_eva_adjust_postponement_normal.updated
|
Updated = m_eva_adjust_postponement_normal.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_adjust_postponement_quota.created,
|
Created = m_eva_adjust_postponement_quota.created,
|
||||||
Updated = m_eva_adjust_postponement_quota.updated
|
Updated = m_eva_adjust_postponement_quota.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation.created,
|
Created = m_eva_create_evaluation.created,
|
||||||
Updated = m_eva_create_evaluation.updated
|
Updated = m_eva_create_evaluation.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation_detail.created,
|
Created = m_eva_create_evaluation_detail.created,
|
||||||
Updated = m_eva_create_evaluation_detail.updated
|
Updated = m_eva_create_evaluation_detail.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation_detail_agreement.created,
|
Created = m_eva_create_evaluation_detail_agreement.created,
|
||||||
Updated = m_eva_create_evaluation_detail_agreement.updated
|
Updated = m_eva_create_evaluation_detail_agreement.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data[0];
|
return data[0];
|
||||||
}
|
}
|
||||||
@@ -188,7 +188,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation_detail_agreement.created,
|
Created = m_eva_create_evaluation_detail_agreement.created,
|
||||||
Updated = m_eva_create_evaluation_detail_agreement.updated
|
Updated = m_eva_create_evaluation_detail_agreement.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation_detail_process.created,
|
Created = m_eva_create_evaluation_detail_process.created,
|
||||||
Updated = m_eva_create_evaluation_detail_process.updated
|
Updated = m_eva_create_evaluation_detail_process.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data[0];
|
return data[0];
|
||||||
}
|
}
|
||||||
@@ -224,7 +224,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation_detail_process.created,
|
Created = m_eva_create_evaluation_detail_process.created,
|
||||||
Updated = m_eva_create_evaluation_detail_process.updated
|
Updated = m_eva_create_evaluation_detail_process.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation_detail_review01.created,
|
Created = m_eva_create_evaluation_detail_review01.created,
|
||||||
Updated = m_eva_create_evaluation_detail_review01.updated
|
Updated = m_eva_create_evaluation_detail_review01.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation_detail_review02.created,
|
Created = m_eva_create_evaluation_detail_review02.created,
|
||||||
Updated = m_eva_create_evaluation_detail_review02.updated
|
Updated = m_eva_create_evaluation_detail_review02.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation_detail_review03.created,
|
Created = m_eva_create_evaluation_detail_review03.created,
|
||||||
Updated = m_eva_create_evaluation_detail_review03.updated
|
Updated = m_eva_create_evaluation_detail_review03.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation_detail_review04.created,
|
Created = m_eva_create_evaluation_detail_review04.created,
|
||||||
Updated = m_eva_create_evaluation_detail_review04.updated
|
Updated = m_eva_create_evaluation_detail_review04.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation_detail_status.created,
|
Created = m_eva_create_evaluation_detail_status.created,
|
||||||
Updated = m_eva_create_evaluation_detail_status.updated
|
Updated = m_eva_create_evaluation_detail_status.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation_detail_summary1.created,
|
Created = m_eva_create_evaluation_detail_summary1.created,
|
||||||
Updated = m_eva_create_evaluation_detail_summary1.updated
|
Updated = m_eva_create_evaluation_detail_summary1.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_create_evaluation_detail_summary2.created,
|
Created = m_eva_create_evaluation_detail_summary2.created,
|
||||||
Updated = m_eva_create_evaluation_detail_summary2.updated
|
Updated = m_eva_create_evaluation_detail_summary2.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_evaluation_achievement.created,
|
Created = m_eva_evaluation_achievement.created,
|
||||||
Updated = m_eva_evaluation_achievement.updated
|
Updated = m_eva_evaluation_achievement.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_evaluation_achievement_process.created,
|
Created = m_eva_evaluation_achievement_process.created,
|
||||||
Updated = m_eva_evaluation_achievement_process.updated
|
Updated = m_eva_evaluation_achievement_process.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_evaluation_achievement_process2.created,
|
Created = m_eva_evaluation_achievement_process2.created,
|
||||||
Updated = m_eva_evaluation_achievement_process2.updated
|
Updated = m_eva_evaluation_achievement_process2.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_evaluation_behavior.created,
|
Created = m_eva_evaluation_behavior.created,
|
||||||
Updated = m_eva_evaluation_behavior.updated
|
Updated = m_eva_evaluation_behavior.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_evaluation_behavior_process.created,
|
Created = m_eva_evaluation_behavior_process.created,
|
||||||
Updated = m_eva_evaluation_behavior_process.updated
|
Updated = m_eva_evaluation_behavior_process.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_evaluation_behavior_process2.created,
|
Created = m_eva_evaluation_behavior_process2.created,
|
||||||
Updated = m_eva_evaluation_behavior_process2.updated
|
Updated = m_eva_evaluation_behavior_process2.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_evaluation_group.created,
|
Created = m_eva_evaluation_group.created,
|
||||||
Updated = m_eva_evaluation_group.updated
|
Updated = m_eva_evaluation_group.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_evaluation_group.created,
|
Created = m_eva_evaluation_group.created,
|
||||||
Updated = m_eva_evaluation_group.updated
|
Updated = m_eva_evaluation_group.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_evaluation_group.created,
|
Created = m_eva_evaluation_group.created,
|
||||||
Updated = m_eva_evaluation_group.updated
|
Updated = m_eva_evaluation_group.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_evaluation_group_detail.created,
|
Created = m_eva_evaluation_group_detail.created,
|
||||||
Updated = m_eva_evaluation_group_detail.updated
|
Updated = m_eva_evaluation_group_detail.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_evaluation_group_detail.created,
|
Created = m_eva_evaluation_group_detail.created,
|
||||||
Updated = m_eva_evaluation_group_detail.updated
|
Updated = m_eva_evaluation_group_detail.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_level_score.created,
|
Created = m_eva_level_score.created,
|
||||||
Updated = m_eva_level_score.updated
|
Updated = m_eva_level_score.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_level_score.created,
|
Created = m_eva_level_score.created,
|
||||||
Updated = m_eva_level_score.updated
|
Updated = m_eva_level_score.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_level_score.created,
|
Created = m_eva_level_score.created,
|
||||||
Updated = m_eva_level_score.updated
|
Updated = m_eva_level_score.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_level_score_basic.created,
|
Created = m_eva_level_score_basic.created,
|
||||||
Updated = m_eva_level_score_basic.updated
|
Updated = m_eva_level_score_basic.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_performance_plan.created,
|
Created = m_eva_performance_plan.created,
|
||||||
Updated = m_eva_performance_plan.updated
|
Updated = m_eva_performance_plan.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_performance_plan.created,
|
Created = m_eva_performance_plan.created,
|
||||||
Updated = m_eva_performance_plan.updated
|
Updated = m_eva_performance_plan.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_performance_plan.created,
|
Created = m_eva_performance_plan.created,
|
||||||
Updated = m_eva_performance_plan.updated
|
Updated = m_eva_performance_plan.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_performance_plan_detail.created,
|
Created = m_eva_performance_plan_detail.created,
|
||||||
Updated = m_eva_performance_plan_detail.updated
|
Updated = m_eva_performance_plan_detail.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_performance_plan_detail.created,
|
Created = m_eva_performance_plan_detail.created,
|
||||||
Updated = m_eva_performance_plan_detail.updated
|
Updated = m_eva_performance_plan_detail.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_performance_plan_detail.created,
|
Created = m_eva_performance_plan_detail.created,
|
||||||
Updated = m_eva_performance_plan_detail.updated
|
Updated = m_eva_performance_plan_detail.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_promoted_percentage.created,
|
Created = m_eva_promoted_percentage.created,
|
||||||
Updated = m_eva_promoted_percentage.updated
|
Updated = m_eva_promoted_percentage.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_promoted_percentage.created,
|
Created = m_eva_promoted_percentage.created,
|
||||||
Updated = m_eva_promoted_percentage.updated
|
Updated = m_eva_promoted_percentage.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_promoted_percentage.created,
|
Created = m_eva_promoted_percentage.created,
|
||||||
Updated = m_eva_promoted_percentage.updated
|
Updated = m_eva_promoted_percentage.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_salary_cylinder.created,
|
Created = m_eva_salary_cylinder.created,
|
||||||
Updated = m_eva_salary_cylinder.updated
|
Updated = m_eva_salary_cylinder.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ namespace TodoAPI2.Models
|
|||||||
Created = m_eva_salary_cylinder.created,
|
Created = m_eva_salary_cylinder.created,
|
||||||
Updated = m_eva_salary_cylinder.updated
|
Updated = m_eva_salary_cylinder.updated
|
||||||
}
|
}
|
||||||
).Take(100).ToList();
|
).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
24
Models/search_employee/Isearch_employeeService.cs
Normal file
24
Models/search_employee/Isearch_employeeService.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
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 Isearch_employeeService
|
||||||
|
{
|
||||||
|
List<search_employeeViewModel> GetListByfullname(string fullname);
|
||||||
|
List<search_employeeViewModel> GetListBySearch(search_employeeSearchModel model);
|
||||||
|
|
||||||
|
search_employeeWithSelectionViewModel GetBlankItem();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
36
Models/search_employee/search_employeeInputModel.cs
Normal file
36
Models/search_employee/search_employeeInputModel.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using TTSW.EF;
|
||||||
|
using TTSW.Utils;
|
||||||
|
using TTSW.Constant;
|
||||||
|
using TTSW.Common;
|
||||||
|
|
||||||
|
namespace TodoAPI2.Models
|
||||||
|
{
|
||||||
|
public class search_employeeInputModel
|
||||||
|
{
|
||||||
|
|
||||||
|
public int? id { get; set; }
|
||||||
|
|
||||||
|
public Guid? eva_evaluation_group_id { get; set; }
|
||||||
|
|
||||||
|
public string employee_number { get; set; }
|
||||||
|
|
||||||
|
public string fullname { get; set; }
|
||||||
|
|
||||||
|
public string position_name { get; set; }
|
||||||
|
|
||||||
|
public string level_name { get; set; }
|
||||||
|
|
||||||
|
public int? org_id { get; set; }
|
||||||
|
|
||||||
|
public string remark { get; set; }
|
||||||
|
|
||||||
|
public string active_mode { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
21
Models/search_employee/search_employeeReportRequestModel.cs
Normal file
21
Models/search_employee/search_employeeReportRequestModel.cs
Normal file
@@ -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 search_employeeReportRequestModel : search_employeeSearchModel
|
||||||
|
{
|
||||||
|
public string filetype { get; set; }
|
||||||
|
|
||||||
|
public string contentType { get { return MyHelper.GetContentType(filetype); } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
27
Models/search_employee/search_employeeSearchModel.cs
Normal file
27
Models/search_employee/search_employeeSearchModel.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
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 search_employeeSearchModel
|
||||||
|
{
|
||||||
|
|
||||||
|
public int id { get; set; }
|
||||||
|
|
||||||
|
public Guid? eva_evaluation_group_id { get; set; }
|
||||||
|
|
||||||
|
public string fullname { get; set; }
|
||||||
|
|
||||||
|
public int? org_id { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
100
Models/search_employee/search_employeeService.cs
Normal file
100
Models/search_employee/search_employeeService.cs
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
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 search_employeeService : Isearch_employeeService
|
||||||
|
{
|
||||||
|
private IBaseRepository2<eva_create_evaluationEntity, int> _repository;
|
||||||
|
private IMyDatabase db;
|
||||||
|
private Iexternal_linkageService ext;
|
||||||
|
private Iexternal_employeeService emp;
|
||||||
|
|
||||||
|
public search_employeeService(IBaseRepository2<eva_create_evaluationEntity, int> repository,
|
||||||
|
IMyDatabase mydb,
|
||||||
|
Iexternal_linkageService inext,
|
||||||
|
Iexternal_employeeService inemp)
|
||||||
|
{
|
||||||
|
db = mydb;
|
||||||
|
ext = inext;
|
||||||
|
_repository = repository;
|
||||||
|
emp = inemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public search_employeeWithSelectionViewModel GetBlankItem()
|
||||||
|
{
|
||||||
|
var i = new search_employeeWithSelectionViewModel();
|
||||||
|
i.item_eva_evaluation_group_id = (from x in _repository.Context.eva_evaluation_group orderby x.thegroup select x).ToList();
|
||||||
|
i.item_org_id = (from x in ext.GetDepartmentData() orderby x.external_name select x).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<search_employeeViewModel> GetListByfullname(string fullname)
|
||||||
|
{
|
||||||
|
var model = new search_employeeSearchModel();
|
||||||
|
model.fullname = fullname;
|
||||||
|
return GetListBySearch(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<search_employeeViewModel> GetListBySearch(search_employeeSearchModel model)
|
||||||
|
{
|
||||||
|
var allemp = emp.GetListByemployee_type(null, null).ToList();
|
||||||
|
|
||||||
|
var data = (
|
||||||
|
from m_search_employee in allemp
|
||||||
|
|
||||||
|
join fk_eva_evaluation_group1_detail in _repository.Context.eva_evaluation_group_detail on m_search_employee.id equals fk_eva_evaluation_group1_detail.employee_id
|
||||||
|
into eva_evaluation_groupResult1_detail
|
||||||
|
from fk_eva_evaluation_groupResult1_detail in eva_evaluation_groupResult1_detail.DefaultIfEmpty()
|
||||||
|
|
||||||
|
//join fk_eva_evaluation_group1 in _repository.Context.eva_evaluation_group on fk_eva_evaluation_groupResult1_detail.evaluation_group_id equals fk_eva_evaluation_group1.id
|
||||||
|
//into eva_evaluation_groupResult1
|
||||||
|
//from fk_eva_evaluation_groupResult1 in eva_evaluation_groupResult1.DefaultIfEmpty()
|
||||||
|
|
||||||
|
where 1 == 1
|
||||||
|
&& ((fk_eva_evaluation_groupResult1_detail != null && fk_eva_evaluation_groupResult1_detail.evaluation_group_id == model.eva_evaluation_group_id) || !model.eva_evaluation_group_id.HasValue)
|
||||||
|
&& (string.IsNullOrEmpty(model.fullname) || (!string.IsNullOrEmpty(m_search_employee.fullname) && (m_search_employee.fullname.Contains(model.fullname))))
|
||||||
|
&& (m_search_employee.department_id == model.org_id || !model.org_id.HasValue)
|
||||||
|
|
||||||
|
orderby m_search_employee.fullname
|
||||||
|
select new search_employeeViewModel()
|
||||||
|
{
|
||||||
|
id = m_search_employee.id,
|
||||||
|
eva_evaluation_group_id = fk_eva_evaluation_groupResult1_detail != null ? fk_eva_evaluation_groupResult1_detail.evaluation_group_id : null,
|
||||||
|
employee_number = m_search_employee.employee_no,
|
||||||
|
fullname = m_search_employee.fullname,
|
||||||
|
position_name = m_search_employee.position_name,
|
||||||
|
level_name = m_search_employee.position_level_text,
|
||||||
|
org_id = m_search_employee.department_id,
|
||||||
|
remark = m_search_employee.user_email,
|
||||||
|
|
||||||
|
eva_evaluation_group_id_eva_evaluation_group_code = null,
|
||||||
|
org_id_external_linkage_external_name = m_search_employee.department_name,
|
||||||
|
|
||||||
|
isActive = true,
|
||||||
|
Created = null,
|
||||||
|
Updated = null
|
||||||
|
}
|
||||||
|
).ToList();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
35
Models/search_employee/search_employeeViewModel.cs
Normal file
35
Models/search_employee/search_employeeViewModel.cs
Normal file
@@ -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 search_employeeViewModel : BaseViewModel2<int>
|
||||||
|
{
|
||||||
|
|
||||||
|
public Guid? eva_evaluation_group_id { get; set; }
|
||||||
|
|
||||||
|
public string employee_number { get; set; }
|
||||||
|
|
||||||
|
public string fullname { get; set; }
|
||||||
|
|
||||||
|
public string position_name { get; set; }
|
||||||
|
|
||||||
|
public string level_name { get; set; }
|
||||||
|
|
||||||
|
public int? org_id { get; set; }
|
||||||
|
|
||||||
|
public string remark { get; set; }
|
||||||
|
|
||||||
|
public string eva_evaluation_group_id_eva_evaluation_group_code { get; set; }
|
||||||
|
public string org_id_external_linkage_external_name { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace TodoAPI2.Models
|
||||||
|
{
|
||||||
|
public class search_employeeWithSelectionViewModel: search_employeeViewModel
|
||||||
|
{
|
||||||
|
public List<eva_evaluation_groupEntity> item_eva_evaluation_group_id { get; set; }
|
||||||
|
public List<external_linkageViewModel> item_org_id { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -282,6 +282,8 @@ namespace Test01
|
|||||||
|
|
||||||
services.AddScoped<Ieva_level_score_basicService, eva_level_score_basicService>();
|
services.AddScoped<Ieva_level_score_basicService, eva_level_score_basicService>();
|
||||||
|
|
||||||
|
services.AddScoped<Isearch_employeeService, search_employeeService>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||||
@@ -485,6 +487,10 @@ namespace Test01
|
|||||||
cfg.CreateMap<eva_level_scoreEntity, eva_level_score_basicViewModel>();
|
cfg.CreateMap<eva_level_scoreEntity, eva_level_score_basicViewModel>();
|
||||||
cfg.CreateMap<eva_level_scoreEntity, eva_level_score_basicWithSelectionViewModel>();
|
cfg.CreateMap<eva_level_scoreEntity, eva_level_score_basicWithSelectionViewModel>();
|
||||||
|
|
||||||
|
//cfg.CreateMap<search_employeeInputModel, external_employeeEntity>();
|
||||||
|
//cfg.CreateMap<external_employeeEntity, search_employeeViewModel>();
|
||||||
|
//cfg.CreateMap<external_employeeEntity, search_employeeWithSelectionViewModel>();
|
||||||
|
|
||||||
});
|
});
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
66
ViewControllers/search_employeeViewControllers.cs
Normal file
66
ViewControllers/search_employeeViewControllers.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using TodoAPI2.Models;
|
||||||
|
using STAFF_API.Models;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using TodoAPI2.Controllers;
|
||||||
|
|
||||||
|
namespace TodoAPI2.Controllers
|
||||||
|
{
|
||||||
|
public class search_employeeViewController : Controller
|
||||||
|
{
|
||||||
|
private ILogger<search_employeeController> _logger;
|
||||||
|
private Isearch_employeeService _repository;
|
||||||
|
private IConfiguration Configuration { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default constructure for dependency injection
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="repository"></param>
|
||||||
|
/// <param name="configuration"></param>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
public search_employeeViewController(ILogger<search_employeeController> logger, Isearch_employeeService repository, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_repository = repository;
|
||||||
|
Configuration = configuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult search_employee()
|
||||||
|
{
|
||||||
|
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult search_employee_d()
|
||||||
|
{
|
||||||
|
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
//public IActionResult search_employee_report()
|
||||||
|
//{
|
||||||
|
// if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
|
||||||
|
// return View();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//public IActionResult search_employee_inline()
|
||||||
|
//{
|
||||||
|
// if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
|
||||||
|
// return View();
|
||||||
|
//}
|
||||||
|
|
||||||
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
|
public IActionResult Error()
|
||||||
|
{
|
||||||
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
82
Views/search_employeeView/search_employee.cshtml
Normal file
82
Views/search_employeeView/search_employee.cshtml
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
@using Microsoft.Extensions.Configuration
|
||||||
|
@inject IConfiguration Configuration
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "search_employee";
|
||||||
|
Layout = "_LayoutDirect";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row page-title">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="page-title">
|
||||||
|
@Configuration["SiteInformation:modulename"]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-7">
|
||||||
|
<ol class="breadcrumb" style="">
|
||||||
|
<li class="breadcrumb-item "><a href="@Configuration["SiteInformation:mainsite"]">หน้าแรก</a></li>
|
||||||
|
<li class="breadcrumb-item "><a href="@Configuration["SiteInformation:mainsite"]@Configuration["SiteInformation:appsite"]">@Configuration["SiteInformation:modulename"]</a></li>
|
||||||
|
<li class="breadcrumb-item active">ค้นหารายชื่อ บุคคลากร</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<section class="wrapper">
|
||||||
|
<div class="title"><div class="line"></div>ค้นหารายชื่อ บุคคลากร</div>
|
||||||
|
<div class="tools">
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label id='lab_s_search_employee_eva_evaluation_group_id' for='s_search_employee_eva_evaluation_group_id'>กลุ่มการประเมิน</label>
|
||||||
|
<select class="form-control" id="s_search_employee_eva_evaluation_group_id" iLabel="กลุ่มการประเมิน" iRequire="true" iGroup="s_search_employee" title='กลุ่มการประเมิน' placeholder='กลุ่มการประเมิน'></select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label id='lab_s_search_employee_org_id' for='s_search_employee_org_id'>หน่วยงาน</label>
|
||||||
|
<select class="form-control" id="s_search_employee_org_id" iLabel="หน่วยงาน" iRequire="true" iGroup="s_search_employee" title='หน่วยงาน' placeholder='หน่วยงาน'></select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label id='lab_s_search_employee_fullname' for='s_search_employee_fullname'>ชื่อ-สกุล</label>
|
||||||
|
<input class="form-control" type="text" id="s_search_employee_fullname" iLabel="ชื่อ-สกุล" iRequire="true" iGroup="s_search_employee" title='ชื่อ-สกุล' placeholder='ชื่อ-สกุล' />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3">
|
||||||
|
<button class="btn btn-info" onclick="javascript:search_employee_DoSearch();">ค้นหา</button>
|
||||||
|
<button class="btn btn-info" onclick="javascript:search_employee_GetSelect('id');">ดึงตัวเลือก</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<button class="btn btn-info" onclick="javascript:search_employee_SelectAll();">เลือก ทั้งหมด</button>
|
||||||
|
<button class="btn btn-info" onclick="javascript:search_employee_DeselectAll();">ไม่เลือก ทั้งหมด</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table id="search_employeeTable" class="display table table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th><label id='h_search_employee_employee_number'>รหัสพนักงาน</label></th>
|
||||||
|
<th><label id='h_search_employee_fullname'>ชื่อ-สกุล</label></th>
|
||||||
|
<th><label id='h_search_employee_position_name'>ตำแหน่ง</label></th>
|
||||||
|
<th><label id='h_search_employee_level_name'>ระดับ</label></th>
|
||||||
|
<th><label id='h_search_employee_org_id'>หน่วยงาน</label></th>
|
||||||
|
<th><label id='h_search_employee_remark'>หมายเหตุ</label></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
@section FooterPlaceHolder{
|
||||||
|
<script src="~/js/search_employee/search_employee.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
search_employee_InitiateDataTable();
|
||||||
|
search_employee_InitialForm();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
}
|
||||||
|
|
||||||
36
tb320eva.xml
36
tb320eva.xml
@@ -3589,6 +3589,34 @@
|
|||||||
<response code="200">Returns the item</response>
|
<response code="200">Returns the item</response>
|
||||||
<response code="500">Error Occurred</response>
|
<response code="500">Error Occurred</response>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:TodoAPI2.Controllers.search_employeeController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.search_employeeController},TodoAPI2.Models.Isearch_employeeService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||||
|
<summary>
|
||||||
|
Default constructure for dependency injection
|
||||||
|
</summary>
|
||||||
|
<param name="repository"></param>
|
||||||
|
<param name="configuration"></param>
|
||||||
|
<param name="logger"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:TodoAPI2.Controllers.search_employeeController.GetBlankItem">
|
||||||
|
<summary>
|
||||||
|
Get Blank Item
|
||||||
|
</summary>
|
||||||
|
<remarks>
|
||||||
|
</remarks>
|
||||||
|
<returns>Return a blank item</returns>
|
||||||
|
<response code="200">Returns the item</response>
|
||||||
|
<response code="500">Error Occurred</response>
|
||||||
|
</member>
|
||||||
|
<member name="M:TodoAPI2.Controllers.search_employeeController.GetListBySearch(TodoAPI2.Models.search_employeeSearchModel)">
|
||||||
|
<summary>
|
||||||
|
Get list items by search
|
||||||
|
</summary>
|
||||||
|
<remarks>
|
||||||
|
</remarks>
|
||||||
|
<returns>Return list of items by specifced keyword</returns>
|
||||||
|
<response code="200">Returns the item</response>
|
||||||
|
<response code="500">Error Occurred</response>
|
||||||
|
</member>
|
||||||
<member name="M:TodoAPI2.Controllers.eva_adjust_postponement_normalViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_adjust_postponement_normalController},TodoAPI2.Models.Ieva_adjust_postponement_normalService,Microsoft.Extensions.Configuration.IConfiguration,TodoAPI2.Models.Iexternal_employeeService)">
|
<member name="M:TodoAPI2.Controllers.eva_adjust_postponement_normalViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_adjust_postponement_normalController},TodoAPI2.Models.Ieva_adjust_postponement_normalService,Microsoft.Extensions.Configuration.IConfiguration,TodoAPI2.Models.Iexternal_employeeService)">
|
||||||
<summary>
|
<summary>
|
||||||
Default constructure for dependency injection
|
Default constructure for dependency injection
|
||||||
@@ -3837,6 +3865,14 @@
|
|||||||
<param name="logger"></param>
|
<param name="logger"></param>
|
||||||
<param name="inemp"></param>
|
<param name="inemp"></param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:TodoAPI2.Controllers.search_employeeViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.search_employeeController},TodoAPI2.Models.Isearch_employeeService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||||
|
<summary>
|
||||||
|
Default constructure for dependency injection
|
||||||
|
</summary>
|
||||||
|
<param name="repository"></param>
|
||||||
|
<param name="configuration"></param>
|
||||||
|
<param name="logger"></param>
|
||||||
|
</member>
|
||||||
<member name="M:TTSW.Controllers.BaseController.#ctor">
|
<member name="M:TTSW.Controllers.BaseController.#ctor">
|
||||||
<summary>
|
<summary>
|
||||||
Default constructure for dependency injection
|
Default constructure for dependency injection
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ function eva_create_evaluation_detail_InitialForm(s) {
|
|||||||
//================= Form Mode Setup and Flow =========================================
|
//================= Form Mode Setup and Flow =========================================
|
||||||
|
|
||||||
function eva_create_evaluation_detail_GoCreate() {
|
function eva_create_evaluation_detail_GoCreate() {
|
||||||
window_open(appsite + "/external_employeeview/external_employee");
|
window_open(appsite + "/search_employeeview/search_employee");
|
||||||
|
|
||||||
// Incase model popup
|
// Incase model popup
|
||||||
//eva_create_evaluation_detail_SetCreateForm(true);
|
//eva_create_evaluation_detail_SetCreateForm(true);
|
||||||
|
|||||||
240
wwwroot/js/search_employee/search_employee.js
Normal file
240
wwwroot/js/search_employee/search_employee.js
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
var search_employee_editMode = "CREATE";
|
||||||
|
var search_employee_API = "/api/search_employee/";
|
||||||
|
|
||||||
|
//================= Search Customizaiton =========================================
|
||||||
|
|
||||||
|
function search_employee_GetSearchParameter() {
|
||||||
|
var search_employeeSearchObject = new Object();
|
||||||
|
search_employeeSearchObject.eva_evaluation_group_id = $("#s_search_employee_eva_evaluation_group_id").val();
|
||||||
|
search_employeeSearchObject.fullname = $("#s_search_employee_fullname").val();
|
||||||
|
search_employeeSearchObject.org_id = $("#s_search_employee_org_id").val();
|
||||||
|
|
||||||
|
return search_employeeSearchObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
function search_employee_FeedDataToSearchForm(data) {
|
||||||
|
DropDownClearFormAndFeedWithData($("#s_search_employee_eva_evaluation_group_id"), data, "id", "thegroup", "item_eva_evaluation_group_id", data.eva_evaluation_group_id);
|
||||||
|
$("#s_search_employee_fullname").val(data.fullname);
|
||||||
|
DropDownClearFormAndFeedWithData($("#s_search_employee_org_id"), data, "id", "external_name", "item_org_id", data.org_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//================= Form Data Customizaiton =========================================
|
||||||
|
|
||||||
|
function search_employee_FeedDataToForm(data) {
|
||||||
|
$("#search_employee_id").val(data.id);
|
||||||
|
DropDownClearFormAndFeedWithData($("#search_employee_eva_evaluation_group_id"), data, "id", "thegroup", "item_eva_evaluation_group_id", data.eva_evaluation_group_id);
|
||||||
|
$("#search_employee_employee_number").val(data.employee_number);
|
||||||
|
$("#search_employee_fullname").val(data.fullname);
|
||||||
|
$("#search_employee_position_name").val(data.position_name);
|
||||||
|
$("#search_employee_level_name").val(data.level_name);
|
||||||
|
DropDownClearFormAndFeedWithData($("#search_employee_org_id"), data, "id", "external_name", "item_org_id", data.org_id);
|
||||||
|
$("#search_employee_remark").val(data.remark);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function search_employee_GetFromForm() {
|
||||||
|
var search_employeeObject = new Object();
|
||||||
|
search_employeeObject.id = $("#search_employee_id").val();
|
||||||
|
search_employeeObject.eva_evaluation_group_id = $("#search_employee_eva_evaluation_group_id").val();
|
||||||
|
search_employeeObject.employee_number = $("#search_employee_employee_number").val();
|
||||||
|
search_employeeObject.fullname = $("#search_employee_fullname").val();
|
||||||
|
search_employeeObject.position_name = $("#search_employee_position_name").val();
|
||||||
|
search_employeeObject.level_name = $("#search_employee_level_name").val();
|
||||||
|
search_employeeObject.org_id = $("#search_employee_org_id").val();
|
||||||
|
search_employeeObject.remark = $("#search_employee_remark").val();
|
||||||
|
|
||||||
|
|
||||||
|
return search_employeeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
function search_employee_InitialForm(s) {
|
||||||
|
var successFunc = function (result) {
|
||||||
|
search_employee_FeedDataToForm(result);
|
||||||
|
search_employee_FeedDataToSearchForm(result);
|
||||||
|
if (s) {
|
||||||
|
// Incase model popup
|
||||||
|
$("#search_employeeModel").modal("show");
|
||||||
|
}
|
||||||
|
endLoad();
|
||||||
|
};
|
||||||
|
startLoad();
|
||||||
|
AjaxGetRequest(apisite + search_employee_API + "GetBlankItem", successFunc, AlertDanger);
|
||||||
|
}
|
||||||
|
|
||||||
|
//================= Form Mode Setup and Flow =========================================
|
||||||
|
|
||||||
|
function search_employee_GoCreate() {
|
||||||
|
// Incase model popup
|
||||||
|
search_employee_SetCreateForm(true);
|
||||||
|
|
||||||
|
// Incase open new page
|
||||||
|
//window_open(appsite + "/search_employeeView/search_employee_d");
|
||||||
|
}
|
||||||
|
|
||||||
|
function search_employee_GoEdit(a) {
|
||||||
|
// Incase model popup
|
||||||
|
search_employee_SetEditForm(a);
|
||||||
|
|
||||||
|
// Incase open new page
|
||||||
|
//window_open(appsite + "/search_employeeView/search_employee_d?id=" + a);
|
||||||
|
}
|
||||||
|
|
||||||
|
function search_employee_SetEditForm(a) {
|
||||||
|
var successFunc = function (result) {
|
||||||
|
search_employee_editMode = "UPDATE";
|
||||||
|
search_employee_FeedDataToForm(result);
|
||||||
|
$("#search_employeeModel").modal("show");
|
||||||
|
endLoad();
|
||||||
|
};
|
||||||
|
startLoad();
|
||||||
|
AjaxGetRequest(apisite + search_employee_API + a, successFunc, AlertDanger);
|
||||||
|
}
|
||||||
|
|
||||||
|
function search_employee_SetCreateForm(s) {
|
||||||
|
search_employee_editMode = "CREATE";
|
||||||
|
search_employee_InitialForm(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
function search_employee_RefreshTable() {
|
||||||
|
// Incase model popup
|
||||||
|
search_employee_DoSearch();
|
||||||
|
|
||||||
|
// Incase open new page
|
||||||
|
//window.parent.search_employee_DoSearch();
|
||||||
|
}
|
||||||
|
|
||||||
|
//================= Update and Delete =========================================
|
||||||
|
|
||||||
|
var search_employee_customValidation = function (group) {
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
function search_employee_PutUpdate() {
|
||||||
|
if (!ValidateForm('search_employee', search_employee_customValidation))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = search_employee_GetFromForm();
|
||||||
|
|
||||||
|
//Update Mode
|
||||||
|
if (search_employee_editMode === "UPDATE") {
|
||||||
|
var successFunc1 = function (result) {
|
||||||
|
$("#search_employeeModel").modal("hide");
|
||||||
|
AlertSuccess(result.code+" "+result.message);
|
||||||
|
search_employee_RefreshTable();
|
||||||
|
endLoad();
|
||||||
|
};
|
||||||
|
startLoad();
|
||||||
|
AjaxPutRequest(apisite + search_employee_API + data.id, data, successFunc1, AlertDanger);
|
||||||
|
}
|
||||||
|
// Create mode
|
||||||
|
else {
|
||||||
|
var successFunc2 = function (result) {
|
||||||
|
$("#search_employeeModel").modal("hide");
|
||||||
|
AlertSuccess(result.code+" "+result.message);
|
||||||
|
search_employee_RefreshTable();
|
||||||
|
endLoad();
|
||||||
|
};
|
||||||
|
startLoad();
|
||||||
|
AjaxPostRequest(apisite + search_employee_API, data, successFunc2, AlertDanger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function search_employee_GoDelete(a) {
|
||||||
|
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
|
||||||
|
var successFunc = function (result) {
|
||||||
|
$("#search_employeeModel").modal("hide");
|
||||||
|
AlertSuccess(result.code+" "+result.message);
|
||||||
|
search_employee_RefreshTable();
|
||||||
|
endLoad();
|
||||||
|
};
|
||||||
|
startLoad();
|
||||||
|
AjaxDeleteRequest(apisite + search_employee_API + a, null, successFunc, AlertDanger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//================= Data Table =========================================
|
||||||
|
|
||||||
|
var search_employeeTableV;
|
||||||
|
|
||||||
|
var search_employee_setupTable = function (result) {
|
||||||
|
tmp = '"';
|
||||||
|
search_employeeTableV = $('#search_employeeTable').DataTable({
|
||||||
|
"processing": true,
|
||||||
|
"serverSide": false,
|
||||||
|
"data": result,
|
||||||
|
"select": {
|
||||||
|
"style": 'multi'
|
||||||
|
},
|
||||||
|
"columns": [
|
||||||
|
{ "data": "" },
|
||||||
|
{ "data": "employee_number" },
|
||||||
|
{ "data": "fullname" },
|
||||||
|
{ "data": "position_name" },
|
||||||
|
{ "data": "level_name" },
|
||||||
|
{ "data": "org_id_external_linkage_external_name" },
|
||||||
|
{ "data": "remark" },
|
||||||
|
],
|
||||||
|
"columnDefs": [
|
||||||
|
{
|
||||||
|
targets: 0,
|
||||||
|
data: "",
|
||||||
|
defaultContent: '',
|
||||||
|
orderable: false,
|
||||||
|
className: 'select-checkbox'
|
||||||
|
}],
|
||||||
|
"language": {
|
||||||
|
"url": appsite + "/DataTables-1.10.16/thai.json"
|
||||||
|
},
|
||||||
|
"paging": true,
|
||||||
|
"searching": false
|
||||||
|
});
|
||||||
|
|
||||||
|
endLoad();
|
||||||
|
};
|
||||||
|
|
||||||
|
function search_employee_SelectAll(){
|
||||||
|
search_employeeTableV.rows().select();
|
||||||
|
}
|
||||||
|
|
||||||
|
function search_employee_DeselectAll(){
|
||||||
|
search_employeeTableV.rows().deselect();
|
||||||
|
}
|
||||||
|
|
||||||
|
function search_employee_InitiateDataTable() {
|
||||||
|
startLoad();
|
||||||
|
var p = $.param(search_employee_GetSearchParameter());
|
||||||
|
AjaxGetRequest(apisite + "/api/search_employee/GetListBySearch?"+p, search_employee_setupTable, AlertDanger);
|
||||||
|
}
|
||||||
|
|
||||||
|
function search_employee_DoSearch() {
|
||||||
|
var p = $.param(search_employee_GetSearchParameter());
|
||||||
|
var search_employee_reload = function (result) {
|
||||||
|
search_employeeTableV.destroy();
|
||||||
|
search_employee_setupTable(result);
|
||||||
|
endLoad();
|
||||||
|
};
|
||||||
|
startLoad();
|
||||||
|
AjaxGetRequest(apisite + "/api/search_employee/GetListBySearch?"+p, search_employee_reload, AlertDanger);
|
||||||
|
}
|
||||||
|
|
||||||
|
function search_employee_GetSelect(f) {
|
||||||
|
var search_employee_selectitem = [];
|
||||||
|
$.each(search_employeeTableV.rows('.selected').data(), function (key, value) {
|
||||||
|
search_employee_selectitem.push(value[f]);
|
||||||
|
});
|
||||||
|
//alert(search_employee_selectitem);
|
||||||
|
window_close();
|
||||||
|
window.parent.AddMultiple(search_employee_selectitem);
|
||||||
|
}
|
||||||
|
|
||||||
|
//================= File Upload =========================================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//================= Multi-Selection Function =========================================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user