Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Shared Function getListPropertyListing(ByVal agencyCompanyRefOwner As String, ByVal psRefOwner As String, ByVal listingStatus As String) As DataTable
- Dim sqlCon As New SqlConnection(_constr)
- Dim sqlCmd As New SqlCommand
- Dim dt As New DataTable
- Dim queryPsOwner As String = String.Empty
- If Trim(psRefOwner) <> "" Then
- queryPsOwner = " and l.psRefOwner = @psRefOwner "
- End If
- sqlCon.Open()
- sqlCmd.Connection = sqlCon
- sqlCmd.CommandType = CommandType.Text
- sqlCmd.CommandText = "select l.*, sb.subLocationName, ct.cityName, p.provinceName, lt.listingTypeName, pt.priceTypeName " + _
- "from " + _natapropertyDb + "..SEC_TR_listing l " + _
- " left join " + _natapropertyDb + "..SEC_LK_listingType lt on lt.listingTypeRef = l.listingTypeRef " + _
- " left join " + _natapropertyDb + "..SEC_LK_priceType pt on pt.priceType = l.priceType " + _
- " left join " + _natapropertyDb + "..LK_addrCountry c on c.countryCode = l.countryCode " + _
- " left join " + _natapropertyDb + "..LK_addrProvince p on p.countryCode = c.countryCode and p.provinceCode = l.provinceCode " + _
- " left join " + _natapropertyDb + "..LK_addrCity ct on ct.countryCode = c.countryCode and ct.provinceCode = p.provinceCode and ct.cityCode = l.cityCode " + _
- " left join " + _natapropertyDb + "..MS_subLocation sb on sb.countryCode = c.countryCode and sb.provinceCode = p.provinceCode and sb.cityCode = ct.cityCode and sb.subLocationRef = l.areaRef " + _
- " " + _
- " " + _
- " where l.listingStatus = @listingStatus and l.agencyCompanyRefOwner = @agencyCompanyRefOwner " + queryPsOwner
- sqlCmd.Parameters.AddWithValue("@agencyCompanyRefOwner", agencyCompanyRefOwner)
- sqlCmd.Parameters.AddWithValue("@listingStatus", listingStatus)
- If Trim(queryPsOwner) <> "" Then
- sqlCmd.Parameters.AddWithValue("@psRefOwner", psRefOwner)
- End If
- Dim sqlDa As New SqlDataAdapter(sqlCmd)
- sqlDa.Fill(dt)
- sqlCmd = Nothing
- sqlCon.Close()
- Return dt
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement