ปรับปรุง รายงานประวัติการเลื่อนเงินเดือนรายบุคคล #1
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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 Ivw_eva_performance_planService
|
||||
{
|
||||
List<vw_eva_performance_planViewModel> GetListByfiscal_year(int? fiscal_year);
|
||||
List<vw_eva_performance_planViewModel> GetListBySearch(vw_eva_performance_planSearchModel model);
|
||||
|
||||
vw_eva_performance_planWithSelectionViewModel GetWithSelection(Guid id);
|
||||
vw_eva_performance_planWithSelectionViewModel GetBlankItem();
|
||||
|
||||
eva_performance_planEntity GetEntity(Guid id);
|
||||
DataContext GetContext();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
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 vw_eva_performance_planInputModel
|
||||
{
|
||||
|
||||
public Guid? id { get; set; }
|
||||
|
||||
public int? fiscal_year { get; set; }
|
||||
|
||||
public int? theTime { get; set; }
|
||||
|
||||
public string active_mode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 vw_eva_performance_planReportRequestModel : vw_eva_performance_planSearchModel
|
||||
{
|
||||
public string filetype { get; set; }
|
||||
|
||||
public string contentType { get { return MyHelper.GetContentType(filetype); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
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 vw_eva_performance_planSearchModel
|
||||
{
|
||||
|
||||
public Guid id { get; set; }
|
||||
|
||||
public int? fiscal_year { get; set; }
|
||||
|
||||
public int? theTime { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
133
Models/vw_eva_performance_plan/vw_eva_performance_planService.cs
Normal file
133
Models/vw_eva_performance_plan/vw_eva_performance_planService.cs
Normal file
@@ -0,0 +1,133 @@
|
||||
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 vw_eva_performance_planService : Ivw_eva_performance_planService
|
||||
{
|
||||
private IBaseRepository<eva_performance_planEntity, Guid> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
|
||||
public vw_eva_performance_planService(IBaseRepository<eva_performance_planEntity, Guid> repository, IMyDatabase mydb, Iexternal_linkageService inext)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
private eva_performance_planEntity GetEntity(vw_eva_performance_planInputModel model)
|
||||
{
|
||||
return Mapper.Map<eva_performance_planEntity>(model);
|
||||
}
|
||||
private List<eva_performance_planEntity> GetEntityList(List<vw_eva_performance_planInputModel> models)
|
||||
{
|
||||
return Mapper.Map<List<eva_performance_planEntity>>(models);
|
||||
}
|
||||
private vw_eva_performance_planViewModel GetDto(eva_performance_planEntity entity)
|
||||
{
|
||||
return Mapper.Map<vw_eva_performance_planViewModel>(entity);
|
||||
}
|
||||
private List<vw_eva_performance_planViewModel> GetDtoList(List<eva_performance_planEntity> entities)
|
||||
{
|
||||
return Mapper.Map<List<vw_eva_performance_planViewModel>>(entities);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
#region Query Functions
|
||||
|
||||
public vw_eva_performance_planViewModel Get(Guid id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
return GetDto(entity);
|
||||
}
|
||||
|
||||
public eva_performance_planEntity GetEntity(Guid id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public DataContext GetContext()
|
||||
{
|
||||
return _repository.Context;
|
||||
}
|
||||
|
||||
public vw_eva_performance_planWithSelectionViewModel GetWithSelection(Guid id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
var i = Mapper.Map<vw_eva_performance_planWithSelectionViewModel>(entity);
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
public vw_eva_performance_planWithSelectionViewModel GetBlankItem()
|
||||
{
|
||||
var i = new vw_eva_performance_planWithSelectionViewModel();
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public List<vw_eva_performance_planViewModel> GetListByfiscal_year(int? fiscal_year)
|
||||
{
|
||||
var model = new vw_eva_performance_planSearchModel();
|
||||
model.fiscal_year = fiscal_year;
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
public List<vw_eva_performance_planViewModel> GetListBySearch(vw_eva_performance_planSearchModel model)
|
||||
{
|
||||
var data = (
|
||||
from m_vw_eva_performance_plan in _repository.Context.eva_performance_plan
|
||||
|
||||
|
||||
where
|
||||
1 == 1
|
||||
&& (!model.fiscal_year.HasValue || m_vw_eva_performance_plan.fiscal_year == model.fiscal_year)
|
||||
&& (!model.theTime.HasValue || m_vw_eva_performance_plan.theTime == model.theTime)
|
||||
|
||||
|
||||
orderby m_vw_eva_performance_plan.created descending
|
||||
select new vw_eva_performance_planViewModel()
|
||||
{
|
||||
id = m_vw_eva_performance_plan.id,
|
||||
fiscal_year = m_vw_eva_performance_plan.fiscal_year,
|
||||
theTime = m_vw_eva_performance_plan.theTime,
|
||||
|
||||
|
||||
isActive = m_vw_eva_performance_plan.isActive,
|
||||
Created = m_vw_eva_performance_plan.created,
|
||||
Updated = m_vw_eva_performance_plan.updated
|
||||
}
|
||||
).Take(1000).ToList();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -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 vw_eva_performance_planViewModel : BaseViewModel2<Guid>
|
||||
{
|
||||
|
||||
public int? fiscal_year { get; set; }
|
||||
|
||||
public int? theTime { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class vw_eva_performance_planWithSelectionViewModel: vw_eva_performance_planViewModel
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user