Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Am developing a car booking application..I have a scenario for restricting no of bookings to 10 in a day.. If it exceeds alert message should come..?
 
How to code for the above..
 
[edit]SHOUTING removed - OriginalGriff[/edit]
Posted 17-Apr-13 2:50am
Edited 17-Apr-13 2:59am
v3
Comments
Dnyaneshwar Kondbale at 17-Apr-13 7:56am
   
If you have save Booking entry in data base then check count of transaction in date range
before inserting the record in database.
 
Hope its Help You :)
Member61 at 17-Apr-13 8:06am
   
Yes I agree
ryanb31 at 17-Apr-13 7:57am
   
There are a million ways to code for this. Where are you stuck?
OriginalGriff at 17-Apr-13 7:57am
   
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
Dnyaneshwar Kondbale at 17-Apr-13 8:10am
   
I am sorry if I doing any mistake, Is this comment for me @OriginalGriff .
@AmitGajjar at 17-Apr-13 8:40am
   
No, thats not for you.
OriginalGriff at 17-Apr-13 9:33am
   
No - it's for the OP (Check the message indentation).
Sorry if you assumed it was, it was never intended that way! :laugh:
onurag19 at 17-Apr-13 8:25am
   
You need to code for that ?
@AmitGajjar at 17-Apr-13 8:41am
   
Try something and let us know if you are stuck somewhere.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

oid Application_Start(object sender, EventArgs e)
{
    Application["ActiveSessions"] = 0;
}
 
void Session_Start(object sender, EventArgs e)
{
    try
    {
        Application.Lock();
 
        int activeSessions = (int) Application["ActiveSessions"] + 1;
        int allowedSessions = 10; // retrieve the threshold here instead

        Application["ActiveSessions"] = activeSessions;
 
        if (activeSessions > allowedSessions)
            System.Web.HttpContext.Current.Response.Redirect("~/UserLimitReached.aspx", false);
    }
    finally
    {
        Application.UnLock();
    }
}
 
void Session_End(object sender, EventArgs e)
{
    Application.Lock();
    Application["ActiveSessions"] = (int)Application["ActiveSessions"] - 1;
    Application.UnLock();
}
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

oid Application_Start(object sender, EventArgs e)
{
    Application["ActiveSessions"] = 0;
}
 
void Session_Start(object sender, EventArgs e)
{
    try
    {
        Application.Lock();
 
        int activeSessions = (int) Application["ActiveSessions"] + 1;
        int allowedSessions = 10; // retrieve the threshold here instead

        Application["ActiveSessions"] = activeSessions;
 
        if (activeSessions > allowedSessions)
            System.Web.HttpContext.Current.Response.Redirect("~/UserLimitReached.aspx", false);
    }
    finally
    {
        Application.UnLock();
    }
}
 
void Session_End(object sender, EventArgs e)
{
    Application.Lock();
    Application["ActiveSessions"] = (int)Application["ActiveSessions"] - 1;
    Application.UnLock();
}
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

you can handle this in stored procedure, you should check with userid and no of transaction per user on the date, you can easily get how many records inserted before you insert a new registration.
  Permalink  

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



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 18 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100