How to inactive the Users

Posted by Self-Innovator under ASP.NET on 12/11/2012 | Points: 10 | Views : 1048 | Status : [Member] | Replies : 4
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 inactive this user

Join Hands Change lives
Thanks & Regards
Straight Edge Society



Responses

Posted by: Pavanandey on: 12/11/2012 [Member] Bronze | Points: 25

Up
0
Down
you can create a trigger on the table and write the below query

Empid EmpName Subscription_in_months Date Active
1 Ram 6 2010-10-10 00:00:00.000 1
2 Subash 6 2012-05-11 00:00:00.000 1
3 Tanvik 6 2012-12-13 00:00:00.000 1

update Table1 set Active=0 where Empid in (SELECT Empid from Table1 where Active=1 and DATEDIFF(month,date1,getdate()) > 6)


Empid EmpName Subscription_in_months Date Active
1 Ram 6 2010-10-10 00:00:00.000 0
2 Subash 6 2012-05-11 00:00:00.000 0
3 Tanvik 6 2012-12-13 00:00:00.000 1

Thanks
Pavan Kumar
Mark Answer if this fits the need

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Self-Innovator on: 12/11/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi pavandaney..thanks a lot dude...

Join Hands Change lives
Thanks & Regards
Straight Edge Society

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 12/11/2012 [Member] Bronze | Points: 25

Up
0
Down
Mark the answer if this helps you :)

Thanks
Pavan Kumar
Mark Answer if this fits the need

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Self-Innovator on: 12/11/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi i have created my Trigger in this way...now how can i able to view my results by running application...
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


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's clear...


Join Hands Change lives
Thanks & Regards
Straight Edge Society

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response