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

            FR_L2DC_GUDCfT_1505 functionReturn = new FR_L2DC_GUDCfT_1505();

            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 ex;
            }
            return(functionReturn);
        }
        protected static FR_L2DC_GUDCfT_1505 Execute(DbConnection Connection, DbTransaction Transaction, P_L2DC_GUDCfT_1505 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L2DC_GUDCfT_1505();

            if (Parameter.codeLength < 1)
            {
                return(null);
            }

            Random _rng         = new Random((int)DateTime.Now.Ticks);
            string _chars       = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
            int    loopCountMax = 100;
            int    loopCounter  = 0;
            bool   uniqueFlag   = false;
            string codeValue;
            do
            {
                loopCounter++;
                if (loopCounter > loopCountMax)
                {
                    return(null);
                }

                char[] buffer = new char[Parameter.codeLength];
                for (int i = 0; i < Parameter.codeLength; i++)
                {
                    buffer[i] = _chars[_rng.Next(_chars.Length)];
                }
                codeValue = new string(buffer);

                var query1 = new ORM_USR_Device_AccountCode.Query();
                query1.AccountCode_Value = codeValue;
                query1.Tenant_RefID      = securityTicket.TenantID;
                query1.IsDeleted         = false;

                var codes = ORM_USR_Device_AccountCode.Query.Search(Connection, Transaction, query1);
                if (codes.Count == 0)
                {
                    uniqueFlag = true;
                }
            } while (!uniqueFlag);

            returnValue.Result           = new L2DC_GUDCfT_1505();
            returnValue.Result.CodeValue = codeValue;

            return(returnValue);

            #endregion UserCode
        }