protected static FR_PA_GPDWCLT_1118 Execute(DbConnection Connection, DbTransaction Transaction, P_PA_GPDWCLT_1118 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_PA_GPDWCLT_1118();
            returnValue.Result = new PA_GPDWCLT_1118();
            var patientData = cls_Get_Patient_Details_for_PatientID.Invoke(Connection, Transaction, new P_P_PA_GPDfPID_1124 {
                PatientID = Parameter.PatientID
            }, securityTicket).Result;
            var ctrList = cls_Get_Contracts_Where_Hip_Participating_for_HipID.Invoke(Connection, Transaction, new P_PA_GCwHipPfHipID_0954()
            {
                HipIkNumber = patientData.HealthInsurance_IKNumber
            }, securityTicket).Result;
            returnValue.Result.InitalData = new PA_GDAPV_1629()
            {
                Contracts = ctrList.Select(ctr =>
                {
                    return(new PA_GDAPV_1629_Contracts()
                    {
                        ID = ctr.ContractID,
                        Name = ctr.ContractName,
                        participation_consent_valid_days = ctr.ParticipationConsentValidForMonths,
                        ValidFrom = ctr.ValidFrom,
                        ValidThrough = ctr.ValidThrough
                    });
                }).ToArray()
            };

            PA_GPDWCLT_1118_PatientData returnPatientData = new PA_GPDWCLT_1118_PatientData();
            returnPatientData.birthday                  = patientData.birthday;
            returnPatientData.contract_number           = patientData.contract_number;
            returnPatientData.gender                    = patientData.gender;
            returnPatientData.health_insurance_provider = patientData.health_insurance_provider;
            returnPatientData.id                 = patientData.id;
            returnPatientData.insurance_id       = patientData.insurance_id;
            returnPatientData.insurance_status   = patientData.insurance_status;
            returnPatientData.name               = patientData.name;
            returnPatientData.patient_first_name = patientData.patient_first_name;
            returnPatientData.patient_last_name  = patientData.patient_last_name;
            if (patientData.ParticipationConsent.Length > 0)
            {
                var participationConsrnt = patientData.ParticipationConsent.OrderByDescending(m => m.participation_consent_issue_date).FirstOrDefault();
                returnPatientData.ValidThrough = participationConsrnt.ValidThrough;
                returnPatientData.participation_consent_issue_date = participationConsrnt.participation_consent_issue_date;
            }
            returnValue.Result.PatientData = returnPatientData;

            return(returnValue);

            #endregion UserCode
        }
 ///<summary>
 /// Ivokes the method with the given Connection, leaving it open if no exceptions occured
 ///<summary>
 public static FR_PA_GPDWCLT_1118 Invoke(DbConnection Connection, P_PA_GPDWCLT_1118 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, null, null, Parameter, securityTicket));
 }
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_PA_GPDWCLT_1118 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_PA_GPDWCLT_1118 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_PA_GPDWCLT_1118 functionReturn = new FR_PA_GPDWCLT_1118();

            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_PatientData_With_ContractListTenant", ex);
            }
            return(functionReturn);
        }