Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 17-Apr-13 1:59am
v3
Comments
Dnyaneshwar Kondbale 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 :)
Rockstar_ 17-Apr-13 8:06am    
Yes I agree
ZurdoDev 17-Apr-13 7:57am    
There are a million ways to code for this. Where are you stuck?
OriginalGriff 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 17-Apr-13 8:10am    
I am sorry if I doing any mistake, Is this comment for me @OriginalGriff .

C#
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();
}
 
Share this answer
 
C#
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();
}
 
Share this answer
 
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.
 
Share this answer
 

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