เปลี่ยนวิธีการดึงคนใหม่
This commit is contained in:
@@ -65,146 +65,7 @@ where ha.employee_id = @emp_id and ha.workingstatus = 'สถานะปฏิ
|
||||
|
||||
public List<external_employeeViewModel> GetListByemployee_type(int? employee_type, int? position_type)
|
||||
{
|
||||
var sql = string.Format(@"
|
||||
select he.employee_id as id, mpn.position_number,he.employee_no,he.position_no,
|
||||
CONCAT(htm.title_name,' ',he.firstname,' ',he.lastname) as fullname,opd.position_name,
|
||||
CONCAT(he.firstname,he.lastname) as halfname,
|
||||
orgdata.id as department_id,orgdata.department_name,orgdata.department_code,he.salary,
|
||||
he.employee_type_id, het.employee_type_name,opd.position_id as position_id,
|
||||
u.email as user_email, u.id as user_id,hpl.position_level_name,
|
||||
|
||||
he.profile_picture,
|
||||
he.position_level_id,
|
||||
he.position_type_id,
|
||||
hpl.position_level_id as hpl_position_level_id,
|
||||
hpt.position_type_id as hpt_position_type_id,
|
||||
he.position_allowance,
|
||||
he.other_money,
|
||||
|
||||
hpt.position_type_name,he.packing_date,he.cost_of_living,
|
||||
(CASE WHEN (SELECT hrm_work_rec.id FROM hrm_working_records as hrm_work_rec
|
||||
WHERE hrm_work_rec.employee_id = he.employee_id
|
||||
AND hrm_work_rec.start_date <= now()
|
||||
AND hrm_work_rec.end_date >= now()
|
||||
AND hrm_work_rec.deleted_at IS null
|
||||
LIMIT 1) IS NOT null THEN 'ช่วยปฎิบัติหน้าที่'
|
||||
ELSE null END) as remark_hrm_work_record,
|
||||
|
||||
org_type_depart.department_degree_id
|
||||
|
||||
from public.hrm_employees as he
|
||||
left join public.hrm_position_types as hpt on he.position_type_id=hpt.id
|
||||
left join public.hrm_position_levels as hpl on he.position_level_id = hpl.id
|
||||
left join public.mpp_position_numbers as mpn on he.position_no = mpn.id
|
||||
left join public.org_position_datas as opd on opd.position_id = mpn.position_id
|
||||
left join public.hrm_title_masters as htm on htm.id = he.prefix_card_name
|
||||
left join public.{0}DepartmentData{0} as orgdata on orgdata.id = he.department_id
|
||||
left join public.hrm_employee_types as het on het.id = he.employee_type_id
|
||||
left join public.users as u on u.employee_id = he.employee_id
|
||||
left join public.org_type_departments as org_type_depart on orgdata.department_type_id = org_type_depart.id
|
||||
left join public.org_type_department_colors as org_depart_color on org_type_depart.department_degree_id = org_depart_color.id
|
||||
where he.deleted_at is null
|
||||
and hpt.deleted_at is null
|
||||
and hpl.deleted_at is null
|
||||
and mpn.deleted_at is null
|
||||
and opd.deleted_at is null
|
||||
and htm.deleted_at is null
|
||||
and orgdata.deleted_at is null
|
||||
and het.deleted_at is null
|
||||
and u.deleted_at is null
|
||||
and org_type_depart.deleted_at is null
|
||||
and org_depart_color.deleted_at is null
|
||||
and he.workingstatus = 'สถานะปฏิบัติงาน'
|
||||
order by he.firstname, he.lastname;
|
||||
", '"'.ToString());
|
||||
var para = db.GetParameterListNpgsql();
|
||||
DataTable dt = db.ExecuteDataTableNpgsql(sql, para);
|
||||
var result = new List<external_employeeViewModel>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
var i = new external_employeeViewModel();
|
||||
i.id = Convert.ToInt32(dr["id"]);
|
||||
i.profile_picture = dr["profile_picture"].ToString();
|
||||
i.position_number = dr["position_number"].ToString();
|
||||
i.position_name = dr["position_name"].ToString();
|
||||
i.fullname = dr["fullname"].ToString();
|
||||
i.halfname = dr["halfname"].ToString();
|
||||
if (dr["employee_type_id"] != DBNull.Value)
|
||||
{
|
||||
i.employee_type_id = Convert.ToInt32(dr["employee_type_id"]);
|
||||
i.employee_type_name = dr["employee_type_name"].ToString();
|
||||
}
|
||||
|
||||
if (dr["position_type_id"] != DBNull.Value)
|
||||
{
|
||||
i.position_type_id = Convert.ToInt32(dr["position_type_id"]);
|
||||
i.position_type_name = dr["position_type_name"].ToString();
|
||||
i.hpt_position_type_id = Convert.ToInt32(dr["hpt_position_type_id"]);
|
||||
}
|
||||
|
||||
if (dr["position_id"] != DBNull.Value)
|
||||
{
|
||||
i.position_id = Convert.ToInt32(dr["position_id"]);
|
||||
}
|
||||
|
||||
if (dr["user_id"] != DBNull.Value)
|
||||
{
|
||||
i.user_email = dr["user_email"].ToString();
|
||||
i.user_id = Convert.ToInt32(dr["user_id"]);
|
||||
}
|
||||
if (dr["department_id"] != DBNull.Value)
|
||||
{
|
||||
i.department_id = Convert.ToInt32(dr["department_id"]);
|
||||
i.department_name = dr["department_name"].ToString();
|
||||
i.department_code = dr["department_code"].ToString();
|
||||
}
|
||||
if (dr["employee_no"] != DBNull.Value)
|
||||
{
|
||||
i.employee_no = dr["employee_no"].ToString();
|
||||
}
|
||||
if (dr["position_level_id"] != DBNull.Value)
|
||||
{
|
||||
i.position_level_id = Convert.ToInt32(dr["position_level_id"]);
|
||||
i.position_level_text = dr["position_level_name"].ToString();
|
||||
}
|
||||
if (dr["hpl_position_level_id"] != DBNull.Value)
|
||||
{
|
||||
i.hpl_position_level_id = Convert.ToInt32(dr["hpl_position_level_id"]);
|
||||
}
|
||||
i.salary = 0;
|
||||
if (dr["salary"] != DBNull.Value)
|
||||
{
|
||||
i.salary = Convert.ToDecimal(dr["salary"]);
|
||||
}
|
||||
i.cost_of_living = 0;
|
||||
if (dr["cost_of_living"] != DBNull.Value)
|
||||
{
|
||||
i.cost_of_living = Convert.ToDecimal(dr["cost_of_living"]);
|
||||
}
|
||||
if (dr["position_allowance"] != DBNull.Value)
|
||||
{
|
||||
i.position_allowance = Convert.ToDecimal(dr["position_allowance"]);
|
||||
}
|
||||
if (dr["other_money"] != DBNull.Value)
|
||||
{
|
||||
i.other_money = Convert.ToDecimal(dr["other_money"]);
|
||||
}
|
||||
if (dr["packing_date"] != DBNull.Value)
|
||||
{
|
||||
i.packing_date = Convert.ToDateTime(dr["packing_date"]);
|
||||
}
|
||||
if (dr["department_degree_id"] != DBNull.Value)
|
||||
{
|
||||
i.department_degree_id = Convert.ToInt32(dr["department_degree_id"]);
|
||||
}
|
||||
if (dr["remark_hrm_work_record"] != DBNull.Value)
|
||||
{
|
||||
i.remark_hrm_work_record = dr["remark_hrm_work_record"].ToString();
|
||||
}
|
||||
|
||||
result.Add(i);
|
||||
}
|
||||
return result;
|
||||
return GetAllEmployee();
|
||||
}
|
||||
|
||||
public List<external_employeeViewModel> GetAllEmployee()
|
||||
|
||||
Reference in New Issue
Block a user