diff --git a/HRM.UI/ClientApp/src/app/picker/employee-picker.component.ts b/HRM.UI/ClientApp/src/app/picker/employee-picker.component.ts index 763a9ba..fe87d77 100644 --- a/HRM.UI/ClientApp/src/app/picker/employee-picker.component.ts +++ b/HRM.UI/ClientApp/src/app/picker/employee-picker.component.ts @@ -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 = ''; diff --git a/HRM.UI/Controllers/Employee/EmployeeController.cs b/HRM.UI/Controllers/Employee/EmployeeController.cs index 9358322..a74efa6 100644 --- a/HRM.UI/Controllers/Employee/EmployeeController.cs +++ b/HRM.UI/Controllers/Employee/EmployeeController.cs @@ -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 { @@ -733,7 +734,20 @@ namespace HRM.UI.Controllers List olist = new List(); try { - olist = _serachManager.FindEmpCodeName((int) currentUser.PayrollTypeID, code, name); + //olist = _serachManager.FindEmpCodeName((int) currentUser.PayrollTypeID, code, name); + if(code != "") + { + List 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 grades = new GradeService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID); //List designations = new DesignationService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID); //List 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) {