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!

Accessing an asp.net app from a vb.net app

Status
Not open for further replies.

etjohnson81

Programmer
Jul 17, 2006
72
US
I am looking for any clues as to how I might be able to do the following...


I have a support ticket site that I am building, I would like the ticket numbers to be created as yyyy-mmdd-####.

The first part is ok, but I am trying to figure out a way to make the application (asp or vb) fire an event at midnight that will reset a daily ticket counter for the #### portion.

Can a VB app access application vars in a ASP app? If so, can someone shed some light for me...thanks!

Travis
 
I'd have the database setup to hold the identity number for the support ticket. If you really must reset the number each day, a sql server job could be used to reset a value stored in the database, however, I would just go the route of using an identity field (and showing the date created as part of a concatenated ticket number of you want to show that).


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
if you have both a web and desktop GUI then I would create also create a central "server" service which both the web and desktop access. granted this is much more complicated, but then your domain is always synchronized between web an desktop.

all you would need then is process to execute the process on the server. neither GUI needs to know about it. a byproduct of this approach is your desktop and web apps become very thin presentation layers.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
this is a good application for a windows service. you would have 3 (maybe 4) projects for your solution.
1. Web
2. Logic
3. Windows Service
4. Tests (if you run unit tests)

all the application and business logic is located in the Logic assembly. Web and Windows Service reference the Logic assembly.

add a timer to the windows service to fire every so many minutes/hours tracking the current date. when the date changes. roll the incrementing number.

thinking about the problem some more. you may be able to use a math equation to generate the ticket number instead of needing to reset the next number.

1st is significance required for the ticket number, or is this for convience? the system should track the timestamp of the ticket in a seperate property/object/column anyway. could you substitute either an autogenerated number or GUID instead of year-month_day-n_ticket_of_the_day. if you wanted to build some significance into the ticket number could you use seconds/milliseconds as yyyy-mmdd-XXXX? if so the following code would work.
Code:
public string GenerateTicketNumber()
{
   DateTime today = DateTime.Today;
   int millisecondsElaspsedToday = (DateTime.Now - today).TotalMilliseconds();
   return string.Format("{0:yyyy}-{0:mmdd}-{1:000000000}", today, millisecondsElaspsedToday);
}
depending on how large of a system you have you may be able to use seconds. this assumes 2 tickets are not entered at the same time. low to moderate volume.

if this is viable. taking it one step further you wouldn't need to store the ticket number in the database, only the timestamp, the ticket number would be generated from the timestamp property.
Code:
public DateTime TimeStamp { get; set; }
public TicketNumber()
{
   int millisecondsElaspsedThatDay = (TimeStamp - TimeStamp.Date).TotalMilliseconds();
   return string.Format("{0:yyyy}-{0:mmdd}-{1:000000000}", TimeStamp, millisecondsElaspsedThatDay);
}
I may be way off the mark, not understanding the full requirements of the system. But I figured it's worth noting. no sense making the system more complicated than it needs to be.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top