///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L3EM_GEFTAME_1403 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3EM_GEFTAME_1403 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L3EM_GEFTAME_1403 functionReturn = new FR_L3EM_GEFTAME_1403(); try { if (cleanupConnection == true) { Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString); Connection.Open(); } if (cleanupTransaction == true) { Transaction = Connection.BeginTransaction(); } functionReturn = Execute(Connection, Transaction, Parameter, securityTicket); #region Cleanup Connection/Transaction //Commit the transaction if (cleanupTransaction == true) { Transaction.Commit(); } //Close the connection if (cleanupConnection == true) { Connection.Close(); } #endregion } catch (Exception ex) { try { if (cleanupTransaction == true && Transaction != null) { Transaction.Rollback(); } } catch { } try { if (cleanupConnection == true && Connection != null) { Connection.Close(); } } catch { } throw new Exception("Exception occured in method cls_Get_EmployeeNames_For_ManagerEmployeeID", ex); } return(functionReturn); }
protected static FR_L3EM_GEFTAME_1403 Execute(DbConnection Connection, DbTransaction Transaction, P_L3EM_GEFTAME_1403 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L3EM_GEFTAME_1403(); returnValue.Result = new L3EM_GEFTAME_1403(); L5EM_GENFT_1344[] employees = cls_Get_EmployeeNames_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result; L5EM_GENFT_1344 loggedEmployee = employees.Where(i => i.CMN_BPT_EMP_EmployeeID == Parameter.EmployeeID).FirstOrDefault(); L5CM_GCSFT_1157 company = cls_Get_Company_Structure_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result; var settingsForTenant = cls_Get_SettingProfile_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result; EmployeeUtils employeeUtils = new EmployeeUtils(); employeeUtils.ComapnyStructure = company; List <Guid> employeesUnderManager = employeeUtils.getEmployeesForManager(Parameter.appStartDate, employees, company, Parameter.EmployeeID, securityTicket.SessionTicket); employees = employees.Where(i => employeesUnderManager.Contains(i.CMN_BPT_EMP_EmployeeID) || EmployeeUtils.getEmployeeWorkplaceHistoriesFromAppStartDate(i.EmployeeWorkplaceHistory, Parameter.appStartDate).Intersect(EmployeeUtils.getEmployeeWorkplaceHistoriesFromAppStartDate(loggedEmployee.EmployeeWorkplaceHistory, Parameter.appStartDate)).Any()).ToArray(); if (employees.Where(i => i.CMN_BPT_EMP_EmployeeID == Parameter.EmployeeID).ToArray().Length == 0) { if (loggedEmployee != null) { if (employees.Length == 0) { employees = new L5EM_GENFT_1344[1]; employees[0] = loggedEmployee; } else { L5EM_GENFT_1344[] employeeList = new L5EM_GENFT_1344[employees.Length + 1]; for (int i = 0; i < employees.Length; i++) { employeeList[i] = employees[i]; } employeeList[employees.Length] = loggedEmployee; employees = employeeList; } } } returnValue.Result.Employees = employees; if (employees.Length == 0) { returnValue.Result = null; } //Put your code here return(returnValue); #endregion UserCode }