adding a timer to implement reminders in application

I have a reminders table in my apps database

FieldName = 'id'
FieldName = 'title'
FieldName = 'description'
FieldName = 'start_date'
FieldName = 'start_time'
FieldName = 'end_date'
FieldName = 'end_time'
FieldName = 'repeat'  (true/false)
FieldName = 'occurs'  (Integer = 1-Daily, 2-Weekly, 3-Monthy, 4-Annually)
FieldName = 'completed" (true/False)

Is there a way to use a TTimer to display the title and description of the reminder whenever the event occurs? If so, please explain in code/seudo code, or text.

a reminder is either a onetime - or - re-occurring event

if one time (occurs = 1 daily) , the date and time is stored in the Start_Date & Start Time The reminder should display at that time. After displayed, table field "Completed" is set to true.

if re-occurring, the date and time is stored in the Start_Date & Start Time and the End Date and End Time is stored. The reminder should display at that day and time, each day (1), week (2), month(3), or year(4)

If daily, reminder should display at that time every day, until end date is reached

If weekly, reminder should display at that time, on that particular day (of each week), until end date is reached

If monthly, reminder should display at that time, on that particular day (of each month), until end date is reached

If Annually, reminder should display at that time, on that particular day (of each year), until end date is reached

when end date is reached, Completed is updated with True

thanks, i hope this is easily do-able with out any additional components or libraries

Answers


<ironic>

Your question: Is there a way to use a TTimer to display the title and description of the reminder whenever the event occurs?

My answer

Yes, is there a way to do it.

Requirement: If so, please explain in code.

Anwer to fillfull your requirement

pseudocode:

procedure TEventsManager.SetNextEventTimer;
begin
  if Assigned(NextOcurringEvent) then
  begin
    Timer1.Interval := MillisecondsBetween(Now, NextOcurringEvent.DateTime);
    Timer1.Enabled := True;
  end;
end;

procedure TEventsManager.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  DisplayReminder(nextOcurringEvent);
  SetNextEventTimer;
end;

</ironic>


I know you said without additional components, but I think you'll like this.

In JVCL, there's a component called TJvScheduledEvents which can do exactly what you need and you can use it with very little programming. Try it and if you have any questions about it, feel free to ask.


Need Your Help

How to open a location's 'native' info window with Google Maps API?

javascript google-maps google-maps-api-3

This is my first time using the Google Maps API. I want to display a location and instead of having to create a custom marker and infowindow at a latitude and longitude, I'd like to actually open the

Event Listener or onClick - Best Practice

javascript addeventlistener

I have an HTML page with around 100 text boxes. I currently use a JS event listener (blur) to detect when a user leaves a text box. Within the event listener I use if statements to filter the action

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.