///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L2CN_GCWRWT_1138_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L2CN_GCWRWT_1138_Array functionReturn = new FR_L2CN_GCWRWT_1138_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_without_Tenant", ex); } return(functionReturn); }
protected static FR_L2CN_GCWRWT_1138_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L2CN_GCWRWT_1138_Array(); //Put your code here ORM_CMN_Country.Query countryQuery = new ORM_CMN_Country.Query(); countryQuery.Tenant_RefID = Guid.Empty; countryQuery.IsDeleted = false; List <ORM_CMN_Country> countries = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery); List <L2CN_GCWRWT_1138> countryList = new List <L2CN_GCWRWT_1138>(); foreach (var country in countries) { L2CN_GCWRWT_1138 item = new L2CN_GCWRWT_1138(); 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; ORM_CMN_LOC_Region.Query regionsQuery = new ORM_CMN_LOC_Region.Query(); regionsQuery.IsDeleted = false; regionsQuery.Country_RefID = country.CMN_CountryID; List <ORM_CMN_LOC_Region> regions = ORM_CMN_LOC_Region.Query.Search(Connection, Transaction, regionsQuery); List <L2CN_GCWRWT_1138_Region> regionList = new List <L2CN_GCWRWT_1138_Region>(); foreach (var region in regions) { L2CN_GCWRWT_1138_Region regionItem = new L2CN_GCWRWT_1138_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(); //Put your code here return(returnValue); #endregion UserCode }