protected static FR_L5WA_GWAFWA_0907 Execute(DbConnection Connection, DbTransaction Transaction, P_L5WA_GWAFWA_0907 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5WA_GWAFWA_0907(); returnValue.Result = new L5WA_GWAFWA_0907(); L5WA_GWAFT_1201 result = new L5WA_GWAFT_1201(); ORM_CMN_STR_PPS_WorkArea item = new ORM_CMN_STR_PPS_WorkArea(); if (Parameter.WorkAreaID != Guid.Empty) { var resultWorkplace = item.Load(Connection, Transaction, Parameter.WorkAreaID); if (resultWorkplace.Status != FR_Status.Success || item.CMN_STR_PPS_WorkAreaID == 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_BPT_STA_SettingProfile_RefID = item.CMN_BPT_STA_SettingProfile_RefID; result.Office_RefID = item.Office_RefID; result.Parent_RefID = item.Parent_RefID; result.WorkAreaName = item.Name; result.WorkAreaDescription = item.Description; result.ShortName = item.ShortName; result.CMN_STR_PPS_WorkAreaID = item.CMN_STR_PPS_WorkAreaID; result.Default_StartWorkingHour = item.Default_StartWorkingHour; ORM_CMN_STR_PPS_WorkArea_2_CostCenter.Query workareaToCostcenterQuery = new ORM_CMN_STR_PPS_WorkArea_2_CostCenter.Query(); workareaToCostcenterQuery.WorkArea_RefID = Parameter.WorkAreaID; workareaToCostcenterQuery.Tenant_RefID = securityTicket.TenantID; workareaToCostcenterQuery.IsDeleted = false; List <ORM_CMN_STR_PPS_WorkArea_2_CostCenter> workareaToCostcenterList = ORM_CMN_STR_PPS_WorkArea_2_CostCenter.Query.Search(Connection, Transaction, workareaToCostcenterQuery); if (workareaToCostcenterList.Count != 0) { L5WA_GWAFT_1201_Costcenter costCenter = new L5WA_GWAFT_1201_Costcenter(); ORM_CMN_STR_CostCenter costCenterItem = new ORM_CMN_STR_CostCenter(); costCenterItem.Load(Connection, Transaction, workareaToCostcenterList[0].CostCenter_RefID); if (!costCenterItem.IsDeleted) { costCenter.AssignmentID = workareaToCostcenterList[0].AssignmentID; costCenter.CMN_STR_CostCenterID = workareaToCostcenterList[0].CostCenter_RefID; costCenter.CostcenterName = costCenterItem.Name; costCenter.InternalID = costCenterItem.InternalID; result.Costcenter = costCenter; } } var responsiblePersonsQuery = new ORM_CMN_STR_PPS_WorkArea_ResponsiblePerson.Query(); responsiblePersonsQuery.Tenant_RefID = securityTicket.TenantID; responsiblePersonsQuery.WorkArea_RefID = item.CMN_STR_PPS_WorkAreaID; responsiblePersonsQuery.IsDeleted = false; var responsiblePersonsList = ORM_CMN_STR_PPS_WorkArea_ResponsiblePerson.Query.Search(Connection, Transaction, responsiblePersonsQuery); List <L5WA_GWAFT_1201_ResponsiblePersons> responsiblePresonsResultList = new List <L5WA_GWAFT_1201_ResponsiblePersons>(); foreach (var responsiblePerson in responsiblePersonsList) { L5WA_GWAFT_1201_ResponsiblePersons responsiblePersonResult = new L5WA_GWAFT_1201_ResponsiblePersons(); responsiblePersonResult.CMN_BPT_EMP_EmployeeID = responsiblePerson.CMN_BPT_EMP_Employee_RefID; responsiblePersonResult.CMN_STR_PPS_WorkArea_ResponsiblePersonID = responsiblePerson.CMN_STR_PPS_WorkArea_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; responsiblePersonResult.WorkArea_RefID = item.CMN_STR_PPS_WorkAreaID; responsiblePresonsResultList.Add(responsiblePersonResult); } result.ResponsiblePersons = responsiblePresonsResultList.ToArray(); returnValue.Result.workarea = result; //Put your code here return(returnValue); #endregion UserCode }
///<summary> /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured ///<summary> public static FR_L5WA_GWAFWA_0907 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5WA_GWAFWA_0907 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5WA_GWAFWA_0907 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5WA_GWAFWA_0907 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5WA_GWAFWA_0907 functionReturn = new FR_L5WA_GWAFWA_0907(); 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_WorkArea_for_WorkAreaID", ex); } return(functionReturn); }
///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L5WA_GWAFWA_0907 Invoke(string ConnectionString, P_L5WA_GWAFWA_0907 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }