Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reset web application variable with VB app

Status
Not open for further replies.
Very easy. You just create a vb .net dll, add it to your asp solution, then call a method within the dll that will alter the variable.

Now...I purposely left that as a very vague answer, because you didn't give a lot of details.

The first time I read it, my thoughts were that you wanted to write an app that could go out and modify a running asp.net application by means of an unethical method. However, I'm sure that's not what you meant :). So, if you can give more details, then we can help you.

im in ur stakz, overflowin ur heapz!
 
My ASP.net application needs the be able to reset an application variable, lets call it dailyTicketCounter, and I am trying to do it without having to cheat by loading the page at midnight to do it.

Does that clarify?

Travis
 
Well...do you store your daily ticket entries in some type of database? If so the ideal way to do it would be to set it up as an object and configure a DailyTicketCount property. Then within the getter you can call the database and query the tickets based on entry date.

Another option would be to modify the asp application to have a reset function that is exposed. This is a bit more dangerous because others could call it too.

It might help if you told us a bit more about your variable. Is it static? Is it private?

im in ur stakz, overflowin ur heapz!
 
The site is a helpdesk site for our clients to manage/view/contact us through.

I am not "great" with sql, how would I create the property and make it reset to 0 at midnight?

I figure I could do some sort of query to make it work, but trying to keep this clean.

Travis
 
Well...let's say you have a SQL table that's like this (leaving some out intentially)

ID --I used an int
TicketNumber --I used a string
Entered --Must be datetime
...

Then within your Get method you would create a connection to your server and use a query like

Select Count(*)
From Tickets
Where Entered >=DATEADD(dd, DATEDIFF(dd,0,GETDATE()), 0)

This will return everything that was enered into the table after midnight of the day you run the query. Of course, if you want to get counts for different days, then you would need to re-write it a touch

HTH

im in ur stakz, overflowin ur heapz!
 
that sounds great actually, and if there were none for that day, then it would assign 1, and then x+1

Thats kinda what i was thinking, just couldnt put it together, thanks a bunch!

Travis
 
Not sure what you mean by "assign 1, and then x+1". If you're talking about quantity of tickets, that already being kept up with in the SQL Server. If you're talking about the actual ticket count, you would assign it each time you ran the query. So it would never be out of sync with the database.

im in ur stakz, overflowin ur heapz!
 
there is a ticket id (autonumber) and ticket number (to look like a bigger company) in this format of yyyy-mmdd-xxxx, so the xxxx portion will be the count part (xxxx) would be generated by the count query(x). (First of the day being x+1 rather than x=0)

Travis
 
one other thing I would like to accomplish, which may be done in the database, is if a ticket has a reminder date set, then at midnight or a set time of day, it would email the ticket owner a reminder.

Travis
 
OK...I'm not a big fan of doing ticket numbers like that because of the added complexity that it injects (I like to keep thinks simple).

As far as the reminder date, you can do this one of two ways. First way is to have your web app monitor the time and do a query, then email the info when needed.

Second option would be to set up a function that does the operation, then create a task that gets ran on a schedule of your choosing. It sounds like the reminder is a one time email, so this would work well. If you wanted to add additional functionality into the reminder (like snooze), then I would look into an Office plug-in that would automatically create a calendar or task event with a reminder built in.

im in ur stakz, overflowin ur heapz!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top