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

            FR_L5BD_GBFB_1408 functionReturn = new FR_L5BD_GBFB_1408();

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

            returnValue.Result = new L5BD_GBFB_1408();

            ORM_RES_BLD_Building building = new ORM_RES_BLD_Building();
            building.Load(Connection, Transaction, Parameter.BuildingID);

            returnValue.Result.Building_BalconyPortionPercent        = building.Building_BalconyPortionPercent;
            returnValue.Result.Building_DocumentationStructure_RefID = building.Building_DocumentationStructure_RefID;
            returnValue.Result.Building_ElevatorCoveragePercent      = building.Building_ElevatorCoveragePercent;
            returnValue.Result.Building_Name = building.Building_Name;
            returnValue.Result.Building_NumberOfAppartments         = building.Building_NumberOfAppartments;
            returnValue.Result.Building_NumberOfFloors              = building.Building_NumberOfFloors;
            returnValue.Result.Building_NumberOfOccupiedAppartments = building.Building_NumberOfOccupiedAppartments;
            returnValue.Result.Building_NumberOfOffices             = building.Building_NumberOfOffices;
            returnValue.Result.Building_NumberOfOtherUnits          = building.Building_NumberOfOtherUnits;
            returnValue.Result.Building_NumberOfProductionUnits     = building.Building_NumberOfProductionUnits;
            returnValue.Result.Building_NumberOfRetailUnits         = building.Building_NumberOfRetailUnits;
            returnValue.Result.IsContaminationSuspected             = building.IsContaminationSuspected;
            returnValue.Result.RES_BLD_BuildingID = building.RES_BLD_BuildingID;


            ORM_RES_BLD_Apartment.Query apQuery = new ORM_RES_BLD_Apartment.Query();
            apQuery.Tenant_RefID               = securityTicket.TenantID;
            apQuery.IsDeleted                  = false;
            apQuery.Building_RefID             = building.RES_BLD_BuildingID;
            returnValue.Result.AppartmentCount = ORM_RES_BLD_Apartment.Query.Search(Connection, Transaction, apQuery).ToArray().Length;

            ORM_RES_BLD_Attic.Query atQuery = new ORM_RES_BLD_Attic.Query();
            atQuery.Tenant_RefID           = securityTicket.TenantID;
            atQuery.IsDeleted              = false;
            atQuery.Building_RefID         = building.RES_BLD_BuildingID;
            returnValue.Result.atticsCount = ORM_RES_BLD_Attic.Query.Search(Connection, Transaction, atQuery).ToArray().Length;

            ORM_RES_BLD_Basement.Query baQuery = new ORM_RES_BLD_Basement.Query();
            baQuery.Tenant_RefID              = securityTicket.TenantID;
            baQuery.IsDeleted                 = false;
            baQuery.Building_RefID            = building.RES_BLD_BuildingID;
            returnValue.Result.basementsCount = ORM_RES_BLD_Basement.Query.Search(Connection, Transaction, baQuery).ToArray().Length;

            ORM_RES_BLD_Facade.Query faQuery = new ORM_RES_BLD_Facade.Query();
            faQuery.Tenant_RefID            = securityTicket.TenantID;
            faQuery.IsDeleted               = false;
            faQuery.Building_RefID          = building.RES_BLD_BuildingID;
            returnValue.Result.facadesCount = ORM_RES_BLD_Facade.Query.Search(Connection, Transaction, faQuery).ToArray().Length;

            ORM_RES_BLD_HVACR.Query hvQuery = new ORM_RES_BLD_HVACR.Query();
            hvQuery.Tenant_RefID           = securityTicket.TenantID;
            hvQuery.IsDeleted              = false;
            hvQuery.Building_RefID         = building.RES_BLD_BuildingID;
            returnValue.Result.hvarcsCount = ORM_RES_BLD_HVACR.Query.Search(Connection, Transaction, hvQuery).ToArray().Length;

            ORM_RES_BLD_OutdoorFacility.Query ofQuery = new ORM_RES_BLD_OutdoorFacility.Query();
            ofQuery.Tenant_RefID   = securityTicket.TenantID;
            ofQuery.IsDeleted      = false;
            ofQuery.Building_RefID = building.RES_BLD_BuildingID;
            returnValue.Result.outdoorfacilitiesCount = ORM_RES_BLD_OutdoorFacility.Query.Search(Connection, Transaction, ofQuery).ToArray().Length;

            ORM_RES_BLD_Roof.Query roQuery = new ORM_RES_BLD_Roof.Query();
            roQuery.Tenant_RefID         = securityTicket.TenantID;
            roQuery.IsDeleted            = false;
            roQuery.Building_RefID       = building.RES_BLD_BuildingID;
            returnValue.Result.roofCount = ORM_RES_BLD_Roof.Query.Search(Connection, Transaction, roQuery).ToArray().Length;

            ORM_RES_BLD_Staircase.Query stQuery = new ORM_RES_BLD_Staircase.Query();
            stQuery.Tenant_RefID               = securityTicket.TenantID;
            stQuery.IsDeleted                  = false;
            stQuery.Building_RefID             = building.RES_BLD_BuildingID;
            returnValue.Result.staircasesCount = ORM_RES_BLD_Staircase.Query.Search(Connection, Transaction, stQuery).ToArray().Length;

            ORM_RES_BLD_Building_2_GarbageContainerType.Query gctQuery = new ORM_RES_BLD_Building_2_GarbageContainerType.Query();
            gctQuery.Tenant_RefID           = securityTicket.TenantID;
            gctQuery.IsDeleted              = false;
            gctQuery.RES_BLD_Building_RefID = building.RES_BLD_BuildingID;
            List <ORM_RES_BLD_Building_2_GarbageContainerType> garbageContainerType = ORM_RES_BLD_Building_2_GarbageContainerType.Query.Search(Connection, Transaction, gctQuery);
            returnValue.Result.RES_BLD_GarbageContainerTypeID = garbageContainerType[0].RES_BLD_GarbageContainerType_RefID;

            ORM_RES_BLD_Building_2_BuildingType.Query bdQuery = new ORM_RES_BLD_Building_2_BuildingType.Query();
            bdQuery.Tenant_RefID           = securityTicket.TenantID;
            bdQuery.IsDeleted              = false;
            bdQuery.RES_BLD_Building_RefID = building.RES_BLD_BuildingID;
            List <ORM_RES_BLD_Building_2_BuildingType> buildingType = ORM_RES_BLD_Building_2_BuildingType.Query.Search(Connection, Transaction, bdQuery);
            returnValue.Result.RES_BLD_Building_TypeID = buildingType[0].RES_BLD_Building_Type_RefID;

            //Put your code here
            return(returnValue);

            #endregion UserCode
        }