You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
177 lines
8.5 KiB
177 lines
8.5 KiB
USE [FastMoneyPro_Remit]
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[proc_getNotifyInfo] Script Date: 11/20/2023 4:56:14 PM ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
ALTER PROCEDURE [dbo].[proc_getNotifyInfo]
|
|
-- Add the parameters for the stored procedure here
|
|
@rowId BIGINT = NULL
|
|
,@title VARCHAR(100) = NULL
|
|
,@createDate DATETIME = NULL
|
|
,@isRead INT = NULL
|
|
,@Type INT = NULL
|
|
,@sentId BIGINT = NULL
|
|
,@customerId BIGINT = NULL
|
|
,@flag VARCHAR(50) = NULL
|
|
AS
|
|
--EXEC proc_getNotifyInfo @flag = 'notification',@customerId='57729'
|
|
------------------------------------------------------------------------------------------------------------
|
|
-- #1135 added new flags (@flag = 'notification' and @flag = 'notification-detail') for new notification icon
|
|
------------------------------------------------------------------------------------------------------------
|
|
IF @flag = 'notice'
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
SELECT rowId
|
|
,title
|
|
,createDate
|
|
,isRead
|
|
,Type
|
|
,sentId
|
|
FROM pushNotificationHistroy
|
|
WHERE type = '1'
|
|
AND rowId > 0
|
|
AND CAST(createDate AS DATE) >= DATEADD(day, - 7, CAST(GETDATE() AS DATE))
|
|
AND customerId = @customerId
|
|
|
|
--UNION ALL
|
|
|
|
--SELECT rowId
|
|
-- ,title
|
|
-- ,createDate
|
|
-- ,isRead
|
|
-- ,Type
|
|
-- ,sentId
|
|
--FROM pushNotificationHistroy
|
|
--WHERE type = '0'
|
|
-- AND rowId > 0
|
|
-- AND CAST(createDate AS DATE) >= DATEADD(day, - 3, CAST(GETDATE() AS DATE))
|
|
-- AND customerId = @customerId
|
|
ORDER BY rowid DESC
|
|
END
|
|
ELSE IF @flag = 'notification'
|
|
BEGIN
|
|
SELECT rowId
|
|
,customerId
|
|
,title
|
|
,body
|
|
,createDate
|
|
,isRead
|
|
,Type
|
|
,sentId
|
|
,ISNULL(category,'INFO') AS category
|
|
,url
|
|
,isClickable = CASE
|
|
WHEN ISNULL(url, 'N') = 'N'
|
|
THEN 'N'
|
|
ELSE 'Y'
|
|
END
|
|
FROM pushNotificationHistroy
|
|
WHERE type = '0'
|
|
AND customerId = @customerId
|
|
--AND isRead=0
|
|
--AND CAST(createDate as date) >= DATEADD(day,-7, CAST(GETDATE() as date))
|
|
ORDER BY rowid desc
|
|
|
|
END
|
|
ELSE IF @flag = 'notification-detail'
|
|
BEGIN
|
|
UPDATE pushNotificationHistroy
|
|
SET isRead = '1',
|
|
modifiedDate= GETDATE(),
|
|
modifiedBy='JsonRx'
|
|
WHERE isRead = '0'
|
|
AND rowid = @rowId
|
|
|
|
SELECT rowId
|
|
,customerId
|
|
,title
|
|
,body
|
|
,createDate
|
|
,isRead
|
|
,Type
|
|
,sentId
|
|
,category
|
|
,url
|
|
FROM pushNotificationHistroy
|
|
WHERE rowId = @rowId --AND CAST(createDate as date) >= DATEADD(day,-3, CAST(GETDATE() as date))
|
|
END
|
|
ELSE IF @flag = 'notification-portal'
|
|
BEGIN
|
|
SELECT top 3 rowId
|
|
,customerId
|
|
,title
|
|
,body
|
|
,createDate
|
|
,isRead
|
|
,Type
|
|
,sentId
|
|
,ISNULL(category,'INFO') AS category
|
|
,url
|
|
,isClickable = CASE
|
|
WHEN ISNULL(url, 'N') = 'N'
|
|
THEN 'N'
|
|
ELSE 'Y'
|
|
END
|
|
, '0' as errorCode
|
|
,'Success' as msg
|
|
,(SELECT COUNT(*)
|
|
FROM pushNotificationHistroy
|
|
WHERE type = '0'
|
|
AND customerId = @customerId
|
|
AND isRead = 0) notificationCount
|
|
FROM pushNotificationHistroy
|
|
WHERE type = '0'
|
|
AND customerId = @customerId
|
|
--AND isRead=0
|
|
--AND CAST(createDate as date) >= DATEADD(day,-7, CAST(GETDATE() as date))
|
|
ORDER BY rowId desc
|
|
|
|
DECLARE @rewardPoints INT = 0;
|
|
DECLARE @profle varchar(500);
|
|
SET @rewardPoints = CAST(DBO.FNA_GET_AVAILABLE_BALANCE_POINTS(@customerId) AS INT);
|
|
|
|
SELECT @profle = selfieDoc From customerMaster where customerid=@customerId;
|
|
SELECT @rewardPoints AS RewardAmount,@profle as SelfieDoc;
|
|
END
|
|
ELSE IF @flag = 'notificationDetail-portal'
|
|
BEGIN
|
|
|
|
SELECT rowId
|
|
,customerId
|
|
,title
|
|
,body
|
|
,createDate
|
|
,isRead
|
|
,Type
|
|
,sentId
|
|
,ISNULL(category,'INFO') AS category
|
|
,url
|
|
,isClickable = CASE
|
|
WHEN ISNULL(url, 'N') = 'N'
|
|
THEN 'N'
|
|
ELSE 'Y'
|
|
END
|
|
, '0' as errorCode
|
|
,'Success' as msg
|
|
,(SELECT COUNT(*)
|
|
FROM pushNotificationHistroy
|
|
WHERE type = '0'
|
|
AND customerId = @customerId
|
|
AND isRead = 0) notificationCount
|
|
FROM pushNotificationHistroy
|
|
WHERE type = '0'
|
|
AND customerId = @customerId
|
|
--AND isRead=0
|
|
--AND CAST(createDate as date) >= DATEADD(day,-7, CAST(GETDATE() as date))
|
|
ORDER BY rowId desc
|
|
|
|
END
|