///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5WP_GWPFWPID_1132 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5WP_GWPFWPID_1132 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5WP_GWPFWPID_1132 functionReturn = new FR_L5WP_GWPFWPID_1132(); 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_Workplaces_For_WorkplaceID", ex); } return(functionReturn); }
protected static FR_L5WP_GWPFWPID_1132 Execute(DbConnection Connection, DbTransaction Transaction, P_L5WP_GWPFWPID_1132 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5WP_GWPFWPID_1132(); returnValue.Result = new L5WP_GWPFWPID_1132(); L5WP_GWFT_1203 result = new L5WP_GWFT_1203(); ORM_CMN_STR_PPS_Workplace item = new ORM_CMN_STR_PPS_Workplace(); if (Parameter.workplaceID != Guid.Empty) { var resultWorkplace = item.Load(Connection, Transaction, Parameter.workplaceID); if (resultWorkplace.Status != FR_Status.Success || item.CMN_STR_PPS_WorkplaceID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(null); } } result.CMN_CAL_CalendarInstance_RefID = item.CMN_CAL_CalendarInstance_RefID; result.CMN_STR_PPS_WorkplaceID = item.CMN_STR_PPS_WorkplaceID; result.ShortName = item.ShortName; result.WorkArea_RefID = item.WorkArea_RefID; result.WorkPlaceDescription = item.Description; result.WorkPlaceName = item.Name; var responsiblePersonsQuery = new ORM_CMN_STR_PPS_Workplace_ResponsiblePerson.Query(); responsiblePersonsQuery.Tenant_RefID = securityTicket.TenantID; responsiblePersonsQuery.Workplace_RefID = item.CMN_STR_PPS_WorkplaceID; responsiblePersonsQuery.IsDeleted = false; var responsiblePersonsList = ORM_CMN_STR_PPS_Workplace_ResponsiblePerson.Query.Search(Connection, Transaction, responsiblePersonsQuery); List <L5WP_GWFT_1203_ResponsiblePerson> responsiblePresonsResultList = new List <L5WP_GWFT_1203_ResponsiblePerson>(); foreach (var responsiblePerson in responsiblePersonsList) { L5WP_GWFT_1203_ResponsiblePerson responsiblePersonResult = new L5WP_GWFT_1203_ResponsiblePerson(); responsiblePersonResult.CMN_BPT_EMP_EmployeeID = responsiblePerson.CMN_BPT_EMP_Employee_RefID; responsiblePersonResult.CMN_STR_PPS_Workplace_ResponsiblePersonID = responsiblePerson.CMN_STR_PPS_Workplace_ResponsiblePersonID; ORM_CMN_BPT_EMP_Employee employee = new ORM_CMN_BPT_EMP_Employee(); employee.Load(Connection, Transaction, responsiblePerson.CMN_BPT_EMP_Employee_RefID); ORM_CMN_BPT_BusinessParticipant bParticipant = new ORM_CMN_BPT_BusinessParticipant(); bParticipant.Load(Connection, Transaction, employee.BusinessParticipant_RefID); ORM_CMN_PER_PersonInfo person = new ORM_CMN_PER_PersonInfo(); person.Load(Connection, Transaction, bParticipant.IfNaturalPerson_CMN_PER_PersonInfo_RefID); responsiblePersonResult.CMN_BPT_BusinessParticipantID = bParticipant.CMN_BPT_BusinessParticipantID; responsiblePersonResult.FirstName = person.FirstName; responsiblePersonResult.LastName = person.LastName; responsiblePersonResult.CMN_PER_PersonInfoID = person.CMN_PER_PersonInfoID; responsiblePresonsResultList.Add(responsiblePersonResult); } result.ResponsiblePersons = responsiblePresonsResultList.ToArray(); returnValue.Result.workplace = result; //Put your code here return(returnValue); #endregion UserCode }