First Initial

This commit is contained in:
Nakorn Rientrakrunchai
2020-02-20 15:02:39 +07:00
commit 8b98125e49
3048 changed files with 760804 additions and 0 deletions

View File

@@ -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_processService
{
List<eva_create_evaluation_detail_processViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id);
List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model);
eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id);
eva_create_evaluation_detail_processWithSelectionViewModel GetBlankItem();
}
}

View File

@@ -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_processInputModel
{
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; }
}
}

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

View 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 eva_create_evaluation_detail_processSearchModel
{
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; }
}
}

View File

@@ -0,0 +1,200 @@
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_create_evaluation_detail_processService : Ieva_create_evaluation_detail_processService
{
private IBaseRepository2<eva_create_evaluation_detailEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
Iexternal_employeeService emp;
public eva_create_evaluation_detail_processService(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_processInputModel model)
{
return Mapper.Map<eva_create_evaluation_detailEntity>(model);
}
private List<eva_create_evaluation_detailEntity> GetEntityList(List<eva_create_evaluation_detail_processInputModel> models)
{
return Mapper.Map<List<eva_create_evaluation_detailEntity>>(models);
}
private eva_create_evaluation_detail_processViewModel GetDto(eva_create_evaluation_detailEntity entity)
{
return Mapper.Map<eva_create_evaluation_detail_processViewModel>(entity);
}
private List<eva_create_evaluation_detail_processViewModel> GetDtoList(List<eva_create_evaluation_detailEntity> entities)
{
return Mapper.Map<List<eva_create_evaluation_detail_processViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public eva_create_evaluation_detail_processWithSelectionViewModel Get(int id)
{
var allemp = emp.GetListByemployee_type(null, null);
var data = (
from m_eva_create_evaluation_detail_process in _repository.Context.eva_create_evaluation_detail
join fk_external_employee in allemp on m_eva_create_evaluation_detail_process.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_process.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_process.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_process.id == id
orderby m_eva_create_evaluation_detail_process.created descending
select new eva_create_evaluation_detail_processWithSelectionViewModel()
{
id = m_eva_create_evaluation_detail_process.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 = null,
employee_position_level = null,
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_process.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,
org_id_external_linkage_external_name = fk_external_employee.department_name,
create_evaluation_score1 = fk_eva_create_evaluationResult10.score1,
create_evaluation_score2 = fk_eva_create_evaluationResult10.score2,
isActive = m_eva_create_evaluation_detail_process.isActive,
Created = m_eva_create_evaluation_detail_process.created,
Updated = m_eva_create_evaluation_detail_process.updated
}
).Take(100).ToList();
return data[0];
}
public eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id)
{
var item = Get(id);
item.item_org_id = ext.GetDepartmentData();
item.item_level_score = (from i in _repository.Context.eva_level_score
orderby i.min_score
select Mapper.Map<eva_level_scoreViewModel>(i)).ToList();
return item;
}
public eva_create_evaluation_detail_processWithSelectionViewModel GetBlankItem()
{
var i = new eva_create_evaluation_detail_processWithSelectionViewModel();
i.item_org_id = ext.GetDepartmentData();
i.item_level_score = (from j in _repository.Context.eva_level_score
orderby j.min_score
select Mapper.Map<eva_level_scoreViewModel>(i)).ToList();
return i;
}
public List<eva_create_evaluation_detail_processViewModel> GetListBycreate_evaluation_id(int? create_evaluation_id)
{
var model = new eva_create_evaluation_detail_processSearchModel();
model.create_evaluation_id = create_evaluation_id;
return GetListBySearch(model);
}
public List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model)
{
var allemp = emp.GetListByemployee_type(null, null);
var data = (
from m_eva_create_evaluation_detail_process in _repository.Context.eva_create_evaluation_detail
join fk_external_employee in allemp on m_eva_create_evaluation_detail_process.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_process.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_process.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_process.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))
orderby m_eva_create_evaluation_detail_process.created descending
select new eva_create_evaluation_detail_processViewModel()
{
id = m_eva_create_evaluation_detail_process.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 = null,
employee_position_level = null,
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_process.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,
org_id_external_linkage_external_name = fk_external_employee.department_name,
isActive = m_eva_create_evaluation_detail_process.isActive,
Created = m_eva_create_evaluation_detail_process.created,
Updated = m_eva_create_evaluation_detail_process.updated
}
).Take(100).ToList();
return data;
}
#endregion
#endregion
}
}

View File

@@ -0,0 +1,47 @@
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_processViewModel : 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 Guid? create_evaluation_id_eva_create_evaluation_performance_plan_id { get; set; }
public string org_id_external_linkage_external_name { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TodoAPI2.Models
{
public class eva_create_evaluation_detail_processWithSelectionViewModel: eva_create_evaluation_detail_processViewModel
{
public List<external_linkageViewModel> item_org_id { get; set; }
public List<eva_level_scoreViewModel> item_level_score { get; set; }
public decimal? create_evaluation_score1 { get; set; }
public decimal? create_evaluation_score2 { get; set; }
}
}