protected static FR_CL6_GSPwAfSH_1049_Array Execute(DbConnection Connection, DbTransaction Transaction, P_CL6_GSPwAfSH_1049 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_CL6_GSPwAfSH_1049_Array();

            #region Get Return Shipment Positions
            var positionsResult = cls_Get_ShipmentPositions_for_ShipmentHeaderID
                                  .Invoke(Connection, Transaction, new P_CL3_GSPfSH_1047()
            {
                ShipmentHeaderID = Parameter.ShipmentHeaderID
            }, securityTicket);
            if (positionsResult.Status != FR_Status.Success)
            {
                returnValue.Status = FR_Status.Error_Internal;
                returnValue.Result = null;
                return(returnValue);
            }
            #endregion

            #region Get Articles
            var paramArticles = new CL3_Articles.Atomic.Retrieval.P_L3AR_GAfAL_0942();
            paramArticles.ProductID_List = positionsResult.Result.Select(x => x.CMN_PRO_Product_RefID).ToArray <Guid>();

            var articles = new CL3_Articles.Atomic.Retrieval.L3AR_GAfAL_0942[0];

            if (paramArticles.ProductID_List.Length != 0)
            {
                articles = CL3_Articles.Atomic.Retrieval.cls_Get_Articles_for_ArticleList.Invoke(Connection, Transaction, paramArticles, securityTicket).Result;
            }
            #endregion



            var lsrResult = new List <CL6_GSPwAfSH_1049>();
            foreach (var position in positionsResult.Result)
            {
                var retObj = new CL6_GSPwAfSH_1049()
                {
                    ShipmentPosition = position,
                    Article          = articles.SingleOrDefault(x => x.CMN_PRO_ProductID == position.CMN_PRO_Product_RefID)
                };
                lsrResult.Add(retObj);
            }
            returnValue.Result = lsrResult.ToArray();

            return(returnValue);

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

            FR_CL6_GSPwAfSH_1049_Array functionReturn = new FR_CL6_GSPwAfSH_1049_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_ShipmentPositions_with_Article_for_ShipmentHeaderID", ex);
            }
            return(functionReturn);
        }