Add level score detail

This commit is contained in:
nakorn
2021-10-19 20:41:43 +07:00
parent 8a02127499
commit 3b8d643eca
17 changed files with 1462 additions and 15 deletions

View File

@@ -0,0 +1,403 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using TTSW.Controllers;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Net;
namespace TodoAPI2.Controllers
{
//[Authorize]
[Produces("application/json")]
[Route("api/eva_level_score_detail")]
public class eva_level_score_detailController : BaseController
{
#region Private Variables
private ILogger<eva_level_score_detailController> _logger;
private Ieva_level_score_detailService _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 eva_level_score_detailController(ILogger<eva_level_score_detailController> logger, Ieva_level_score_detailService repository, IConfiguration configuration)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
}
/// <summary>
/// Get specific item by id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return Get specific item by id</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("{id}")]
[ProducesResponseType(typeof(eva_level_score_detailWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Get(Guid 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}");
}
}
/// <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(eva_level_score_detailWithSelectionViewModel), 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 level_score_id
/// </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("")]
[ProducesResponseType(typeof(List<eva_level_score_detailViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetList(Guid level_score_id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListBylevel_score_id(level_score_id));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetList.", 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<eva_level_score_detailViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetListBySearch(eva_level_score_detailSearchModel 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}");
}
}
/// <summary>
/// Download Report
/// </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("eva_level_score_detail_report")]
[ProducesResponseType(typeof(FileStreamResult), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult eva_level_score_detail_report(eva_level_score_detailReportRequestModel model)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
string url = $"{mainurl}{reportsite}/xxใส่ชื่อรายงานตรงนี้xx.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
if (model.filetype == "xlsx")
{
url += "&ignorePagination=true";
}
var data = httpclient.DownloadData(url);
var stream = new MemoryStream(data);
return File(stream, model.contentType);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while GetReport.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Create new item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPost("")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Insert([FromBody] eva_level_score_detailInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Insert(model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"เพิ่มข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while insert.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Update item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Update(Guid id, [FromBody] eva_level_score_detailInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Update(id, model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"แก้ไขข้อมูล เรียบร้อย";
message.data = result;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while update {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Delete item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpDelete("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Delete(Guid id)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.Delete(id);
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ลบข้อมูล เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while delete {id.ToString()}.", ex);
return StatusCode(500, $"{id.ToString()}. {ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Update multiple item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("UpdateMultiple")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult UpdateMultiple([FromBody] List<eva_level_score_detailInputModel> model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
string rowCount = _repository.UpdateMultiple(model, true);
var message = new CommonResponseMessage();
message.code = "200";
message.message = "ปรับปรุงข้อมูลเรียบร้อย จำนวน "+rowCount+" รายการ";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while UpdateMultiple.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
return BadRequest(ModelState);
}
/// <summary>
/// Refresh AutoField of all items
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("RefreshAutoField")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult RefreshAutoField()
{
if (ModelState.IsValid)
{
try
{
//if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
_repository.RefreshAutoFieldOfAllData();
var message = new CommonResponseMessage();
message.code = "200";
message.message = $"ปรับปรุง Auto Field ของทุก record เรียบร้อย";
message.data = null;
return Ok(message);
}
catch (Exception ex)
{
_logger.LogCritical($"Exception while RefreshAutoField.", ex);
return StatusCode(500, $"มีปัญหาระหว่างการปรับปรุง Auto Field. {ex.Message}");
}
}
return BadRequest(ModelState);
}
}
}

View File

@@ -46,7 +46,7 @@ namespace TTSW.EF {
public DbSet<eva_evaluation_achievement_attachEntity> eva_evaluation_achievement_attach { get; set; }
public DbSet<activity_log_evaEntity> activity_log_eva { get; set; }
public DbSet<eva_setup_permissionEntity> eva_setup_permission { get; set; }
public DbSet<eva_level_score_detailEntity> eva_level_score_detail { get; set; }
protected override void OnModelCreating (ModelBuilder modelBuilder) {
base.OnModelCreating (modelBuilder);

Binary file not shown.

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
namespace TodoAPI2.Models
{
public interface Ieva_level_score_detailService : IBaseService2<Guid, eva_level_score_detailInputModel, eva_level_score_detailViewModel>
{
new eva_level_score_detailViewModel Insert(eva_level_score_detailInputModel model, bool is_force_save);
new eva_level_score_detailViewModel Update(Guid id, eva_level_score_detailInputModel model, bool is_force_save);
List<eva_level_score_detailViewModel> GetListBylevel_score_id(Guid level_score_id);
List<eva_level_score_detailViewModel> GetListBySearch(eva_level_score_detailSearchModel model);
string UpdateMultiple(List<eva_level_score_detailInputModel> model, bool is_force_save);
eva_level_score_detailWithSelectionViewModel GetWithSelection(Guid id);
eva_level_score_detailWithSelectionViewModel GetBlankItem();
void RefreshAutoFieldOfAllData();
eva_level_score_detailEntity GetEntity(Guid id);
DataContext GetContext();
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using System.IO;
namespace TodoAPI2.Models
{
public class eva_level_score_detailEntity : BaseEntity2<Guid>
{
[ForeignKey("level_score_id")]
public eva_level_scoreEntity eva_level_score_level_score_id { get; set; }
public Guid level_score_id { get; set; }
public decimal? min_value { get; set; }
public decimal? max_value { get; set; }
public decimal? min_percentage { get; set; }
public decimal? max_percentage { get; set; }
public void SetAutoField(DataContext context)
{
}
public void DoAfterInsertUpdate(DataContext context)
{
}
}
}

View File

@@ -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_level_score_detailInputModel
{
public Guid? id { get; set; }
public Guid level_score_id { get; set; }
public decimal? min_value { get; set; }
public decimal? max_value { get; set; }
public decimal? min_percentage { get; set; }
public decimal? max_percentage { get; set; }
public string active_mode { get; set; }
}
}

View 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 eva_level_score_detailReportRequestModel : eva_level_score_detailSearchModel
{
public string filetype { get; set; }
public string contentType { get { return MyHelper.GetContentType(filetype); } }
}
}

View File

@@ -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_level_score_detailSearchModel
{
public Guid id { get; set; }
public Guid level_score_id { get; set; }
}
}

View File

@@ -0,0 +1,288 @@
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_level_score_detailService : Ieva_level_score_detailService
{
private IBaseRepository2<eva_level_score_detailEntity, Guid> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
public eva_level_score_detailService(IBaseRepository2<eva_level_score_detailEntity, Guid> repository, IMyDatabase mydb, Iexternal_linkageService inext)
{
_repository = repository;
db = mydb;
ext = inext;
}
#region Private Functions
private eva_level_score_detailEntity GetEntity(eva_level_score_detailInputModel model)
{
return Mapper.Map<eva_level_score_detailEntity>(model);
}
private List<eva_level_score_detailEntity> GetEntityList(List<eva_level_score_detailInputModel> models)
{
return Mapper.Map<List<eva_level_score_detailEntity>>(models);
}
private eva_level_score_detailViewModel GetDto(eva_level_score_detailEntity entity)
{
return Mapper.Map<eva_level_score_detailViewModel>(entity);
}
private List<eva_level_score_detailViewModel> GetDtoList(List<eva_level_score_detailEntity> entities)
{
return Mapper.Map<List<eva_level_score_detailViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public eva_level_score_detailViewModel Get(Guid id)
{
var entity = _repository.Get(id);
return GetDto(entity);
}
public eva_level_score_detailEntity GetEntity(Guid id)
{
var entity = _repository.Get(id);
return entity;
}
public DataContext GetContext()
{
return _repository.Context;
}
public eva_level_score_detailWithSelectionViewModel GetWithSelection(Guid id)
{
var entity = _repository.Get(id);
var i = Mapper.Map<eva_level_score_detailWithSelectionViewModel>(entity);
return i;
}
public eva_level_score_detailWithSelectionViewModel GetBlankItem()
{
var i = new eva_level_score_detailWithSelectionViewModel();
return i;
}
public List<eva_level_score_detailViewModel> GetListBylevel_score_id(Guid level_score_id)
{
var model = new eva_level_score_detailSearchModel();
model.level_score_id = level_score_id;
return GetListBySearch(model);
}
public List<eva_level_score_detailViewModel> GetListBySearch(eva_level_score_detailSearchModel model)
{
var data = (
from m_eva_level_score_detail in _repository.Context.eva_level_score_detail
join fk_eva_level_score1 in _repository.Context.eva_level_score on m_eva_level_score_detail.level_score_id equals fk_eva_level_score1.id
into eva_level_scoreResult1
from fk_eva_level_scoreResult1 in eva_level_scoreResult1.DefaultIfEmpty()
where
1 == 1
&& (m_eva_level_score_detail.level_score_id == model.level_score_id)
orderby m_eva_level_score_detail.created descending
select new eva_level_score_detailViewModel()
{
id = m_eva_level_score_detail.id,
level_score_id = m_eva_level_score_detail.level_score_id,
min_value = m_eva_level_score_detail.min_value,
max_value = m_eva_level_score_detail.max_value,
min_percentage = m_eva_level_score_detail.min_percentage,
max_percentage = m_eva_level_score_detail.max_percentage,
level_score_id_eva_level_score_code = fk_eva_level_scoreResult1.code,
isActive = m_eva_level_score_detail.isActive,
Created = m_eva_level_score_detail.created,
Updated = m_eva_level_score_detail.updated
}
).Take(1000).ToList();
return data;
}
#endregion
#region Manipulation Functions
public eva_level_score_detailViewModel Insert(eva_level_score_detailInputModel model, bool is_force_save)
{
var entity = GetEntity(model);
entity.id = Guid.NewGuid();
entity.SetAutoField(_repository.Context);
if (is_force_save)
{
var inserted = _repository.Insert(entity);
entity.DoAfterInsertUpdate(_repository.Context);
return Get(inserted.id);
}
else
{
_repository.InsertWithoutCommit(entity);
entity.DoAfterInsertUpdate(_repository.Context);
return Mapper.Map<eva_level_score_detailViewModel>(entity);
}
}
public eva_level_score_detailViewModel Update(Guid id, eva_level_score_detailInputModel model, bool is_force_save)
{
var existingEntity = _repository.Get(id);
if (existingEntity != null)
{
existingEntity.level_score_id = model.level_score_id;
existingEntity.min_value = model.min_value;
existingEntity.max_value = model.max_value;
existingEntity.min_percentage = model.min_percentage;
existingEntity.max_percentage = model.max_percentage;
existingEntity.SetAutoField(_repository.Context);
if (is_force_save)
{
var updated = _repository.Update(id, existingEntity);
existingEntity.DoAfterInsertUpdate(_repository.Context);
return Get(updated.id);
}
else
{
_repository.UpdateWithoutCommit(id, existingEntity);
existingEntity.DoAfterInsertUpdate(_repository.Context);
return Mapper.Map<eva_level_score_detailViewModel>(existingEntity);
}
}
else
throw new NotificationException("No data to update");
}
public string UpdateMultiple(List<eva_level_score_detailInputModel> model, bool is_force_save)
{
foreach(var i in model)
{
if (i.active_mode == "1" && i.id.HasValue) // update
{
var existingEntity = _repository.Get(i.id.Value);
if (existingEntity != null)
{
existingEntity.level_score_id = i.level_score_id;
existingEntity.min_value = i.min_value;
existingEntity.max_value = i.max_value;
existingEntity.min_percentage = i.min_percentage;
existingEntity.max_percentage = i.max_percentage;
existingEntity.SetAutoField(_repository.Context);
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}
}
else if (i.active_mode == "1" && !i.id.HasValue) // add
{
var entity = GetEntity(i);
entity.id = Guid.NewGuid();
entity.SetAutoField(_repository.Context);
_repository.InsertWithoutCommit(entity);
}
else if (i.active_mode == "0" && i.id.HasValue) // remove
{
_repository.DeleteWithoutCommit(i.id.Value);
}
else if (i.active_mode == "0" && !i.id.HasValue)
{
// nothing to do
}
}
if (is_force_save)
{
_repository.Context.SaveChanges();
}
return model.Count().ToString();
}
public eva_level_score_detailViewModel SetAsActive(Guid id)
{
var updated = _repository.SetAsActive(id);
return Get(updated.id);
}
public eva_level_score_detailViewModel SetAsInactive(Guid id)
{
var updated = _repository.SetAsInActive(id);
return Get(updated.id);
}
public void Delete(Guid id)
{
_repository.Delete(id);
return;
}
public void RefreshAutoFieldOfAllData()
{
var all_items = from i in _repository.Context.eva_level_score_detail
select i;
foreach (var item in all_items)
{
item.SetAutoField(_repository.Context);
}
_repository.Context.SaveChanges();
}
private Dictionary<string,string> GetLookupForLog()
{
var i = new Dictionary<string, string>();
i.Add("level_score_id", "level_score_id");
i.Add("level_score_id_eva_level_score_code", "level_score_id");
i.Add("min_value", "ช่วงคะแนนต่ำสุด");
i.Add("max_value", "ช่วงคะแนนสูงสุด");
i.Add("min_percentage", "ร้อยละที่ได้เลื่อนต่ำสุด");
i.Add("max_percentage", "ร้อยละที่ได้เลื่อนสูงสุด");
return i;
}
#endregion
#region Match Item
#endregion
#endregion
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class eva_level_score_detailViewModel : BaseViewModel2<Guid>
{
public Guid level_score_id { get; set; }
public decimal? min_value { get; set; }
public decimal? max_value { get; set; }
public decimal? min_percentage { get; set; }
public decimal? max_percentage { get; set; }
public string level_score_id_eva_level_score_code { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TodoAPI2.Models
{
public class eva_level_score_detailWithSelectionViewModel: eva_level_score_detailViewModel
{
}
}

View File

@@ -340,6 +340,9 @@ namespace Test01
services.AddScoped<IBaseRepository2<eva_setup_permissionEntity, Guid>, BaseRepository2<eva_setup_permissionEntity, Guid>>();
services.AddScoped<Ieva_setup_permissionService, eva_setup_permissionService>();
services.AddScoped<IBaseRepository2<eva_level_score_detailEntity, Guid>, BaseRepository2<eva_level_score_detailEntity, Guid>>();
services.AddScoped<Ieva_level_score_detailService, eva_level_score_detailService>();
#endregion
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
@@ -643,6 +646,9 @@ namespace Test01
cfg.CreateMap<eva_setup_permissionEntity, eva_setup_permissionViewModel>();
cfg.CreateMap<eva_setup_permissionEntity, eva_setup_permissionWithSelectionViewModel>();
cfg.CreateMap<eva_level_score_detailInputModel, eva_level_score_detailEntity>();
cfg.CreateMap<eva_level_score_detailEntity, eva_level_score_detailViewModel>();
cfg.CreateMap<eva_level_score_detailEntity, eva_level_score_detailWithSelectionViewModel>();
});
#endregion

View File

@@ -5,6 +5,59 @@
Layout = "_LayoutDirect";
}
<div class="modal fade" id="eva_level_score_detailModel" style="z-index:1500" tabindex="-1" role="dialog" aria-labelledby="eva_level_score_detailModelLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="eva_level_score_detailModelLabel">บันทึกข้อมูล ช่วงร้อยละที่ได้เลื่อน</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<input class="form-control" type="hidden" id="eva_level_score_detail_id" />
<input class="form-control" type="hidden" id="eva_level_score_detail_level_score_id" />
<div class='row'></div>
<div class='row'></div>
<div class='row'>
<div class="form-group col-md-4">
<label id="lab_eva_level_score_detail_min_value" for="eva_level_score_detail_min_value">ช่วงคะแนนต่ำสุด</label>
<input class="form-control" type="number" id="eva_level_score_detail_min_value" iLabel="ช่วงคะแนนต่ำสุด" iRequire="true" iGroup="eva_level_score_detail" />
</div>
<div class="form-group col-md-4">
<label id="lab_eva_level_score_detail_max_value" for="eva_level_score_detail_max_value">ช่วงคะแนนสูงสุด</label>
<input class="form-control" type="number" id="eva_level_score_detail_max_value" iLabel="ช่วงคะแนนสูงสุด" iRequire="true" iGroup="eva_level_score_detail" />
</div>
</div>
<div class='row'>
<div class="form-group col-md-4">
<label id="lab_eva_level_score_detail_min_percentage" for="eva_level_score_detail_min_percentage">ร้อยละที่ได้เลื่อนต่ำสุด</label>
<input class="form-control" type="number" id="eva_level_score_detail_min_percentage" iLabel="ร้อยละที่ได้เลื่อนต่ำสุด" iRequire="true" iGroup="eva_level_score_detail" />
</div>
<div class="form-group col-md-4">
<label id="lab_eva_level_score_detail_max_percentage" for="eva_level_score_detail_max_percentage">ร้อยละที่ได้เลื่อนสูงสุด</label>
<input class="form-control" type="number" id="eva_level_score_detail_max_percentage" iLabel="ร้อยละที่ได้เลื่อนสูงสุด" iRequire="true" iGroup="eva_level_score_detail" />
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">ยกเลิก</button>
<button type="button" class="btn btn-primary" onclick="javascript:eva_level_score_detail_PutUpdate()">บันทึก</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="eva_promoted_percentageModel" style="z-index:1500" role="dialog" aria-labelledby="eva_promoted_percentageModelLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
@@ -143,7 +196,39 @@
<th><label id='h_eva_promoted_percentage_promoted_percentage'>ร้อยละที่ได้เลื่อน</label></th>
<th><label id='h_eva_promoted_percentage_min_score'>ช่วงคะแนนต่ำสุด</label></th>
<th><label id='h_eva_promoted_percentage_max_score'>ช่วงคะแนนสูงสุด</label></th>
</tr>
</thead>
<tbody></tbody>
</table>
</section>
<br />
<section class="wrapper">
<div class="title"><div class="line"></div>ตารางกำหนดช่วงร้อยละที่ได้เลื่อน</div>
<div class="tools">
<div class="row">
<input class="form-control" type="hidden" id="s_eva_level_score_detail_level_score_id" />
<div class="col-md-6">
<button class="btn btn-info" onclick="javascript:eva_level_score_detail_GoCreate();"><i class="fa fa-plus" style="font-size: 14px;"></i> เพิ่มรายการ</button>
</div>
</div>
</div>
<table id="eva_level_score_detailTable" class="display table table-bordered table-striped">
<thead>
<tr>
<!--<th>เลือก</th>-->
<th>เครื่องมือ</th>
<th><label id='h_eva_level_score_detail_min_value'>ช่วงคะแนนต่ำสุด</label></th>
<th><label id='h_eva_level_score_detail_max_value'>ช่วงคะแนนสูงสุด</label></th>
<th><label id='h_eva_level_score_detail_min_percentage'>ร้อยละที่ได้เลื่อนต่ำสุด</label></th>
<th><label id='h_eva_level_score_detail_max_percentage'>ร้อยละที่ได้เลื่อนสูงสุด</label></th>
</tr>
</thead>
<tbody></tbody>
@@ -153,20 +238,23 @@
@section FooterPlaceHolder{
<script src="~/js/eva_level_score/eva_level_score_d.js?version=@MyHelper.GetDummyText()"></script>
<script src="~/js/eva_promoted_percentage/eva_promoted_percentage.js?version=@MyHelper.GetDummyText()"></script>
<script src="~/js/eva_level_score_detail/eva_level_score_detail.js?version=@MyHelper.GetDummyText()"></script>
<script>
$(document).ready(function () {
var id = getUrlParameter("id");
if (id) {
eva_level_score_SetEditForm(id);
eva_promoted_percentage_InitiateDataTable(id);
eva_promoted_percentage_InitialForm();
} else {
eva_level_score_SetCreateForm();
}
SetupValidationRemark("eva_level_score");
SetupValidationRemark("eva_promoted_percentage");
});
$(document).ready(function () {
var id = getUrlParameter("id");
if (id) {
eva_level_score_SetEditForm(id);
eva_promoted_percentage_InitiateDataTable(id);
eva_promoted_percentage_InitialForm();
eva_level_score_detail_InitiateDataTable();
eva_level_score_detail_InitialForm();
} else {
eva_level_score_SetCreateForm();
}
SetupValidationRemark("eva_level_score");
SetupValidationRemark("eva_promoted_percentage");
SetupValidationRemark("eva_level_score_detail");
});
</script>
}

View File

@@ -0,0 +1,122 @@
@using Microsoft.Extensions.Configuration
@inject IConfiguration Configuration
@{
ViewData["Title"] = "eva_level_score_detail";
}
<div class="modal fade" id="eva_level_score_detailModel" style="z-index:1500" tabindex="-1" role="dialog" aria-labelledby="eva_level_score_detailModelLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="eva_level_score_detailModelLabel">บันทึกข้อมูล eva_level_score_detail</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<input class="form-control" type="hidden" id="eva_level_score_detail_id" />
<input class="form-control" type="hidden" id="eva_level_score_detail_level_score_id" />
<div class='row'></div>
<div class='row'></div>
<div class='row'>
<div class="form-group col-md-4">
<label id="lab_eva_level_score_detail_min_value" for="eva_level_score_detail_min_value">ช่วงคะแนนต่ำสุด</label>
<input class="form-control" type="number" id="eva_level_score_detail_min_value" iLabel="ช่วงคะแนนต่ำสุด" iRequire="true" iGroup="eva_level_score_detail" />
</div>
<div class="form-group col-md-4">
<label id="lab_eva_level_score_detail_max_value" for="eva_level_score_detail_max_value">ช่วงคะแนนสูงสุด</label>
<input class="form-control" type="number" id="eva_level_score_detail_max_value" iLabel="ช่วงคะแนนสูงสุด" iRequire="true" iGroup="eva_level_score_detail" />
</div>
</div>
<div class='row'>
<div class="form-group col-md-4">
<label id="lab_eva_level_score_detail_min_percentage" for="eva_level_score_detail_min_percentage">ร้อยละที่ได้เลื่อนต่ำสุด</label>
<input class="form-control" type="number" id="eva_level_score_detail_min_percentage" iLabel="ร้อยละที่ได้เลื่อนต่ำสุด" iRequire="true" iGroup="eva_level_score_detail" />
</div>
<div class="form-group col-md-4">
<label id="lab_eva_level_score_detail_max_percentage" for="eva_level_score_detail_max_percentage">ร้อยละที่ได้เลื่อนสูงสุด</label>
<input class="form-control" type="number" id="eva_level_score_detail_max_percentage" iLabel="ร้อยละที่ได้เลื่อนสูงสุด" iRequire="true" iGroup="eva_level_score_detail" />
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">ยกเลิก</button>
<button type="button" class="btn btn-primary" onclick="javascript:eva_level_score_detail_PutUpdate()">บันทึก</button>
</div>
</div>
</div>
</div>
<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">eva_level_score_detail</li>
</ol>
</div>
</div>
<section class="wrapper">
<div class="title"><div class="line"></div>ค้นหา eva_level_score_detail</div>
<div class="tools">
<div class="row">
<div class="form-group col-md-3">
<label id='lab_s_eva_level_score_detail_level_score_id' for='s_eva_level_score_detail_level_score_id'>level_score_id</label>
<input class="form-control" type="hidden" id="s_eva_level_score_detail_level_score_id" />
</div>
<div class="col-md-6">
<button class="btn btn-info" onclick="javascript:eva_level_score_detail_DoSearch();">ค้นหา</button>
<button class="btn btn-info" onclick="javascript:eva_level_score_detail_GoCreate();"><i class="fa fa-plus" style="font-size: 14px;"></i> เพิ่มรายการ</button>
<button style="display:none;" class="btn btn-info" onclick="javascript:eva_level_score_detail_GetSelect('id');">ดึงตัวเลือก</button>
</div>
</div>
</div>
<table id="eva_level_score_detailTable" class="display table table-bordered table-striped">
<thead>
<tr>
<!--<th>เลือก</th>-->
<th>เครื่องมือ</th>
<th><label id='h_eva_level_score_detail_id'>รหัสอ้างอิง</label></th>
<th><label id='h_eva_level_score_detail_level_score_id'>level_score_id</label></th>
<th><label id='h_eva_level_score_detail_min_value'>ช่วงคะแนนต่ำสุด</label></th>
<th><label id='h_eva_level_score_detail_max_value'>ช่วงคะแนนสูงสุด</label></th>
<th><label id='h_eva_level_score_detail_min_percentage'>ร้อยละที่ได้เลื่อนต่ำสุด</label></th>
<th><label id='h_eva_level_score_detail_max_percentage'>ร้อยละที่ได้เลื่อนสูงสุด</label></th>
</tr>
</thead>
<tbody></tbody>
</table>
</section>
@section FooterPlaceHolder{
<script src="~/js/eva_level_score_detail/eva_level_score_detail.js"></script>
<script>
$(document).ready(function () {
eva_level_score_detail_InitiateDataTable();
eva_level_score_detail_InitialForm();
SetupValidationRemark("eva_level_score_detail");
});
</script>
}

View File

@@ -73,6 +73,7 @@
<None Include="Views\eva_evaluation_achievement_attachView\eva_evaluation_achievement_attach.cshtml" />
<None Include="Views\eva_evaluation_operating_agreementView\eva_evaluation_operating_agreement.cshtml" />
<None Include="Views\eva_idp_plan_reviewerView\eva_idp_plan_reviewer.cshtml" />
<None Include="Views\eva_level_score_detailView\eva_level_score_detail.cshtml" />
<None Include="Views\eva_limit_frame_groupView\eva_limit_frame_group.cshtml" />
<None Include="Views\eva_limit_frame_groupView\eva_limit_frame_group_d.cshtml" />
<None Include="Views\eva_limit_frame_planView\eva_limit_frame_plan.cshtml" />
@@ -92,6 +93,7 @@
<None Include="wwwroot\js\eva_evaluation_achievement_attach\eva_evaluation_achievement_attach.js" />
<None Include="wwwroot\js\eva_evaluation_operating_agreement\eva_evaluation_operating_agreement.js" />
<None Include="wwwroot\js\eva_idp_plan_reviewer\eva_idp_plan_reviewer.js" />
<None Include="wwwroot\js\eva_level_score_detail\eva_level_score_detail.js" />
<None Include="wwwroot\js\eva_limit_frame_employee\eva_limit_frame_employee.js" />
<None Include="wwwroot\js\eva_limit_frame_group\eva_limit_frame_group.js" />
<None Include="wwwroot\js\eva_limit_frame_group\eva_limit_frame_group_d.js" />

View File

@@ -3720,6 +3720,124 @@
<response code="400">If the model is invalid</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_level_score_detailController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_level_score_detailController},TodoAPI2.Models.Ieva_level_score_detailService,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.eva_level_score_detailController.Get(System.Guid)">
<summary>
Get specific item by id
</summary>
<remarks>
</remarks>
<returns>Return Get specific item by id</returns>
<response code="200">Returns the item</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_level_score_detailController.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.eva_level_score_detailController.GetList(System.Guid)">
<summary>
Get list items by level_score_id
</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_level_score_detailController.GetListBySearch(TodoAPI2.Models.eva_level_score_detailSearchModel)">
<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_level_score_detailController.eva_level_score_detail_report(TodoAPI2.Models.eva_level_score_detailReportRequestModel)">
<summary>
Download Report
</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_level_score_detailController.Insert(TodoAPI2.Models.eva_level_score_detailInputModel)">
<summary>
Create new item
</summary>
<remarks>
</remarks>
<param name="model"></param>
<returns>Response Result Message</returns>
<response code="200">Response Result Message</response>
<response code="400">If the model is invalid</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_level_score_detailController.Update(System.Guid,TodoAPI2.Models.eva_level_score_detailInputModel)">
<summary>
Update item
</summary>
<remarks>
</remarks>
<param name="id"></param>
<param name="model"></param>
<returns>Response Result Message</returns>
<response code="200">Response Result Message</response>
<response code="400">If the model is invalid</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_level_score_detailController.Delete(System.Guid)">
<summary>
Delete item
</summary>
<remarks>
</remarks>
<param name="id"></param>
<returns>Response Result Message</returns>
<response code="200">Response Result Message</response>
<response code="400">If the model is invalid</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_level_score_detailController.UpdateMultiple(System.Collections.Generic.List{TodoAPI2.Models.eva_level_score_detailInputModel})">
<summary>
Update multiple item
</summary>
<remarks>
</remarks>
<param name="model"></param>
<returns>Response Result Message</returns>
<response code="200">Response Result Message</response>
<response code="400">If the model is invalid</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_level_score_detailController.RefreshAutoField">
<summary>
Refresh AutoField of all items
</summary>
<remarks>
</remarks>
<returns>Response Result Message</returns>
<response code="200">Response Result Message</response>
<response code="400">If the model is invalid</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_limit_frame_employeeController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_limit_frame_employeeController},TodoAPI2.Models.Ieva_limit_frame_employeeService,Microsoft.Extensions.Configuration.IConfiguration)">
<summary>
Default constructure for dependency injection

View File

@@ -0,0 +1,227 @@
var eva_level_score_detail_editMode = "CREATE";
var eva_level_score_detail_API = "/api/eva_level_score_detail/";
//================= Search Customizaiton =========================================
function eva_level_score_detail_GetSearchParameter() {
var eva_level_score_detailSearchObject = new Object();
eva_level_score_detailSearchObject.level_score_id = getUrlParameter("id");
return eva_level_score_detailSearchObject;
}
function eva_level_score_detail_FeedDataToSearchForm(data) {
$("#s_eva_level_score_detail_level_score_id").val(data.level_score_id);
}
//================= Form Data Customizaiton =========================================
function eva_level_score_detail_FeedDataToForm(data) {
$("#eva_level_score_detail_id").val(data.id);
$("#eva_level_score_detail_level_score_id").val(data.level_score_id);
$("#eva_level_score_detail_min_value").val(data.min_value);
$("#eva_level_score_detail_max_value").val(data.max_value);
$("#eva_level_score_detail_min_percentage").val(data.min_percentage);
$("#eva_level_score_detail_max_percentage").val(data.max_percentage);
}
function eva_level_score_detail_GetFromForm() {
var eva_level_score_detailObject = new Object();
eva_level_score_detailObject.id = $("#eva_level_score_detail_id").val();
eva_level_score_detailObject.level_score_id = getUrlParameter("id");
eva_level_score_detailObject.min_value = $("#eva_level_score_detail_min_value").val();
eva_level_score_detailObject.max_value = $("#eva_level_score_detail_max_value").val();
eva_level_score_detailObject.min_percentage = $("#eva_level_score_detail_min_percentage").val();
eva_level_score_detailObject.max_percentage = $("#eva_level_score_detail_max_percentage").val();
return eva_level_score_detailObject;
}
function eva_level_score_detail_InitialForm(s) {
var successFunc = function (result) {
eva_level_score_detail_FeedDataToForm(result);
eva_level_score_detail_FeedDataToSearchForm(result);
if (s) {
// Incase model popup
$("#eva_level_score_detailModel").modal("show");
}
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_level_score_detail_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Form Mode Setup and Flow =========================================
function eva_level_score_detail_GoCreate() {
// Incase model popup
eva_level_score_detail_SetCreateForm(true);
// Incase open new page
//window_open(appsite + "/eva_level_score_detailView/eva_level_score_detail_d");
}
function eva_level_score_detail_GoEdit(a) {
// Incase model popup
eva_level_score_detail_SetEditForm(a);
// Incase open new page
//window_open(appsite + "/eva_level_score_detailView/eva_level_score_detail_d?id=" + a);
}
function eva_level_score_detail_SetEditForm(a) {
var successFunc = function (result) {
eva_level_score_detail_editMode = "UPDATE";
eva_level_score_detail_FeedDataToForm(result);
$("#eva_level_score_detailModel").modal("show");
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_level_score_detail_API + a, successFunc, AlertDanger);
}
function eva_level_score_detail_SetCreateForm(s) {
eva_level_score_detail_editMode = "CREATE";
eva_level_score_detail_InitialForm(s);
}
function eva_level_score_detail_RefreshTable() {
// Incase model popup
eva_level_score_detail_DoSearch();
// Incase open new page
//window.parent.eva_level_score_detail_DoSearch();
}
//================= Update and Delete =========================================
var eva_level_score_detail_customValidation = function (group) {
return "";
};
function eva_level_score_detail_PutUpdate() {
if (!ValidateForm('eva_level_score_detail', eva_level_score_detail_customValidation)) {
return;
}
var data = eva_level_score_detail_GetFromForm();
//Update Mode
if (eva_level_score_detail_editMode === "UPDATE") {
var successFunc1 = function (result) {
$("#eva_level_score_detailModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
eva_level_score_detail_RefreshTable();
endLoad();
};
startLoad();
AjaxPutRequest(apisite + eva_level_score_detail_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
else {
var successFunc2 = function (result) {
$("#eva_level_score_detailModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
eva_level_score_detail_RefreshTable();
endLoad();
};
startLoad();
AjaxPostRequest(apisite + eva_level_score_detail_API, data, successFunc2, AlertDanger);
}
}
function eva_level_score_detail_GoDelete(a) {
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
var successFunc = function (result) {
$("#eva_level_score_detailModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
eva_level_score_detail_RefreshTable();
endLoad();
};
startLoad();
AjaxDeleteRequest(apisite + eva_level_score_detail_API + a, null, successFunc, AlertDanger);
}
}
//================= Data Table =========================================
var eva_level_score_detailTableV;
var eva_level_score_detail_setupTable = function (result) {
tmp = '"';
eva_level_score_detailTableV = $('#eva_level_score_detailTable').DataTable({
"processing": true,
"serverSide": false,
"data": result,
//"select": {
// "style": 'multi'
//},
"columns": [
//{ "data": "" },
{ "data": "id" },
{ "data": "min_value" },
{ "data": "max_value" },
{ "data": "min_percentage" },
{ "data": "max_percentage" },
],
"columnDefs": [
{
"targets": 0, //1,
"data": "id",
"render": function (data, type, row, meta) {
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:eva_level_score_detail_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> <button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_level_score_detail_GoDelete(" + tmp + data + tmp + ")'><i class='fa fa-trash-o '></i></button> ";
}
},
//{
// targets: 0,
// data: "",
// defaultContent: '',
// orderable: false,
// className: 'select-checkbox'
//}
],
"language": {
"url": appsite + "/DataTables-1.10.16/thai.json"
},
"paging": true,
"searching": false
});
endLoad();
};
function eva_level_score_detail_InitiateDataTable() {
startLoad();
var p = $.param(eva_level_score_detail_GetSearchParameter());
AjaxGetRequest(apisite + "/api/eva_level_score_detail/GetListBySearch?" + p, eva_level_score_detail_setupTable, AlertDanger);
}
function eva_level_score_detail_DoSearch() {
var p = $.param(eva_level_score_detail_GetSearchParameter());
var eva_level_score_detail_reload = function (result) {
eva_level_score_detailTableV.destroy();
eva_level_score_detail_setupTable(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_level_score_detail/GetListBySearch?" + p, eva_level_score_detail_reload, AlertDanger);
}
function eva_level_score_detail_GetSelect(f) {
var eva_level_score_detail_selectitem = [];
$.each(eva_level_score_detailTableV.rows('.selected').data(), function (key, value) {
eva_level_score_detail_selectitem.push(value[f]);
});
alert(eva_level_score_detail_selectitem);
}
//================= File Upload =========================================
//================= Multi-Selection Function =========================================