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

            FR_L5QT_GDDQFQ_1507 functionReturn = new FR_L5QT_GDDQFQ_1507();

            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_DueDiligence_Questionnaire_For_QuestionnaireID", ex);
            }
            return(functionReturn);
        }
        protected static FR_L5QT_GDDQFQ_1507 Execute(DbConnection Connection, DbTransaction Transaction, P_L5QT_GDDQFQ_1507 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_L5QT_GDDQFQ_1507();

            returnValue.Result = new L5QT_GDDQFQ_1507();



            ORM_RES_QST_Questionnaire_Version version = new ORM_RES_QST_Questionnaire_Version();
            version.Load(Connection, Transaction, Parameter.QuestionnaireVersionID);
            returnValue.Result.IsApartmentStructureVisible = version.IsApartmentStructureVisible;
            returnValue.Result.IsAtticVisible              = version.IsAtticVisible;
            returnValue.Result.IsBasementVisible           = version.IsBasementVisible;
            returnValue.Result.IsFacadeVisible             = version.IsFacadeVisible;
            returnValue.Result.IsHVACRVisible              = version.IsHVACRVisible;
            returnValue.Result.IsRoofVisible               = version.IsRoofVisible;
            returnValue.Result.IsOutdoorFacilityVisible    = version.IsOutdoorFacilityVisible;
            returnValue.Result.IsStaircaseStructureVisible = version.IsStaircaseStructureVisible;

            ORM_RES_QST_Questionnaire.Query questionnaireQuery = new ORM_RES_QST_Questionnaire.Query();
            questionnaireQuery.Tenant_RefID            = securityTicket.TenantID;
            questionnaireQuery.RES_QST_QuestionnaireID = version.Questionnaire_RefID;
            List <ORM_RES_QST_Questionnaire> questionnaire = ORM_RES_QST_Questionnaire.Query.Search(Connection, Transaction, questionnaireQuery);
            if (questionnaire.Count == 0)
            {
                return(null);
            }

            returnValue.Result.Questionnaire_Name = questionnaire[0].Questionnaire_Name;

            ORM_RES_QST_Apartment_AvailableProperty.Query apartmentQuery = new ORM_RES_QST_Apartment_AvailableProperty.Query();
            apartmentQuery.Tenant_RefID = securityTicket.TenantID;
            apartmentQuery.IsDeleted    = false;
            apartmentQuery.RES_QST_Questionnaire_Version_RefID = version.RES_QST_Questionnaire_VersionID;
            List <ORM_RES_QST_Apartment_AvailableProperty> apartments = ORM_RES_QST_Apartment_AvailableProperty.Query.Search(Connection, Transaction, apartmentQuery);

            List <L5QT_GDDQFQ_1507_Apartments> apartmentList = new List <L5QT_GDDQFQ_1507_Apartments>();
            foreach (var buildingPart in apartments)
            {
                ORM_RES_STR_Apartment_Property property = new ORM_RES_STR_Apartment_Property();
                property.Load(Connection, Transaction, buildingPart.RES_STR_Apartment_Property_RefID);
                L5QT_GDDQFQ_1507_Apartments item = new L5QT_GDDQFQ_1507_Apartments();
                item.ApartmentProperty_Name = property.ApartmentProperty_Name;
                item.RES_QST_Apartment_AvailablePropertyID = buildingPart.RES_QST_Apartment_AvailablePropertyID;
                item.RES_STR_Apartment_PropertyID          = buildingPart.RES_STR_Apartment_Property_RefID;
                apartmentList.Add(item);
            }
            returnValue.Result.Apartments = apartmentList.ToArray();

            ORM_RES_QST_Attic_AvailableProperty.Query atticQuery = new ORM_RES_QST_Attic_AvailableProperty.Query();
            atticQuery.Tenant_RefID = securityTicket.TenantID;
            atticQuery.IsDeleted    = false;
            atticQuery.RES_QST_Questionnaire_Version_RefID = version.RES_QST_Questionnaire_VersionID;
            List <ORM_RES_QST_Attic_AvailableProperty> attics = ORM_RES_QST_Attic_AvailableProperty.Query.Search(Connection, Transaction, atticQuery);

            List <L5QT_GDDQFQ_1507_Attics> atticList = new List <L5QT_GDDQFQ_1507_Attics>();
            foreach (var buildingPart in attics)
            {
                ORM_RES_STR_Attic_Property property = new ORM_RES_STR_Attic_Property();
                property.Load(Connection, Transaction, buildingPart.RES_STR_Attic_Property_RefID);
                L5QT_GDDQFQ_1507_Attics item = new L5QT_GDDQFQ_1507_Attics();
                item.AtticProperty_Name = property.AtticProperty_Name;
                item.RES_QST_Attic_AvailablePropertyID = buildingPart.RES_QST_Attic_AvailablePropertyID;
                item.RES_STR_Attic_PropertyID          = buildingPart.RES_STR_Attic_Property_RefID;
                atticList.Add(item);
            }
            returnValue.Result.Attics = atticList.ToArray();

            ORM_RES_QST_Basement_AvailableProperty.Query basementQuery = new ORM_RES_QST_Basement_AvailableProperty.Query();
            basementQuery.Tenant_RefID = securityTicket.TenantID;
            basementQuery.IsDeleted    = false;
            basementQuery.RES_QST_Questionnaire_Version_RefID = version.RES_QST_Questionnaire_VersionID;
            List <ORM_RES_QST_Basement_AvailableProperty> basements = ORM_RES_QST_Basement_AvailableProperty.Query.Search(Connection, Transaction, basementQuery);

            List <L5QT_GDDQFQ_1507_Basements> basementList = new List <L5QT_GDDQFQ_1507_Basements>();
            foreach (var buildingPart in basements)
            {
                ORM_RES_STR_Basement_Property property = new ORM_RES_STR_Basement_Property();
                property.Load(Connection, Transaction, buildingPart.RES_STR_Basement_Property_RefID);
                L5QT_GDDQFQ_1507_Basements item = new L5QT_GDDQFQ_1507_Basements();
                item.BasementProperty_Name = property.BasementProperty_Name;
                item.RES_QST_Basement_AvailablePropertyID = buildingPart.RES_QST_Basement_AvailablePropertyID;
                item.RES_STR_Basement_PropertyID          = buildingPart.RES_STR_Basement_Property_RefID;
                basementList.Add(item);
            }
            returnValue.Result.Basements = basementList.ToArray();

            ORM_RES_QST_Facade_AvailableProperty.Query facadeQuery = new ORM_RES_QST_Facade_AvailableProperty.Query();
            facadeQuery.Tenant_RefID = securityTicket.TenantID;
            facadeQuery.IsDeleted    = false;
            facadeQuery.RES_QST_Questionnaire_Version_RefID = version.RES_QST_Questionnaire_VersionID;
            List <ORM_RES_QST_Facade_AvailableProperty> facades = ORM_RES_QST_Facade_AvailableProperty.Query.Search(Connection, Transaction, facadeQuery);

            List <L5QT_GDDQFQ_1507_Facades> facadeList = new List <L5QT_GDDQFQ_1507_Facades>();
            foreach (var buildingPart in facades)
            {
                ORM_RES_STR_Facade_Property property = new ORM_RES_STR_Facade_Property();
                property.Load(Connection, Transaction, buildingPart.RES_STR_Facade_Property_RefID);
                L5QT_GDDQFQ_1507_Facades item = new L5QT_GDDQFQ_1507_Facades();
                item.FacadeProperty_Name = property.FacadeProperty_Name;
                item.RES_QST_Facade_AvailablePropertyID = buildingPart.RES_QST_Facade_AvailablePropertyID;
                item.RES_STR_Facade_PropertyID          = buildingPart.RES_STR_Facade_Property_RefID;
                facadeList.Add(item);
            }
            returnValue.Result.Facades = facadeList.ToArray();

            ORM_RES_QST_HVACR_AvailableProperty.Query hvacrQuery = new ORM_RES_QST_HVACR_AvailableProperty.Query();
            hvacrQuery.Tenant_RefID = securityTicket.TenantID;
            hvacrQuery.IsDeleted    = false;
            hvacrQuery.RES_QST_Questionnaire_Version_RefID = version.RES_QST_Questionnaire_VersionID;
            List <ORM_RES_QST_HVACR_AvailableProperty> hvacrs = ORM_RES_QST_HVACR_AvailableProperty.Query.Search(Connection, Transaction, hvacrQuery);

            List <L5QT_GDDQFQ_1507_HVACRs> hvacrList = new List <L5QT_GDDQFQ_1507_HVACRs>();
            foreach (var buildingPart in hvacrs)
            {
                ORM_RES_STR_HVACR_Property property = new ORM_RES_STR_HVACR_Property();
                property.Load(Connection, Transaction, buildingPart.RES_STR_HVACR_Property_RefID);
                L5QT_GDDQFQ_1507_HVACRs item = new L5QT_GDDQFQ_1507_HVACRs();
                item.HVACRProperty_Name = property.HVACRProperty_Name;
                item.RES_QST_HVACR_AvailablePropertyID = buildingPart.RES_QST_HVACR_AvailablePropertyID;
                item.RES_STR_HVACR_PropertyID          = buildingPart.RES_STR_HVACR_Property_RefID;
                hvacrList.Add(item);
            }
            returnValue.Result.HVACRs = hvacrList.ToArray();

            ORM_RES_QST_OutdoorFacility_AvailableProperty.Query outdoorQuery = new ORM_RES_QST_OutdoorFacility_AvailableProperty.Query();
            outdoorQuery.Tenant_RefID = securityTicket.TenantID;
            outdoorQuery.IsDeleted    = false;
            outdoorQuery.RES_QST_Questionnaire_Version_RefID = version.RES_QST_Questionnaire_VersionID;
            List <ORM_RES_QST_OutdoorFacility_AvailableProperty> outdoors = ORM_RES_QST_OutdoorFacility_AvailableProperty.Query.Search(Connection, Transaction, outdoorQuery);

            List <L5QT_GDDQFQ_1507_OutdoorFacilities> outdoorList = new List <L5QT_GDDQFQ_1507_OutdoorFacilities>();
            foreach (var buildingPart in outdoors)
            {
                ORM_RES_STR_OutdoorFacility_Property property = new ORM_RES_STR_OutdoorFacility_Property();
                property.Load(Connection, Transaction, buildingPart.RES_STR_OutdoorFacility_Property_RefID);
                L5QT_GDDQFQ_1507_OutdoorFacilities item = new L5QT_GDDQFQ_1507_OutdoorFacilities();
                item.OutdoorFacilityProperty_Name = property.OutdoorFacilityProperty_Name;
                item.RES_QST_OutdoorFacility_AvailablePropertyID = buildingPart.RES_QST_OutdoorFacility_AvailablePropertyID;
                item.RES_STR_OutdoorFacility_PropertyID          = buildingPart.RES_STR_OutdoorFacility_Property_RefID;
                outdoorList.Add(item);
            }
            returnValue.Result.OutdoorFacilities = outdoorList.ToArray();

            ORM_RES_QST_Roof_AvailableProperty.Query roofQuery = new ORM_RES_QST_Roof_AvailableProperty.Query();
            roofQuery.Tenant_RefID = securityTicket.TenantID;
            roofQuery.IsDeleted    = false;
            roofQuery.RES_QST_Questionnaire_Version_RefID = version.RES_QST_Questionnaire_VersionID;
            List <ORM_RES_QST_Roof_AvailableProperty> roofs = ORM_RES_QST_Roof_AvailableProperty.Query.Search(Connection, Transaction, roofQuery);

            List <L5QT_GDDQFQ_1507_Roofs> roofList = new List <L5QT_GDDQFQ_1507_Roofs>();
            foreach (var buildingPart in roofs)
            {
                ORM_RES_STR_Roof_Property property = new ORM_RES_STR_Roof_Property();
                property.Load(Connection, Transaction, buildingPart.RES_STR_Roof_Property_RefID);
                L5QT_GDDQFQ_1507_Roofs item = new L5QT_GDDQFQ_1507_Roofs();
                item.RoofProperty_Name = property.RoofProperty_Name;
                item.RES_QST_Roof_AvailablePropertyID = buildingPart.RES_QST_Roof_AvailablePropertyID;
                item.RES_STR_Roof_PropertyID          = buildingPart.RES_STR_Roof_Property_RefID;
                roofList.Add(item);
            }
            returnValue.Result.Roofs = roofList.ToArray();

            ORM_RES_QST_Staircase_AvailableProperty.Query staircaseQuery = new ORM_RES_QST_Staircase_AvailableProperty.Query();
            staircaseQuery.Tenant_RefID = securityTicket.TenantID;
            staircaseQuery.IsDeleted    = false;
            staircaseQuery.RES_QST_Questionnaire_Version_RefID = version.RES_QST_Questionnaire_VersionID;
            List <ORM_RES_QST_Staircase_AvailableProperty> staircases = ORM_RES_QST_Staircase_AvailableProperty.Query.Search(Connection, Transaction, staircaseQuery);

            List <L5QT_GDDQFQ_1507_Staircases> staircaseList = new List <L5QT_GDDQFQ_1507_Staircases>();
            foreach (var buildingPart in staircases)
            {
                ORM_RES_STR_Staircase_Property property = new ORM_RES_STR_Staircase_Property();
                property.Load(Connection, Transaction, buildingPart.RES_STR_Staircase_Property_RefID);
                L5QT_GDDQFQ_1507_Staircases item = new L5QT_GDDQFQ_1507_Staircases();
                item.StaircaseProperty_Name = property.StaircaseProperty_Name;
                item.RES_QST_Staircase_AvailablePropertyID = buildingPart.RES_QST_Staircase_AvailablePropertyID;
                item.RES_STR_Staircase_PropertyID          = buildingPart.RES_STR_Staircase_Property_RefID;
                staircaseList.Add(item);
            }
            returnValue.Result.Staircases = staircaseList.ToArray();

            //Put your code here
            return(returnValue);

            #endregion UserCode
        }