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

            FR_L6PA_GBBVPFT_1700_Array functionReturn = new FR_L6PA_GBBVPFT_1700_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 ex;
            }
            return(functionReturn);
        }
        protected static FR_L6PA_GBBVPFT_1700_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L6PA_GBBVPFT_1700_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL6_BBV_Patient.Atomic.Retrieval.SQL.cls_Get_BBV_Patients_For_Tenant.sql";

            command.CommandText = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(commandLocation)).ReadToEnd();
            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ticket", securityTicket);
            command.CommandTimeout = QueryTimeout;
            List <L6PA_GBBVPFT_1700_raw> results = new List <L6PA_GBBVPFT_1700_raw>();
            var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
            var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader());

            try
            {
                reader.SetOrdinals(new string[] { "Salutation_General", "FirstName", "LastName", "PrimaryEmail", "HealthInsurance_Number", "PatientComment", "HasFulfilledParticipationPolicyRequirements", "CMN_PER_PersonInfoID", "CMN_BPT_BusinessParticipantID", "HEC_Patient_HealthInsurancesID", "HEC_PatientID", "HEC_STU_Study_ParticipatingPatientID", "Participation_DateOfSigning", "Participation_Comment", "Driver_FirstName", "Driver_LastName", "Content", "CMN_PER_CommunicationContactID", "Contact_Type", "Street_Number", "Street_Name", "City_Name", "City_PostalCode", "Province_Name", "SequenceNumber", "IsPrimary", "CMN_AddressID", "AssignmentID", "GlobalPropertyMatchingID", "File_Name", "File_Extension", "File_ServerLocation", "File_Size_Bytes", "HEC_STU_Study_PatientDocumentID" });
                while (reader.Read())
                {
                    L6PA_GBBVPFT_1700_raw resultItem = new L6PA_GBBVPFT_1700_raw();
                    //0:Parameter Salutation_General of type string
                    resultItem.Salutation_General = reader.GetString(0);
                    //1:Parameter FirstName of type string
                    resultItem.FirstName = reader.GetString(1);
                    //2:Parameter LastName of type string
                    resultItem.LastName = reader.GetString(2);
                    //3:Parameter PrimaryEmail of type string
                    resultItem.PrimaryEmail = reader.GetString(3);
                    //4:Parameter HealthInsurance_Number of type string
                    resultItem.HealthInsurance_Number = reader.GetString(4);
                    //5:Parameter PatientComment of type string
                    resultItem.PatientComment = reader.GetString(5);
                    //6:Parameter HasFulfilledParticipationPolicyRequirements of type bool
                    resultItem.HasFulfilledParticipationPolicyRequirements = reader.GetBoolean(6);
                    //7:Parameter CMN_PER_PersonInfoID of type Guid
                    resultItem.CMN_PER_PersonInfoID = reader.GetGuid(7);
                    //8:Parameter CMN_BPT_BusinessParticipantID of type Guid
                    resultItem.CMN_BPT_BusinessParticipantID = reader.GetGuid(8);
                    //9:Parameter HEC_Patient_HealthInsurancesID of type Guid
                    resultItem.HEC_Patient_HealthInsurancesID = reader.GetGuid(9);
                    //10:Parameter HEC_PatientID of type Guid
                    resultItem.HEC_PatientID = reader.GetGuid(10);
                    //11:Parameter HEC_STU_Study_ParticipatingPatientID of type Guid
                    resultItem.HEC_STU_Study_ParticipatingPatientID = reader.GetGuid(11);
                    //12:Parameter Participation_DateOfSigning of type DateTime
                    resultItem.Participation_DateOfSigning = reader.GetDate(12);
                    //13:Parameter Participation_Comment of type string
                    resultItem.Participation_Comment = reader.GetString(13);
                    //14:Parameter Driver_FirstName of type string
                    resultItem.Driver_FirstName = reader.GetString(14);
                    //15:Parameter Driver_LastName of type string
                    resultItem.Driver_LastName = reader.GetString(15);
                    //16:Parameter Content of type String
                    resultItem.Content = reader.GetString(16);
                    //17:Parameter CMN_PER_CommunicationContactID of type Guid
                    resultItem.CMN_PER_CommunicationContactID = reader.GetGuid(17);
                    //18:Parameter Contact_Type of type Guid
                    resultItem.Contact_Type = reader.GetGuid(18);
                    //19:Parameter Street_Number of type String
                    resultItem.Street_Number = reader.GetString(19);
                    //20:Parameter Street_Name of type String
                    resultItem.Street_Name = reader.GetString(20);
                    //21:Parameter City_Name of type String
                    resultItem.City_Name = reader.GetString(21);
                    //22:Parameter City_PostalCode of type String
                    resultItem.City_PostalCode = reader.GetString(22);
                    //23:Parameter Province_Name of type String
                    resultItem.Province_Name = reader.GetString(23);
                    //24:Parameter SequenceNumber of type int
                    resultItem.SequenceNumber = reader.GetInteger(24);
                    //25:Parameter IsPrimary of type bool
                    resultItem.IsPrimary = reader.GetBoolean(25);
                    //26:Parameter CMN_AddressID of type Guid
                    resultItem.CMN_AddressID = reader.GetGuid(26);
                    //27:Parameter AssignmentID of type Guid
                    resultItem.AssignmentID = reader.GetGuid(27);
                    //28:Parameter GlobalPropertyMatchingID of type String
                    resultItem.GlobalPropertyMatchingID = reader.GetString(28);
                    //29:Parameter File_Name of type String
                    resultItem.File_Name = reader.GetString(29);
                    //30:Parameter File_Extension of type String
                    resultItem.File_Extension = reader.GetString(30);
                    //31:Parameter File_ServerLocation of type String
                    resultItem.File_ServerLocation = reader.GetString(31);
                    //32:Parameter File_Size_Bytes of type int
                    resultItem.File_Size_Bytes = reader.GetInteger(32);
                    //33:Parameter HEC_STU_Study_PatientDocumentID of type Guid
                    resultItem.HEC_STU_Study_PatientDocumentID = reader.GetGuid(33);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw ex;
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = L6PA_GBBVPFT_1700_raw.Convert(results).ToArray();
            return(returnStatus);
        }