ปรับปรุง ลำดับการอนุมัติ
This commit is contained in:
@@ -142,6 +142,8 @@ namespace TodoAPI2.Models
|
||||
managed_by = m_eva_adjust_postponement_quota.managed_by,
|
||||
limit = m_eva_adjust_postponement_quota.limit,
|
||||
|
||||
quota_status_submit_to = m_eva_adjust_postponement_quota.quota_status_submit_to,
|
||||
|
||||
managed_by_external_linkage_external_name = fk_external_linkageResult7.fullname,
|
||||
|
||||
isActive = m_eva_adjust_postponement_quota.isActive,
|
||||
|
||||
@@ -34,5 +34,7 @@ namespace TodoAPI2.Models
|
||||
|
||||
public string managed_by_external_linkage_external_name { get; set; }
|
||||
|
||||
public int? quota_status_submit_to { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
using TodoAPI2.Models;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public interface Ieva_adjust_quota_update_final_statusService
|
||||
{
|
||||
new eva_adjust_quota_update_final_statusViewModel Update(int id, eva_adjust_quota_update_final_statusInputModel model, bool is_force_save, int? updateby);
|
||||
List<eva_adjust_quota_update_final_statusViewModel> GetListByquota_final_status_note(string quota_final_status_note);
|
||||
List<eva_adjust_quota_update_final_statusViewModel> GetListBySearch(eva_adjust_quota_update_final_statusSearchModel model);
|
||||
|
||||
eva_adjust_quota_update_final_statusWithSelectionViewModel GetWithSelection(int id);
|
||||
eva_adjust_quota_update_final_statusWithSelectionViewModel GetBlankItem();
|
||||
eva_adjust_postponementEntity GetEntity(int id);
|
||||
DataContext GetContext();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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_adjust_quota_update_final_statusInputModel
|
||||
{
|
||||
|
||||
public int? id { get; set; }
|
||||
|
||||
public string quota_final_status { get; set; }
|
||||
|
||||
public DateTime? quota_final_status_date { get; set; }
|
||||
|
||||
public int? quota_final_status_by { get; set; }
|
||||
|
||||
public string quota_final_status_note { 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 eva_adjust_quota_update_final_statusReportRequestModel : eva_adjust_quota_update_final_statusSearchModel
|
||||
{
|
||||
public string filetype { get; set; }
|
||||
|
||||
public string contentType { get { return MyHelper.GetContentType(filetype); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_adjust_quota_update_final_statusSearchModel
|
||||
{
|
||||
|
||||
public int id { get; set; }
|
||||
|
||||
public string quota_final_status_note { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
using TodoAPI2.Models;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Net;
|
||||
using TTSW.Configure;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Data;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_adjust_quota_update_final_statusService : Ieva_adjust_quota_update_final_statusService
|
||||
{
|
||||
private IBaseRepository2<eva_adjust_postponementEntity, int> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
|
||||
public eva_adjust_quota_update_final_statusService(IBaseRepository2<eva_adjust_postponementEntity, int> repository,
|
||||
IMyDatabase mydb, Iexternal_linkageService inext,
|
||||
Iexternal_employeeService inemp)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
private eva_adjust_postponementEntity GetEntity(eva_adjust_quota_update_final_statusInputModel model)
|
||||
{
|
||||
return Mapper.Map<eva_adjust_postponementEntity>(model);
|
||||
}
|
||||
private List<eva_adjust_postponementEntity> GetEntityList(List<eva_adjust_quota_update_final_statusInputModel> models)
|
||||
{
|
||||
return Mapper.Map<List<eva_adjust_postponementEntity>>(models);
|
||||
}
|
||||
private eva_adjust_quota_update_final_statusViewModel GetDto(eva_adjust_postponementEntity entity)
|
||||
{
|
||||
return Mapper.Map<eva_adjust_quota_update_final_statusViewModel>(entity);
|
||||
}
|
||||
private List<eva_adjust_quota_update_final_statusViewModel> GetDtoList(List<eva_adjust_postponementEntity> entities)
|
||||
{
|
||||
return Mapper.Map<List<eva_adjust_quota_update_final_statusViewModel>>(entities);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
#region Query Functions
|
||||
|
||||
public eva_adjust_quota_update_final_statusViewModel Get(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
return GetDto(entity);
|
||||
}
|
||||
|
||||
public eva_adjust_postponementEntity GetEntity(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public DataContext GetContext()
|
||||
{
|
||||
return _repository.Context;
|
||||
}
|
||||
|
||||
public eva_adjust_quota_update_final_statusWithSelectionViewModel GetWithSelection(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
var i = Mapper.Map<eva_adjust_quota_update_final_statusWithSelectionViewModel>(entity);
|
||||
i.item_quota_final_status = (from x in ext.GetAgreeDisagree5() select x).ToList();
|
||||
i.item_quota_final_status_by = (from x in emp.GetAllEmployee() select x).ToList();
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
public eva_adjust_quota_update_final_statusWithSelectionViewModel GetBlankItem()
|
||||
{
|
||||
var i = new eva_adjust_quota_update_final_statusWithSelectionViewModel();
|
||||
i.item_quota_final_status = (from x in ext.GetAgreeDisagree5() select x).ToList();
|
||||
i.item_quota_final_status_by = (from x in emp.GetAllEmployee() select x).ToList();
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public List<eva_adjust_quota_update_final_statusViewModel> GetListByquota_final_status_note(string quota_final_status_note)
|
||||
{
|
||||
var model = new eva_adjust_quota_update_final_statusSearchModel();
|
||||
model.quota_final_status_note = quota_final_status_note;
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
public List<eva_adjust_quota_update_final_statusViewModel> GetListBySearch(eva_adjust_quota_update_final_statusSearchModel model)
|
||||
{
|
||||
var data = (
|
||||
from m_eva_adjust_quota_update_final_status in _repository.Context.eva_adjust_postponement
|
||||
|
||||
join fk_external_linkage1 in ext.GetAgreeDisagree5() on m_eva_adjust_quota_update_final_status.quota_final_status equals fk_external_linkage1.external_code
|
||||
into external_linkageResult1
|
||||
from fk_external_linkageResult1 in external_linkageResult1.DefaultIfEmpty()
|
||||
|
||||
join fk_external_linkage3 in emp.GetAllEmployee() on m_eva_adjust_quota_update_final_status.quota_final_status_by equals fk_external_linkage3.id
|
||||
into external_linkageResult3
|
||||
from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty()
|
||||
|
||||
|
||||
where
|
||||
1 == 1
|
||||
&& (string.IsNullOrEmpty(model.quota_final_status_note) || m_eva_adjust_quota_update_final_status.quota_final_status_note.Contains(model.quota_final_status_note))
|
||||
|
||||
|
||||
orderby m_eva_adjust_quota_update_final_status.created descending
|
||||
select new eva_adjust_quota_update_final_statusViewModel()
|
||||
{
|
||||
id = m_eva_adjust_quota_update_final_status.id,
|
||||
quota_final_status = m_eva_adjust_quota_update_final_status.quota_final_status,
|
||||
quota_final_status_date = m_eva_adjust_quota_update_final_status.quota_final_status_date,
|
||||
quota_final_status_by = m_eva_adjust_quota_update_final_status.quota_final_status_by,
|
||||
quota_final_status_note = m_eva_adjust_quota_update_final_status.quota_final_status_note,
|
||||
|
||||
quota_final_status_external_linkage_external_name = fk_external_linkageResult1.external_name,
|
||||
quota_final_status_by_external_linkage_external_name = fk_external_linkageResult3.fullname,
|
||||
|
||||
isActive = m_eva_adjust_quota_update_final_status.isActive,
|
||||
Created = m_eva_adjust_quota_update_final_status.created,
|
||||
Updated = m_eva_adjust_quota_update_final_status.updated
|
||||
}
|
||||
).Take(1000).ToList();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Manipulation Functions
|
||||
|
||||
|
||||
public int GetNewPrimaryKey()
|
||||
{
|
||||
int? newkey = 0;
|
||||
|
||||
var x = (from i in _repository.Context.eva_adjust_postponement
|
||||
orderby i.id descending
|
||||
select i).Take(1).ToList();
|
||||
|
||||
if(x.Count > 0)
|
||||
{
|
||||
newkey = x[0].id + 1;
|
||||
}
|
||||
|
||||
return newkey.Value;
|
||||
}
|
||||
|
||||
|
||||
public eva_adjust_quota_update_final_statusViewModel Update(int id,
|
||||
eva_adjust_quota_update_final_statusInputModel model, bool is_force_save, int? updateby)
|
||||
{
|
||||
var existingEntity = _repository.Get(id);
|
||||
if (existingEntity != null)
|
||||
{
|
||||
existingEntity.quota_final_status = model.quota_final_status;
|
||||
existingEntity.quota_final_status_date = DateTime.Now;
|
||||
existingEntity.quota_final_status_by = updateby;
|
||||
existingEntity.quota_final_status_note = model.quota_final_status_note;
|
||||
|
||||
if (model.quota_final_status == "N")
|
||||
{
|
||||
existingEntity.quota_status = "W";
|
||||
existingEntity.quota_status_note = existingEntity.quota_final_status_note;
|
||||
}
|
||||
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
return Get(updated.id);
|
||||
}
|
||||
else
|
||||
throw new NotificationException("No data to update");
|
||||
}
|
||||
|
||||
|
||||
public eva_adjust_quota_update_final_statusViewModel SetAsActive(int id)
|
||||
{
|
||||
var updated = _repository.SetAsActive(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
public eva_adjust_quota_update_final_statusViewModel SetAsInactive(int id)
|
||||
{
|
||||
var updated = _repository.SetAsInActive(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
public void Delete(int id)
|
||||
{
|
||||
_repository.Delete(id);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
private Dictionary<string,string> GetLookupForLog()
|
||||
{
|
||||
var i = new Dictionary<string, string>();
|
||||
|
||||
|
||||
i.Add("quota_final_status", "สถานะการปรับเลื่อนเงินเดือน");
|
||||
i.Add("quota_final_status_external_linkage_external_name", "สถานะการปรับเลื่อนเงินเดือน");
|
||||
i.Add("quota_final_status_date", "วันที่");
|
||||
i.Add("txt_quota_final_status_date", "วันที่");
|
||||
i.Add("quota_final_status_by", "ปรับสถานะโดย");
|
||||
i.Add("quota_final_status_by_external_linkage_external_name", "ปรับสถานะโดย");
|
||||
i.Add("quota_final_status_note", "หมายเหตุ");
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Match Item
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_adjust_quota_update_final_statusViewModel : BaseViewModel2<int>
|
||||
{
|
||||
|
||||
public string quota_final_status { get; set; }
|
||||
|
||||
public DateTime? quota_final_status_date { get; set; }
|
||||
|
||||
public string txt_quota_final_status_date { get { return MyHelper.GetDateStringForReport(this.quota_final_status_date); } }
|
||||
|
||||
public int? quota_final_status_by { get; set; }
|
||||
|
||||
public string quota_final_status_note { get; set; }
|
||||
|
||||
public string quota_final_status_external_linkage_external_name { get; set; }
|
||||
public string quota_final_status_by_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 eva_adjust_quota_update_final_statusWithSelectionViewModel: eva_adjust_quota_update_final_statusViewModel
|
||||
{
|
||||
public List<external_linkageViewModel> item_quota_final_status { get; set; }
|
||||
public List<external_employeeViewModel> item_quota_final_status_by { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -175,6 +175,13 @@ namespace TodoAPI2.Models
|
||||
existingEntity.quota_status_date = DateTime.Now;
|
||||
existingEntity.quota_status_by = updateby;
|
||||
existingEntity.quota_status_note = model.quota_status_note;
|
||||
existingEntity.quota_status_submit_to = model.quota_status_submit_to;
|
||||
|
||||
if (model.quota_status == "Y")
|
||||
{
|
||||
existingEntity.quota_final_status = "W";
|
||||
existingEntity.quota_final_status_note = existingEntity.quota_status_note;
|
||||
}
|
||||
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
return Get(updated.id);
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace TodoAPI2.Models
|
||||
|
||||
List<external_linkageViewModel> GetSalaryReportType();
|
||||
List<external_linkageViewModel> GetAgreeDisagree4();
|
||||
List<external_linkageViewModel> GetAgreeDisagree5();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ namespace TodoAPI2.Models
|
||||
|
||||
var k = new external_linkageViewModel();
|
||||
k.external_id = 1;
|
||||
k.external_code = "";
|
||||
k.external_code = "W";
|
||||
k.external_name = "ระหว่างพิจารณา";
|
||||
result.Add(k);
|
||||
|
||||
@@ -333,6 +333,31 @@ namespace TodoAPI2.Models
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<external_linkageViewModel> GetAgreeDisagree5()
|
||||
{
|
||||
var result = new List<external_linkageViewModel>();
|
||||
|
||||
var k = new external_linkageViewModel();
|
||||
k.external_id = 1;
|
||||
k.external_code = "W";
|
||||
k.external_name = "ระหว่างพิจารณา";
|
||||
result.Add(k);
|
||||
|
||||
var i = new external_linkageViewModel();
|
||||
i.external_id = 2;
|
||||
i.external_code = "Y";
|
||||
i.external_name = "อนุมัติและแสดงแก่พนักงาน";
|
||||
result.Add(i);
|
||||
|
||||
var j = new external_linkageViewModel();
|
||||
j.external_id = 3;
|
||||
j.external_code = "N";
|
||||
j.external_name = "ตีกลับ";
|
||||
result.Add(j);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<external_linkageViewModel> GetDepartmentData()
|
||||
{
|
||||
var sql_parent = string.Format("select" +
|
||||
|
||||
Reference in New Issue
Block a user