///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5PA_GPFD_1252 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5PA_GPFD_1252 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5PA_GPFD_1252 functionReturn = new FR_L5PA_GPFD_1252();

            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 ex;
            }
            return(functionReturn);
        }
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L5PA_GPFD_1252 Invoke(string ConnectionString, P_L5PA_GPFD_1252 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L5PA_GPFD_1252 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5PA_GPFD_1252 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
        protected static FR_L5PA_GPFD_1252 Execute(DbConnection Connection, DbTransaction Transaction, P_L5PA_GPFD_1252 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5PA_GPFD_1252();
            returnValue.Result             = new L5PA_GPFD_1252();
            returnValue.Result.static_data = new L5PA_GPFD_1252_StaticData();

            returnValue.Result.static_data.Practices = cls_Get_AllOfficess_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result.Where(i => i.IsMedicalPractice == true).ToArray();
            returnValue.Result.static_data.Doctors   = cls_Get_Doctors_for_PracticeID.Invoke(Connection, Transaction, new P_L5DO_GDfPID_1316 {
                OfficeID = returnValue.Result.static_data.Practices[0].OfficeID
            }, securityTicket).Result;
            returnValue.Result.static_data.ReferalType = cls_Get_MedicalPracticeTypes_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result;
            returnValue.Result.Findings = cls_Get_PatientFindings.Invoke(Connection, Transaction, new P_L5PA_GPF_1649 {
                PatientID = Parameter.PatientID
            }, securityTicket).Result;
            returnValue.Result.static_data.ReferalPractices = cls_Get_ReferalPractices_BaseData.Invoke(Connection, Transaction, securityTicket).Result;
            return(returnValue);

            #endregion UserCode
        }