First Initial
This commit is contained in:
@@ -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_create_evaluation_detail_agreementService
|
||||
{
|
||||
List<eva_create_evaluation_detail_agreementViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id, int? emp_id);
|
||||
List<eva_create_evaluation_detail_agreementViewModel> GetListBySearch(eva_create_evaluation_detail_agreementSearchModel model, int? emp_id);
|
||||
|
||||
eva_create_evaluation_detail_agreementWithSelectionViewModel GetWithSelection(int id);
|
||||
eva_create_evaluation_detail_agreementWithSelectionViewModel GetBlankItem();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
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_create_evaluation_detail_agreementInputModel
|
||||
{
|
||||
|
||||
public int? id { get; set; }
|
||||
|
||||
public string evaluation_round { get; set; }
|
||||
|
||||
public string employee_code { get; set; }
|
||||
|
||||
public string employee_fullname { get; set; }
|
||||
|
||||
public string employee_position { get; set; }
|
||||
|
||||
public string employee_position_type { get; set; }
|
||||
|
||||
public string employee_position_level { get; set; }
|
||||
|
||||
public string employee_org { get; set; }
|
||||
|
||||
public string chief_fullname { get; set; }
|
||||
|
||||
public string chief_position { get; set; }
|
||||
|
||||
public int? create_evaluation_id { get; set; }
|
||||
|
||||
public int? org_id { get; set; }
|
||||
|
||||
public string search_employee_code { get; set; }
|
||||
|
||||
public string search_employee_fullname { 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_create_evaluation_detail_agreementReportRequestModel : eva_create_evaluation_detail_agreementSearchModel
|
||||
{
|
||||
public string filetype { get; set; }
|
||||
|
||||
public string contentType { get { return MyHelper.GetContentType(filetype); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 eva_create_evaluation_detail_agreementSearchModel
|
||||
{
|
||||
|
||||
public int? create_evaluation_id { get; set; }
|
||||
|
||||
public int? org_id { get; set; }
|
||||
|
||||
public string search_employee_code { get; set; }
|
||||
|
||||
public string search_employee_fullname { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
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;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_agreementService : Ieva_create_evaluation_detail_agreementService
|
||||
{
|
||||
private IBaseRepository2<eva_create_evaluation_detailEntity, int> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
|
||||
public eva_create_evaluation_detail_agreementService(IBaseRepository2<eva_create_evaluation_detailEntity, int> repository,
|
||||
IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
private eva_create_evaluation_detailEntity GetEntity(eva_create_evaluation_detail_agreementInputModel model)
|
||||
{
|
||||
return Mapper.Map<eva_create_evaluation_detailEntity>(model);
|
||||
}
|
||||
private List<eva_create_evaluation_detailEntity> GetEntityList(List<eva_create_evaluation_detail_agreementInputModel> models)
|
||||
{
|
||||
return Mapper.Map<List<eva_create_evaluation_detailEntity>>(models);
|
||||
}
|
||||
private eva_create_evaluation_detail_agreementViewModel GetDto(eva_create_evaluation_detailEntity entity)
|
||||
{
|
||||
return Mapper.Map<eva_create_evaluation_detail_agreementViewModel>(entity);
|
||||
}
|
||||
private List<eva_create_evaluation_detail_agreementViewModel> GetDtoList(List<eva_create_evaluation_detailEntity> entities)
|
||||
{
|
||||
return Mapper.Map<List<eva_create_evaluation_detail_agreementViewModel>>(entities);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
#region Query Functions
|
||||
|
||||
public eva_create_evaluation_detail_agreementWithSelectionViewModel Get(int id)
|
||||
{
|
||||
var allemp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
var data = (
|
||||
from m_eva_create_evaluation_detail_agreement in _repository.Context.eva_create_evaluation_detail
|
||||
|
||||
join fk_external_employee in allemp on m_eva_create_evaluation_detail_agreement.employee_id equals fk_external_employee.id
|
||||
into external_employeeResult
|
||||
from fk_external_employee in external_employeeResult.DefaultIfEmpty()
|
||||
|
||||
join fk_external_chief in allemp on m_eva_create_evaluation_detail_agreement.chief equals fk_external_chief.id
|
||||
into external_chiefResult
|
||||
from fk_external_chief in external_chiefResult.DefaultIfEmpty()
|
||||
|
||||
join fk_eva_create_evaluation10 in _repository.Context.eva_create_evaluation on m_eva_create_evaluation_detail_agreement.create_evaluation_id equals fk_eva_create_evaluation10.id
|
||||
into eva_create_evaluationResult10
|
||||
from fk_eva_create_evaluationResult10 in eva_create_evaluationResult10.DefaultIfEmpty()
|
||||
|
||||
where m_eva_create_evaluation_detail_agreement.id == id
|
||||
|
||||
orderby m_eva_create_evaluation_detail_agreement.created descending
|
||||
select new eva_create_evaluation_detail_agreementWithSelectionViewModel()
|
||||
{
|
||||
id = m_eva_create_evaluation_detail_agreement.id,
|
||||
evaluation_round = fk_eva_create_evaluationResult10.eva_performance_plan.theTime.ToString(),
|
||||
employee_code = fk_external_employee.employee_no,
|
||||
employee_fullname = fk_external_employee.fullname,
|
||||
employee_position = fk_external_employee.position_name,
|
||||
employee_position_type = fk_external_employee.employee_type_name,
|
||||
employee_position_level = fk_external_employee.position_level_text,
|
||||
employee_org = fk_external_employee.department_name,
|
||||
chief_fullname = fk_external_chief.fullname,
|
||||
chief_position = fk_external_chief.position_name,
|
||||
create_evaluation_id = m_eva_create_evaluation_detail_agreement.create_evaluation_id,
|
||||
org_id = fk_external_employee.department_id,
|
||||
search_employee_code = fk_external_employee.employee_no,
|
||||
search_employee_fullname = fk_external_employee.fullname,
|
||||
status_self = m_eva_create_evaluation_detail_agreement.status_self,
|
||||
status_chief = m_eva_create_evaluation_detail_agreement.status_chief,
|
||||
status_supervisor = m_eva_create_evaluation_detail_agreement.status_supervisor,
|
||||
|
||||
org_id_external_linkage_external_name = fk_external_employee.department_name,
|
||||
|
||||
isActive = m_eva_create_evaluation_detail_agreement.isActive,
|
||||
Created = m_eva_create_evaluation_detail_agreement.created,
|
||||
Updated = m_eva_create_evaluation_detail_agreement.updated
|
||||
}
|
||||
).Take(100).ToList();
|
||||
|
||||
return data[0];
|
||||
}
|
||||
public eva_create_evaluation_detail_agreementWithSelectionViewModel GetWithSelection(int id)
|
||||
{
|
||||
var item = Get(id);
|
||||
var i = item;
|
||||
i.item_org_id = ext.GetDepartmentData();
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
public eva_create_evaluation_detail_agreementWithSelectionViewModel GetBlankItem()
|
||||
{
|
||||
var i = new eva_create_evaluation_detail_agreementWithSelectionViewModel();
|
||||
i.item_org_id = ext.GetDepartmentData();
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_agreementViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id, int? emp_id)
|
||||
{
|
||||
var model = new eva_create_evaluation_detail_agreementSearchModel();
|
||||
model.create_evaluation_id = create_evaluation_id;
|
||||
return GetListBySearch(model, emp_id);
|
||||
}
|
||||
|
||||
public List<eva_create_evaluation_detail_agreementViewModel> GetListBySearch(eva_create_evaluation_detail_agreementSearchModel model, int? emp_id)
|
||||
{
|
||||
|
||||
var allemp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
var data = (
|
||||
from m_eva_create_evaluation_detail_agreement in _repository.Context.eva_create_evaluation_detail
|
||||
|
||||
join fk_external_employee in allemp on m_eva_create_evaluation_detail_agreement.employee_id equals fk_external_employee.id
|
||||
into external_employeeResult
|
||||
from fk_external_employee in external_employeeResult.DefaultIfEmpty()
|
||||
|
||||
join fk_external_chief in allemp on m_eva_create_evaluation_detail_agreement.chief equals fk_external_chief.id
|
||||
into external_chiefResult
|
||||
from fk_external_chief in external_chiefResult.DefaultIfEmpty()
|
||||
|
||||
join fk_eva_create_evaluation10 in _repository.Context.eva_create_evaluation on m_eva_create_evaluation_detail_agreement.create_evaluation_id equals fk_eva_create_evaluation10.id
|
||||
into eva_create_evaluationResult10
|
||||
from fk_eva_create_evaluationResult10 in eva_create_evaluationResult10.DefaultIfEmpty()
|
||||
|
||||
where 1==1
|
||||
&& (m_eva_create_evaluation_detail_agreement.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue)
|
||||
&& (fk_external_employee.department_id == model.org_id || !model.org_id.HasValue)
|
||||
&& (fk_external_employee.employee_no == model.search_employee_code || string.IsNullOrEmpty(model.search_employee_code))
|
||||
&& (fk_external_employee.fullname.Contains(model.search_employee_fullname) || string.IsNullOrEmpty(model.search_employee_fullname))
|
||||
&& m_eva_create_evaluation_detail_agreement.employee_id == emp_id
|
||||
|
||||
orderby m_eva_create_evaluation_detail_agreement.created descending
|
||||
select new eva_create_evaluation_detail_agreementViewModel()
|
||||
{
|
||||
id = m_eva_create_evaluation_detail_agreement.id,
|
||||
evaluation_round = fk_eva_create_evaluationResult10.eva_performance_plan.theTime.ToString(),
|
||||
employee_code = fk_external_employee.employee_no,
|
||||
employee_fullname = fk_external_employee.fullname,
|
||||
employee_position = fk_external_employee.position_name,
|
||||
employee_position_type = fk_external_employee.employee_type_name,
|
||||
employee_position_level = fk_external_employee.position_level_text,
|
||||
employee_org = fk_external_employee.department_name,
|
||||
chief_fullname = fk_external_chief.fullname,
|
||||
chief_position = fk_external_chief.position_name,
|
||||
create_evaluation_id = m_eva_create_evaluation_detail_agreement.create_evaluation_id,
|
||||
org_id = fk_external_employee.department_id,
|
||||
search_employee_code = fk_external_employee.employee_no,
|
||||
search_employee_fullname = fk_external_employee.fullname,
|
||||
status_self = m_eva_create_evaluation_detail_agreement.status_self,
|
||||
status_chief = m_eva_create_evaluation_detail_agreement.status_chief,
|
||||
status_supervisor = m_eva_create_evaluation_detail_agreement.status_supervisor,
|
||||
|
||||
org_id_external_linkage_external_name = fk_external_employee.department_name,
|
||||
|
||||
isActive = m_eva_create_evaluation_detail_agreement.isActive,
|
||||
Created = m_eva_create_evaluation_detail_agreement.created,
|
||||
Updated = m_eva_create_evaluation_detail_agreement.updated
|
||||
}
|
||||
).Take(100).ToList();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
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_create_evaluation_detail_agreementViewModel : BaseViewModel2<int>
|
||||
{
|
||||
|
||||
public string evaluation_round { get; set; }
|
||||
|
||||
public string employee_code { get; set; }
|
||||
|
||||
public string employee_fullname { get; set; }
|
||||
|
||||
public string employee_position { get; set; }
|
||||
|
||||
public string employee_position_type { get; set; }
|
||||
|
||||
public string employee_position_level { get; set; }
|
||||
|
||||
public string employee_org { get; set; }
|
||||
|
||||
public string chief_fullname { get; set; }
|
||||
|
||||
public string chief_position { get; set; }
|
||||
|
||||
public int? create_evaluation_id { get; set; }
|
||||
|
||||
public int? org_id { get; set; }
|
||||
|
||||
public string search_employee_code { get; set; }
|
||||
|
||||
public string search_employee_fullname { get; set; }
|
||||
|
||||
public string org_id_external_linkage_external_name { get; set; }
|
||||
|
||||
public string status_self { get; set; }
|
||||
|
||||
public string status_chief { get; set; }
|
||||
|
||||
public string status_supervisor { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_create_evaluation_detail_agreementWithSelectionViewModel: eva_create_evaluation_detail_agreementViewModel
|
||||
{
|
||||
public List<external_linkageViewModel> item_org_id { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user