Hi satabeach,
Refer the below article.
From the above article you are able to detect the user transaction is from mobile devices or from pc.
You need to set value if it mobile device also you can make any column field same in your payment table /or from related table where you saved successful transaction details where you can save transaction made from mobile or from pc. You just need to store value if successful transaction is made.
When user made a successful transaction then need to save transaction detail with current date and user details with mobile details (IP Address) in a particular table in the database. So that you can check the user is exceed the maximum limit per day per device with condition as like below.
if(IsMobile)
{
if((countof Date per User per IPAddress) >= 2)
{
Show Message ("Transaction limit exceeded");
}
}
Or you can directly check with sql query
Select Count(*) From tablename
Where Isnull(Ismobile,'N') = 'Y'
AND user = @user
AND IPAddress = @IPAddress
AND TranDate = GETDATE()
I have provided the logic so you need to implement this by modifying your logic if you feel something better.
Below is a sample sql query so that you can refer.
DECLARE @Table AS TABLE(Id INT IDENTITY,IsMobile CHAR(1),IPAddress VARCHAR(50),UserName VARCHAR(50),TranDate DATETIME)
INSERT INTO @Table VALUES('Y','1:12:1','Test','2017-05-09 16:00:23.133')
INSERT INTO @Table VALUES('Y','1:12:1','Test','2017-05-09 16:10:23.133')
SELECT * FROM @Table
DECLARE @user VARCHAR(50),@IPAddress VARCHAR(50)
SET @user = 'Test'
SET @IPAddress = '1:12:1'
SELECT Count(*) TranCount FROM @Table
WHERE ISNULL(IsMobile,'N') = 'Y'
AND UserName = @user
AND IPAddress = @IPAddress
AND CONVERT(VARCHAR(10),TranDate,101) = CONVERT(VARCHAR(10),GETDATE(),101)