Hi.

Using the following Software:
--- Visual C# Express 2008
--- MySQL
--- Windows Operating System


I am supposed to work on a Monitoring Application for an IT Center, so the requirement is:

  • Users will be registered into the database and they will have an expiration_datetime; which means that they can work until that date and time.
  • All computers are registered also into the database.
  • When Users logging a computer; that computer would be listed as occupied and at the same time the user logged in time will be stored into the database.
  • The Time Duration and Time left of every users who are currently using the computer is required to be updated. When their Time Left reaches to 30 minutes Warning message will be displayed and when their time left reaches 0 minutes then they will be logged out.

I did implement some parts as follow:

  • List all occupied computers into a separate List View
  • List all Free computers into another List View
  • Time Duration and Time Left calculation for every user is done, and it is updating using a timer
  • When a user logged out the computer, both list will be updated

Problem:
I don't know the method I used is optimized and good? Let's consider if there are 100 users currently using the computers and in order to refresh their Time Duration and Time Left every second; it is required to read all the data from the database. It will effects system performance.

Have a look on the attached project including the database Schema and ER-Diagram and the project itself.

What is the solution?

Recommended Answers

All 3 Replies

Why has the update to take place every second? Are you going to calculate for computer use by the second? At my work we have a computer system registering my time of arrival and leave. My loan is calculated and thus rounded by the minute. If you round by the minute, you could also have the opportunity to update, say every 10 secs a part of your logged in computers in a circular way.

Thanks for the reply.

You are right about every 10 seconds or every 1 minute, but what about those users who are logged in or logged out during this period?

I shall be glad if you have a look in the source code and let me know if I am using the right way of coding? Since there are threads and background worker available. I don't know which one is the best; but I used the timer.

Thanks in advanced.

>>You are right about every 10 seconds or every 1 minute, but what about those users who are logged in or logged out during this period?

Does not matter, login time can still be hh:mm:ss, just round to hh:mm.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.