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

            var param = new P_L2NR_GINfUA_1113()
            {
                GlobalStaticMatchingID = Parameter.GlobalStaticMatchingID
            };
            var result = cls_Get_IncreasingNumber_for_UsageArea.Invoke(Connection, Transaction, param, securityTicket).Result;

            if (result.CMN_NumberRangeID != Guid.Empty)
            {
                var numberRange = new ORM_CMN_NumberRange();
                numberRange.Load(Connection, Transaction, result.CMN_NumberRangeID);
                numberRange.Value_Current++;
                numberRange.Save(Connection, Transaction);
            }

            returnValue.Result = new L2NR_GaIINfUA_1454()
            {
                Current_IncreasingNumber = result.Current_IncreasingNumber
            };

            return(returnValue);

            #endregion UserCode
        }
        protected static FR_L2NR_GINfUA_1113 Execute(DbConnection Connection, DbTransaction Transaction, P_L2NR_GINfUA_1113 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L2NR_GINfUA_1113();
            returnValue.Result = new L2NR_GINfUA_1113();

            #region Get_NumberRange_BasicInfo_for_UsageArea

            var param = new P_L2NR_GNRBIfUA_1000()
            {
                GlobalStaticMatchingID = Parameter.GlobalStaticMatchingID
            };

            var numberRangeBasicInfo = cls_Get_NumberRange_BasicInfo_for_UsageArea.Invoke(Connection, Transaction, param, securityTicket).Result;

            #endregion

            if (numberRangeBasicInfo == null || numberRangeBasicInfo.CMN_NumberRangeID == Guid.Empty)
            {
                returnValue.Result.Current_IncreasingNumber = "Nummernkreis ist nicht definiert";
                return(returnValue);
            }

            try
            {
                var lengthOfNextNumber = numberRangeBasicInfo.Value_Current.ToString().Length;
                var currentNumber      =
                    numberRangeBasicInfo.FixedPrefix +
                    new String(numberRangeBasicInfo.Formatting_LeadingFillCharacter[0], numberRangeBasicInfo.Formatting_NumberLength - lengthOfNextNumber) +
                    numberRangeBasicInfo.Value_Current;

                var nextNumber = numberRangeBasicInfo.Value_Current + 1;
                if (nextNumber == numberRangeBasicInfo.Value_End && numberRangeBasicInfo.Value_End != 0)
                {
                    nextNumber = numberRangeBasicInfo.Value_Start;
                }

                returnValue.Result = new L2NR_GINfUA_1113()
                {
                    CMN_NumberRangeID        = numberRangeBasicInfo.CMN_NumberRangeID,
                    Current_IncreasingNumber = currentNumber
                };
            }
            catch (Exception ex) {
                returnValue.Result.Current_IncreasingNumber = "Falsch Nummernkreis";
            }

            return(returnValue);

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

            FR_L2NR_GINfUA_1113 functionReturn = new FR_L2NR_GINfUA_1113();

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