
<cfcomponent hint="BusinessMaster object" output="false">
    <cffunction name="init" access="public" output="true">
        <cfloop list="#structkeylist(arguments)#" index="argvar">
            <cfset this[argvar]=arguments[argvar]/>
        </cfloop>
        <cfreturn this />
 
    </cffunction>
 
    <cffunction access="public" name="getBusinessMaster" output="false" returntype="query">
        <cfargument name="isDemo" type="string" default="0" required="No">
        <cfargument name="IsHidden" type="string" default="0" required="No">
        <cfargument name="orderby" type="string" default="BusinessID" required="No">
        <cfargument name="CityName" type="string" default="" required="No">
        <cfargument name="orderDirection" type="string" default="desc" required="No">
        <cfargument name="top" type="string" required="no" default="">
        <cfquery name="local.getBusinessMaster" datasource="#this.odbc#">

            SELECT #arguments.top# [BusinessID]
                ,[UserID]
                ,[dbo].[BusinessMaster].[CityID]
                ,[BusinessName]
                ,[BusinessLogo]
                ,[BusinessBGImage]
                ,[Address]
                ,[Latitude]
                ,[Longitude]
                ,[MinimumCharge]
                ,[MaximumCharge]
                ,[DefaultCharge]
                ,[ServiceCharge]
                ,[IsServiceCharge]
                ,[TaxCharge]
                ,[Remark]
                ,[AddedOn]
                ,[IsTakeaway]
                ,[IsDelivery]
                ,[DeliveryRadius]
                ,[MinimumOrderAmount]
                ,[DeliveryCharge]
                ,[DeliveryFreeOrder]
                ,[IsDemo]
                ,[IsHidden]
            FROM [dbo].[BusinessMaster]
            <cfif len(trim(arguments.CityName))>
            Left join [dbo].[CityMaster] ON [dbo].[CityMaster].CityID = [dbo].[BusinessMaster].CityID
            </cfif>
            WHERE 1=1
             <cfif len(trim(arguments.IsDemo))>
                and IsDemo  = <cfqueryparam value = "#arguments.IsDemo#" cfsqltype="cf_sql_varchar">
             </cfif>
             <cfif len(trim(arguments.IsHidden))>
                and IsHidden  = <cfqueryparam value = "#arguments.IsHidden#" cfsqltype="cf_sql_varchar">
             </cfif>
             <cfif len(trim(arguments.IsHidden))>
                and IsHidden  = <cfqueryparam value = "#arguments.IsHidden#" cfsqltype="cf_sql_varchar">
             </cfif>
             <cfif len(trim(arguments.CityName))>
                AND CityName = <cfqueryparam value = "#arguments.CityName#" cfsqltype="cf_sql_varchar">
             </cfif>
           
             Order by #arguments.orderby# #arguments.orderDirection#
        </cfquery>
       
        <cfreturn local.getBusinessMaster>
        
    </cffunction>
</cfcomponent>