protected static FR_L5OR_GCORPfBH_1045_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5OR_GCORPfBH_1045 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5OR_GCORPfBH_1045_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_APOBilling_CustomerOrderReturn.Atomic.Retrieval.SQL.cls_Get_CustomerOrderReturnPosition_for_BillHeader.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;

            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "BillHeaderID", Parameter.BillHeaderID);



            List <L5OR_GCORPfBH_1045> results = new List <L5OR_GCORPfBH_1045>();
            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[] { "BIL_BillPositionID", "Quantity", "PositionValue_BeforeTax", "PositionValue_IncludingTax", "CMN_PRO_Product_RefID", "Position_ValuePerUnit", "ORD_CUO_CustomerOrderReturn_PositionID", "CustomerOrderReturnNumber", "DisplayName", "CMN_BPT_BusinessParticipantID", "CurrencySymbol", "CMN_BPT_CTM_OrganizationalUnitID", "OrganizationalUnit_SimpleName", "OrganizationalUnit_Name_DictID", "OrganizationalUnit_Description_DictID", "InternalOrganizationalUnitNumber", "InternalOrganizationalUnitSimpleName", "ExternalOrganizationalUnitNumber", "ORD_CUO_CustomerOrderReturn_HeaderID", "Creation_Timestamp", "DateOfCustomerReturn", "PositionPricePerUnitValue_BeforeTax", "PositionPricePerUnitValue_IncludingTax" });
                while (reader.Read())
                {
                    L5OR_GCORPfBH_1045 resultItem = new L5OR_GCORPfBH_1045();
                    //0:Parameter BIL_BillPositionID of type Guid
                    resultItem.BIL_BillPositionID = reader.GetGuid(0);
                    //1:Parameter Quantity of type Double
                    resultItem.Quantity = reader.GetDouble(1);
                    //2:Parameter PositionValue_BeforeTax of type Decimal
                    resultItem.PositionValue_BeforeTax = reader.GetDecimal(2);
                    //3:Parameter PositionValue_IncludingTax of type Decimal
                    resultItem.PositionValue_IncludingTax = reader.GetDecimal(3);
                    //4:Parameter CMN_PRO_Product_RefID of type Guid
                    resultItem.CMN_PRO_Product_RefID = reader.GetGuid(4);
                    //5:Parameter Position_ValuePerUnit of type Decimal
                    resultItem.Position_ValuePerUnit = reader.GetDecimal(5);
                    //6:Parameter ORD_CUO_CustomerOrderReturn_PositionID of type Guid
                    resultItem.ORD_CUO_CustomerOrderReturn_PositionID = reader.GetGuid(6);
                    //7:Parameter CustomerOrderReturnNumber of type String
                    resultItem.CustomerOrderReturnNumber = reader.GetString(7);
                    //8:Parameter DisplayName of type String
                    resultItem.DisplayName = reader.GetString(8);
                    //9:Parameter CMN_BPT_BusinessParticipantID of type Guid
                    resultItem.CMN_BPT_BusinessParticipantID = reader.GetGuid(9);
                    //10:Parameter CurrencySymbol of type String
                    resultItem.CurrencySymbol = reader.GetString(10);
                    //11:Parameter CMN_BPT_CTM_OrganizationalUnitID of type Guid
                    resultItem.CMN_BPT_CTM_OrganizationalUnitID = reader.GetGuid(11);
                    //12:Parameter OrganizationalUnit_SimpleName of type String
                    resultItem.OrganizationalUnit_SimpleName = reader.GetString(12);
                    //13:Parameter OrganizationalUnit_Name_DictID of type Dict
                    resultItem.OrganizationalUnit_Name_DictID             = reader.GetDictionary(13);
                    resultItem.OrganizationalUnit_Name_DictID.SourceTable = "cmn_bpt_ctm_organizationalunits";
                    loader.Append(resultItem.OrganizationalUnit_Name_DictID);
                    //14:Parameter OrganizationalUnit_Description_DictID of type Dict
                    resultItem.OrganizationalUnit_Description_DictID             = reader.GetDictionary(14);
                    resultItem.OrganizationalUnit_Description_DictID.SourceTable = "cmn_bpt_ctm_organizationalunits";
                    loader.Append(resultItem.OrganizationalUnit_Description_DictID);
                    //15:Parameter InternalOrganizationalUnitNumber of type String
                    resultItem.InternalOrganizationalUnitNumber = reader.GetString(15);
                    //16:Parameter InternalOrganizationalUnitSimpleName of type String
                    resultItem.InternalOrganizationalUnitSimpleName = reader.GetString(16);
                    //17:Parameter ExternalOrganizationalUnitNumber of type String
                    resultItem.ExternalOrganizationalUnitNumber = reader.GetString(17);
                    //18:Parameter ORD_CUO_CustomerOrderReturn_HeaderID of type Guid
                    resultItem.ORD_CUO_CustomerOrderReturn_HeaderID = reader.GetGuid(18);
                    //19:Parameter Creation_Timestamp of type DateTime
                    resultItem.Creation_Timestamp = reader.GetDate(19);
                    //20:Parameter DateOfCustomerReturn of type DateTime
                    resultItem.DateOfCustomerReturn = reader.GetDate(20);
                    //21:Parameter PositionPricePerUnitValue_BeforeTax of type Decimal
                    resultItem.PositionPricePerUnitValue_BeforeTax = reader.GetDecimal(21);
                    //22:Parameter PositionPricePerUnitValue_IncludingTax of type Decimal
                    resultItem.PositionPricePerUnitValue_IncludingTax = reader.GetDecimal(22);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw new Exception("Exception occured durng data retrieval in method cls_Get_CustomerOrderReturnPosition_for_BillHeader", ex);
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = results.ToArray();
            return(returnStatus);
        }
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L5OR_GCORPfBH_1045_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L5OR_GCORPfBH_1045 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5OR_GCORPfBH_1045_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5OR_GCORPfBH_1045 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5OR_GCORPfBH_1045_Array functionReturn = new FR_L5OR_GCORPfBH_1045_Array();

            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_CustomerOrderReturnPosition_for_BillHeader", ex);
            }
            return(functionReturn);
        }
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L5OR_GCORPfBH_1045_Array Invoke(string ConnectionString, P_L5OR_GCORPfBH_1045 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }