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

            #region Determine Shipment 'Shipped' and 'Created' statuses
            var statusParam1 = new P_L5SH_GSSfGPMaT_1700 {
                GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(EShipmentStatus.Shipped)
            };
            var frStatus1 = cls_Get_Shipment_Status_for_GlobalPropertyMatchingID_and_TenantID.Invoke(Connection, Transaction, statusParam1, securityTicket);
            Parameter.FilterCriteria.ShipmentStatusID_Shipped = frStatus1.Result.LOG_SHP_Shipment_StatusID;

            var statusParam2 = new P_L5SH_GSSfGPMaT_1700 {
                GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(EShipmentStatus.Created)
            };
            var frStatus2 = cls_Get_Shipment_Status_for_GlobalPropertyMatchingID_and_TenantID.Invoke(Connection, Transaction, statusParam1, securityTicket);
            Parameter.FilterCriteria.ShipmentStatusID_Created = frStatus1.Result.LOG_SHP_Shipment_StatusID;
            #endregion

            #region Get Client Orders
            var resultClientOrders = cls_Get_Client_Orders_with_Details_for_TenantID.Invoke(Connection, Transaction, Parameter.FilterCriteria, securityTicket).Result;
            #endregion

            #region Get Client Return Orders
            var clientReturnOrderParameter = new P_L5SH_GCORPwDfT_1455()
            {
                Customer    = Parameter.FilterCriteria.Customer,
                OrderNumber = Parameter.FilterCriteria.OrderNumber,
                PeriodFrom  = Parameter.FilterCriteria.PeriodFrom,
                PeriodTo    = Parameter.FilterCriteria.PeriodTo
            };
            var resultClientReturnOrder = cls_Get_CustomerOrderReturnPositions_with_Details_forTenantID.Invoke(Connection, Transaction, clientReturnOrderParameter, securityTicket).Result;
            #endregion

            #region Set Result
            returnValue.Result = new L5SH_GCOaROfT_1517();
            returnValue.Result.ClientOrders       = resultClientOrders;
            returnValue.Result.ClientReturnOrders = resultClientReturnOrder;
            returnValue.Status = FR_Status.Success;
            #endregion

            return(returnValue);

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

            FR_L5SH_GCOaROfT_1517 functionReturn = new FR_L5SH_GCOaROfT_1517();

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