From f8882b172ba41e409495f126f225b81d4a660042 Mon Sep 17 00:00:00 2001 From: mashfiq Date: Thu, 27 Feb 2025 17:11:40 +0600 Subject: [PATCH] Bangla Info and Employee serach --- HRM.DA/DA/Employee/EmployeeDA.cs | 3 ++- HRM.DA/DA/SearchReport/SearchEmployeeDA.cs | 5 +++-- .../general/general.component.html | 10 +++++----- .../general/general.component.ts | 3 ++- .../Employee/EmployeeController.cs | 19 ++++++++++++++++--- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/HRM.DA/DA/Employee/EmployeeDA.cs b/HRM.DA/DA/Employee/EmployeeDA.cs index cb75831..aedec39 100644 --- a/HRM.DA/DA/Employee/EmployeeDA.cs +++ b/HRM.DA/DA/Employee/EmployeeDA.cs @@ -730,7 +730,8 @@ namespace HRM.DA } internal static void UpdateBanglaContactInformation(TransactionContext tc, List employeBanglaInfo) { - tc.ExecuteNonQuery("UPDATE EMPCONTACT SET presentPOInBangla = %s, presentAddressInBangla = %s, parmanentPOInBangla = %s, permanentAddressInBangla =%s WHERE EMPLOYEEID = %s", employeBanglaInfo[1], employeBanglaInfo[2], employeBanglaInfo[3], employeBanglaInfo[4], employeBanglaInfo[0]); + string sql = SQLParser.MakeSQL("UPDATE EMPCONTACT SET presentPOInBangla = %s, presentAddressInBangla = %s, parmanentPOInBangla = %s, permanentAddressInBangla =%s WHERE EMPLOYEEID = %n", employeBanglaInfo[1], employeBanglaInfo[2], employeBanglaInfo[3], employeBanglaInfo[4], employeBanglaInfo[0]); + tc.ExecuteNonQuery(sql); } internal static IDataReader GetByEmpIDs(TransactionContext tc, string empIDs) diff --git a/HRM.DA/DA/SearchReport/SearchEmployeeDA.cs b/HRM.DA/DA/SearchReport/SearchEmployeeDA.cs index 5448128..20dc698 100644 --- a/HRM.DA/DA/SearchReport/SearchEmployeeDA.cs +++ b/HRM.DA/DA/SearchReport/SearchEmployeeDA.cs @@ -374,9 +374,10 @@ END;"; //orderby = "EmployeeNo"; //Using TOP - sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("EmployeeNo LIKE %s", ( code + "%")); + //sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("EmployeeNo LIKE %s", ( code + "%")); // Using LIKE Operator + sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("EmployeeNo = %s", ( code)); // Without Using LIKE Operator orderby = "EmployeeNo"; - top = "TOP 15"; + top = "TOP 5"; //Without suggestion //sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("EmployeeNo = %s", code ); diff --git a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.html b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.html index 47395bf..b99f631 100644 --- a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.html +++ b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.html @@ -534,12 +534,12 @@ class="bangla-font" pInputText style="width:100%" type="text"> -
+
diff --git a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.ts b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.ts index 0c16708..af72077 100644 --- a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.ts +++ b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.ts @@ -578,8 +578,9 @@ export class GeneralComponent implements OnInit { ) } SaveBanglaContactInformation() { + this.saveBanglaPersonalInformation(); const data = { - employeeNo: this.employeeService.hrEmployee.employeeNo, + employeeID: this.employeeService.hrEmployee.id, presentPOInBangla: this.contact.presentPOInBangla, presentAddressInBangla: this.contact.presentAddressInBangla, parmanentPOInBangla: this.contact.parmanentPOInBangla, diff --git a/HRM.UI/Controllers/Employee/EmployeeController.cs b/HRM.UI/Controllers/Employee/EmployeeController.cs index 9633749..235bc5f 100644 --- a/HRM.UI/Controllers/Employee/EmployeeController.cs +++ b/HRM.UI/Controllers/Employee/EmployeeController.cs @@ -2085,7 +2085,7 @@ namespace HRM.UI.Controllers CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User); var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data)); - string employeeNo = (string)item["employeeNo"].ToObject(); + int employeeID = Convert.ToInt32(item["employeeID"].ToObject()); string presentPOInBangla = (string)item["presentPOInBangla"].ToObject(); string presentAddressInBangla = (string)item["presentAddressInBangla"].ToObject(); string parmanentPOInBangla = (string)item["parmanentPOInBangla"].ToObject(); @@ -2095,7 +2095,7 @@ namespace HRM.UI.Controllers int ModifiedBy = currentUser.UserID; List employeBanglaInfo = new List(); - employeBanglaInfo.Add(employeeNo); + employeBanglaInfo.Add(employeeID); employeBanglaInfo.Add(presentPOInBangla); employeBanglaInfo.Add(presentAddressInBangla); employeBanglaInfo.Add(parmanentPOInBangla); @@ -2105,7 +2105,20 @@ namespace HRM.UI.Controllers try { - new EmployeeService().UpdateBanglaContactInformation(employeBanglaInfo); + EmpContact contact = _hrEmployeeService.GetEmpContacts(employeeID).FirstOrDefault(); + + if(contact != null) + new EmployeeService().UpdateBanglaContactInformation(employeBanglaInfo); + else + { + EmpContact ec = new EmpContact(); + ec.EmployeeID = employeeID; + ec.PresentPOInBangla = presentPOInBangla; + ec.ParmanentPOInBangla = parmanentPOInBangla; + ec.PresentAddressInBangla = presentAddressInBangla; + ec.PermanentAddressInBangla = presentAddressInBangla; + _hrEmployeeService.SaveContact(ec); + } } catch (Exception ex) {