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

            FR_L5OU_GOUDEUID_1330 functionReturn = new FR_L5OU_GOUDEUID_1330();

            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_OrgUnitDataEdit_for_UnitID", ex);
            }
            return(functionReturn);
        }
        protected static FR_L5OU_GOUDEUID_1330 Execute(DbConnection Connection, DbTransaction Transaction, P_L5OU_GOUDEUID_1330 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5OU_GOUDEUID_1330();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_MyHealthClub_OrgUnits.Atomic.Retrieval.SQL.cls_Get_OrgUnitDataEdit_for_UnitID.sql";

            command.CommandText = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(commandLocation)).ReadToEnd();
            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ticket", securityTicket);
            command.CommandTimeout = QueryTimeout;

            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "OfficeID", Parameter.OfficeID);



            List <L5OU_GOUDEUID_1330_raw> results = new List <L5OU_GOUDEUID_1330_raw>();
            var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
            var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader());

            try
            {
                reader.SetOrdinals(new string[] { "CMN_STR_OfficeID", "Parent_RefID", "DisplayImage_Document_RefID", "Office_Name_DictID", "PhoneNumber", "Default_Email", "Default_Website", "Comment", "Office_Type_RefID", "ContactPersonFirstName", "ContactPersonLastName", "ContactPersonTitle", "ParentNameDict", "CMN_AddressID", "IsDefaultAddress", "IsSpecialAddress", "IsBillingAddress", "IsShippingAddress", "Street_Name", "Street_Number", "City_Name", "ZIP", "Longitude", "Lattitude", "Country_ISOCode", "Country_Name", "PPS_TSK_Task_Template_RefID" });
                while (reader.Read())
                {
                    L5OU_GOUDEUID_1330_raw resultItem = new L5OU_GOUDEUID_1330_raw();
                    //0:Parameter CMN_STR_OfficeID of type Guid
                    resultItem.CMN_STR_OfficeID = reader.GetGuid(0);
                    //1:Parameter Parent_RefID of type Guid
                    resultItem.Parent_RefID = reader.GetGuid(1);
                    //2:Parameter DisplayImage_Document_RefID of type Guid
                    resultItem.DisplayImage_Document_RefID = reader.GetGuid(2);
                    //3:Parameter Office_Name of type Dict
                    resultItem.Office_Name             = reader.GetDictionary(3);
                    resultItem.Office_Name.SourceTable = "cmn_str_offices";
                    loader.Append(resultItem.Office_Name);
                    //4:Parameter PhoneNumber of type String
                    resultItem.PhoneNumber = reader.GetString(4);
                    //5:Parameter Default_Email of type String
                    resultItem.Default_Email = reader.GetString(5);
                    //6:Parameter Default_Website of type String
                    resultItem.Default_Website = reader.GetString(6);
                    //7:Parameter Comment of type String
                    resultItem.Comment = reader.GetString(7);
                    //8:Parameter Office_Type_RefID of type Guid
                    resultItem.Office_Type_RefID = reader.GetGuid(8);
                    //9:Parameter ContactPersonFirstName of type String
                    resultItem.ContactPersonFirstName = reader.GetString(9);
                    //10:Parameter ContactPersonLastName of type String
                    resultItem.ContactPersonLastName = reader.GetString(10);
                    //11:Parameter ContactPersonTitle of type String
                    resultItem.ContactPersonTitle = reader.GetString(11);
                    //12:Parameter ParentNameDict of type Dict
                    resultItem.ParentNameDict             = reader.GetDictionary(12);
                    resultItem.ParentNameDict.SourceTable = "cmn_str_offices";
                    loader.Append(resultItem.ParentNameDict);
                    //13:Parameter CMN_AddressID of type Guid
                    resultItem.CMN_AddressID = reader.GetGuid(13);
                    //14:Parameter IsDefaultAddress of type bool
                    resultItem.IsDefaultAddress = reader.GetBoolean(14);
                    //15:Parameter IsSpecialAddress of type bool
                    resultItem.IsSpecialAddress = reader.GetBoolean(15);
                    //16:Parameter IsBillingAddress of type bool
                    resultItem.IsBillingAddress = reader.GetBoolean(16);
                    //17:Parameter IsShippingAddress of type bool
                    resultItem.IsShippingAddress = reader.GetBoolean(17);
                    //18:Parameter Street_Name of type String
                    resultItem.Street_Name = reader.GetString(18);
                    //19:Parameter Street_Number of type String
                    resultItem.Street_Number = reader.GetString(19);
                    //20:Parameter City_Name of type String
                    resultItem.City_Name = reader.GetString(20);
                    //21:Parameter ZIP of type String
                    resultItem.ZIP = reader.GetString(21);
                    //22:Parameter Longitude of type double
                    resultItem.Longitude = reader.GetDouble(22);
                    //23:Parameter Lattitude of type double
                    resultItem.Lattitude = reader.GetDouble(23);
                    //24:Parameter Country_ISOCode of type String
                    resultItem.Country_ISOCode = reader.GetString(24);
                    //25:Parameter Country_Name of type String
                    resultItem.Country_Name = reader.GetString(25);
                    //26:Parameter PPS_TSK_Task_Template_RefID of type Guid
                    resultItem.PPS_TSK_Task_Template_RefID = reader.GetGuid(26);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw new Exception("Exception occured durng data retrieval in method cls_Get_OrgUnitDataEdit_for_UnitID", ex);
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = L5OU_GOUDEUID_1330_raw.Convert(results).FirstOrDefault();

            return(returnStatus);
        }