5 Replies - 503 Views - Last Post: 26 April 2014 - 06:34 PM Rate Topic: -----

#1 CY5  Icon User is offline

  • D.I.C Regular

Reputation: 12
  • View blog
  • Posts: 348
  • Joined: 28-September 12

Creating a Reminder System

Posted 26 April 2014 - 11:02 AM

Hi friends,
I wanted create a Reminder Systems for my Project

So Scenario is like this,
A Gym has owned a Software to maintain record of employee and customer, everything is ready now only reminder system is to be made. Reminder system is like for example if customer comes to gym and inquires about plan and fees and says call back him at so and so time, so receptionist will require reminder system to alert him at the time given by customer for call back.

What i have done
1.Created a Listview to show reminder list, and created two button ADD reminder and DELETE reminder
When reminder is added following things are added in Reminder table in Database
i.ID
ii.Title
iii.Message
iv.Time
v.Date

2.when i display the reminder table in reminder listview, the order will be in (Date, time)asecnding order.

---Till here everything is done---

Now i am confused here, lets take example
The first Reminder in Listview is around 3.00 clock, when the time is reached i want to show message that "call back this customer".
So to do this i was thinking of using timer and on each tick compare Current time with Reminder time, if equals display message, but this method is inefficient it can freeze my UI.

The Alternate way i was thinking to run this timer inside Background worker as it would create a different thread there will be no issue with my application.

Friends I want some idea to create Reminder system, please help me.

Is This A Good Question/Topic? 0
  • +

Replies To: Creating a Reminder System

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5467
  • View blog
  • Posts: 11,745
  • Joined: 02-June 10

Re: Creating a Reminder System

Posted 26 April 2014 - 11:23 AM

Quote

it can freeze my UI.

You should never have any work happening on the UI thread. You'll need to make this a multi-threaded application. That way your timer is seperate from the UI. Everything should always be seperate from the UI.

Quote

The Alternate way i was thinking to run this timer inside Background worker as it would create a different thread there will be no issue with my application.


Yep. So when you tried this, did it not resolve the issue?

You've pretty much answered your own question. What is your question for us?
Was This Post Helpful? 0
  • +
  • -

#3 Momerath  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1010
  • View blog
  • Posts: 2,444
  • Joined: 04-October 09

Re: Creating a Reminder System

Posted 26 April 2014 - 01:12 PM

Use System.Threading.Timer or System.Timers.Timer as they execute on their own thread. But remember, you can't invoke UI controls from within the event (as they aren't on the UI thread) so you'll have to invoke through a delegate (though you can get the second one to raise the event on the UI thread if you really want it to).

This post has been edited by Momerath: 26 April 2014 - 01:14 PM

Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5467
  • View blog
  • Posts: 11,745
  • Joined: 02-June 10

Re: Creating a Reminder System

Posted 26 April 2014 - 05:46 PM

Rather than invoking through a delegate, just don't do it in 1990's WinForms. In 2014 using WinForms might as well be using VB6.

If you build under the current WPF then all you have to do is bind to the property your data object. The UI will update itself.
Was This Post Helpful? 0
  • +
  • -

#5 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3535
  • View blog
  • Posts: 10,944
  • Joined: 05-May 12

Re: Creating a Reminder System

Posted 26 April 2014 - 06:30 PM

Just out of curiosity, what is the minimum resolution for your times for reminders. I find it really hard to realistically have those set to be less than a minute. I can't imagine a receptionist saying that they need a reminder down to the 1 second resolution.

Assuming a timer tick of once every minute, I can't see how you are freezing your UI by checking to see there is an appointment unless you have to open a slow database connection over dialup for each check since you said you have appointments stored the list view.
Was This Post Helpful? 1
  • +
  • -

#6 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5467
  • View blog
  • Posts: 11,745
  • Joined: 02-June 10

Re: Creating a Reminder System

Posted 26 April 2014 - 06:34 PM

Oh good point Skydiver. Design flaws do tend to account for more problems than just about anything else.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1