protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5EM_SEA_1409 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); ORM_CMN_BPT_EMP_ContractAbsenceAdjustment adjustment = new ORM_CMN_BPT_EMP_ContractAbsenceAdjustment(); if (Parameter.AdjustmentID != Guid.Empty) { var result = adjustment.Load(Connection, Transaction, Parameter.AdjustmentID); if (result.Status != FR_Status.Success || adjustment.CMN_BPT_EMP_ContractAbsenceAdjustmentID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } Guid workingContractTimeFrameID = Guid.Empty; var timeFrame = cls_Get_CalculationTimeFramesForTenant.Invoke(Connection, Transaction, securityTicket).Result.Where(x => x.CalculationTimeframe_StartDate.Year == Parameter.Year).FirstOrDefault(); if (timeFrame == null) { ORM_CMN_CAL_CalculationTimeframe timeFramePar = new ORM_CMN_CAL_CalculationTimeframe(); timeFramePar.CalculationTimeframe_StartDate = new DateTime(Parameter.Year, 1, 1); timeFramePar.CalculationTimefrate_EndDate = new DateTime(0); timeFramePar.CalculationTimeframe_EstimatedEndDate = new DateTime(Parameter.Year, 12, 31); timeFramePar.IsCalculationTimeframe_Active = false; timeFramePar.Tenant_RefID = securityTicket.TenantID; timeFramePar.Save(Connection, Transaction); L5EM_GEFT_0959[] employees = cls_Get_Employees_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result; foreach (var emp in employees) { ORM_CMN_BPT_EMP_EmploymentRelationship_Timeframe workingContractTimeFrame = new ORM_CMN_BPT_EMP_EmploymentRelationship_Timeframe(); workingContractTimeFrame.CalculationTimeframe_RefID = timeFramePar.CMN_CAL_CalculationTimeframeID; workingContractTimeFrame.EmploymentRelationship_RefID = emp.CMN_BPT_EMP_EmploymentRelationshipID; workingContractTimeFrame.Tenant_RefID = securityTicket.TenantID; workingContractTimeFrame.Save(Connection, Transaction); if (emp.CMN_BPT_EMP_EmployeeID == Parameter.EmployeeID) { workingContractTimeFrameID = workingContractTimeFrame.CMN_BPT_EMP_EmploymentRelationship_TimeframeID; } } } else { P_L5EM_GERTFFETF_1129 param = new P_L5EM_GERTFFETF_1129(); param.EmployeeID = Parameter.EmployeeID; param.CalculationTimeframeID = timeFrame.CMN_CAL_CalculationTimeframeID; L5EM_GERTFFETF_1129 workingContractTimeFrame = cls_Get_EmploymentRelationshipTimeFrame_For_Employee_And_TimeFrame.Invoke(Connection, Transaction, param, securityTicket).Result; if (workingContractTimeFrame == null) { P_L5EM_GEFE_1150 empPar = new P_L5EM_GEFE_1150(); empPar.EmployeeID = Parameter.EmployeeID; L5EM_GEFE_1150 employee = cls_Get_Employee_For_EmployeeID.Invoke(Connection, Transaction, empPar, securityTicket).Result; ORM_CMN_BPT_EMP_EmploymentRelationship_Timeframe workingContractTimeFrameNew = new ORM_CMN_BPT_EMP_EmploymentRelationship_Timeframe(); workingContractTimeFrameNew.CalculationTimeframe_RefID = timeFrame.CMN_CAL_CalculationTimeframeID; workingContractTimeFrameNew.EmploymentRelationship_RefID = employee.CMN_BPT_EMP_EmploymentRelationshipID; workingContractTimeFrameNew.Tenant_RefID = securityTicket.TenantID; workingContractTimeFrameNew.Save(Connection, Transaction); workingContractTimeFrameID = workingContractTimeFrameNew.CMN_BPT_EMP_EmploymentRelationship_TimeframeID; } else { workingContractTimeFrameID = workingContractTimeFrame.CMN_BPT_EMP_EmploymentRelationship_TimeframeID; } } adjustment.AbsenceTime_InMinutes = Parameter.AbsenceTimeInMinutes; adjustment.AdjustmentComment = Parameter.AdjustmentComment; adjustment.AbsenceReason_RefID = Parameter.AbsenceReasonID; adjustment.EmploymentRelationship_Timeframe_RefID = workingContractTimeFrameID; adjustment.IsManual = Parameter.isManual; adjustment.InternalAdjustmentType = Parameter.InternalAdjustmentType; adjustment.TriggeringAccount_RefID = securityTicket.AccountID; adjustment.AdjustmentDate = Parameter.AdjustmentDate; adjustment.Tenant_RefID = securityTicket.TenantID; adjustment.IsDeleted = Parameter.isDeleted; adjustment.Save(Connection, Transaction); returnValue.Result = adjustment.CMN_BPT_EMP_ContractAbsenceAdjustmentID; //Put your code here return(returnValue); #endregion UserCode }
protected static FR_L5EM_GERTFFETF_1129 Execute(DbConnection Connection, DbTransaction Transaction, P_L5EM_GERTFFETF_1129 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L5EM_GERTFFETF_1129(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL5_VacationPlanner_Employees.Atomic.Retrieval.SQL.cls_Get_EmploymentRelationshipTimeFrame_For_Employee_And_TimeFrame.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, "CalculationTimeframeID", Parameter.CalculationTimeframeID); CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "EmployeeID", Parameter.EmployeeID); List <L5EM_GERTFFETF_1129> results = new List <L5EM_GERTFFETF_1129>(); 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_CAL_CalculationTimeframeID", "CalculationTimeframe_StartDate", "CalculationTimefrate_EndDate", "CalculationTimeframe_EstimatedEndDate", "IsCalculationTimeframe_Active", "CMN_BPT_EMP_EmploymentRelationship_TimeframeID", "CalculationTimeframe_RefID", "CMN_BPT_EMP_EmploymentRelationshipID", "HasWorkRelationEnded", "Work_StartDate", "Work_EndDate", "IsLockedFor_TemplateUpdates", "InstanceOf_EmploymentRelationships_Template_RefID", "CMN_BPT_EMP_EmployeeID", "BusinessParticipant_RefID", "Staff_Number", "StandardFunction", "EmployeeDocument_Structure_RefID" }); while (reader.Read()) { L5EM_GERTFFETF_1129 resultItem = new L5EM_GERTFFETF_1129(); //0:Parameter CMN_CAL_CalculationTimeframeID of type Guid resultItem.CMN_CAL_CalculationTimeframeID = reader.GetGuid(0); //1:Parameter CalculationTimeframe_StartDate of type DateTime resultItem.CalculationTimeframe_StartDate = reader.GetDate(1); //2:Parameter CalculationTimefrate_EndDate of type DateTime resultItem.CalculationTimefrate_EndDate = reader.GetDate(2); //3:Parameter CalculationTimeframe_EstimatedEndDate of type DateTime resultItem.CalculationTimeframe_EstimatedEndDate = reader.GetDate(3); //4:Parameter IsCalculationTimeframe_Active of type bool resultItem.IsCalculationTimeframe_Active = reader.GetBoolean(4); //5:Parameter CMN_BPT_EMP_EmploymentRelationship_TimeframeID of type Guid resultItem.CMN_BPT_EMP_EmploymentRelationship_TimeframeID = reader.GetGuid(5); //6:Parameter CalculationTimeframe_RefID of type Guid resultItem.CalculationTimeframe_RefID = reader.GetGuid(6); //7:Parameter CMN_BPT_EMP_EmploymentRelationshipID of type Guid resultItem.CMN_BPT_EMP_EmploymentRelationshipID = reader.GetGuid(7); //8:Parameter HasWorkRelationEnded of type bool resultItem.HasWorkRelationEnded = reader.GetBoolean(8); //9:Parameter Work_StartDate of type DateTime resultItem.Work_StartDate = reader.GetDate(9); //10:Parameter Work_EndDate of type DateTime resultItem.Work_EndDate = reader.GetDate(10); //11:Parameter IsLockedFor_TemplateUpdates of type bool resultItem.IsLockedFor_TemplateUpdates = reader.GetBoolean(11); //12:Parameter InstanceOf_EmploymentRelationships_Template_RefID of type Guid resultItem.InstanceOf_EmploymentRelationships_Template_RefID = reader.GetGuid(12); //13:Parameter CMN_BPT_EMP_EmployeeID of type Guid resultItem.CMN_BPT_EMP_EmployeeID = reader.GetGuid(13); //14:Parameter BusinessParticipant_RefID of type Guid resultItem.BusinessParticipant_RefID = reader.GetGuid(14); //15:Parameter Staff_Number of type String resultItem.Staff_Number = reader.GetString(15); //16:Parameter StandardFunction of type String resultItem.StandardFunction = reader.GetString(16); //17:Parameter EmployeeDocument_Structure_RefID of type Guid resultItem.EmployeeDocument_Structure_RefID = reader.GetGuid(17); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_Get_EmploymentRelationshipTimeFrame_For_Employee_And_TimeFrame", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = results.FirstOrDefault(); 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_GERTFFETF_1129 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5EM_GERTFFETF_1129 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5EM_GERTFFETF_1129 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5EM_GERTFFETF_1129 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5EM_GERTFFETF_1129 functionReturn = new FR_L5EM_GERTFFETF_1129(); 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_EmploymentRelationshipTimeFrame_For_Employee_And_TimeFrame", ex); } return(functionReturn); }
///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L5EM_GERTFFETF_1129 Invoke(string ConnectionString, P_L5EM_GERTFFETF_1129 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }