แก้ไขหลายอย่าง
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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 Isearch_employee_for_groupService
|
||||
{
|
||||
List<search_employee_for_groupViewModel> GetListByfullname(string fullname);
|
||||
List<search_employee_for_groupViewModel> GetListBySearch(search_employee_for_groupSearchModel model);
|
||||
|
||||
search_employee_for_groupWithSelectionViewModel GetBlankItem();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
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 search_employee_for_groupInputModel
|
||||
{
|
||||
|
||||
public int? id { get; set; }
|
||||
|
||||
public string employee_number { get; set; }
|
||||
|
||||
public string fullname { get; set; }
|
||||
|
||||
public int? position_id { get; set; }
|
||||
|
||||
public string level_name { get; set; }
|
||||
|
||||
public int? org_id { get; set; }
|
||||
|
||||
public string remark { 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 search_employee_for_groupReportRequestModel : search_employee_for_groupSearchModel
|
||||
{
|
||||
public string filetype { get; set; }
|
||||
|
||||
public string contentType { get { return MyHelper.GetContentType(filetype); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
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 search_employee_for_groupSearchModel
|
||||
{
|
||||
|
||||
public int id { get; set; }
|
||||
|
||||
public string employee_number { get; set; }
|
||||
|
||||
public string fullname { get; set; }
|
||||
|
||||
public int? position_id { get; set; }
|
||||
|
||||
public int? org_id { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
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 search_employee_for_groupService : Isearch_employee_for_groupService
|
||||
{
|
||||
private IBaseRepository2<eva_create_evaluationEntity, int> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
|
||||
public search_employee_for_groupService(IBaseRepository2<eva_create_evaluationEntity, int> repository,
|
||||
IMyDatabase mydb,
|
||||
Iexternal_linkageService inext,
|
||||
Iexternal_employeeService inemp)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
}
|
||||
|
||||
|
||||
public search_employee_for_groupWithSelectionViewModel GetBlankItem()
|
||||
{
|
||||
var i = new search_employee_for_groupWithSelectionViewModel();
|
||||
i.item_position_id = (from x in ext.Gethrm_position_types() orderby x.external_name select x).ToList();
|
||||
i.item_org_id = (from x in ext.GetDepartmentData() orderby x.external_name select x).ToList();
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public List<search_employee_for_groupViewModel> GetListByfullname(string fullname)
|
||||
{
|
||||
var model = new search_employee_for_groupSearchModel();
|
||||
model.fullname = fullname;
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
public List<search_employee_for_groupViewModel> GetListBySearch(search_employee_for_groupSearchModel model)
|
||||
{
|
||||
var allemp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
var data = (
|
||||
from m_search_employee_for_group in allemp
|
||||
|
||||
where 1 == 1
|
||||
&& (string.IsNullOrEmpty(model.employee_number) || (!string.IsNullOrEmpty(model.employee_number) && m_search_employee_for_group.employee_no.Contains(model.employee_number)))
|
||||
&& (string.IsNullOrEmpty(model.fullname) || (!string.IsNullOrEmpty(model.fullname) && m_search_employee_for_group.fullname.Contains(model.fullname)))
|
||||
&& (m_search_employee_for_group.position_type_id == model.position_id || !model.position_id.HasValue)
|
||||
&& (m_search_employee_for_group.department_id == model.org_id || !model.org_id.HasValue)
|
||||
|
||||
orderby m_search_employee_for_group.fullname
|
||||
select new search_employee_for_groupViewModel()
|
||||
{
|
||||
id = m_search_employee_for_group.id,
|
||||
employee_number = m_search_employee_for_group.employee_no,
|
||||
fullname = m_search_employee_for_group.fullname,
|
||||
position_id = m_search_employee_for_group.position_type_id,
|
||||
level_name = m_search_employee_for_group.position_level_text,
|
||||
org_id = m_search_employee_for_group.department_id,
|
||||
remark = m_search_employee_for_group.user_email,
|
||||
|
||||
position_id_external_linkage_external_name = m_search_employee_for_group.position_name,
|
||||
org_id_external_linkage_external_name = m_search_employee_for_group.department_name,
|
||||
|
||||
isActive = true,
|
||||
Created = null,
|
||||
Updated = null
|
||||
}
|
||||
).ToList();
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
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 search_employee_for_groupViewModel : BaseViewModel2<int>
|
||||
{
|
||||
|
||||
public string employee_number { get; set; }
|
||||
|
||||
public string fullname { get; set; }
|
||||
|
||||
public int? position_id { get; set; }
|
||||
|
||||
public string level_name { get; set; }
|
||||
|
||||
public int? org_id { get; set; }
|
||||
|
||||
public string remark { get; set; }
|
||||
|
||||
public string position_id_external_linkage_external_name { get; set; }
|
||||
public string org_id_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 search_employee_for_groupWithSelectionViewModel: search_employee_for_groupViewModel
|
||||
{
|
||||
public List<external_linkageViewModel> item_position_id { get; set; }
|
||||
public List<external_linkageViewModel> item_org_id { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user