protected static FR_L5EM_GEALRDFIDL_1138_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5EM_GEALRDFIDL_1138 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5EM_GEALRDFIDL_1138_Array(); List <L5EM_GEALRDFIDL_1138> resultList = new List <L5EM_GEALRDFIDL_1138>(); //Put your code here L5EM_GEAAWCFT_1210[] allEmployees = cls_Get_Employees_And_ActiveWorkingContracts_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result; L5AR_GART_1118[] allReasons = cls_Get_AbsenceReasons_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result; foreach (var employeeID in Parameter.EmployeeIDList) { L5EM_GEALRDFIDL_1138 result = new L5EM_GEALRDFIDL_1138(); L5EM_GEAAWCFT_1210 employee = allEmployees.Where(x => x.CMN_BPT_EMP_EmployeeID == employeeID).FirstOrDefault(); if (employee == null) { continue; } result.FirstName = employee.FirstName; result.LastName = employee.LastName; result.CMN_BPT_BusinessParticipantID = employee.CMN_BPT_BusinessParticipantID; result.CMN_BPT_EMP_EmployeeID = employee.CMN_BPT_EMP_EmployeeID; result.CMN_BPT_EMP_EmploymentRelationshipID = employee.CMN_BPT_EMP_EmploymentRelationshipID; result.Work_StartDate = employee.Work_StartDate; result.Work_EndDate = employee.Work_EndDate; result.CMN_BPT_EMP_WorkingContractID = employee.ActiveWorkingContract.CMN_BPT_EMP_WorkingContractID; result.IsContractEndDateDefined = employee.ActiveWorkingContract.IsContractEndDateDefined; result.IsWorkTimeCalculated_InDays = employee.ActiveWorkingContract.IsWorkTimeCalculated_InDays; result.IsWorkTimeCalculated_InHours = employee.ActiveWorkingContract.IsWorkTimeCalculated_InHours; result.Contract_StartDate = employee.ActiveWorkingContract.Contract_StartDate; result.Contract_EndDate = employee.ActiveWorkingContract.Contract_EndDate; result.R_WorkTime_DaysPerWeek = employee.ActiveWorkingContract.R_WorkTime_DaysPerWeek; result.R_WorkTime_HoursPerWeek = employee.ActiveWorkingContract.R_WorkTime_HoursPerWeek; List <L5EM_GEALRDFIDL_1138_WeeklyOfficeHour> weeklyOfficeHoursResult = new List <L5EM_GEALRDFIDL_1138_WeeklyOfficeHour>(); foreach (var weeklyOfficeHours in employee.ActiveWorkingContract.WeeklyOfficeHours) { L5EM_GEALRDFIDL_1138_WeeklyOfficeHour weeklyOfficeHourInterval = new L5EM_GEALRDFIDL_1138_WeeklyOfficeHour(); weeklyOfficeHourInterval.CMN_CAL_WeeklyOfficeHours_IntervalID = weeklyOfficeHours.CMN_CAL_WeeklyOfficeHours_IntervalID; weeklyOfficeHourInterval.IsWholeDay = weeklyOfficeHours.IsWholeDay; weeklyOfficeHourInterval.TimeFrom_InMinutes = weeklyOfficeHours.TimeFrom_InMinutes; weeklyOfficeHourInterval.TimeTo_InMinutes = weeklyOfficeHours.TimeTo_InMinutes; weeklyOfficeHourInterval.IsMonday = weeklyOfficeHours.IsMonday; weeklyOfficeHourInterval.IsTuesday = weeklyOfficeHours.IsTuesday; weeklyOfficeHourInterval.IsWednesday = weeklyOfficeHours.IsWednesday; weeklyOfficeHourInterval.IsThursday = weeklyOfficeHours.IsThursday; weeklyOfficeHourInterval.IsFriday = weeklyOfficeHours.IsFriday; weeklyOfficeHourInterval.IsSaturday = weeklyOfficeHours.IsSaturday; weeklyOfficeHourInterval.IsSunday = weeklyOfficeHours.IsSunday; weeklyOfficeHoursResult.Add(weeklyOfficeHourInterval); } result.WeeklyOfficeHours = weeklyOfficeHoursResult.ToArray(); P_L5EM_GAFE_1216 adjustmentsParam = new P_L5EM_GAFE_1216(); adjustmentsParam.EmployeeID = employeeID; L5EM_GAFE_1216[] adjustmentsForEmployee = cls_get_Adjustments_For_Employee.Invoke(Connection, Transaction, adjustmentsParam, securityTicket).Result; List <L5EM_GEALRDFIDL_1138_WorkingContract2LeaveRequest> workingContract2LeaveRequestResult = new List <L5EM_GEALRDFIDL_1138_WorkingContract2LeaveRequest>(); List <L5EM_GEALRDFIDL_1138_EmployeeWorkplaceHistory> employeeWorkplaceAssignments = new List <L5EM_GEALRDFIDL_1138_EmployeeWorkplaceHistory>(); foreach (var workplaceAssignemns in employee.EmployeeWorkplaceHistory) { L5EM_GEALRDFIDL_1138_EmployeeWorkplaceHistory item = new L5EM_GEALRDFIDL_1138_EmployeeWorkplaceHistory(); item.BoundTo_Workplace_RefID = workplaceAssignemns.BoundTo_Workplace_RefID; item.CMN_BPT_EMP_Employee_PlanGroup_RefID = workplaceAssignemns.CMN_BPT_EMP_Employee_PlanGroup_RefID; item.CMN_BPT_EMP_Employee_WorkplaceAssignmentID = workplaceAssignemns.CMN_BPT_EMP_Employee_WorkplaceAssignmentID; item.Default_BreakTime_Template_RefID = workplaceAssignemns.Default_BreakTime_Template_RefID; item.IsBreakTimeCalculated_Actual = workplaceAssignemns.IsBreakTimeCalculated_Actual; item.IsBreakTimeCalculated_Planning = workplaceAssignemns.IsBreakTimeCalculated_Planning; item.SequenceNumber = workplaceAssignemns.SequenceNumber; item.WorkplaceAssignment_StartDate = workplaceAssignemns.WorkplaceAssignment_StartDate; employeeWorkplaceAssignments.Add(item); } result.EmployeeWorkplaceHistory = employeeWorkplaceAssignments.ToArray(); foreach (var absence in employee.ActiveWorkingContract.WorkingContract2LeaveRequest) { L5EM_GEALRDFIDL_1138_WorkingContract2LeaveRequest workingContract2LeaveRequest = new L5EM_GEALRDFIDL_1138_WorkingContract2LeaveRequest(); L5AR_GART_1118 reason = allReasons.Where(x => x.CMN_BPT_STA_AbsenceReasonID == absence.STA_AbsenceReason_RefID).FirstOrDefault(); if (reason == null) { continue; } workingContract2LeaveRequest.CMN_BPT_EMP_Employee_WorkingContract_AllowedAbsenceReasonID = absence.CMN_BPT_EMP_Employee_WorkingContract_AllowedAbsenceReasonID; workingContract2LeaveRequest.IsAbsenceCalculated_InDays = absence.IsAbsenceCalculated_InDays; workingContract2LeaveRequest.IsAbsenceCalculated_InHours = absence.IsAbsenceCalculated_InHours; workingContract2LeaveRequest.ContractAllowedAbsence_per_Month = absence.ContractAllowedAbsence_per_Month; workingContract2LeaveRequest.AbsenceReasonName = reason.ReasonName; workingContract2LeaveRequest.CMN_BPT_STA_AbsenceReasonID = reason.CMN_BPT_STA_AbsenceReasonID; workingContract2LeaveRequest.AbsenceReason_ParentID = reason.Parent_RefID; workingContract2LeaveRequest.IsAuthorizationRequired = reason.IsAuthorizationRequired; workingContract2LeaveRequest.IsIncludedInCapacityCalculation = reason.IsIncludedInCapacityCalculation; workingContract2LeaveRequest.IsAllowedAbsence = reason.IsAllowedAbsence; workingContract2LeaveRequest.IsDeactivated = reason.IsDeactivated; workingContract2LeaveRequest.IsCarryOverEnabled = reason.IsCarryOverEnabled; L5EM_GAFE_1216[] adjustmentsForAbsenceReason = adjustmentsForEmployee.Where(x => x.CMN_BPT_STA_AbsenceReasonID == workingContract2LeaveRequest.CMN_BPT_STA_AbsenceReasonID).ToArray(); List <L5EM_GEALRDFIDL_1138_adjustments> adjustmentsResult = new List <L5EM_GEALRDFIDL_1138_adjustments>(); foreach (var adjustment in adjustmentsForAbsenceReason) { L5EM_GEALRDFIDL_1138_adjustments adjustmentResult = new L5EM_GEALRDFIDL_1138_adjustments(); adjustmentResult.CMN_BPT_EMP_ContractAbsenceAdjustmentID = adjustment.CMN_BPT_EMP_ContractAbsenceAdjustmentID; adjustmentResult.AbsenceTime_InMinutes = adjustment.AbsenceTime_InMinutes; adjustmentResult.ContractAbsenceAdjustment_Group_RefID = adjustment.CMN_BPT_EMP_ContractAbsenceAdjustment_GroupID; adjustmentResult.IsManual = adjustment.IsManual; adjustmentResult.TriggeringAccount_RefID = adjustment.TriggeringAccount_RefID; adjustmentResult.AdjustmentComment = adjustment.AdjustmentComment; adjustmentResult.AdjustmentDate = adjustment.AdjustmentDate; adjustmentsResult.Add(adjustmentResult); } workingContract2LeaveRequest.Adjustments = adjustmentsResult.ToArray(); workingContract2LeaveRequestResult.Add(workingContract2LeaveRequest); } result.WorkingContract2LeaveRequest = workingContract2LeaveRequestResult.ToArray(); resultList.Add(result); } returnValue.Result = resultList.ToArray(); return(returnValue); #endregion UserCode }
protected static FR_L5EM_GAFE_1216_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5EM_GAFE_1216 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L5EM_GAFE_1216_Array(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL5_VacationPlanner_Employees.Atomic.Retrieval.SQL.cls_get_Adjustments_For_Employee.sql"; command.CommandText = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(commandLocation)).ReadToEnd(); CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ticket", securityTicket); command.CommandTimeout = QueryTimeout; CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "EmployeeID", Parameter.EmployeeID); List <L5EM_GAFE_1216> results = new List <L5EM_GAFE_1216>(); var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction); var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader()); try { reader.SetOrdinals(new string[] { "CMN_BPT_EMP_ContractAbsenceAdjustment_GroupID", "AbsenceAdjustment_Comment", "CMN_BPT_EMP_ContractAbsenceAdjustmentID", "AbsenceTime_InMinutes", "AdjustmentComment", "TriggeringAccount_RefID", "IsManual", "InternalAdjustmentType", "AdjustmentDate", "Name_DictID", "CMN_BPT_STA_AbsenceReasonID", "CMN_BPT_EMP_EmploymentRelationship_TimeframeID", "CMN_CAL_CalculationTimeframeID", "CalculationTimeframe_StartDate", "CalculationTimefrate_EndDate", "CalculationTimeframe_EstimatedEndDate", "IsCalculationTimeframe_Active", "CMN_BPT_EMP_EmploymentRelationshipID", "HasWorkRelationEnded", "Work_StartDate", "Work_EndDate", "IsLockedFor_TemplateUpdates", "InstanceOf_EmploymentRelationships_Template_RefID", "StandardFunction", "Staff_Number", "BusinessParticipant_RefID", "CMN_BPT_EMP_EmployeeID", "EmployeeDocument_Structure_RefID", "Creation_Timestamp" }); while (reader.Read()) { L5EM_GAFE_1216 resultItem = new L5EM_GAFE_1216(); //0:Parameter CMN_BPT_EMP_ContractAbsenceAdjustment_GroupID of type Guid resultItem.CMN_BPT_EMP_ContractAbsenceAdjustment_GroupID = reader.GetGuid(0); //1:Parameter AbsenceAdjustment_Comment of type String resultItem.AbsenceAdjustment_Comment = reader.GetString(1); //2:Parameter CMN_BPT_EMP_ContractAbsenceAdjustmentID of type Guid resultItem.CMN_BPT_EMP_ContractAbsenceAdjustmentID = reader.GetGuid(2); //3:Parameter AbsenceTime_InMinutes of type int resultItem.AbsenceTime_InMinutes = reader.GetInteger(3); //4:Parameter AdjustmentComment of type String resultItem.AdjustmentComment = reader.GetString(4); //5:Parameter TriggeringAccount_RefID of type Guid resultItem.TriggeringAccount_RefID = reader.GetGuid(5); //6:Parameter IsManual of type bool resultItem.IsManual = reader.GetBoolean(6); //7:Parameter InternalAdjustmentType of type String resultItem.InternalAdjustmentType = reader.GetString(7); //8:Parameter AdjustmentDate of type DateTime resultItem.AdjustmentDate = reader.GetDate(8); //9:Parameter Name of type Dict resultItem.Name = reader.GetDictionary(9); resultItem.Name.SourceTable = "cmn_bpt_sta_absencereasons"; loader.Append(resultItem.Name); //10:Parameter CMN_BPT_STA_AbsenceReasonID of type Guid resultItem.CMN_BPT_STA_AbsenceReasonID = reader.GetGuid(10); //11:Parameter CMN_BPT_EMP_EmploymentRelationship_TimeframeID of type Guid resultItem.CMN_BPT_EMP_EmploymentRelationship_TimeframeID = reader.GetGuid(11); //12:Parameter CMN_CAL_CalculationTimeframeID of type Guid resultItem.CMN_CAL_CalculationTimeframeID = reader.GetGuid(12); //13:Parameter CalculationTimeframe_StartDate of type DateTime resultItem.CalculationTimeframe_StartDate = reader.GetDate(13); //14:Parameter CalculationTimefrate_EndDate of type DateTime resultItem.CalculationTimefrate_EndDate = reader.GetDate(14); //15:Parameter CalculationTimeframe_EstimatedEndDate of type DateTime resultItem.CalculationTimeframe_EstimatedEndDate = reader.GetDate(15); //16:Parameter IsCalculationTimeframe_Active of type bool resultItem.IsCalculationTimeframe_Active = reader.GetBoolean(16); //17:Parameter CMN_BPT_EMP_EmploymentRelationshipID of type Guid resultItem.CMN_BPT_EMP_EmploymentRelationshipID = reader.GetGuid(17); //18:Parameter HasWorkRelationEnded of type bool resultItem.HasWorkRelationEnded = reader.GetBoolean(18); //19:Parameter Work_StartDate of type DateTime resultItem.Work_StartDate = reader.GetDate(19); //20:Parameter Work_EndDate of type DateTime resultItem.Work_EndDate = reader.GetDate(20); //21:Parameter IsLockedFor_TemplateUpdates of type bool resultItem.IsLockedFor_TemplateUpdates = reader.GetBoolean(21); //22:Parameter InstanceOf_EmploymentRelationships_Template_RefID of type Guid resultItem.InstanceOf_EmploymentRelationships_Template_RefID = reader.GetGuid(22); //23:Parameter StandardFunction of type String resultItem.StandardFunction = reader.GetString(23); //24:Parameter Staff_Number of type String resultItem.Staff_Number = reader.GetString(24); //25:Parameter BusinessParticipant_RefID of type Guid resultItem.BusinessParticipant_RefID = reader.GetGuid(25); //26:Parameter CMN_BPT_EMP_EmployeeID of type Guid resultItem.CMN_BPT_EMP_EmployeeID = reader.GetGuid(26); //27:Parameter EmployeeDocument_Structure_RefID of type Guid resultItem.EmployeeDocument_Structure_RefID = reader.GetGuid(27); //28:Parameter Creation_Timestamp of type DateTime resultItem.Creation_Timestamp = reader.GetDate(28); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_get_Adjustments_For_Employee", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = results.ToArray(); return(returnStatus); }
///<summary> /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured ///<summary> public static FR_L5EM_GAFE_1216_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L5EM_GAFE_1216 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5EM_GAFE_1216_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5EM_GAFE_1216 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5EM_GAFE_1216_Array functionReturn = new FR_L5EM_GAFE_1216_Array(); 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_Adjustments_For_Employee", ex); } return(functionReturn); }
///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L5EM_GAFE_1216_Array Invoke(string ConnectionString, P_L5EM_GAFE_1216 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }