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

            FR_L5CM_GCWRfT_0938_Array functionReturn = new FR_L5CM_GCWRfT_0938_Array();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, 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_CountriesWithRegions_for_TenantID", ex);
            }
            return(functionReturn);
        }
        protected static FR_L5CM_GCWRfT_0938_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode

            var returnValue = new FR_L5CM_GCWRfT_0938_Array();
            //Put your code here
            ORM_CMN_Country.Query countryQuery = new ORM_CMN_Country.Query();
            countryQuery.IsDeleted    = false;
            countryQuery.Tenant_RefID = securityTicket.TenantID;
            List <ORM_CMN_Country>  countries   = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery);
            List <L5CM_GCWRfT_0938> countryList = new List <L5CM_GCWRfT_0938>();
            foreach (var country in countries)
            {
                L5CM_GCWRfT_0938 item = new L5CM_GCWRfT_0938();
                item.CMN_CountryID           = country.CMN_CountryID;
                item.Country_ISOCode_Alpha2  = country.Country_ISOCode_Alpha2;
                item.Country_ISOCode_Alpha3  = country.Country_ISOCode_Alpha3;
                item.Country_ISOCode_Numeric = country.Country_ISOCode_Numeric;
                item.Country_Name            = country.Country_Name;
                item.Default_Currency_RefID  = country.Default_Currency_RefID;
                item.Default_Language_RefID  = country.Default_Language_RefID;
                countryQuery                        = new ORM_CMN_Country.Query();
                countryQuery.IsDeleted              = false;
                countryQuery.Tenant_RefID           = Guid.Empty;
                countryQuery.Country_ISOCode_Alpha2 = item.Country_ISOCode_Alpha2;
                countries = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery);

                ORM_CMN_LOC_Region.Query regionsQuery = new ORM_CMN_LOC_Region.Query();
                regionsQuery.IsDeleted     = false;
                regionsQuery.Country_RefID = countries[0].CMN_CountryID;
                List <ORM_CMN_LOC_Region>      regions    = ORM_CMN_LOC_Region.Query.Search(Connection, Transaction, regionsQuery);
                List <L5CM_GCWRfT_0938_Region> regionList = new List <L5CM_GCWRfT_0938_Region>();
                foreach (var region in regions)
                {
                    L5CM_GCWRfT_0938_Region regionItem = new L5CM_GCWRfT_0938_Region();
                    regionItem.CMN_LOC_RegionID = region.CMN_LOC_RegionID;
                    regionItem.Parent_RefID     = region.Parent_RefID;
                    regionItem.Region_Name      = region.Region_Name;
                    regionItem.RegionExternalID = region.RegionExternalID;
                    regionList.Add(regionItem);
                }
                item.Regions = regionList.ToArray();

                countryList.Add(item);
            }

            returnValue.Result = countryList.ToArray();

            return(returnValue);

            #endregion UserCode
        }