Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
SQL
Hi,
In my project i need to inactive the users when their subscription plan gets expired. How can I achieve this? Any idea on this?
For Example User 1's  Plan is for 6 months Started from Started on:6/6/2012 after 6 months 6/12/2012 i need to[B] inactive [/B] this user.
Posted
Updated 10-Dec-12 19:27pm
v2

Hi,

You can use the following code to know whether the user's account has expired or not?

DateTime createddate = Convert.ToDateTime(createddate);
            DateTime currenctdate = DateTime.Now;
            TimeSpan t = currenctdate.Subtract(createddate);
            int numberofdays = Convert.ToInt32(t.TotalDays);
            if (numberofdays <= howmanydays(month store at days))
            {
            }
 
Share this answer
 
v2
Hi i have created my Trigger in this way...now how can i able to view my results by running application...
[CODE]create trigger tr_InactiveUsers
on aspnet_membership
for insert
as
begin
update asp_mem
set
IsApproved='0'
from
aspnet_membership asp_mem
join
planmapping pm
on
pm.accountexpiry=getdate()
end[/CODE]

Is this Correct? if not please help it...accordingly..
I have aspnetmembership one table and planmapping another table base on the value of acccountexpiry on planmapping table i need to update IsApproved='1' in aspnet_membership table...
I hope it clears...
 
Share this answer
 
Hi,
Each and every login check the subscription plan with created date & current date

subtract the created date with current date and check the month
 
Share this answer
 
it would be better if u give me with soln...
 
Share this answer
 
Hi nagalkumar,
I have a table with field of Started Date and Expiration date of user plan's in Months.
If user has started a plan for 2 months...
Started Date:1/10/2012
Expiration Date :30/11/2012
here i need to change the status of ISAPPROVED column of the specific user on the expiration days gets elapsed
here i need to implement a trigger like SQL jobs to inactive the user..Please i need a code i am new to this concept...
 
Share this answer
 
Hi sahmed

Add the following query to your trigger or sql job to update ISAPPROVED column.

update table_name set ISAPPROVED='N' where Expiration_Date=getdate()
 
Share this answer
 
Comments
Erik Rude 11-Dec-12 5:35am    
In principle a good ide, but the implementation means that the user will be allowed if the trigger is not run on the day when the software expires. Better to say in Expiration <= the current date.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900