spGetAddressBookContactCounts
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ClientUsersID | int | IN | |
@ShowEmptyEmail | bit | IN | |
@filter | int | IN |
Definition
Copy
create procedure [dbo].[spGetAddressBookContactCounts]
@ClientUsersID int,
@ShowEmptyEmail bit,
@filter int
as
if (@filter = 0) --all contacts
begin
if (@ShowEmptyEmail=1)
select count(id) from AddressBookContacts where ClientUsersId = @ClientUsersID and [deleted] = 0
else
select count(id) from AddressBookContacts where ClientUsersId = @ClientUsersID and [deleted] = 0 and isnull(Email, '') <> ''
end
if (@filter = 1) --personal contacts only
begin
if (@ShowEmptyEmail=1)
select count(id) from AddressBookContacts where ClientUsersId = @ClientUsersID and [deleted] = 0 and isnull(REID, 0) = 0
else
select count(id) from AddressBookContacts where ClientUsersId = @ClientUsersID and [deleted] = 0 and isnull(Email, '') <> '' and isnull(REID, 0) = 0
end
if (@filter = 2) --assigned constits only
begin
if (@ShowEmptyEmail=1)
select count(id) from AddressBookContacts where ClientUsersId = @ClientUsersID and [deleted] = 0 and isnull(REID, 0) <> 0
else
select count(id) from AddressBookContacts where ClientUsersId = @ClientUsersID and [deleted] = 0 and isnull(Email, '') <> '' and isnull(REID, 0) <> 0
end