///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5WP_GWFT_1203_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5WP_GWFT_1203_Array functionReturn = new FR_L5WP_GWFT_1203_Array(); try { if (cleanupConnection == true) { Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString); Connection.Open(); } if (cleanupTransaction == true) { Transaction = Connection.BeginTransaction(); } functionReturn = Execute(Connection, Transaction, 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_Tenant", ex); } return(functionReturn); }
protected static FR_L5WP_GWFT_1203_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_L5WP_GWFT_1203_Array(); L5WP_GWFT_1203 result = new L5WP_GWFT_1203(); ORM_CMN_STR_PPS_Workplace.Query workplaceQuery = new ORM_CMN_STR_PPS_Workplace.Query(); workplaceQuery.IsDeleted = false; workplaceQuery.Tenant_RefID = securityTicket.TenantID; List <ORM_CMN_STR_PPS_Workplace> workplaceResults = ORM_CMN_STR_PPS_Workplace.Query.Search(Connection, Transaction, workplaceQuery); List <L5WP_GWFT_1203> workplaceResultList = new List <L5WP_GWFT_1203>(); foreach (var workplace in workplaceResults) { result = new L5WP_GWFT_1203(); ORM_CMN_STR_PPS_Workplace item = new ORM_CMN_STR_PPS_Workplace(); var resultWorkplace = item.Load(Connection, Transaction, workplace.CMN_STR_PPS_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 = workplace.CMN_STR_PPS_WorkplaceID; result.ShortName = item.ShortName; result.WorkArea_RefID = item.WorkArea_RefID; result.WorkPlaceDescription = item.Description; result.WorkPlaceName = item.Name; result.DisplayColor = item.DisplayColor; var responsiblePersonsQuery = new ORM_CMN_STR_PPS_Workplace_ResponsiblePerson.Query(); responsiblePersonsQuery.Tenant_RefID = securityTicket.TenantID; responsiblePersonsQuery.Workplace_RefID = workplace.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(); workplaceResultList.Add(result); } returnValue.Result = workplaceResultList.ToArray(); //Put your code here return(returnValue); #endregion UserCode }