restricting number of ads by user RRS feed

  • Question

  • User-2042959507 posted


    Has someone implemented a solution which restricts number of ads by user? I would be greatfull for some tips or source code in c#.




    Friday, May 22, 2009 2:21 AM

All replies

  • User-903370090 posted

    Your query does not seem to be clear, please elaborate in detail.

    Friday, May 22, 2009 4:28 AM
  • User-2042959507 posted


     I would like to limit the number of ads which may be posted by single user with guest status for example to 2. I would like to create another role for

    members who should be able to post for example up to 10 ads. How do I do that? I will appriciate any suggestions and c# source code if possible.





    Friday, May 22, 2009 7:28 AM
  • User-122480877 posted

    Sorry I dont have the time right now to give you some working code but here is a solution for you.

    • Create a method class called HasUserReachedLimit returning System.Boolean
      • Declare a new int as AllowedAds = 2
      • In this method do a get all query on 'active listings' with the 'members Id'
      • With the results given the table has a result count so
      • in the final section can return a value like, return (AllowedAds == AdTable.Count) either true or false
    • In the PostAd.aspx Page_Load Event
      • Call your method in an if statement, if (HasUserReachedLimit(Profile.MemberId))
      • If returned true then you can do what ever you want here to tell the user and stop them from creating a listing.

    Hope this helps you [:D] 


    Saturday, May 23, 2009 4:41 AM
  • User-2042959507 posted


    1) I would like to limit the number of ads which may be posted by single user with Guest role status to 2.

    2) I have created another role called Premium for members who should be able to post up to 20 ads. When I
    upgrade users from Guest role to Premium role they should be able to post and manage up to 20 ads.

    If you are savvy in asp.net and c# it should not be the problem. I am not. So I am willing to pay a small amount to someone who helps me.

    Contact me privately.



    Tuesday, May 26, 2009 6:49 AM