employee search ordered and lenth addition

This commit is contained in:
mashfiq 2024-12-10 17:01:26 +06:00
parent 6a436e9b3c
commit b3aaed7af4
2 changed files with 19 additions and 3 deletions

View File

@ -438,12 +438,13 @@ export class EmployeePickerComponent implements OnInit {
}
handleFilter(value) {
debugger
const str: string = value;
if (value.length === 0 || this.empCodeNameList === undefined) {
this.empCodeNameList = [];
this.empCodeNameListSource = [];
}
if (str !== '') {
if (str !== '' && str.length > 2) {
this.empCodeNameList = [];
/*if (this.empCodeNameList.length === 0) {*/
let code = '';

View File

@ -17,6 +17,7 @@ using Microsoft.Extensions.Options;
using static Azure.Core.HttpHeader;
using iTextSharp.text;
using static iTextSharp.text.pdf.AcroFields;
using Org.BouncyCastle.Utilities;
namespace HRM.UI.Controllers
{
@ -732,8 +733,21 @@ namespace HRM.UI.Controllers
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
List<SearchEmployee> olist = new List<SearchEmployee>();
try
{
//olist = _serachManager.FindEmpCodeName((int) currentUser.PayrollTypeID, code, name);
if(code != "")
{
List<SearchEmployee> unorderedList = _serachManager.FindEmpCodeName((int)currentUser.PayrollTypeID, code, name);
olist = unorderedList
.OrderBy(item => item.EmployeeNo != code) // False (0) for priority value, True (1) for others
.ThenBy(item => item.EmployeeNo).ToList();
}
else
{
olist = _serachManager.FindEmpCodeName((int)currentUser.PayrollTypeID, code, name);
}
//List<Grade> grades = new GradeService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
//List<Designation> designations = new DesignationService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
//List<Department> departments = new DepartmentService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
@ -746,7 +760,8 @@ namespace HRM.UI.Controllers
// if (designation != null) x.designationName = designation.Name;
// var department = departments.FirstOrDefault(d => d.ID == x.DepartmentID);
// if (department != null) x.departmentName = department.Name;
//});
//}); // Secondary ordering (alphabetical)
}
catch (Exception ex)
{